Browse code

lost: typedef naming changed and copyright added

Wolfgang Kampichler authored on 08/04/2021 19:31:24
Showing 1 changed files
... ...
@@ -79,7 +79,7 @@
79 79
 #define BUFSIZE 128	   /* temporary buffer to hold geolocation */
80 80
 #define RANDSTRSIZE 16 /* temporary id in a findService request */
81 81
 
82
-typedef struct LOC
82
+typedef struct lost_loc
83 83
 {
84 84
 	char *identity;	 /* location idendity (findServiceRequest) */
85 85
 	char *urn;		 /* service URN (findServiceRequest) */
... ...
@@ -93,7 +93,7 @@ typedef struct LOC
93 93
 	int boundary;	 /* boundary ref|value (findServiceRequest)*/
94 94
 } s_lost_loc_t, *p_lost_loc_t;
95 95
 
96
-typedef struct HELD
96
+typedef struct lost_held
97 97
 {
98 98
 	char *identity; /* location idendity (locationRequest) */
99 99
 	char *type;		/* location type (locationRequest) */
... ...
@@ -101,7 +101,7 @@ typedef struct HELD
101 101
 	int exact;		/* exact true|false (locationRequest)*/
102 102
 } s_lost_held_t, *p_lost_held_t;
103 103
 
104
-typedef enum GEOTYPE
104
+typedef enum lost_geotype
105 105
 {
106 106
 	ANY,		 /* any type */
107 107
 	CID,		 /* content-indirection */
... ...
@@ -110,12 +110,12 @@ typedef enum GEOTYPE
110 110
 	UNKNOWN = -1 /* unknown */
111 111
 } lost_geotype_t;
112 112
 
113
-typedef struct GEOLIST
113
+typedef struct lost_geolist
114 114
 {
115 115
 	char *value;		 /* geolocation header value */
116 116
 	char *param;		 /* value parameter */
117 117
 	lost_geotype_t type; /* type */
118
-	struct GEOLIST *next;
118
+	struct lost_geolist *next;
119 119
 } s_lost_geolist_t, *p_lost_geolist_t;
120 120
 
121 121
 void lost_rand_str(char *, size_t);
Browse code

lost: memory leak fix and code refactoring

Wolfgang Kampichler authored on 31/03/2021 21:14:14
Showing 1 changed files
... ...
@@ -91,7 +91,7 @@ typedef struct LOC
91 91
 	int radius;		 /* geo radius (findServiceRequest) */
92 92
 	int recursive;	 /* recursion true|false (findServiceRequest)*/
93 93
 	int boundary;	 /* boundary ref|value (findServiceRequest)*/
94
-} s_loc_t, *p_loc_t;
94
+} s_lost_loc_t, *p_lost_loc_t;
95 95
 
96 96
 typedef struct HELD
97 97
 {
... ...
@@ -99,7 +99,7 @@ typedef struct HELD
99 99
 	char *type;		/* location type (locationRequest) */
100 100
 	int time;		/* response time (locationRequest) */
101 101
 	int exact;		/* exact true|false (locationRequest)*/
102
-} s_held_t, *p_held_t;
102
+} s_lost_held_t, *p_lost_held_t;
103 103
 
104 104
 typedef enum GEOTYPE
105 105
 {
... ...
@@ -108,32 +108,32 @@ typedef enum GEOTYPE
108 108
 	HTTP,		 /* http uri */
109 109
 	HTTPS,		 /* https uri */
110 110
 	UNKNOWN = -1 /* unknown */
111
-} geotype_t;
111
+} lost_geotype_t;
112 112
 
113 113
 typedef struct GEOLIST
114 114
 {
115
-	char *value;	/* geolocation header value */
116
-	char *param;	/* value parameter */
117
-	geotype_t type; /* type */
115
+	char *value;		 /* geolocation header value */
116
+	char *param;		 /* value parameter */
117
+	lost_geotype_t type; /* type */
118 118
 	struct GEOLIST *next;
119
-} s_geolist_t, *p_geolist_t;
119
+} s_lost_geolist_t, *p_lost_geolist_t;
120 120
 
121 121
 void lost_rand_str(char *, size_t);
122
-void lost_free_loc(p_loc_t *);
123
-void lost_free_held(p_held_t *);
122
+void lost_free_loc(p_lost_loc_t *);
123
+void lost_free_held(p_lost_held_t *);
124 124
 void lost_free_string(str *);
125
-void lost_free_geoheader_list(p_geolist_t *);
126
-void lost_reverse_geoheader_list(p_geolist_t *);
125
+void lost_free_geoheader_list(p_lost_geolist_t *);
126
+void lost_reverse_geoheader_list(p_lost_geolist_t *);
127 127
 
