Browse code

added .txt extension to Readme files

git-svn-id: http://svn.berlios.de/svnroot/repos/sems/trunk@1555 8eb893ce-cfd4-0310-b710-fb5ebe64c474

Stefan Sayer authored on 22/10/2009 01:22:47
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,139 @@
1
+
2
+diameter client                   (C) 2007 iptego GmbH
3
+---------------
4
+
5
+this is a very simple DIAMETER client implementation. it does 
6
+implement only parts of the base protocol, and is not a complete 
7
+DIAMETER implementation.
8
+
9
+it is used from other modules with the DI API - i.e. other modules 
10
+can execute DI functions to add a server connection, or send a 
11
+DIAMETER request.
12
+
13
+the DIAMETER base implementation is based on ser-0.9.6 diameter_auth 
14
+module by Elena-Ramona Modroiu,  Copyright � 2003, 2004 FhG FOKUS.
15
+connection pool and asynchronous message handling has been added, 
16
+together with the CER/CEA handshake and other things.
17
+
18
+be prepared that you will need to look into the source to see how this 
19
+works, and you will need to build up your request AVPs by hand by 
20
+assembling an AmArg with the AVPs as ArgBlobs, and also unpack the 
21
+results/a received event from an AmArg array yourself.
22
+
23
+WHY?
24
+----
25
+It seems that there is no simple to use free DIAMETER client implementation
26
+available. 
27
+ - OpenDIAMETER is probably a complete solution, but seems to 
28
+be very complex to use. 
29
+ - DISC  (http://developer.berlios.de/projects/disc/) is of 2003, seems to 
30
+   be quite complete but assumes to be a complete server
31
+ - openimscore cdp module would probably have been a better basis 
32
+   than ser 0.9.6's auth diameter. well...
33
+
34
+BUGS/TODO
35
+---------
36
+ o CEA needs probably be fixed to specific AVP set
37
+ o mandatory AVP checking in compund AVP not implemented
38
+ 
39
+
40
+API
41
+---
42
+o connections are added with new_connection; connections are pooled for 
43
+  an application, and are retried periodically if broken. only active 
44
+  connections are used when sending a request (obviously)
45
+
46
+o replies to requests are posted as event to the session/module 
47
+  (identified by sess_link)
48
+
49
+new_connection
50
+  string app_name
51
+  string server_ip
52
+  unsigned int server_port
53
+  string origin_host
54
+  string origin_realm
55
+  string origin_ip
56
+  unsigned int app_id
57
+  unsigned int vendor_id
58
+  string product_name
59
+
60
+send_request
61
+  string app_name
62
+  unsigned int command_code
63
+  unsigned int app_id
64
+  arg val
65
+  string sess_link
66
+
67
+  args:  array
68
+    [int avp_id, int flags, int vendor, blob data]
69
+
70
+ returns :
71
+   DIA_OK
72
+   DIA_ERR_NOAPP
73
+   DIA_ERR_NOCONN
74
+
75
+reply events : 
76
+  ... 
77
+
78
+
79
+some testing code
80
+----------------
81
+
82
+else if(method == "test1"){
83
+    AmArg a; 
84
+    a.push(AmArg("vtm"));
85
+    a.push(AmArg("10.1.0.196"));
86
+    a.push(AmArg(8080));
87
+    a.push(AmArg("vtm01"));
88
+    a.push(AmArg("vtm.t-online.de"));
89
+    a.push(AmArg("10.42.32.13"));
90
+    a.push(AmArg(16777241));
91
+    a.push(AmArg(29631));
92
+    a.push(AmArg("vtm"));
93
+    a.assertArrayFmt("ssisssiis");
94
+    newConnection(a, ret);
95
+  } else if(method == "test2"){
96
+    AmArg a; 
97
+#define AAA_APP_USPI    16777241
98
+#define AVP_E164_NUMBER     1024
99
+#define AAA_VENDOR_IPTEGO  29631
100
+#define AAA_LAR         16777214
101
+
102
+    a.push(AmArg("vtm"));
103
+    a.push(AmArg(AAA_LAR));
104
+    a.push(AmArg(AAA_APP_USPI));
105
+    DBG("x pushin \n");
106
+    AmArg avps;
107
+
108
+    AmArg e164;
109
+    e164.push((int)AVP_E164_NUMBER);
110
+    e164.push((int)AAA_AVP_FLAG_VENDOR_SPECIFIC | AAA_AVP_FLAG_MANDATORY);
111
+    e164.push((int)AAA_VENDOR_IPTEGO);
112
+    string e164_number = "+49331600001";
113
+    e164.push(ArgBlob(e164_number.c_str(), e164_number.length()));
114
+    avps.push(e164);
115
+
116
+    AmArg drealm;
117
+    drealm.push((int)AVP_Destination_Realm);
118
+    drealm.push((int)AAA_AVP_FLAG_MANDATORY);
119
+    drealm.push((int)0);
120
+    string dest_realm = "iptego.de";
121
+    drealm.push(ArgBlob(dest_realm.c_str(), dest_realm.length()));
122
+    avps.push(drealm);
123
+
124
+    a.push(avps);
125
+    a.push(AmArg("bogus_link"));
126
+
127
+    // check...
128
+    a.assertArrayFmt("siias");
129
+
130
+    // check values
131
+    AmArg& vals = a.get(3);
132
+    for (size_t i=0;i<vals.size(); i++) {
133
+      AmArg& row = vals.get(i);
134
+      //    [int avp_id, int flags, int vendor, blob data]
135
+      row.assertArrayFmt("iiib");
136
+    }
137
+    DBG("x sendrequest\n");
138
+    sendRequest(a, ret);
139
+