17 #ifndef GLOBUS_I_GFS_IPC_H
18 #define GLOBUS_I_GFS_IPC_H
20 #include "globus_i_gridftp_server.h"
27 #define GFSEncodeUInt32(_start, _len, _buf, _w) \
32 _ndx = (globus_byte_t *)_buf - (globus_byte_t *)_start; \
34 while(_ndx + 4 > _len) \
37 _start = globus_libc_realloc(_start, _len); \
38 _buf = _start + _ndx; \
40 _cw = (uint32_t) htonl((uint32_t)_w); \
41 memcpy(_buf, &_cw, 4); \
45 #define GFSDecodeUInt32P(_buf, _len, _w) \
54 memcpy(&_cw, _buf, 4); \
55 _w = (void *) (intptr_t) htonl((uint32_t)_cw); \
60 #define GFSDecodeUInt32(_buf, _len, _w) \
69 memcpy(&_cw, _buf, 4); \
70 _w = htonl((uint32_t)_cw); \
79 #if defined(WORDS_BIGENDIAN)
81 #define GFSEncodeUInt64(_start, _len, _buf, _w) \
85 _ndx = (globus_byte_t *)_buf - (globus_byte_t *)_start; \
86 while(_ndx + 8 > _len) \
89 _start = globus_libc_realloc(_start, _len); \
90 _buf = _start + _ndx; \
92 memcpy(_buf, &_w, 8); \
96 #define GFSDecodeUInt64(_buf, _len, _w) \
104 memcpy(&_w, _buf, 8); \
111 #define GFSEncodeUInt64(_start, _len, _buf, _w) \
114 globus_size_t _ndx; \
116 uint32_t _lo = _w & 0xffffffff; \
117 uint32_t _hi = _w >> 32U; \
119 _ndx = (globus_byte_t *)_buf - (globus_byte_t *)_start; \
120 while(_ndx + 8 > _len) \
123 _start = globus_libc_realloc(_start, _len); \
124 _buf = _start + _ndx; \
129 _cw = ((uint64_t) _lo) << 32U | _hi; \
130 memcpy(_buf, &_cw, 8); \
134 #define GFSDecodeUInt64(_buf, _len, _w) \
146 memcpy(&_cw, _buf, 8); \
147 _lo = _cw & 0xffffffff; \
151 _w = ((uint64_t) _lo) << 32U | _hi; \
157 #define GFSEncodeChar(_start, _len, _buf, _w) \
160 globus_size_t _ndx; \
161 _ndx = (globus_byte_t *)_buf - (globus_byte_t *)_start; \
162 while(_ndx >= _len) \
165 _start = globus_libc_realloc(_start, _len); \
166 _buf = _start + _ndx; \
172 #define GFSDecodeChar(_buf, _len, _w) \
184 #define GFSEncodeString(_start, _len, _buf, _w) \
187 char * _str=(char*)_w; \
190 GFSEncodeUInt32(_start, _len, _buf, 0); \
194 GFSEncodeUInt32(_start, _len, _buf, strlen(_str)+1); \
195 for(_str = (char *)_w; *_str != '\0'; _str++) \
197 GFSEncodeChar(_start, _len, _buf, *_str); \
202 #define GFSDecodeString(_buf, _len, _w) \
208 GFSDecodeUInt32(_buf, _len, _sz); \
212 for(_ctr = 0; _ctr < _sz - 1; _ctr++) \
214 GFSDecodeChar(_buf, _len, _w[_ctr]); \
225 globus_i_gfs_ipc_query_op_info(
228 extern globus_xio_stack_t globus_i_gfs_ipc_xio_stack;
229 extern globus_xio_driver_t globus_i_gfs_tcp_driver;