Back to index

php5  5.3.10
xmlrpc_private.h
Go to the documentation of this file.
00001 /*
00002   This file is part of libXMLRPC - a C library for xml-encoded function calls.
00003 
00004   Author: Dan Libby (dan@libby.com)
00005   Epinions.com may be contacted at feedback@epinions-inc.com
00006 */
00007 
00008 /*  
00009   Copyright 2000 Epinions, Inc. 
00010 
00011   Subject to the following 3 conditions, Epinions, Inc.  permits you, free 
00012   of charge, to (a) use, copy, distribute, modify, perform and display this 
00013   software and associated documentation files (the "Software"), and (b) 
00014   permit others to whom the Software is furnished to do so as well.  
00015 
00016   1) The above copyright notice and this permission notice shall be included 
00017   without modification in all copies or substantial portions of the 
00018   Software.  
00019 
00020   2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF 
00021   ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY 
00022   IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR 
00023   PURPOSE OR NONINFRINGEMENT.  
00024 
00025   3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, 
00026   SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT 
00027   OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING 
00028   NEGLIGENCE), EVEN IF EPINIONS, INC.  IS AWARE OF THE POSSIBILITY OF SUCH 
00029   DAMAGES.    
00030 
00031 */
00032 
00033 /* only non-public things should be in this file.  It is fine for any .c file
00034  * in xmlrpc/src to include it, but users of the public API should never
00035  * include it, and thus *.h files that are part of the public API should
00036  * never include it, or they would break if this file is not present.
00037  */
00038 
00039 #ifndef XMLRPC_PRIVATE_ALREADY_INCLUDED
00040 /*
00041  * Avoid include redundancy.
00042  */
00043 #define XMLRPC_PRIVATE_ALREADY_INCLUDED
00044 
00045 #ifdef __cplusplus
00046 extern "C" {
00047 #endif
00048 
00049 
00050 /*----------------------------------------------------------------------------
00051  * xmlrpc_private.h
00052  *
00053  * Purpose:
00054  *   define non-public intra-library routines & data
00055  * Comments:
00056  */
00057 
00058 /*----------------------------------------------------------------------------
00059  * Constants
00060  */
00061 
00062 
00063 /*----------------------------------------------------------------------------
00064  * Includes
00065  */
00066 
00067 /*----------------------------------------------------------------------------
00068  * Structures
00069  */
00070  
00071 /* Some of these are typedef'd in xmlrpc.h for public use */
00072 
00073 typedef struct _xmlrpc_vector* XMLRPC_VECTOR;
00074 
00075 /****s* VALUE/XMLRPC_VALUE
00076  * NAME
00077  *   XMLRPC_VALUE
00078  * NOTES
00079  *   A value of variable data type. The most important object in this API.  :)
00080  *
00081  *  This struct is opaque to callers and should be accessed only via accessor functions.
00082  * SEE ALSO
00083  *   XMLRPC_REQUEST
00084  *   XMLRPC_CreateValueEmpty ()
00085  *   XMLRPC_CleanupValue ()
00086  * SOURCE
00087  */
00088 typedef struct _xmlrpc_value {
00089    XMLRPC_VALUE_TYPE type; /* data type of this value                        */
00090    XMLRPC_VECTOR v;        /* vector type specific info                      */
00091    simplestring str;       /* string value buffer                            */
00092    simplestring id;        /* id of this value.  possibly empty.             */
00093    int i;                  /* integer value.                                 */
00094    double d;               /* double value                                   */
00095    int iRefCount;          /* So we know when we can delete the value      . */
00096 } STRUCT_XMLRPC_VALUE;
00097 /******/
00098 
00099 /****s* VALUE/XMLRPC_REQUEST
00100  * NAME
00101  *   XMLRPC_REQUEST
00102  * NOTES
00103  *   Internal representation of an XML request.
00104  *
00105  *  This struct is opaque to callers and should be accessed only via accessor functions.
00106  *  
00107  * SEE ALSO
00108  *   XMLRPC_VALUE
00109  *   XMLRPC_RequestNew ()
00110  *   XMLRPC_RequestFree ()
00111  * SOURCE
00112  */
00113 typedef struct _xmlrpc_request {
00114    XMLRPC_VALUE                         io;           /* data associated with this request */
00115    simplestring                         methodName;   /* name of method being called       */
00116    XMLRPC_REQUEST_TYPE                  request_type; /* type of request                   */
00117    STRUCT_XMLRPC_REQUEST_OUTPUT_OPTIONS output;       /* xml output options                */
00118    XMLRPC_VALUE                         error;        /* error codes                       */
00119 } STRUCT_XMLRPC_REQUEST;
00120 /******/
00121 
00122 /* Vector type. Used by XMLRPC_VALUE.  Never visible to users of the API. */
00123 typedef struct _xmlrpc_vector {
00124    XMLRPC_VECTOR_TYPE type;                           /* vector type                       */
00125    queue *q;                                          /* list of child values              */
00126 } STRUCT_XMLRPC_VECTOR;
00127 /******/
00128 
00129 /****s* VALUE/XMLRPC_SERVER
00130  * NAME
00131  *   XMLRPC_SERVER
00132  * NOTES
00133  *   internal representation of an xmlrpc server
00134  *
00135  *  This struct is opaque to callers and should be accessed only via accessor functions.
00136  *  
00137  * SEE ALSO
00138  *   XMLRPC_ServerCreate ()
00139  *   XMLRPC_ServerDestroy ()
00140  * SOURCE
00141  */
00142 typedef struct _xmlrpc_server {
00143    queue methodlist;                                  /* list of callback methods          */
00144    queue docslist;                                    /* list of introspection callbacks   */
00145    XMLRPC_VALUE xIntrospection;
00146 } STRUCT_XMLRPC_SERVER;
00147 /******/
00148 
00149 typedef struct _server_method {
00150    char*                   name;
00151    XMLRPC_VALUE            desc;
00152    XMLRPC_Callback         method;
00153 } server_method;
00154 
00155 
00156 /*----------------------------------------------------------------------------
00157  * Globals
00158  */
00159 
00160 /*----------------------------------------------------------------------------
00161  * Functions
00162  */
00163 server_method* find_method(XMLRPC_SERVER server, const char* name);
00164 const char* type_to_str(XMLRPC_VALUE_TYPE type, XMLRPC_VECTOR_TYPE vtype);
00165  
00166 /*----------------------------------------------------------------------------
00167  * Macros
00168  */
00169 #define my_free(thing)  if(thing) {free(thing); thing = 0;}
00170  
00171 
00172 #ifdef __cplusplus
00173 }
00174 #endif
00175 
00176 
00177 #endif /* XMLRPC_PRIVATE_ALREADY_INCLUDED */
00178