Browse code

lost: typedef naming changed and copyright added

Wolfgang Kampichler authored on 08/04/2021 19:31:24
Showing 6 changed files
... ...
@@ -761,7 +761,7 @@ int lost_function(struct sip_msg *_m, char *_con, char *_uri, char *_name,
761 761
 
762 762
 	p_lost_loc_t loc = NULL;
763 763
 	p_lost_geolist_t geolist = NULL;
764
-	p_fsr_t fsrdata = NULL;
764
+	p_lost_fsr_t fsrdata = NULL;
765 765
 
766 766
 	str name = STR_NULL; /* return value displayName */
767 767
 	str uri = STR_NULL;	 /* return value uri */
... ...
@@ -2,6 +2,8 @@
2 2
  * lost module naptr functions
3 3
  * thankfully taken over from the enum module
4 4
  *
5
+ * Copyright (C) 2002-2010 Juha Heinanen
6
+ * 
5 7
  * Copyright (C) 2021 Wolfgang Kampichler
6 8
  * DEC112, FREQUENTIS AG
7 9
  *
... ...
@@ -1,6 +1,8 @@
1 1
 /*
2 2
  * lost module naptr functions
3 3
  *
4
+ * Copyright (C) 2002-2010 Juha Heinanen
5
+ * 
4 6
  * Copyright (C) 2021 Wolfgang Kampichler
5 7
  * DEC112, FREQUENTIS AG
6 8
  *
... ...
@@ -214,11 +214,11 @@ int is_urn(char *search)
214 214
  * lost_new_response(void)
215 215
  * creates a new response object in private memory and returns a pointer
216 216
  */
217
-p_fsr_t lost_new_response(void)
217
+p_lost_fsr_t lost_new_response(void)
218 218
 {
219
-	p_fsr_t res;
219
+	p_lost_fsr_t res;
220 220
 
221
-	res = (p_fsr_t)pkg_malloc(sizeof(s_fsr_t));
221
+	res = (p_lost_fsr_t)pkg_malloc(sizeof(s_lost_fsr_t));
222 222
 	if(res == NULL) {
223 223
 		return NULL;
224 224
 	}
... ...
@@ -239,11 +239,11 @@ p_fsr_t lost_new_response(void)
239 239
  * lost_new_response_type(void)
240 240
  * creates a new response type object in private memory and returns a pointer
241 241
  */
242
-p_type_t lost_new_response_type(void)
242
+p_lost_type_t lost_new_response_type(void)
243 243
 {
244
-	p_type_t res;
244
+	p_lost_type_t res;
245 245
 
246
-	res = (p_type_t)pkg_malloc(sizeof(s_type_t));
246
+	res = (p_lost_type_t)pkg_malloc(sizeof(s_lost_type_t));
247 247
 	if(res == NULL) {
248 248
 		PKG_MEM_ERROR;
249 249
 		return NULL;
... ...
@@ -252,7 +252,7 @@ p_type_t lost_new_response_type(void)
252 252
 	res->target = NULL;
253 253
 	res->source = NULL;
254 254
 
255
-	res->info = (p_info_t)pkg_malloc(sizeof(s_info_t));
255
+	res->info = (p_lost_info_t)pkg_malloc(sizeof(s_lost_info_t));
256 256
 	if(res->info == NULL) {
257 257
 		PKG_MEM_ERROR;
258 258
 	} else {
... ...
@@ -269,11 +269,11 @@ p_type_t lost_new_response_type(void)
269 269
  * lost_new_response_issues(void)
270 270
  * creates a new issues object in private memory and returns a pointer
271 271
  */
272
-p_issue_t lost_new_response_issues(void)
272
+p_lost_issue_t lost_new_response_issues(void)
273 273
 {
274
-	p_issue_t res = NULL;
274
+	p_lost_issue_t res = NULL;
275 275
 
276
-	res = (p_issue_t)pkg_malloc(sizeof(s_issue_t));
276
+	res = (p_lost_issue_t)pkg_malloc(sizeof(s_lost_issue_t));
277 277
 	if(res == NULL) {
278 278
 		PKG_MEM_ERROR;
279 279
 		return NULL;
... ...
@@ -290,11 +290,11 @@ p_issue_t lost_new_response_issues(void)
290 290
  * lost_new_response_data(void)
291 291
  * creates a new response data object in private memory and returns a pointer
292 292
  */
293
-p_data_t lost_new_response_data(void)
293
+p_lost_data_t lost_new_response_data(void)
294 294
 {
295
-	p_data_t res;
295
+	p_lost_data_t res;
296 296
 
297
-	res = (p_data_t)pkg_malloc(sizeof(s_data_t));
297
+	res = (p_lost_data_t)pkg_malloc(sizeof(s_lost_data_t));
298 298
 	if(res == NULL) {
299 299
 		PKG_MEM_ERROR;
300 300
 		return NULL;
... ...
@@ -316,11 +316,11 @@ p_data_t lost_new_response_data(void)
316 316
  * lost_new_response_list(void)
317 317
  * creates a new response list object in private memory and returns a pointer
318 318
  */
319
-p_list_t lost_new_response_list(void)
319
+p_lost_list_t lost_new_response_list(void)
320 320
 {
321
-	p_list_t list;
321
+	p_lost_list_t list;
322 322
 
323
-	list = (p_list_t)pkg_malloc(sizeof(s_list_t));
323
+	list = (p_lost_list_t)pkg_malloc(sizeof(s_lost_list_t));
324 324
 	if(list == NULL) {
325 325
 		PKG_MEM_ERROR;
326 326
 		return NULL;
... ...
@@ -338,11 +338,11 @@ p_list_t lost_new_response_list(void)
338 338
  * lost_reverse_response_list(list)
339 339
  * reverses list order of a list object
340 340
  */
341
-void lost_reverse_response_list(p_list_t *head)
341
+void lost_reverse_response_list(p_lost_list_t *head)
342 342
 {
343
-	p_list_t prev = NULL;
344
-	p_list_t next = NULL;
345
-	p_list_t current = *head;
343
+	p_lost_list_t prev = NULL;
344
+	p_lost_list_t next = NULL;
345
+	p_lost_list_t current = *head;
346 346
 
347 347
 	while(current != NULL) {
348 348
 		next = current->next;
... ...
@@ -357,9 +357,9 @@ void lost_reverse_response_list(p_list_t *head)
357 357
  * lost_delete_response_list(list)
358 358
  * removes response list from private memory
359 359
  */
360
-void lost_delete_response_list(p_list_t *list)
360
+void lost_delete_response_list(p_lost_list_t *list)
361 361
 {
362
-	p_list_t cur;
362
+	p_lost_list_t cur;
363 363
 
364 364
 	if(*list == NULL)
365 365
 		return;
... ...
@@ -383,9 +383,9 @@ void lost_delete_response_list(p_list_t *list)
383 383
  * lost_delete_response_msg(msg)
384 384
  * removes response info from private memory
385 385
  */
386
-void lost_delete_response_info(p_info_t *info)
386
+void lost_delete_response_info(p_lost_info_t *info)
387 387
 {
388
-	p_info_t ptr;
388
+	p_lost_info_t ptr;
389 389
 
390 390
 	if(*info == NULL)
391 391
 		return;
... ...
@@ -411,9 +411,9 @@ void lost_delete_response_info(p_info_t *info)
411 411
  * lost_delete_response_msg(type)
412 412
  * removes response type from private memory
413 413
  */
414
-void lost_delete_response_type(p_type_t *type)
414
+void lost_delete_response_type(p_lost_type_t *type)
415 415
 {
416
-	p_type_t ptr;
416
+	p_lost_type_t ptr;
417 417
 
418 418
 	if(*type == NULL)
419 419
 		return;
... ...
@@ -445,9 +445,9 @@ void lost_delete_response_type(p_type_t *type)
445 445
  * lost_delete_response_issue(list)
446 446
  * removes response issue object from private memory
447 447
  */
448
-void lost_delete_response_issues(p_issue_t *list)
448
+void lost_delete_response_issues(p_lost_issue_t *list)
449 449
 {
450
-	p_issue_t cur;
450
+	p_lost_issue_t cur;
451 451
 
452 452
 	while((cur = *list) != NULL) {
453 453
 		*list = cur->next;
... ...
@@ -468,9 +468,9 @@ void lost_delete_response_issues(p_issue_t *list)
468 468
  * lost_delete_response_issue(mapping)
469 469
  * removes respone data object from private memory
470 470
  */
471
-void lost_delete_response_data(p_data_t *m)
471
+void lost_delete_response_data(p_lost_data_t *m)
472 472
 {
473
-	p_data_t ptr;
473
+	p_lost_data_t ptr;
474 474
 
475 475
 	if(*m == NULL)
476 476
 		return;
... ...
@@ -511,9 +511,9 @@ void lost_delete_response_data(p_data_t *m)
511 511
  * lost_free_findServiceResponse(response)
512 512
  * removes findServiceResponse object from private memory
513 513
  */
514
-void lost_free_findServiceResponse(p_fsr_t *res)
514
+void lost_free_findServiceResponse(p_lost_fsr_t *res)
515 515
 {
516
-	p_fsr_t ptr;
516
+	p_lost_fsr_t ptr;
517 517
 
518 518
 	if(*res == NULL)
519 519
 		return;
... ...
@@ -552,13 +552,13 @@ void lost_free_findServiceResponse(p_fsr_t *res)
552 552
  * parses response issue (errors, warnings) and writes 
553 553
  * results to issue object
554 554
  */
555
-p_issue_t lost_get_response_issues(xmlNodePtr node)
555
+p_lost_issue_t lost_get_response_issues(xmlNodePtr node)
556 556
 {
557 557
 	xmlNodePtr cur = NULL;
558 558
 
559
-	p_issue_t list = NULL;
560
-	p_issue_t new = NULL;
561
-	p_type_t issue = NULL;
559
+	p_lost_issue_t list = NULL;
560
+	p_lost_issue_t new = NULL;
561
+	p_lost_type_t issue = NULL;
562 562
 
563 563
 	str tmp = STR_NULL;
564 564
 
... ...
@@ -620,13 +620,13 @@ p_issue_t lost_get_response_issues(xmlNodePtr node)
620 620
  * lost_get_response_list(node, name, property)
621 621
  * parses response list and writes results to list object
622 622
  */
623
-p_list_t lost_get_response_list(
623
+p_lost_list_t lost_get_response_list(
624 624
 		xmlNodePtr node, const char *name, const char *prop)
625 625
 {
626 626
 	xmlNodePtr cur = NULL;
627 627
 
628
-	p_list_t list = NULL;
629
-	p_list_t new = NULL;
628
+	p_lost_list_t list = NULL;
629
+	p_lost_list_t new = NULL;
630 630
 
631 631
 	str tmp = STR_NULL;
632 632
 	int len = 0;
... ...
@@ -695,9 +695,9 @@ char *lost_get_response_element(xmlNodePtr node, const char *name)
695 695
  * lost_get_response_type(node, name)
696 696
  * parses response type and writes results to type object
697 697
  */
698
-p_type_t lost_get_response_type(xmlNodePtr node, const char *name)
698
+p_lost_type_t lost_get_response_type(xmlNodePtr node, const char *name)
699 699
 {
700
-	p_type_t res = NULL;
700
+	p_lost_type_t res = NULL;
701 701
 
702 702
 	str tmp = STR_NULL;
703 703
 
... ...
@@ -735,10 +735,10 @@ p_type_t lost_get_response_type(xmlNodePtr node, const char *name)
735 735
  * lost_get_response_info(node, name, property)
736 736
  * parses response info (text, language) and writes results to info object
737 737
  */
738
-p_info_t lost_get_response_info(
738
+p_lost_info_t lost_get_response_info(
739 739
 		xmlNodePtr node, const char *name, const char *prop)
740 740
 {
741
-	p_info_t res = NULL;
741
+	p_lost_info_t res = NULL;
742 742
 
743 743
 	str tmp = STR_NULL;
744 744
 
... ...
@@ -750,7 +750,7 @@ p_info_t lost_get_response_info(
750 750
 
751 751
 	LM_DBG("### LOST %s\n", node->name);
752 752
 
753
-	res = (p_info_t)pkg_malloc(sizeof(s_info_t));
753
+	res = (p_lost_info_t)pkg_malloc(sizeof(s_lost_info_t));
754 754
 	if(res == NULL) {
755 755
 		PKG_MEM_ERROR;
756 756
 		return NULL;
... ...
@@ -782,17 +782,17 @@ p_info_t lost_get_response_info(
782 782
  * lost_print_findServiceResponse(response)
783 783
  * prints/logs response elements
784 784
  */
785
-void lost_print_findServiceResponse(p_fsr_t res)
785
+void lost_print_findServiceResponse(p_lost_fsr_t res)
786 786
 {
787 787
 	if(res == NULL) {
788 788
 		return;
789 789
 	}
790
-	p_data_t m = NULL;
791
-	p_type_t r = NULL;
792
-	p_issue_t e = NULL;
793
-	p_issue_t w = NULL;
794
-	p_type_t t = NULL;
795
-	p_list_t list = NULL;
790
+	p_lost_data_t m = NULL;
791
+	p_lost_type_t r = NULL;
792
+	p_lost_issue_t e = NULL;
793
+	p_lost_issue_t w = NULL;
794
+	p_lost_type_t t = NULL;
795
+	p_lost_list_t list = NULL;
796 796
 
797 797
 	switch(res->category) {
798 798
 		case RESPONSE:
... ...
@@ -871,15 +871,15 @@ void lost_print_findServiceResponse(p_fsr_t res)
871 871
  * lost_parse_findServiceResponse(str)
872 872
  * read and parse the findServiceResponse xml string
873 873
  */
874
-p_fsr_t lost_parse_findServiceResponse(str ret)
874
+p_lost_fsr_t lost_parse_findServiceResponse(str ret)
875 875
 {
876 876
 	xmlDocPtr doc = NULL;
877 877
 	xmlNodePtr root = NULL;
878 878
 	xmlNodePtr node = NULL;
879 879
 
880
-	p_fsr_t res = NULL;
881
-	p_data_t m = NULL;
882
-	p_type_t r = NULL;
880
+	p_lost_fsr_t res = NULL;
881
+	p_lost_data_t m = NULL;
882
+	p_lost_type_t r = NULL;
883 883
 
884 884
 	int len = 0;
885 885
 
... ...
@@ -56,19 +56,19 @@
56 56
 
57 57
 #define ERRORS_NODE (const char *)"errors"
58 58
 
59
-typedef struct LIST
59
+typedef struct lost_list
60 60
 {
61 61
 	char *value;
62
-	struct LIST *next;
63
-} s_list_t, *p_list_t;
62
+	struct lost_list *next;
63
+} s_lost_list_t, *p_lost_list_t;
64 64
 
65
-typedef struct INFO
65
+typedef struct lost_info
66 66
 {
67 67
 	char *text;
68 68
 	char *lang;
69
-} s_info_t, *p_info_t;
69
+} s_lost_info_t, *p_lost_info_t;
70 70
 
71
-typedef struct DATA
71
+typedef struct lost_data
72 72
 {
73 73
 	char *expires;
74 74
 	char *updated;
... ...
@@ -76,48 +76,48 @@ typedef struct DATA
76 76
 	char *sourceid;
77 77
 	char *urn;
78 78
 	char *number;
79
-	p_info_t name;
80
-} s_data_t, *p_data_t;
79
+	p_lost_info_t name;
80
+} s_lost_data_t, *p_lost_data_t;
81 81
 
82
-typedef struct TYPE
82
+typedef struct lost_type
83 83
 {
84 84
 	char *type;
85 85
 	char *target;
86 86
 	char *source;
87
-	p_info_t info;
88
-} s_type_t, *p_type_t;
87
+	p_lost_info_t info;
88
+} s_lost_type_t, *p_lost_type_t;
89 89
 
90
-typedef struct ISSUE
90
+typedef struct lost_issue
91 91
 {
92
-	p_type_t issue;
93
-	struct ISSUE *next;
94
-} s_issue_t, *p_issue_t;
92
+	p_lost_type_t issue;
93
+	struct lost_issue *next;
94
+} s_lost_issue_t, *p_lost_issue_t;
95 95
 
96
-typedef enum CAT
96
+typedef enum lost_cat
97 97
 {
98 98
 	RESPONSE,
99 99
 	ERROR,
100 100
 	REDIRECT,
101 101
 	OTHER = -1
102
-} cat_t;
102
+} lost_cat_t;
103 103
 
104
-typedef struct FSR
104
+typedef struct lost_fsr
105 105
 {
106
-	cat_t category;
107
-	p_data_t mapping;
108
-	p_issue_t warnings;
109
-	p_issue_t errors;
110
-	p_type_t redirect;
111
-	p_list_t path;
112
-	p_list_t uri;
113
-} s_fsr_t, *p_fsr_t;
106
+	lost_cat_t category;
107
+	p_lost_data_t mapping;
108
+	p_lost_issue_t warnings;
109
+	p_lost_issue_t errors;
110
+	p_lost_type_t redirect;
111
+	p_lost_list_t path;
112
+	p_lost_list_t uri;
113
+} s_lost_fsr_t, *p_lost_fsr_t;
114 114
 
115 115
 /* read and parse response data */
116
-p_fsr_t lost_parse_findServiceResponse(str);
116
+p_lost_fsr_t lost_parse_findServiceResponse(str);
117 117
 /* print the response */
118
-void lost_print_findServiceResponse(p_fsr_t);
118
+void lost_print_findServiceResponse(p_lost_fsr_t);
119 119
 /* remove response data from memory */
120
-void lost_free_findServiceResponse(p_fsr_t *);
120
+void lost_free_findServiceResponse(p_lost_fsr_t *);
121 121
 
122 122
 /* uri scheme parsing */
123 123
 int is_urn(char *);
... ...
@@ -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);