dtn_types_xdr.c

Go to the documentation of this file.
00001 /*
00002  * Please do not edit this file.
00003  * It was generated using rpcgen.
00004  */
00005 
00006 #include "dtn_types.h"
00007 /*
00008  * IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
00009  * By downloading, copying, installing or using the software you agree
00010  * to this license. If you do not agree to this license, do not
00011  * download, install, copy or use the software.
00012  * 
00013  * Intel Open Source License 
00014  * 
00015  * Copyright (c) 2004 Intel Corporation. All rights reserved. 
00016  * 
00017  * Redistribution and use in source and binary forms, with or without
00018  * modification, are permitted provided that the following conditions
00019  * are met:
00020  * 
00021  *   Redistributions of source code must retain the above copyright
00022  *   notice, this list of conditions and the following disclaimer.
00023  * 
00024  *   Redistributions in binary form must reproduce the above copyright
00025  *   notice, this list of conditions and the following disclaimer in
00026  *   the documentation and/or other materials provided with the
00027  *   distribution.
00028  * 
00029  *   Neither the name of the Intel Corporation nor the names of its
00030  *   contributors may be used to endorse or promote products derived
00031  *   from * this software without specific prior written permission.
00032  *  
00033  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00034  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00035  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00036  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
00037  * INTEL OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00038  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
00039  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00040  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00041  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
00042  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00043  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
00044  * OF THE POSSIBILITY OF SUCH DAMAGE.
00045  */
00046 
00047 /**********************************
00048  * This file defines the types used in the DTN client API. The structures are
00049  * autogenerated using rpcgen, as are the marshalling and unmarshalling
00050  * XDR routines.
00051  */
00052 
00053 #include <limits.h>
00054 #ifndef ARG_MAX
00055 #define ARG_MAX _POSIX_ARG_MAX
00056 #endif
00057 
00058 #include <rpc/rpc.h>
00059 
00060 
00061 /**********************************
00062  * Constants.
00063  * (Note that we use #defines to get the comments as well)
00064  */
00065 #define DTN_MAX_ENDPOINT_ID 256 /* max endpoint_id size (bytes) */
00066 #define DTN_MAX_PATH_LEN PATH_MAX /* max path length */
00067 #define DTN_MAX_EXEC_LEN ARG_MAX /* length of string passed to exec() */
00068 #define DTN_MAX_AUTHDATA 1024 /* length of auth/security data*/
00069 #define DTN_MAX_REGION_LEN 64 /* 64 chars "should" be long enough */
00070 #define DTN_MAX_BUNDLE_MEM 50000 /* biggest in-memory bundle is ~50K*/
00071 
00081 bool_t
00082 xdr_dtn_endpoint_id_t (XDR *xdrs, dtn_endpoint_id_t *objp)
00083 {
00084         register int32_t *buf;
00085 
00086         int i;
00087          if (!xdr_opaque (xdrs, objp->uri, DTN_MAX_ENDPOINT_ID))
00088                  return FALSE;
00089         return TRUE;
00090 }
00091 
00096 bool_t
00097 xdr_dtn_reg_id_t (XDR *xdrs, dtn_reg_id_t *objp)
00098 {
00099         register int32_t *buf;
00100 
00101          if (!xdr_u_int (xdrs, objp))
00102                  return FALSE;
00103         return TRUE;
00104 }
00105 
00110 bool_t
00111 xdr_dtn_timeval_t (XDR *xdrs, dtn_timeval_t *objp)
00112 {
00113         register int32_t *buf;
00114 
00115          if (!xdr_u_int (xdrs, objp))
00116                  return FALSE;
00117         return TRUE;
00118 }
00119 
00123 #define DTN_TIMEOUT_INF ((dtn_timeval_t)-1)
00124 
00134 bool_t
00135 xdr_dtn_service_tag_t (XDR *xdrs, dtn_service_tag_t *objp)
00136 {
00137         register int32_t *buf;
00138 
00139         int i;
00140          if (!xdr_vector (xdrs, (char *)objp->tag, DTN_MAX_ENDPOINT_ID,
00141                 sizeof (char), (xdrproc_t) xdr_char))
00142                  return FALSE;
00143         return TRUE;
00144 }
00145 
00158 bool_t
00159 xdr_dtn_reg_failure_action_t (XDR *xdrs, dtn_reg_failure_action_t *objp)
00160 {
00161         register int32_t *buf;
00162 
00163          if (!xdr_enum (xdrs, (enum_t *) objp))
00164                  return FALSE;
00165         return TRUE;
00166 }
00167 
00172 bool_t
00173 xdr_dtn_reg_info_t (XDR *xdrs, dtn_reg_info_t *objp)
00174 {
00175         register int32_t *buf;
00176 
00177          if (!xdr_dtn_endpoint_id_t (xdrs, &objp->endpoint))
00178                  return FALSE;
00179          if (!xdr_dtn_reg_id_t (xdrs, &objp->regid))
00180                  return FALSE;
00181          if (!xdr_dtn_reg_failure_action_t (xdrs, &objp->failure_action))
00182                  return FALSE;
00183          if (!xdr_dtn_timeval_t (xdrs, &objp->expiration))
00184                  return FALSE;
00185          if (!xdr_bool (xdrs, &objp->init_passive))
00186                  return FALSE;
00187          if (!xdr_bytes (xdrs, (char **)&objp->script.script_val, (u_int *) &objp->script.script_len, DTN_MAX_EXEC_LEN))
00188                  return FALSE;
00189         return TRUE;
00190 }
00191 
00200 bool_t
00201 xdr_dtn_bundle_priority_t (XDR *xdrs, dtn_bundle_priority_t *objp)
00202 {
00203         register int32_t *buf;
00204 
00205          if (!xdr_enum (xdrs, (enum_t *) objp))
00206                  return FALSE;
00207         return TRUE;
00208 }
00209 
00223 bool_t
00224 xdr_dtn_bundle_delivery_opts_t (XDR *xdrs, dtn_bundle_delivery_opts_t *objp)
00225 {
00226         register int32_t *buf;
00227 
00228          if (!xdr_enum (xdrs, (enum_t *) objp))
00229                  return FALSE;
00230         return TRUE;
00231 }
00232 
00237 bool_t
00238 xdr_dtn_bundle_spec_t (XDR *xdrs, dtn_bundle_spec_t *objp)
00239 {
00240         register int32_t *buf;
00241 
00242          if (!xdr_dtn_endpoint_id_t (xdrs, &objp->source))
00243                  return FALSE;
00244          if (!xdr_dtn_endpoint_id_t (xdrs, &objp->dest))
00245                  return FALSE;
00246          if (!xdr_dtn_endpoint_id_t (xdrs, &objp->replyto))
00247                  return FALSE;
00248          if (!xdr_dtn_bundle_priority_t (xdrs, &objp->priority))
00249                  return FALSE;
00250          if (!xdr_int (xdrs, &objp->dopts))
00251                  return FALSE;
00252          if (!xdr_dtn_timeval_t (xdrs, &objp->expiration))
00253                  return FALSE;
00254         return TRUE;
00255 }
00256 
00266 bool_t
00267 xdr_dtn_bundle_payload_location_t (XDR *xdrs, dtn_bundle_payload_location_t *objp)
00268 {
00269         register int32_t *buf;
00270 
00271          if (!xdr_enum (xdrs, (enum_t *) objp))
00272                  return FALSE;
00273         return TRUE;
00274 }
00275 
00276 bool_t
00277 xdr_dtn_bundle_payload_t (XDR *xdrs, dtn_bundle_payload_t *objp)
00278 {
00279         register int32_t *buf;
00280 
00281          if (!xdr_dtn_bundle_payload_location_t (xdrs, &objp->location))
00282                  return FALSE;
00283         switch (objp->location) {
00284         case DTN_PAYLOAD_FILE:
00285                  if (!xdr_bytes (xdrs, (char **)&objp->dtn_bundle_payload_t_u.filename.filename_val, (u_int *) &objp->dtn_bundle_payload_t_u.filename.filename_len, DTN_MAX_PATH_LEN))
00286                          return FALSE;
00287                 break;
00288         case DTN_PAYLOAD_MEM:
00289                  if (!xdr_bytes (xdrs, (char **)&objp->dtn_bundle_payload_t_u.buf.buf_val, (u_int *) &objp->dtn_bundle_payload_t_u.buf.buf_len, DTN_MAX_BUNDLE_MEM))
00290                          return FALSE;
00291                 break;
00292         default:
00293                 return FALSE;
00294         }
00295         return TRUE;
00296 }
00297 
00302 bool_t
00303 xdr_dtn_bundle_id_t (XDR *xdrs, dtn_bundle_id_t *objp)
00304 {
00305         register int32_t *buf;
00306 
00307          if (!xdr_dtn_endpoint_id_t (xdrs, &objp->source))
00308                  return FALSE;
00309          if (!xdr_u_int (xdrs, &objp->creation_secs))
00310                  return FALSE;
00311          if (!xdr_u_int (xdrs, &objp->creation_subsecs))
00312                  return FALSE;
00313         return TRUE;
00314 }
00315 
00320 bool_t
00321 xdr_dtn_bundle_auth_t (XDR *xdrs, dtn_bundle_auth_t *objp)
00322 {
00323         register int32_t *buf;
00324 
00325          if (!xdr_bytes (xdrs, (char **)&objp->blob.blob_val, (u_int *) &objp->blob.blob_len, DTN_MAX_AUTHDATA))
00326                  return FALSE;
00327         return TRUE;
00328 }

Generated on Fri Dec 22 14:47:58 2006 for DTN Reference Implementation by  doxygen 1.5.1