11 #ifndef MERCURY_PROC_H
12 #define MERCURY_PROC_H
21 #include <rpc/types.h>
24 # define xdr_int8_t xdr_char
25 # define xdr_uint8_t xdr_u_char
26 # define xdr_uint16_t xdr_u_int16_t
27 # define xdr_uint32_t xdr_u_int32_t
28 # define xdr_uint64_t xdr_u_int64_t
32 #ifndef HG_PROC_INLINE
33 #if defined(__GNUC__) && !defined(__GNUC_STDC_INLINE__)
34 #define HG_PROC_INLINE extern HG_INLINE
36 #define HG_PROC_INLINE HG_INLINE
234 static HG_INLINE
void *
237 const void *src = NULL;
241 src = (op ==
HG_ENCODE) ? (
const void *) data : (
const void *) buf;
243 memcpy(dest, src, data_size);
245 return ((
char *) buf + data_size);
279 #define hg_proc_int8_t hg_proc_hg_int8_t
280 #define hg_proc_uint8_t hg_proc_hg_uint8_t
281 #define hg_proc_int16_t hg_proc_hg_int16_t
282 #define hg_proc_uint16_t hg_proc_hg_uint16_t
283 #define hg_proc_int32_t hg_proc_hg_int32_t
284 #define hg_proc_uint32_t hg_proc_hg_uint32_t
285 #define hg_proc_int64_t hg_proc_hg_int64_t
286 #define hg_proc_uint64_t hg_proc_hg_uint64_t
289 #define hg_proc_hg_bool_t hg_proc_hg_uint8_t
290 #define hg_proc_hg_ptr_t hg_proc_hg_uint64_t
291 #define hg_proc_hg_id_t hg_proc_hg_uint32_t
466 hg_uint8_t *buf_ptr_lim = (hg_uint8_t*) buf + buf_size;
469 for (buf_ptr = (hg_uint8_t*) buf; buf_ptr < buf_ptr_lim; buf_ptr++) {
493 hg_uint64_t buf_size = 0;
499 buf = malloc(buf_size);
538 buf = malloc(buf_size);
HG_EXPORT HG_PROC_INLINE hg_return_t hg_proc_hg_uint32_t(hg_proc_t proc, hg_uint32_t *data)
Generic processing routine.
HG_EXPORT HG_PROC_INLINE hg_return_t hg_proc_hg_uint64_t(hg_proc_t proc, hg_uint64_t *data)
Generic processing routine.
HG_EXPORT hg_proc_op_t hg_proc_get_op(hg_proc_t proc)
Get the operation type associated to the processor.
HG_EXPORT hg_return_t HG_Bulk_handle_free(hg_bulk_t handle)
Free bulk handle.
HG_EXPORT HG_PROC_INLINE hg_return_t hg_proc_hg_int16_t(hg_proc_t proc, hg_int16_t *data)
Generic processing routine.
HG_EXPORT HG_PROC_INLINE hg_return_t hg_proc_hg_bulk_t(hg_proc_t proc, hg_bulk_t *handle)
Generic processing routine.
HG_EXPORT hg_return_t hg_proc_free(hg_proc_t proc)
Free the processor.
HG_EXPORT hg_return_t hg_proc_set_size(hg_proc_t proc, size_t buf_size)
Request a new buffer size.
HG_EXPORT hg_return_t HG_Bulk_handle_deserialize(hg_bulk_t *handle, const void *buf, size_t buf_size)
Deserialize bulk handle from a buffer.
HG_EXPORT HG_PROC_INLINE hg_return_t hg_proc_raw(hg_proc_t proc, void *buf, size_t buf_size)
Generic processing routine.
HG_EXPORT hg_return_t hg_proc_memcpy(hg_proc_t proc, void *data, size_t data_size)
Base proc routine using memcpy.
HG_EXPORT HG_PROC_INLINE hg_return_t hg_proc_hg_uint16_t(hg_proc_t proc, hg_uint16_t *data)
Generic processing routine.
HG_EXPORT size_t hg_proc_get_extra_size(hg_proc_t proc)
Get eventual size of the extra buffer used by processor.
HG_EXPORT hg_return_t hg_proc_buf_free(void *mem_ptr)
Free memory which has been previously allocated using hg_proc_buf_alloc.
HG_EXPORT hg_return_t hg_proc_flush(hg_proc_t proc)
Flush the proc after data has been encoded or decoded and verify data using base checksum if availabl...
HG_EXPORT size_t HG_Bulk_handle_get_serialize_size(hg_bulk_t handle)
Get size required to serialize bulk handle.
HG_EXPORT void * hg_proc_get_buf_ptr(hg_proc_t proc)
Get pointer to current buffer (for manual encoding).
HG_EXPORT HG_PROC_INLINE hg_return_t hg_proc_hg_int64_t(hg_proc_t proc, hg_int64_t *data)
Generic processing routine.
HG_EXPORT void * hg_proc_get_extra_buf(hg_proc_t proc)
Get eventual extra buffer used by processor.
HG_EXPORT size_t hg_proc_get_size_left(hg_proc_t proc)
Get size left for processing.
HG_EXPORT hg_return_t hg_proc_set_extra_buf_is_mine(hg_proc_t proc, hg_bool_t mine)
Set extra buffer to mine (if other calls mine, buffer is no longer freed after hg_proc_free) ...
hg_proc_hash_t
Hash methods available for proc.
HG_EXPORT HG_PROC_INLINE hg_return_t hg_proc_hg_int32_t(hg_proc_t proc, hg_int32_t *data)
Generic processing routine.
HG_EXPORT HG_PROC_INLINE hg_return_t hg_proc_hg_uint8_t(hg_proc_t proc, hg_uint8_t *data)
Generic processing routine.
hg_proc_op_t
Proc operations.
enum hg_return hg_return_t
HG_EXPORT size_t hg_proc_get_size(hg_proc_t proc)
Get buffer size available for processing.
HG_EXPORT hg_return_t HG_Bulk_handle_serialize(void *buf, size_t buf_size, hg_bulk_t handle)
Serialize bulk handle into a buffer.
static HG_INLINE void * hg_proc_buf_memcpy(void *buf, void *data, size_t data_size, hg_proc_op_t op)
Copy data to buf if HG_ENCODE or buf to data if HG_DECODE and return incremented pointer to buf...
HG_EXPORT void * hg_proc_buf_alloc(size_t size)
Can be used to allocate a buffer that will be used by the generic processor.
HG_EXPORT HG_PROC_INLINE hg_return_t hg_proc_hg_int8_t(hg_proc_t proc, hg_int8_t *data)
Inline prototypes (do not remove)
HG_EXPORT hg_return_t hg_proc_set_buf_ptr(hg_proc_t proc, void *buf_ptr)
Set new buffer pointer (for manual encoding).
HG_EXPORT hg_return_t hg_proc_create(void *buf, size_t buf_size, hg_proc_op_t op, hg_proc_hash_t hash, hg_proc_t *proc)
Create a new encoding/decoding processor.