Diff for /libaitio/inc/aitio.h between versions 1.15 and 1.15.2.1

version 1.15, 2012/03/15 01:52:22 version 1.15.2.1, 2012/03/27 20:53:37
Line 81  typedef struct _tagArray { Line 81  typedef struct _tagArray {
 /* AIT RPC variables and managment */  /* AIT RPC variables and managment */
   
 typedef enum {  typedef enum {
        empty, ptr,                     /* empty -> variable is not set; ptr -> void* */        empty, ptr, data,           /* empty -> variable is not set; ptr -> void*; data -> data after struct  */
         buffer, string, blob,           /* buffer -> uint8_t*; string -> int8_t*; blob -> uint32_t blobID(+socket); */          buffer, string, blob,           /* buffer -> uint8_t*; string -> int8_t*; blob -> uint32_t blobID(+socket); */
         f32, f64,                       /* float -> f32; double -> f64 */          f32, f64,                       /* float -> f32; double -> f64 */
         u8, u16, u32, u64,              /* unsigned integers ... */          u8, u16, u32, u64,              /* unsigned integers ... */
Line 110  typedef struct { Line 110  typedef struct {
                 int32_t         i32;                  int32_t         i32;
                 int64_t         i64;                  int64_t         i64;
         } val;          } val;
           uint8_t         val_data[0];
 } __packed ait_val_t;  } __packed ait_val_t;
   
 #define AIT_TYPE(_vl)                   ((ait_type_t) (_vl)->val_type)  #define AIT_TYPE(_vl)                   ((ait_type_t) (_vl)->val_type)
Line 122  typedef struct { Line 123  typedef struct {
 #define AIT_GET_LIKE(_vl, _type)        (assert((_vl)), (_type) (_vl)->val.ptr)  #define AIT_GET_LIKE(_vl, _type)        (assert((_vl)), (_type) (_vl)->val.ptr)
   
 #define AIT_GET_PTR(_vl)                (assert((_vl)), assert(AIT_TYPE((_vl)) == ptr), (_vl)->val.ptr)  #define AIT_GET_PTR(_vl)                (assert((_vl)), assert(AIT_TYPE((_vl)) == ptr), (_vl)->val.ptr)
   #define AIT_GET_DATA(_vl)               (assert((_vl)), assert(AIT_TYPE((_vl)) == data), (_vl)->val_data)
 #define AIT_GET_BUF(_vl)                (assert((_vl)), assert(AIT_TYPE((_vl)) == buffer), (_vl)->val.buffer)  #define AIT_GET_BUF(_vl)                (assert((_vl)), assert(AIT_TYPE((_vl)) == buffer), (_vl)->val.buffer)
 #define AIT_GET_STR(_vl)                (assert((_vl)), assert(AIT_TYPE((_vl)) == string), (_vl)->val.string)  #define AIT_GET_STR(_vl)                (assert((_vl)), assert(AIT_TYPE((_vl)) == string), (_vl)->val.string)
 #define AIT_GET_BLOB(_vl)               (assert((_vl)), assert(AIT_TYPE((_vl)) == blob), (_vl)->val.blob)  #define AIT_GET_BLOB(_vl)               (assert((_vl)), assert(AIT_TYPE((_vl)) == blob), (_vl)->val.blob)
Line 136  typedef struct { Line 138  typedef struct {
 #define AIT_GET_F32(_vl)                (assert((_vl)), assert(AIT_TYPE((_vl)) == f32), (_vl)->val.f32)  #define AIT_GET_F32(_vl)                (assert((_vl)), assert(AIT_TYPE((_vl)) == f32), (_vl)->val.f32)
 #define AIT_GET_F64(_vl)                (assert((_vl)), assert(AIT_TYPE((_vl)) == f64), (_vl)->val.f64)  #define AIT_GET_F64(_vl)                (assert((_vl)), assert(AIT_TYPE((_vl)) == f64), (_vl)->val.f64)
   
   #define AIT_SET_DATA(_vl, _p, _len)     do { ait_val_t *__val = (_vl); assert(__val); \
                                                   __val = realloc(__val, sizeof(ait_val_t) + _len); \
                                                   if (__val) { \
                                                           __val->val_type = data; AIT_LEN(__val) = _len; \
                                                           if ((_p)) \
                                                                   memcpy(__val->val_data, (_p), _len); \
                                                   } \
                                                   (_vl) = __val; \
                                           } while (0);
 #define AIT_SET_PTR(_vl, _p, _len)      do { ait_val_t *__val = (_vl); assert(__val); \  #define AIT_SET_PTR(_vl, _p, _len)      do { ait_val_t *__val = (_vl); assert(__val); \
                                                 __val->val_type = ptr; AIT_LEN(__val) = _len; \                                                  __val->val_type = ptr; AIT_LEN(__val) = _len; \
                                                 __val->val.ptr = _p; } while (0)                                                  __val->val.ptr = _p; } while (0)
Line 199  typedef struct { Line 210  typedef struct {
                                                 AIT_LEN(__val) = sizeof(double); } while (0)                                                  AIT_LEN(__val) = sizeof(double); } while (0)
   
                                         /* if attribute zeroCopy is set not execute free() */                                          /* if attribute zeroCopy is set not execute free() */
#define AIT_FREE_VAL(_vl)               do { ait_val_t *__val = (ait_val_t*) (_vl); assert(__val); \#define AIT_FREE_VAL(_vl)               do { ait_val_t *__val = (_vl); assert(__val); \
                                                switch (__val->val_type) { \                                                switch (AIT_TYPE(__val)) { \
                                                         case buffer: \                                                          case buffer: \
                                                                 if (__val->val.buffer) { \                                                                  if (__val->val.buffer) { \
                                                                         free(__val->val.buffer); \                                                                          free(__val->val.buffer); \
Line 213  typedef struct { Line 224  typedef struct {
                                                                         __val->val.string = NULL; \                                                                          __val->val.string = NULL; \
                                                                 } \                                                                  } \
                                                                 break; \                                                                  break; \
                                                           case data: \
                                                                   __val = realloc(__val, sizeof(ait_val_t)); \
                                                                   break; \
                                                         default: \                                                          default: \
                                                                 break; \                                                                  break; \
                                                 } \                                                  } \
                                                __val->val_type = empty; \                                                if (__val) { \
                                                AIT_LEN(__val) = 0; \                                                        __val->val_type = empty; \
                                                         AIT_LEN(__val) = 0; \
                                                 } \
                                         } while (0)                                          } while (0)
   
 struct io_ether_addr {  struct io_ether_addr {

Removed from v.1.15  
changed lines
  Added in v.1.15.2.1


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>