Browse code

core: added comments to xavps structures

Daniel-Constantin Mierla authored on 12/12/2012 10:08:45
Showing 1 changed files
... ...
@@ -32,43 +32,47 @@
32 32
 
33 33
 struct _sr_xavp;
34 34
 
35
+/* types for xavp values */
35 36
 typedef enum {
36 37
 	SR_XTYPE_NULL=0,
37
-	SR_XTYPE_INT,
38
-	SR_XTYPE_STR,
39
-	SR_XTYPE_TIME,
40
-	SR_XTYPE_LONG,
41
-	SR_XTYPE_LLONG,
42
-	SR_XTYPE_XAVP,
43
-	SR_XTYPE_DATA
38
+	SR_XTYPE_INT,     /* integer value */
39
+	SR_XTYPE_STR,     /* str value */
40
+	SR_XTYPE_TIME,    /* timestamp value */
41
+	SR_XTYPE_LONG,    /* long value */
42
+	SR_XTYPE_LLONG,   /* long long value */
43
+	SR_XTYPE_XAVP,    /* xavp value */
44
+	SR_XTYPE_DATA     /* custom data value */
44 45
 } sr_xtype_t;
45 46
 
46 47
 typedef void (*sr_xavp_sfree_f)(void *d);
47 48
 typedef void (*sr_data_free_f)(void *d, sr_xavp_sfree_f sfree);
48 49
 
50
+/* structure custom data value */
49 51
 typedef struct _sr_data {
50 52
 	void *p;
51 53
 	sr_data_free_f pfree;
52 54
 } sr_data_t;
53 55
 
56
+/* avp value */
54 57
 typedef struct _sr_xval {
55
-	sr_xtype_t type;
58
+	sr_xtype_t type;           /* type of the value */
56 59
 	union {
57 60
 		int i;
58
-		str s;                 /* replicated */
61
+		str s;                 /* cloned in shared memory */
59 62
 		time_t t;
60 63
 		long l;
61 64
 		long long ll;
62
-		struct _sr_xavp *xavp; /* must be given in shm */
63
-		sr_data_t *data;       /* must be given in shm */
65
+		struct _sr_xavp *xavp; /* must be given in shm (not cloned) */
66
+		sr_data_t *data;       /* must be given in shm (not cloned) */
64 67
 	} v;
65 68
 } sr_xval_t;
66 69
 
70
+/* structure for extended avp */
67 71
 typedef struct _sr_xavp {
68
-	unsigned int id;
69
-	str name;
70
-	sr_xval_t val;
71
-	struct _sr_xavp *next;
72
+	unsigned int id;          /* internal hash id */
73
+	str name;                 /* name of the xavp */
74
+	sr_xval_t val;            /* value of the xavp */
75
+	struct _sr_xavp *next;    /* pointer to next xavp in list */
72 76
 } sr_xavp_t;
73 77
 
74 78
 int xavp_init_head(void);