Main Page | Modules | Data Structures | File List | Globals | Examples

/net/hp45/pmw/mware/cmrpc/cmrpc.h

Go to the documentation of this file.
00001 #ifndef __CMRPC_H__
00002 #define __CMRPC_H__
00003 
00004 /*
00005  *
00006  *  $Id: cmrpc_8h-source.html,v 1.3 2004/10/14 22:36:19 pmw Exp $
00007  *
00008  */
00011 #include <stdlib.h>
00012 #include <errno.h>
00013 #include <sys/types.h>
00014 
00015 #include "atl.h"
00016 #include "gen_thread.h"
00017 #include "cm.h"
00018 
00019 
00020 #if defined(__cplusplus) || defined(c_plusplus)
00021 extern "C" {
00022 #endif
00023 
00024 #if defined(FUNCPROTO) || defined(__STDC__) || defined(__cplusplus) || defined(c_plusplus)
00025 #ifndef ARGS
00026 #define ARGS(args) args
00027 #endif
00028 #else
00029 #ifndef ARGS
00030 #define ARGS(args) (/*args*/)
00031 #endif
00032 #endif
00033 
00034 
00039 
00042 typedef struct
00043 {
00044   CManager cm;
00045   void* channel;
00046   unsigned long flags;
00047 } *CMrpc_options, CMrpc_options_t;
00048 
00056 typedef void (*CMrpc_HandlerFunc) ARGS((void* in_param_msg, void* out_param_msg, CMrpc_options options));
00057 
00062 typedef void (*CMrpc_OnewayHandlerFunc) ARGS((void* in_param_msg, CMrpc_options options));
00063 
00068 typedef void (*CMrpc_HandlerCleanupFunc) ARGS((CManager cm,
00069                                                 void* out_msg));
00070 
00075 #define CMrpc_set_option(X,OPT) ((X)->flags |= (OPT))
00076 #define CMrpc_clear_option(X,OPT) ((X)->flags &= ~(OPT))
00077 
00078 #define CMrpc_call_cleanup_function (0x1)
00079 
00080 
00081 /*
00082  * option flags for RPC calls
00083  */
00084 #define CMrpc_async_call (0x1)
00085 
00086 
00098 extern int
00099 CMrpc_register_rpc_handler ARGS((CManager cm,
00100                                   const char* rpc_name,
00101                                   CMrpc_HandlerFunc func,
00102                                   CMrpc_OnewayHandlerFunc oneway_func,
00103                                   CMrpc_HandlerCleanupFunc cleanup_func));
00104 
00111 extern int
00112 CMrpc_unregister_rpc ARGS((const char* rpc_name));
00113 
00121 
00124 extern int CMrpc_errno;
00125 
00126 
00137 extern int
00138 CMrpc_register_rpc_format ARGS((CManager cm,
00139                                  const char* rpc_name,
00140                                  IOFieldList in_field_list,
00141                                  CMFormatList in_subformats,
00142                                  IOFieldList out_field_list,
00143                                  CMFormatList out_subformats));
00144 
00146 extern void
00147 CMrpc_shutdown();
00148 
00155 
00156 struct _CMrpc_ticket_struct;
00159 typedef struct _CMrpc_ticket_struct *CMrpc_ticket;
00160 
00161 
00171 extern CMrpc_ticket
00172 CMrpc_call_rpc ARGS((CManager cm,
00173                       const char* rpc_name,
00174                       attr_list contact_info,
00175                       void* in_data,
00176                       void* out_data,
00177                       unsigned long flags));
00178 
00186 extern void
00187 CMrpc_call_rpc_oneway ARGS((CManager cm,
00188                              const char* rpc_name,
00189                              attr_list contact_info,
00190                              void* in_data,
00191                              unsigned long flags));
00192 
00199 extern int
00200 CMrpc_register_rpc_contact_info ARGS((CManager cm,
00201                                        const char* rpc_name,
00202                                        attr_list contact_info));
00203 
00216 extern CMrpc_ticket
00217 CMrpc_call_anon_rpc ARGS((CManager cm,
00218                            const char* rpc_name,
00219                            attr_list target_spec,
00220                            IOContext anon_in_context,
00221                            void* in_data,
00222                            IOContext anon_out_context,
00223                            void* out_data,
00224                            unsigned long flags));
00225 
00233 extern int
00234 CMrpc_redeem_ticket ARGS((CManager cm,
00235                            CMrpc_ticket ticket,
00236                            void* out_data,
00237                            int wait));
00238 
00243 #ifdef CMRPC_WITH_CHANNEL
00244 
00245 /*
00246  *  I cheaply steal the typedef from ECho so I don't have to include
00247  *  the header file.
00248  */
00249 typedef void (*CMrpc_Chan_HandlerFunction) ARGS((void *event, int length,
00250                                                   void *client_data));
00251 
00252 extern int
00253 CMrpc_call_rpc_with_channel ARGS((CManager cm,
00254                                    const char* rpc_name,
00255                                    attr_list contact_info,
00256                                    void* in_data,
00257                                    void* out_data,
00258                                    unsigned long flags));
00259 
00260 extern int
00261 CMrpc_register_chan_handler ARGS((CManager cm,
00262                                    const char* rpc_name,
00263                                    CMrpc_Chan_HandlerFunction chan_handler));
00264 
00265 #endif /* CMRPC_WITH_CHANNEL */
00266                                    
00267 
00268 /*
00269  *
00270  *  $Log: cmrpc_8h-source.html,v $
00270  *  Revision 1.3  2004/10/14 22:36:19  pmw
00270  *  last documentation tweaks for a while
00270  *
00271  *  Revision 1.22  2004/10/14 21:59:19  pmw
00272  *  Rearranging documentation
00273  *
00274  *  Revision 1.21  2004/10/14 21:16:15  pmw
00275  *  Added doxygen documentation.
00276  *  Also changed prefix of everything from CM_RPC to CMrpc.  It looks better.
00277  *
00278  *  Revision 1.20  2003/10/07 19:49:35  eisen
00279  *  Add 'extern "C" {' stuff to cmrpc.h header.
00280  *
00281  *  Revision 1.19  2002/06/16 21:59:16  pmw
00282  *  more and more fixes.  This should at least shut up the messages from
00283  *  the nightly chaos builds.
00284  *
00285  *  Revision 1.18  2002/05/27 07:44:55  pmw
00286  *  const correctness for C compilers sucks.  Especially when I use so much code from
00287  *  other people that isn't const correct :)
00288  *
00289  *  Revision 1.17  2000/10/27 19:28:54  pmw
00290  *  Removed CM_RPC_register_rpc_subformat().  I didn't understand how CM
00291  *  worked well enough; this function is really not necessary.
00292  *
00293  *  Revision 1.16  2000/10/23 20:52:09  pmw
00294  *  Added contact_info parameter to call_rpc calls.  This is to be used
00295  *  if, for a specific invocation of an RPC, you wish to override the
00296  *  registered contact information.
00297  *
00298  *  Revision 1.15  2000/10/16 03:45:35  pmw
00299  *  Added oneway RPC calls.  This has been tested somewhat.
00300  *
00301  *  Revision 1.14  2000/10/16 02:31:21  pmw
00302  *  1 - fixed gotcha-in-waiting concerning IOcontext management and anonymous
00303  *  calls.  The IOcontext allocated for anon calls was getting freed before the
00304  *  user ever saw the result structure from the call, and the underlying PBIO
00305  *  buffer was suspect.  This meant revising the anon-call interface back to
00306  *  where the user supplies his own IOcontext values.
00307  *  2 - Added rpc-with-channel functionality, not yet tested.
00308  *
00309  *  Revision 1.13  2000/09/29 20:52:07  pmw
00310  *  fixed lingering problems from subcontext changes.  hopefully this closes it.
00311  *  make check works correctly, so I'll believe it for the moment.
00312  *
00313  *  Revision 1.12  2000/09/19 20:54:18  pmw
00314  *  changed syntax of handlers to eliminate explicit passing of CManager value - now contained in options structure
00315  *
00316  *  Revision 1.11  2000/05/12 20:54:17  pmw
00317  *  Re-did anonymous call syntax to avoid PBIO memory-handling issues
00318  *
00319  *  Revision 1.10  2000/05/10 19:49:11  pmw
00320  *  removed extra free() which caused async test bug
00321  *
00322  *  Revision 1.9  2000/04/11 18:40:33  pmw
00323  *  added CM_RPC_errno
00324  *
00325  *  Revision 1.8  2000/04/10 21:22:17  pmw
00326  *  added options flag to handlers
00327  *
00328  *  Revision 1.7  2000/04/10 20:28:32  pmw
00329  *  Added cleanup handler functionality
00330  *
00331  *  Revision 1.6  2000/04/10 18:10:14  pmw
00332  *  more rearrangement
00333  *
00334  *  Revision 1.5  2000/04/06 22:39:18  pmw
00335  *  Now does sane handling of IO conversions
00336  *
00337  *  Revision 1.4  2000/04/05 03:00:05  pmw
00338  *  added high-level convenience functions
00339  *
00340  *  Revision 1.3  2000/04/04 20:40:04  pmw
00341  *  Restructured for asyncronous calls
00342  *
00343  *  Revision 1.2  2000/04/04 18:35:29  pmw
00344  *  added RCS headers
00345  *
00346  *
00347  */
00348 #if defined(__cplusplus) || defined(c_plusplus)
00349 }
00350 #endif
00351 
00352 #endif /* ifndef __CMRPC_H__ */

Generated on Thu Oct 14 18:34:49 2004 for CMrpc by  doxygen 1.3.9.1