7 #ifndef GLOBUS_I_GFS_IPC_H
8 #define GLOBUS_I_GFS_IPC_H
10 #include "globus_i_gridftp_server.h"
17 #define GFSEncodeUInt32(_start, _len, _buf, _w) \
22 _ndx = (globus_byte_t *)_buf - (globus_byte_t *)_start; \
24 while(_ndx + 4 > _len) \
27 _start = globus_libc_realloc(_start, _len); \
28 _buf = _start + _ndx; \
30 _cw = (uint32_t) htonl((uint32_t)_w); \
31 memcpy(_buf, &_cw, 4); \
35 #define GFSDecodeUInt32P(_buf, _len, _w) \
44 memcpy(&_cw, _buf, 4); \
45 _w = (void *) (intptr_t) htonl((uint32_t)_cw); \
50 #define GFSDecodeUInt32(_buf, _len, _w) \
59 memcpy(&_cw, _buf, 4); \
60 _w = htonl((uint32_t)_cw); \
69 #if defined(WORDS_BIGENDIAN)
71 #define GFSEncodeUInt64(_start, _len, _buf, _w) \
75 _ndx = (globus_byte_t *)_buf - (globus_byte_t *)_start; \
76 while(_ndx + 8 > _len) \
79 _start = globus_libc_realloc(_start, _len); \
80 _buf = _start + _ndx; \
82 memcpy(_buf, &_w, 8); \
86 #define GFSDecodeUInt64(_buf, _len, _w) \
94 memcpy(&_w, _buf, 8); \
101 #define GFSEncodeUInt64(_start, _len, _buf, _w) \
104 globus_size_t _ndx; \
106 uint32_t _lo = _w & 0xffffffff; \
107 uint32_t _hi = _w >> 32U; \
109 _ndx = (globus_byte_t *)_buf - (globus_byte_t *)_start; \
110 while(_ndx + 8 > _len) \
113 _start = globus_libc_realloc(_start, _len); \
114 _buf = _start + _ndx; \
119 _cw = ((uint64_t) _lo) << 32U | _hi; \
120 memcpy(_buf, &_cw, 8); \
124 #define GFSDecodeUInt64(_buf, _len, _w) \
136 memcpy(&_cw, _buf, 8); \
137 _lo = _cw & 0xffffffff; \
141 _w = ((uint64_t) _lo) << 32U | _hi; \
147 #define GFSEncodeChar(_start, _len, _buf, _w) \
150 globus_size_t _ndx; \
151 _ndx = (globus_byte_t *)_buf - (globus_byte_t *)_start; \
152 while(_ndx >= _len) \
155 _start = globus_libc_realloc(_start, _len); \
156 _buf = _start + _ndx; \
162 #define GFSDecodeChar(_buf, _len, _w) \
174 #define GFSEncodeString(_start, _len, _buf, _w) \
177 char * _str=(char*)_w; \
180 GFSEncodeUInt32(_start, _len, _buf, 0); \
184 GFSEncodeUInt32(_start, _len, _buf, strlen(_str)+1); \
185 for(_str = (char *)_w; *_str != '\0'; _str++) \
187 GFSEncodeChar(_start, _len, _buf, *_str); \
192 #define GFSDecodeString(_buf, _len, _w) \
198 GFSDecodeUInt32(_buf, _len, _sz); \
202 for(_ctr = 0; _ctr < _sz - 1; _ctr++) \
204 GFSDecodeChar(_buf, _len, _w[_ctr]); \
215 globus_i_gfs_ipc_query_op_info(
218 extern globus_xio_stack_t globus_i_gfs_ipc_xio_stack;
219 extern globus_xio_driver_t globus_i_gfs_tcp_driver;