imp_sockets.h

Go to the documentation of this file.
00001 #ifndef SOCKETS_IMPLEMENTATION_ONLY_GROUP
00002 #define SOCKETS_IMPLEMENTATION_ONLY_GROUP
00003 
00004 /*****************************************************************************\
00005 *                                                                             *
00006 *  Name   : sockets implementation only support                               *
00007 *  Author : Chris Koeritz                                                     *
00008 *                                                                             *
00009 *  Purpose:                                                                   *
00010 *                                                                             *
00011 *    Commonly required headers and macros for code files only.                *
00012 *                                                                             *
00013 *******************************************************************************
00014 * Copyright (c) 1994-$now By Author.  This program is free software; you can  *
00015 * redistribute it and/or modify it under the terms of the GNU General Public  *
00016 * License as published by the Free Software Foundation; either version 2 of   *
00017 * the License or (at your option) any later version.  This is online at:      *
00018 *     http://www.fsf.org/copyleft/gpl.html                                    *
00019 * Please send any updates to: fred@gruntose.com                               *
00020 \*****************************************************************************/
00021 
00022 #include "sockets_dll.h"
00023 
00024 #include <basis/istring.h>
00025 #include <basis/log_base.h>
00026 #include <textual/tokenizer.h>
00027 
00029 
00030 // wraps a macro in standard stuff.
00031 
00032 #define WRAPUP(retval, to_wrap) { FUNCTION(func); to_wrap; return retval; }
00033 
00035 
00036 // logs a complaint about a response being garbled.
00037 
00038 void SOCKETS_CLASS_STYLE sockets_complain_garbage(const istring &f);
00039 #define COMPLAIN_GARBAGE(retval) \
00040   { WRAPUP(retval, sockets_complain_garbage(function_name)); }
00041 
00043 
00044 // submits a qualm regarding the health of an object "what".
00045 
00046 void SOCKETS_CLASS_STYLE sockets_complain_dead(const istring &f,
00047     const istring &what);
00048 #define COMPLAIN_DEAD(what, retval) \
00049   { WRAPUP(retval, sockets_complain_dead(function_name, what)); }
00050 
00052 
00053 // complains when a cefloon request fails for a command "what".
00054 
00055 void SOCKETS_CLASS_STYLE sockets_complain_reject(const istring &f,
00056     const istring &what);
00057 #define COMPLAIN_REJECT(what, retval) \
00058   { WRAPUP(retval, sockets_complain_reject(function_name, what)); }
00059 
00061 
00062 // these macros are parser bits used in tokenizing and detokenizing.
00063 
00064 const char SOCKETS_CLASS_STYLE *TOKEN_SEPARATOR();
00065 const char SOCKETS_CLASS_STYLE *TOKEN_ASSIGN();
00066 
00067 // begins operation of a tokenizer for loading.  LOADER_EXIT must be called
00068 // after finishing with the tokenizer.
00069 #define LOADER_ENTRY \
00070   tokenizer addr_parser; \
00071   addr_parser.parse(info)
00072 
00073 #define LOADER_EXIT 
00074   // currently no implementation.
00075 
00076 // locates a variable in the tokenizer.
00077 #define FIND(name, value) istring value = addr_parser.find(name)
00078 
00079 // locates a variable like FIND, but returns if it couldn't find it.
00080 #define GRAB(name, value) FIND(name, value); if (!value) return false
00081 
00082 // begins operation of a tokenizer for storing.  remember to call STORER_EXIT
00083 // when finished.
00084 #define STORER_ENTRY \
00085   tokenizer addr_parser
00086 
00087 #define STORER_EXIT 
00088   // currently no implementation.
00089 
00090 // adds a new entry into the tokenizer.
00091 #define ADD(name, value) addr_parser.table().add(name, value)
00092 
00093 // returns the accumulated tokens in the storing tokenizer.
00094 #define DUMP_EXIT istring to_return = addr_parser.text_form(); \
00095   STORER_EXIT; \
00096   return to_return
00097 
00098 #endif
00099 

Generated on Fri Nov 21 04:29:15 2008 for HOOPLE Libraries by  doxygen 1.5.1