128
-int lost_parse_location_info(xmlNodePtr, p_loc_t);
129
-int lost_xpath_location(xmlDocPtr, char *, p_loc_t);
130
-int lost_parse_geo(xmlNodePtr, p_loc_t);
128
+int lost_parse_location_info(xmlNodePtr, p_lost_loc_t);
129
+int lost_xpath_location(xmlDocPtr, char *, p_lost_loc_t);
130
+int lost_parse_geo(xmlNodePtr, p_lost_loc_t);
131 131
 int lost_parse_host(const char *, str *, int *);
132
-int lost_new_geoheader_list(p_geolist_t *, str);
132
+int lost_new_geoheader_list(p_lost_geolist_t *, str);
133 133
 int lost_get_nameinfo(char *, str *, int);
134 134
 
135
-char *lost_find_service_request(p_loc_t, int *);
136
-char *lost_held_location_request(p_held_t, int *);
135
+char *lost_find_service_request(p_lost_loc_t, int *);
136
+char *lost_held_location_request(p_lost_held_t, int *);
137 137
 char *lost_held_post_request(int *, long, char *);
138 138
 char *lost_get_content(xmlNodePtr, const char *, int *);
139 139
 char *lost_get_property(xmlNodePtr, const char *, int *);
... ...
@@ -142,12 +142,12 @@ char *lost_get_pai_header(struct sip_msg *, int *);
142 142
 char *lost_get_childname(xmlNodePtr, const char *, int *);
143 143
 char *lost_trim_content(char *, int *);
144 144
 char *lost_copy_geoheader_value(char *, int);
145
-char *lost_get_geoheader_value(p_geolist_t, geotype_t, int *);
145
+char *lost_get_geoheader_value(p_lost_geolist_t, lost_geotype_t, int *);
146 146
 char *lost_copy_string(str, int *);
147 147
 
148
-p_loc_t lost_new_loc(str);
149
-p_loc_t lost_parse_pidf(str, str);
150
-p_held_t lost_new_held(str, str, int, int);
151
-p_geolist_t lost_get_geolocation_header(struct sip_msg *, int *);
148
+p_lost_loc_t lost_new_loc(str);
149
+p_lost_loc_t lost_parse_pidf(str, str);
150
+p_lost_held_t lost_new_held(str, str, int, int);
151
+p_lost_geolist_t lost_get_geolocation_header(struct sip_msg *, int *);
152 152
 
153 153
 #endif
Browse code

lost: new features, attributes and a new function to dereference location

