home *** CD-ROM | disk | FTP | other *** search
/ ftp.parl.clemson.edu / 2015-02-07.ftp.parl.clemson.edu.tar / ftp.parl.clemson.edu / pub / pvfs2 / orangefs-2.8.3-20110323.tar.gz / orangefs-2.8.3-20110323.tar / orangefs / src / proto / PINT-reqproto-encode.h < prev    next >
C/C++ Source or Header  |  2004-12-02  |  3KB  |  110 lines

  1. /*
  2.  * (C) 2001 Clemson University and The University of Chicago
  3.  *
  4.  * See COPYING in top-level directory.
  5.  */
  6.  
  7. /* This file defines the API for encoding and decoding the request
  8.  * protocol that is used between clients and servers in pvfs2
  9.  */
  10.  
  11. #ifndef __PINT_REQUEST_ENCODE_H
  12. #define __PINT_REQUEST_ENCODE_H
  13.  
  14. #include "src/proto/pvfs2-req-proto.h"
  15. #include "bmi.h"
  16.  
  17. /* structure to describe messages that have been encoded */
  18. struct PINT_encoded_msg
  19. {
  20.     PVFS_BMI_addr_t dest;             /* host this is going to */
  21.     enum PVFS_encoding_type enc_type; /* type of encoding that was used */
  22.     enum bmi_buffer_type buffer_type; /* buffer flag for BMI's use */
  23.     void **buffer_list;               /* list of buffers */
  24.     PVFS_size *size_list;             /* size of buffers */
  25.     PVFS_size *alloc_size_list;       /* original size of buffers */
  26.     int list_count;                   /* number of buffers */
  27.     PVFS_size total_size;             /* aggregate size of encoding */
  28.  
  29.     /* fields below this comment are meant for internal use */
  30.     char *ptr_current;                /* current encoding pointer */
  31.     PVFS_size size_stub;              /* used for size_list */
  32.     PVFS_size alloc_size_stub;        /* used for size_list */
  33.     void *buffer_stub;                /* used for buffer_list */
  34. };
  35.  
  36. /* structure to describe messages that have been decoded */
  37. struct PINT_decoded_msg
  38. {
  39.     void *buffer;                     /* decoded buffer */
  40.     enum PVFS_encoding_type enc_type; /* encoding type used */
  41.  
  42.     /* fields below this comment are meant for internal use */
  43.     char *ptr_current;                /* current encoding pointer */
  44.  
  45.     /* used for storing decoded info */
  46.     union
  47.     {
  48.         struct PVFS_server_req req;
  49.         struct PVFS_server_resp resp;
  50.     } stub_dec;
  51. };
  52.  
  53. /* types of messages we will encode or decode */
  54. enum PINT_encode_msg_type
  55. {
  56.     PINT_ENCODE_REQ = 1,
  57.     PINT_ENCODE_RESP = 2
  58. };
  59.  
  60. /* convenience, just for less weird looking arguments to decode functions */
  61. #define PINT_DECODE_REQ PINT_ENCODE_REQ
  62. #define PINT_DECODE_RESP PINT_ENCODE_RESP
  63.  
  64. /*******************************************************
  65.  * public function prototypes
  66.  */
  67.  
  68. int PINT_encode_initialize(void);
  69.  
  70. void PINT_encode_finalize(void);
  71.  
  72. int PINT_encode(
  73.     void* input_buffer,
  74.     enum PINT_encode_msg_type input_type,
  75.     struct PINT_encoded_msg* target_msg,
  76.     PVFS_BMI_addr_t target_addr,
  77.     enum PVFS_encoding_type enc_type);
  78.  
  79. int PINT_decode(
  80.     void* input_buffer,
  81.     enum PINT_encode_msg_type input_type,
  82.     struct PINT_decoded_msg* target_msg,
  83.     PVFS_BMI_addr_t target_addr,
  84.     PVFS_size size);
  85.  
  86. void PINT_encode_release(
  87.     struct PINT_encoded_msg* msg,
  88.     enum PINT_encode_msg_type input_type);
  89.  
  90. void PINT_decode_release(
  91.     struct PINT_decoded_msg* msg,
  92.     enum PINT_encode_msg_type input_type);
  93.  
  94. int PINT_encode_calc_max_size(
  95.     enum PINT_encode_msg_type input_type,
  96.     enum PVFS_server_op op_type,
  97.     enum PVFS_encoding_type enc_type);
  98.  
  99.  
  100. #endif /* __PINT_REQUEST_ENCODE_H */
  101.  
  102. /*
  103.  * Local variables:
  104.  *  c-indent-level: 4
  105.  *  c-basic-offset: 4
  106.  * End:
  107.  *
  108.  * vim: ts=8 sts=4 sw=4 expandtab
  109.  */
  110.