core: added comments to xavps structures
authorDaniel-Constantin Mierla <miconda@gmail.com>
Wed, 12 Dec 2012 10:08:45 +0000 (11:08 +0100)
committerDaniel-Constantin Mierla <miconda@gmail.com>
Wed, 12 Dec 2012 10:08:45 +0000 (11:08 +0100)
xavp.h

diff --git a/xavp.h b/xavp.h
index 9a31a0e..979bee4 100644 (file)
--- a/xavp.h
+++ b/xavp.h
 
 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);