- features: LoST redirect, dynamic HELD url resolving (#2574), LoST NAPTR,
POST request to dereference loation
- attributes: reponse_time (-1:emergencyDispatch, 0:emergencyRouting, >0[ms]);
post_request (POST method to dereference location #2641); recursion (yes/no);
location_profile (PIDF/LO profile selection: first/last/geo/civic);
verbose (detailed LoST response as log INFO);
geoheader_type (filter schema: any/cid/http/https);
geoheader_order (first/last)
- function: lost_held_dereference (specific function to dereference location
using POST method); attributes are url (r), resp.-time (r), resp.-type (r),
pidf (r/w) and error (r/w)
- general: The extension of the module allows dynamic querying of LIS/HELD
and LOST services via NAPTR lookup. In the case of LOST, a redirect
response is evaluated. In case a lost_held_request (used to connect
to a LIS via POST or GET) is passed with an empty string ("") for the
connection parameter, then P-A-I or From header value hostnames are used
for NAPTR lookup to get a corresponding service.

Wolfgang Kampichler authored on 15/03/2021 13:18:57
Showing 1 changed files
... ...
@@ -1,7 +1,7 @@
1 1
 /*
2 2
  * lost module utility functions
3 3
  *
4
- * Copyright (C) 2020 Wolfgang Kampichler
4
+ * Copyright (C) 2021 Wolfgang Kampichler
5 5
  * DEC112, FREQUENTIS AG
6 6
  *
7 7
  * This file is part of Kamailio, a free SIP server.
... ...
@@ -33,14 +33,15 @@
33 33
 #define LOST_UTILITIES_H
34 34
 
35 35
 #define LAQUOT '<'
36
+#define COLON ':'
36 37
 
37 38
 #define LOST_GEOLOC_HEADER "Geolocation: "
38 39
 #define LOST_GEOLOC_HEADER_SIZE strlen(LOST_GEOLOC_HEADER)
39 40
 #define LOST_PAI_HEADER "P-Asserted-Identity: "
40 41
 #define LOST_PAI_HEADER_SIZE strlen(LOST_PAI_HEADER)
41 42
 
42
-#define LOST_RECURSION_TRUE 1
43
-#define LOST_RECURSION_FALSE 0
43
+#define LOST_BOUNDARY_TRUE 1
44
+#define LOST_BOUNDARY_FALSE 0
44 45
 #define LOST_XPATH_DPTH 3
45 46
 #define LOST_XPATH_GP "//gp:location-info/*"
46 47
 
... ...
@@ -66,6 +67,12 @@
66 67
 #define HELD_TYPE_URI "locationURI"
67 68
 #define HELD_TYPE_SEP " "
68 69
 
70
+#define HELD_LR "locationRequest"
71
+#define HELD_LT "locationType"
72
+#define HELD_RT "responseTime"
73
+#define HELD_ED "emergencyDispatch"
74
+#define HELD_ER "emergencyRouting"
75
+
69 76
 #define HELD_EXACT_TRUE 1
70 77
 #define HELD_EXACT_FALSE 0
71 78
 
... ...
@@ -112,31 +119,35 @@ typedef struct GEOLIST
112 119
 } s_geolist_t, *p_geolist_t;
113 120
 
114 121
 void lost_rand_str(char *, size_t);
115
-void lost_free_loc(p_loc_t);
116
-void lost_free_held(p_held_t);
122
+void lost_free_loc(p_loc_t *);
123
+void lost_free_held(p_held_t *);
117 124
 void lost_free_string(str *);
125
+void lost_free_geoheader_list(p_geolist_t *);
118 126
 void lost_reverse_geoheader_list(p_geolist_t *);
119
-void lost_delete_geoheader_list(p_geolist_t);
120 127
 
121 128
 int lost_parse_location_info(xmlNodePtr, p_loc_t);
122 129
 int lost_xpath_location(xmlDocPtr, char *, p_loc_t);
123 130
 int lost_parse_geo(xmlNodePtr, p_loc_t);
131
+int lost_parse_host(const char *, str *, int *);
132
+int lost_new_geoheader_list(p_geolist_t *, str);
133
+int lost_get_nameinfo(char *, str *, int);
124 134
 
125 135
 char *lost_find_service_request(p_loc_t, int *);
126 136
 char *lost_held_location_request(p_held_t, int *);
137
+char *lost_held_post_request(int *, long, char *);
127 138
 char *lost_get_content(xmlNodePtr, const char *, int *);
128 139
 char *lost_get_property(xmlNodePtr, const char *, int *);
129
-char *lost_get_geolocation_header(struct sip_msg *, int *);
130 140
 char *lost_get_from_header(struct sip_msg *, int *);
131 141
 char *lost_get_pai_header(struct sip_msg *, int *);
132 142
 char *lost_get_childname(xmlNodePtr, const char *, int *);
133 143
 char *lost_trim_content(char *, int *);
134 144
 char *lost_copy_geoheader_value(char *, int);
135 145
 char *lost_get_geoheader_value(p_geolist_t, geotype_t, int *);
146
+char *lost_copy_string(str, int *);
136 147
 
137 148
 p_loc_t lost_new_loc(str);
138 149
 p_loc_t lost_parse_pidf(str, str);
139 150
 p_held_t lost_new_held(str, str, int, int);
140
-p_geolist_t lost_new_geoheader_list(str, int *);
151
+p_geolist_t lost_get_geolocation_header(struct sip_msg *, int *);
141 152
 
142 153
 #endif
Browse code

lost: added Geolocation header value list support

- the Geolocation header value parsing now supports
a list of location URIs of type (cid, http and https).
- types may be filtered and the list sequence may be
changed via new module parameters.
- besides: README update and code refactoring.

Wolfgang Kampichler authored on 12/01/2021 10:56:47
Showing 1 changed files
... ...
@@ -32,6 +32,8 @@
32 32
 #ifndef LOST_UTILITIES_H
33 33
 #define LOST_UTILITIES_H
34 34
 
35
+#define LAQUOT '<'
36
+
35 37
 #define LOST_GEOLOC_HEADER "Geolocation: "
36 38
 #define LOST_GEOLOC_HEADER_SIZE strlen(LOST_GEOLOC_HEADER)
37 39
 #define LOST_PAI_HEADER "P-Asserted-Identity: "
... ...
@@ -67,35 +69,54 @@
67 69
 #define HELD_EXACT_TRUE 1
68 70
 #define HELD_EXACT_FALSE 0
69 71
 
70
-#define BUFSIZE 128	/* temporary buffer to hold geolocation */
72
+#define BUFSIZE 128	   /* temporary buffer to hold geolocation */
71 73
 #define RANDSTRSIZE 16 /* temporary id in a findService request */
72 74
 
73 75
 typedef struct LOC
74 76
 {
75
-	char *identity;		/* location idendity (findServiceRequest) */
76
-	char *urn;			/* service URN (findServiceRequest) */ 
77
-	char *xpath;		/* civic address (findServiceRequest) */
78
-	char *geodetic;		/* geodetic location (findServiceRequest) */
79
-	char *longitude;	/* geo longitude */
80
-	char *latitude;		/* geo latitude */
81
-	char *profile;		/* location profile (findServiceRequest) */
82
-	int radius;			/* geo radius (findServiceRequest) */
83
-	int recursive;		/* recursion true|false (findServiceRequest)*/
84
-	int boundary;       /* boundary ref|value (findServiceRequest)*/
77
+	char *identity;	 /* location idendity (findServiceRequest) */
78
+	char *urn;		 /* service URN (findServiceRequest) */
79
+	char *xpath;	 /* civic address (findServiceRequest) */
80
+	char *geodetic;	 /* geodetic location (findServiceRequest) */
81
+	char *longitude; /* geo longitude */
82
+	char *latitude;	 /* geo latitude */
83
+	char *profile;	 /* location profile (findServiceRequest) */
84
+	int radius;		 /* geo radius (findServiceRequest) */
85
+	int recursive;	 /* recursion true|false (findServiceRequest)*/
86
+	int boundary;	 /* boundary ref|value (findServiceRequest)*/
85 87
 } s_loc_t, *p_loc_t;
86 88
 
87 89
 typedef struct HELD
88 90
 {
89
-	char *identity;		/* location idendity (locationRequest) */
90
-	char *type;			/* location type (locationRequest) */ 
91
-	int time;			/* response time (locationRequest) */
92
-	int exact;			/* exact true|false (locationRequest)*/
91
+	char *identity; /* location idendity (locationRequest) */
92
+	char *type;		/* location type (locationRequest) */
93
+	int time;		/* response time (locationRequest) */
94
+	int exact;		/* exact true|false (locationRequest)*/
93 95
 } s_held_t, *p_held_t;
94 96
 
97
+typedef enum GEOTYPE
98
+{
99
+	ANY,		 /* any type */
100
+	CID,		 /* content-indirection */
101
+	HTTP,		 /* http uri */
102
+	HTTPS,		 /* https uri */
103
+	UNKNOWN = -1 /* unknown */
104
+} geotype_t;
105
+
106
+typedef struct GEOLIST
107
+{
108
+	char *value;	/* geolocation header value */
109
+	char *param;	/* value parameter */
110
+	geotype_t type; /* type */
111
+	struct GEOLIST *next;
112
+} s_geolist_t, *p_geolist_t;
113
+
95 114
 void lost_rand_str(char *, size_t);
96 115
 void lost_free_loc(p_loc_t);
97 116
 void lost_free_held(p_held_t);
98 117
 void lost_free_string(str *);
118
+void lost_reverse_geoheader_list(p_geolist_t *);
119
+void lost_delete_geoheader_list(p_geolist_t);
99 120
 
100 121
 int lost_parse_location_info(xmlNodePtr, p_loc_t);
101 122
 int lost_xpath_location(xmlDocPtr, char *, p_loc_t);
... ...
@@ -110,8 +131,12 @@ char *lost_get_from_header(struct sip_msg *, int *);
110 131
 char *lost_get_pai_header(struct sip_msg *, int *);
111 132
 char *lost_get_childname(xmlNodePtr, const char *, int *);
112 133
 char *lost_trim_content(char *, int *);
134
+char *lost_copy_geoheader_value(char *, int);
135
+char *lost_get_geoheader_value(p_geolist_t, geotype_t, int *);
113 136
 
114 137
 p_loc_t lost_new_loc(str);
138
+p_loc_t lost_parse_pidf(str, str);
115 139
 p_held_t lost_new_held(str, str, int, int);
140
+p_geolist_t lost_new_geoheader_list(str, int *);
116 141
 
117 142
 #endif
Browse code

lost: fixed defects reported from Coverity Scan

- in lost_function(): illegal access
- in lost_held_type(): null pointer dereferences
- in lost_xpath_location(): resource leak, control flow,
null pointer dereferences
- besides: README update and code refactoring.

Wolfgang Kampichler authored on 26/03/2020 21:36:05
Showing 1 changed files
... ...
@@ -74,7 +74,7 @@ typedef struct LOC
74 74
 {
75 75
 	char *identity;		/* location idendity (findServiceRequest) */
76 76
 	char *urn;			/* service URN (findServiceRequest) */ 
77
-	char *civic;		/* civic address (findServiceRequest) */
77
+	char *xpath;		/* civic address (findServiceRequest) */
78 78
 	char *geodetic;		/* geodetic location (findServiceRequest) */
79 79
 	char *longitude;	/* geo longitude */
80 80
 	char *latitude;		/* geo latitude */
Browse code

lost: new module parameters to set HeLD request attributes

- parameters are exact_type, response_time, and location_type
- the module function lost_held_query now supports proper
handling of location types 'any', 'civic', 'geodetic' or
'locationURI' (or any combination).
- besides: README update and code refactoring.

Wolfgang Kampichler authored on 23/03/2020 21:44:27
Showing 1 changed files
... ...
@@ -58,8 +58,12 @@
58 58
 #define LOST_CIR "Circle"
59 59
 #define LOST_CIV "civicAddress"
60 60
 
61
-#define HELD_TYPE "geodetic locationURI"
62
-#define HELD_TIME "3"
61
+#define HELD_TYPE_ANY "any"
62
+#define HELD_TYPE_CIV "civic"
63
+#define HELD_TYPE_GEO "geodetic"
64
+#define HELD_TYPE_URI "locationURI"
65
+#define HELD_TYPE_SEP " "
66
+
63 67
 #define HELD_EXACT_TRUE 1
64 68
 #define HELD_EXACT_FALSE 0
65 69
 
... ...
@@ -84,11 +88,10 @@ typedef struct HELD
84 88
 {
85 89
 	char *identity;		/* location idendity (locationRequest) */
86 90
 	char *type;			/* location type (locationRequest) */ 
87
-	char *time;			/* response time (locationRequest) */
91
+	int time;			/* response time (locationRequest) */
88 92
 	int exact;			/* exact true|false (locationRequest)*/
89 93
 } s_held_t, *p_held_t;
90 94
 
91
-
92 95
 void lost_rand_str(char *, size_t);
93 96
 void lost_free_loc(p_loc_t);
94 97
 void lost_free_held(p_held_t);
... ...
@@ -109,6 +112,6 @@ char *lost_get_childname(xmlNodePtr, const char *, int *);
109 112
 char *lost_trim_content(char *, int *);
110 113
 
111 114
 p_loc_t lost_new_loc(str);
112
-p_held_t lost_new_held(str, str, str, int);
115
+p_held_t lost_new_held(str, str, int, int);
113 116
 
114 117
 #endif
Browse code

lost: added civic address parsing via xpath

- the pidf-lo parsing function now uses xpath to support
geolocation (point, circle) and civic address.
- as fall-back (failing xpath or malformed pidf-lo) the
the function looks for point or cirle attributes.
- besides: README update and code refactoring.

wkampich authored on 08/03/2020 08:23:53
Showing 1 changed files
... ...
@@ -1,7 +1,7 @@
1 1
 /*
2 2
  * lost module utility functions
3 3
  *
4
- * Copyright (C) 2019 Wolfgang Kampichler
4
+ * Copyright (C) 2020 Wolfgang Kampichler
5 5
  * DEC112, FREQUENTIS AG
6 6
  *
7 7
  * This file is part of Kamailio, a free SIP server.
... ...
@@ -37,32 +37,69 @@
37 37
 #define LOST_PAI_HEADER "P-Asserted-Identity: "
38 38
 #define LOST_PAI_HEADER_SIZE strlen(LOST_PAI_HEADER)
39 39
 
40
+#define LOST_RECURSION_TRUE 1
41
+#define LOST_RECURSION_FALSE 0
42
+#define LOST_XPATH_DPTH 3
43
+#define LOST_XPATH_GP "//gp:location-info/*"
44
+
45
+#define XPATH_NS                                         \
46
+	"gp=urn:ietf:params:xml:ns:pidf:geopriv10"           \
47
+	" "                                                  \
48
+	"xmlns=urn:ietf:params:xml:ns:pidf"                  \
49
+	" "                                                  \
50
+	"ca=urn:ietf:params:xml:ns:pidf:geopriv10:civicAddr" \
51
+	" "                                                  \
52
+	"gm=http://www.opengis.net/gml"
53
+
54
+#define LOST_PRO_GEO2D "geodetic-2d"
55
+#define LOST_PRO_CIVIC "civic"
56
+
57
+#define LOST_PNT "Point"
58
+#define LOST_CIR "Circle"
59
+#define LOST_CIV "civicAddress"
60
+
61
+#define HELD_TYPE "geodetic locationURI"
62
+#define HELD_TIME "3"
63
+#define HELD_EXACT_TRUE 1
64
+#define HELD_EXACT_FALSE 0
65
+
40 66
 #define BUFSIZE 128	/* temporary buffer to hold geolocation */
41 67
 #define RANDSTRSIZE 16 /* temporary id in a findService request */
42 68
 
43
-#define LOSTFREE(x) pkg_free(x); x = NULL;
44
-
45
-typedef struct
69
+typedef struct LOC
46 70
 {
47
-	char *identity;
48
-	char *urn;
49
-	char *longitude;
50
-	char *latitude;
51
-	char *uri;
52
-	char *ref;
53
-	int radius;
54
-	int recursive;
71
+	char *identity;		/* location idendity (findServiceRequest) */
72
+	char *urn;			/* service URN (findServiceRequest) */ 
73
+	char *civic;		/* civic address (findServiceRequest) */
74
+	char *geodetic;		/* geodetic location (findServiceRequest) */
75
+	char *longitude;	/* geo longitude */
76
+	char *latitude;		/* geo latitude */
77
+	char *profile;		/* location profile (findServiceRequest) */
78
+	int radius;			/* geo radius (findServiceRequest) */
79
+	int recursive;		/* recursion true|false (findServiceRequest)*/
80
+	int boundary;       /* boundary ref|value (findServiceRequest)*/
55 81
 } s_loc_t, *p_loc_t;
56 82
 
83
+typedef struct HELD
84
+{
85
+	char *identity;		/* location idendity (locationRequest) */
86
+	char *type;			/* location type (locationRequest) */ 
87
+	char *time;			/* response time (locationRequest) */
88
+	int exact;			/* exact true|false (locationRequest)*/
89
+} s_held_t, *p_held_t;
90
+
91
+
57 92
 void lost_rand_str(char *, size_t);
58 93
 void lost_free_loc(p_loc_t);
94
+void lost_free_held(p_held_t);
59 95
 void lost_free_string(str *);
60 96
 
61
-int lost_get_location_object(p_loc_t, xmlDocPtr, xmlNodePtr);
62
-int lost_parse_location_info(xmlNodePtr node, p_loc_t loc);
97
+int lost_parse_location_info(xmlNodePtr, p_loc_t);
98
+int lost_xpath_location(xmlDocPtr, char *, p_loc_t);
99
+int lost_parse_geo(xmlNodePtr, p_loc_t);
63 100
 
64 101
 char *lost_find_service_request(p_loc_t, int *);
65
-char *lost_held_location_request(char *, int *);
102
+char *lost_held_location_request(p_held_t, int *);
66 103
 char *lost_get_content(xmlNodePtr, const char *, int *);
67 104
 char *lost_get_property(xmlNodePtr, const char *, int *);
68 105
 char *lost_get_geolocation_header(struct sip_msg *, int *);
... ...
@@ -72,5 +109,6 @@ char *lost_get_childname(xmlNodePtr, const char *, int *);
72 109
 char *lost_trim_content(char *, int *);
73 110
 
74 111
 p_loc_t lost_new_loc(str);
112
+p_held_t lost_new_held(str, str, str, int);
75 113
 
76 114
 #endif
Browse code

lost: end of line normalization to linux line ending format

Henning Westerholt authored on 09/09/2019 19:28:45
Showing 1 changed files
... ...
@@ -1,76 +1,76 @@
1
-/*
2
- * lost module utility functions
3
- *
4
- * Copyright (C) 2019 Wolfgang Kampichler
5
- * DEC112, FREQUENTIS AG
6
- *
7
- * This file is part of Kamailio, a free SIP server.
8
- *
9
- * Kamailio is free software; you can redistribute it and/or modify
10
- * it under the terms of the GNU General Public License as published by
11
- * the Free Software Foundation; either version 2 of the License, or
12
- * (at your option) any later version
13
- *
14
- * Kamailio is distributed in the hope that it will be useful,
15
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
- * GNU General Public License for more details.
18
- *
19
- * You should have received a copy of the GNU General Public License
20
- * along with this program; if not, write to the Free Software
21
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
22
- *
23
- */
24
-
25
-/*!
26
- * \file
27
- * \brief Kamailio lost :: functions
28
- * \ingroup lost
29
- * Module: \ref lost
30
- */
31
-
32
-#ifndef LOST_UTILITIES_H
33
-#define LOST_UTILITIES_H
34
-
35
-#define LOST_GEOLOC_HEADER "Geolocation: "
36
-#define LOST_GEOLOC_HEADER_SIZE strlen(LOST_GEOLOC_HEADER)
37
-#define LOST_PAI_HEADER "P-Asserted-Identity: "
38
-#define LOST_PAI_HEADER_SIZE strlen(LOST_PAI_HEADER)
39
-
40
-#define BUFSIZE 128	/* temporary buffer to hold geolocation */
41
-#define RANDSTRSIZE 16 /* temporary id in a findService request */
42
-
43
-#define LOSTFREE(x) pkg_free(x); x = NULL;
44
-
45
-typedef struct
46
-{
47
-	char *identity;
48
-	char *urn;
49
-	char *longitude;
50
-	char *latitude;
51
-	char *uri;
52
-	char *ref;
53
-	int radius;
54
-	int recursive;
55
-} s_loc_t, *p_loc_t;
56
-
57
-void lost_rand_str(char *, size_t);
58
-void lost_free_loc(p_loc_t);
59
-void lost_free_string(str *);
60
-
61
-int lost_get_location_object(p_loc_t, xmlDocPtr, xmlNodePtr);
62
-int lost_parse_location_info(xmlNodePtr node, p_loc_t loc);
63
-
64
-char *lost_find_service_request(p_loc_t, int *);
65
-char *lost_held_location_request(char *, int *);
66
-char *lost_get_content(xmlNodePtr, const char *, int *);
67
-char *lost_get_property(xmlNodePtr, const char *, int *);
68
-char *lost_get_geolocation_header(struct sip_msg *, int *);
69
-char *lost_get_from_header(struct sip_msg *, int *);
70
-char *lost_get_pai_header(struct sip_msg *, int *);
71
-char *lost_get_childname(xmlNodePtr, const char *, int *);
72
-char *lost_trim_content(char *, int *);
73
-
74
-p_loc_t lost_new_loc(str);
75
-
76
-#endif
1
+/*
2
+ * lost module utility functions
3
+ *
4
+ * Copyright (C) 2019 Wolfgang Kampichler
5
+ * DEC112, FREQUENTIS AG
6
+ *
7
+ * This file is part of Kamailio, a free SIP server.
8
+ *
9
+ * Kamailio is free software; you can redistribute it and/or modify
10
+ * it under the terms of the GNU General Public License as published by
11
+ * the Free Software Foundation; either version 2 of the License, or
12
+ * (at your option) any later version
13
+ *
14
+ * Kamailio is distributed in the hope that it will be useful,
15
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
+ * GNU General Public License for more details.
18
+ *
19
+ * You should have received a copy of the GNU General Public License
20
+ * along with this program; if not, write to the Free Software
21
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
22
+ *
23
+ */
24
+
25
+/*!
26
+ * \file
27
+ * \brief Kamailio lost :: functions
28
+ * \ingroup lost
29
+ * Module: \ref lost
30
+ */
31
+
32
+#ifndef LOST_UTILITIES_H
33
+#define LOST_UTILITIES_H
34
+
35
+#define LOST_GEOLOC_HEADER "Geolocation: "
36
+#define LOST_GEOLOC_HEADER_SIZE strlen(LOST_GEOLOC_HEADER)
37
+#define LOST_PAI_HEADER "P-Asserted-Identity: "
38
+#define LOST_PAI_HEADER_SIZE strlen(LOST_PAI_HEADER)
39
+
40
+#define BUFSIZE 128	/* temporary buffer to hold geolocation */
41
+#define RANDSTRSIZE 16 /* temporary id in a findService request */
42
+
43
+#define LOSTFREE(x) pkg_free(x); x = NULL;
44
+
45
+typedef struct
46
+{
47
+	char *identity;
48
+	char *urn;
49
+	char *longitude;
50
+	char *latitude;
51
+	char *uri;
52
+	char *ref;
53
+	int radius;
54
+	int recursive;
55
+} s_loc_t, *p_loc_t;
56
+
57
+void lost_rand_str(char *, size_t);
58
+void lost_free_loc(p_loc_t);
59
+void lost_free_string(str *);
60
+
61
+int lost_get_location_object(p_loc_t, xmlDocPtr, xmlNodePtr);
62
+int lost_parse_location_info(xmlNodePtr node, p_loc_t loc);
63
+
64
+char *lost_find_service_request(p_loc_t, int *);
65
+char *lost_held_location_request(char *, int *);
66
+char *lost_get_content(xmlNodePtr, const char *, int *);
67
+char *lost_get_property(xmlNodePtr, const char *, int *);
68
+char *lost_get_geolocation_header(struct sip_msg *, int *);
69
+char *lost_get_from_header(struct sip_msg *, int *);
70
+char *lost_get_pai_header(struct sip_msg *, int *);
71
+char *lost_get_childname(xmlNodePtr, const char *, int *);
72
+char *lost_trim_content(char *, int *);
73
+
74
+p_loc_t lost_new_loc(str);
75
+
76
+#endif
Browse code

lost: adds HELD (RFC6155) and LOST (RFC5222) queries for location-based routing

- code review, updates to memory managment and error handling

wkampich authored on 14/08/2019 18:22:04 • Henning Westerholt committed on 16/08/2019 06:04:03
Showing 1 changed files
... ...
@@ -40,6 +40,8 @@
40 40
 #define BUFSIZE 128	/* temporary buffer to hold geolocation */
41 41
 #define RANDSTRSIZE 16 /* temporary id in a findService request */
42 42
 
43
+#define LOSTFREE(x) pkg_free(x); x = NULL;
44
+
43 45
 typedef struct
44 46
 {
45 47
 	char *identity;
... ...
@@ -54,6 +56,7 @@ typedef struct
54 56
 
55 57
 void lost_rand_str(char *, size_t);
56 58
 void lost_free_loc(p_loc_t);
59
+void lost_free_string(str *);
57 60
 
58 61
 int lost_get_location_object(p_loc_t, xmlDocPtr, xmlNodePtr);
59 62
 int lost_parse_location_info(xmlNodePtr node, p_loc_t loc);
Browse code

lost: adds HELD (RFC6155) and LOST (RFC5222) queries for location-based routing

- lost_held_query() takes specific id (pvar, P-A-I, or From), assembles a
locationRequest (XML), and sends it to an http_client connection, responses
are parsed (pidf-lo and location reference are returned)
- lost_query() takes pidf-lo (pvar, msg body, or de-referenced), a service urn
(pvar, request line) assembles a findService request (XML), and sends it to
an http_client connection, responses are parsed (target uri and display name
are returned)

wkampich authored on 12/08/2019 13:04:38 • Henning Westerholt committed on 16/08/2019 06:04:03
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,73 @@
1
+/*
2
+ * lost module utility functions
3
+ *
4
+ * Copyright (C) 2019 Wolfgang Kampichler
5
+ * DEC112, FREQUENTIS AG
6
+ *
7
+ * This file is part of Kamailio, a free SIP server.
8
+ *
9
+ * Kamailio is free software; you can redistribute it and/or modify
10
+ * it under the terms of the GNU General Public License as published by
11
+ * the Free Software Foundation; either version 2 of the License, or
12
+ * (at your option) any later version
13
+ *
14
+ * Kamailio is distributed in the hope that it will be useful,
15
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
+ * GNU General Public License for more details.
18
+ *
19
+ * You should have received a copy of the GNU General Public License
20
+ * along with this program; if not, write to the Free Software
21
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
22
+ *
23
+ */
24
+
25
+/*!
26
+ * \file
27
+ * \brief Kamailio lost :: functions
28
+ * \ingroup lost
29
+ * Module: \ref lost
30
+ */
31
+
32
+#ifndef LOST_UTILITIES_H
33
+#define LOST_UTILITIES_H
34
+
35
+#define LOST_GEOLOC_HEADER "Geolocation: "
36
+#define LOST_GEOLOC_HEADER_SIZE strlen(LOST_GEOLOC_HEADER)
37
+#define LOST_PAI_HEADER "P-Asserted-Identity: "
38
+#define LOST_PAI_HEADER_SIZE strlen(LOST_PAI_HEADER)
39
+
40
+#define BUFSIZE 128	/* temporary buffer to hold geolocation */
41
+#define RANDSTRSIZE 16 /* temporary id in a findService request */
42
+
43
+typedef struct
44
+{
45
+	char *identity;
46
+	char *urn;
47
+	char *longitude;
48
+	char *latitude;
49
+	char *uri;
50
+	char *ref;
51
+	int radius;
52
+	int recursive;
53
+} s_loc_t, *p_loc_t;
54
+
55
+void lost_rand_str(char *, size_t);
56
+void lost_free_loc(p_loc_t);
57
+
58
+int lost_get_location_object(p_loc_t, xmlDocPtr, xmlNodePtr);
59
+int lost_parse_location_info(xmlNodePtr node, p_loc_t loc);
60
+
61
+char *lost_find_service_request(p_loc_t, int *);
62
+char *lost_held_location_request(char *, int *);
63
+char *lost_get_content(xmlNodePtr, const char *, int *);
64
+char *lost_get_property(xmlNodePtr, const char *, int *);
65
+char *lost_get_geolocation_header(struct sip_msg *, int *);
66
+char *lost_get_from_header(struct sip_msg *, int *);
67
+char *lost_get_pai_header(struct sip_msg *, int *);
68
+char *lost_get_childname(xmlNodePtr, const char *, int *);
69
+char *lost_trim_content(char *, int *);
70
+
71
+p_loc_t lost_new_loc(str);
72
+
73
+#endif