[sr-dev] git:master: core: added comments to xavps structures
Daniel-Constantin Mierla
miconda at gmail.com
Wed Dec 12 11:13:27 CET 2012
Module: sip-router
Branch: master
Commit: dccf5ede42eaf2b2f030d8c5a730418ce0517ec2
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=dccf5ede42eaf2b2f030d8c5a730418ce0517ec2
Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: Wed Dec 12 11:08:45 2012 +0100
core: added comments to xavps structures
---
xavp.h | 34 +++++++++++++++++++---------------
1 files changed, 19 insertions(+), 15 deletions(-)
diff --git a/xavp.h b/xavp.h
index 9a31a0e..979bee4 100644
--- a/xavp.h
+++ b/xavp.h
@@ -32,43 +32,47 @@
struct _sr_xavp;
+/* types for xavp values */
typedef enum {
SR_XTYPE_NULL=0,
- SR_XTYPE_INT,
- SR_XTYPE_STR,
- SR_XTYPE_TIME,
- SR_XTYPE_LONG,
- SR_XTYPE_LLONG,
- SR_XTYPE_XAVP,
- SR_XTYPE_DATA
+ SR_XTYPE_INT, /* integer value */
+ SR_XTYPE_STR, /* str value */
+ SR_XTYPE_TIME, /* timestamp value */
+ SR_XTYPE_LONG, /* long value */
+ SR_XTYPE_LLONG, /* long long value */
+ SR_XTYPE_XAVP, /* xavp value */
+ SR_XTYPE_DATA /* custom data value */
} sr_xtype_t;
typedef void (*sr_xavp_sfree_f)(void *d);
typedef void (*sr_data_free_f)(void *d, sr_xavp_sfree_f sfree);
+/* structure custom data value */
typedef struct _sr_data {
void *p;
sr_data_free_f pfree;
} sr_data_t;
+/* avp value */
typedef struct _sr_xval {
- sr_xtype_t type;
+ sr_xtype_t type; /* type of the value */
union {
int i;
- str s; /* replicated */
+ str s; /* cloned in shared memory */
time_t t;
long l;
long long ll;
- struct _sr_xavp *xavp; /* must be given in shm */
- sr_data_t *data; /* must be given in shm */
+ struct _sr_xavp *xavp; /* must be given in shm (not cloned) */
+ sr_data_t *data; /* must be given in shm (not cloned) */
} v;
} sr_xval_t;
+/* structure for extended avp */
typedef struct _sr_xavp {
- unsigned int id;
- str name;
- sr_xval_t val;
- struct _sr_xavp *next;
+ unsigned int id; /* internal hash id */
+ str name; /* name of the xavp */
+ sr_xval_t val; /* value of the xavp */
+ struct _sr_xavp *next; /* pointer to next xavp in list */
} sr_xavp_t;
int xavp_init_head(void);
More information about the sr-dev
mailing list