Main Page   Class Hierarchy   Alphabetical List   Data Structures   File List   Data Fields   Globals  

rpc_msg.cc

Go to the documentation of this file.
00001 #ifdef VXWORKS
00002 extern "C"
00003 {
00004 #include <vxWorks.h>
00005 #include <rpc/rpctypes.h>       /* needed by xdr.h */
00006 #include <rpc/xdr.h>            /* XDR */
00007 #if 0                           /* FIXME-- Vx5.1 header doesn't work with
00008                                    old C++ cross compiler */
00009 #include <stdlib.h>             /* malloc() */
00010 #else
00011 #include <stddef.h>             /* size_t */
00012   extern void *malloc (size_t size);
00013 #endif
00014 }
00015 #else
00016 extern "C"
00017 {
00018 #include <rpc/types.h>          /* needed by xdr.h */
00019 #include <rpc/xdr.h>            /* XDR */
00020 #include <stdlib.h>             /* malloc() */
00021 }
00022 #endif
00023 
00024 #include "rcs_defs.hh"          /* RCS_EXPORT, RCS_PASCAL, RCS_FAR */
00025 #include "rpc_msg.hh"
00026 #include "cms.hh"
00027 
00028 /* Function needed by rpc servers and clients. */
00029 bool_t RCS_EXPORT RCS_PASCAL
00030 xdr_RPC_READ_REQUEST (XDR RCS_FAR * xdrsp, RPC_READ_REQUEST RCS_FAR * buf)
00031 {
00032   bool_t catch_it;
00033   if ((NULL == buf) || (NULL == xdrsp))
00034     {
00035       return FALSE;
00036     }
00037   catch_it = xdr_long (xdrsp, &buf->buffer_number);
00038   catch_it = xdr_int (xdrsp, &buf->access_type);
00039   catch_it = xdr_long (xdrsp, &buf->last_id_read);
00040   return (catch_it);
00041 }
00042 
00043 bool_t RCS_EXPORT RCS_PASCAL
00044 xdr_RPC_WRITE_REQUEST (XDR RCS_FAR * xdrsp, RPC_WRITE_REQUEST RCS_FAR * buf)
00045 {
00046   bool_t catch_it;
00047   if ((NULL == buf) || (NULL == xdrsp))
00048     {
00049       return FALSE;
00050     }
00051   catch_it = xdr_long (xdrsp, &buf->buffer_number);
00052   catch_it = xdr_int (xdrsp, &buf->access_type);
00053   catch_it = xdr_int (xdrsp, &buf->size);
00054   if (NULL == buf->data)
00055     {
00056       buf->data = malloc (buf->size);
00057     }
00058   catch_it = xdr_opaque (xdrsp, (char *) buf->data, buf->size);
00059   return catch_it;
00060 }
00061 
00062 bool_t RCS_EXPORT RCS_PASCAL
00063 xdr_RPC_READ_REPLY (XDR RCS_FAR * xdrsp, RPC_READ_REPLY RCS_FAR * buf)
00064 {
00065   bool_t catch_it;
00066   if ((NULL == buf) || (NULL == xdrsp))
00067     {
00068       return FALSE;
00069     }
00070   catch_it = xdr_int (xdrsp, &buf->status);
00071   catch_it = xdr_int (xdrsp, &buf->size);
00072   catch_it = xdr_long (xdrsp, &buf->write_id);
00073   catch_it = xdr_long (xdrsp, &buf->was_read);
00074   if (0 < buf->size)
00075     {
00076       if (NULL == buf->data)
00077         {
00078           buf->data = malloc (buf->size);
00079         }
00080       catch_it = xdr_opaque (xdrsp, (char *) buf->data, buf->size);
00081     }
00082   return (catch_it);
00083 }
00084 
00085 bool_t RCS_EXPORT RCS_PASCAL
00086 xdr_RPC_WRITE_REPLY (XDR RCS_FAR * xdrsp, RPC_WRITE_REPLY RCS_FAR * buf)
00087 {
00088   bool_t catch_it;
00089   if ((NULL == buf) || (NULL == xdrsp))
00090     {
00091       return FALSE;
00092     }
00093   catch_it = xdr_int (xdrsp, &buf->status);
00094   catch_it = xdr_long (xdrsp, &buf->was_read);
00095   return (catch_it);
00096 }

Generated on Sun Dec 2 15:56:52 2001 for rcslib by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001