version 1.14.2.5, 2012/03/13 16:40:12
|
version 1.15.2.1, 2012/03/27 20:53:37
|
Line 12 terms:
|
Line 12 terms:
|
All of the documentation and software included in the ELWIX and AITNET |
All of the documentation and software included in the ELWIX and AITNET |
Releases is copyrighted by ELWIX - Sofia/Bulgaria <info@elwix.org> |
Releases is copyrighted by ELWIX - Sofia/Bulgaria <info@elwix.org> |
|
|
Copyright 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 | Copyright 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 |
by Michael Pounov <misho@elwix.org>. All rights reserved. |
by Michael Pounov <misho@elwix.org>. All rights reserved. |
|
|
Redistribution and use in source and binary forms, with or without |
Redistribution and use in source and binary forms, with or without |
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 119 typedef struct {
|
Line 120 typedef struct {
|
#define AIT_BLOB_CHUNKS(_vl, _n) (assert((_vl)), AIT_LEN((_vl)) / _n + (AIT_LEN((_vl)) % _n) ? 1 : 0) |
#define AIT_BLOB_CHUNKS(_vl, _n) (assert((_vl)), AIT_LEN((_vl)) / _n + (AIT_LEN((_vl)) % _n) ? 1 : 0) |
#define AIT_ISEMPTY(_vl) (assert((_vl)), AIT_TYPE((_vl)) == empty) |
#define AIT_ISEMPTY(_vl) (assert((_vl)), AIT_TYPE((_vl)) == empty) |
|
|
#define AIT_GET_LIKE(_vl, _type) (assert((_vl)), (_type) (_vl)->val.net) | #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 { |
Line 233 typedef union {
|
Line 249 typedef union {
|
struct sockaddr_in6 sin6; |
struct sockaddr_in6 sin6; |
struct sockaddr_dl sdl; |
struct sockaddr_dl sdl; |
} io_sockaddr_t; |
} io_sockaddr_t; |
|
|
|
|
|
#define io_align(x, a) (((x) + (a)) & ~(a)) |
|
|
|
|
// io_GetErrno() Get error code of last operation |
// io_GetErrno() Get error code of last operation |