Browse code

pua: use file name specific include guard

Daniel-Constantin Mierla authored on 06/05/2020 15:15:36
Showing 1 changed files
... ...
@@ -15,8 +15,8 @@
15 15
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 16
  * GNU General Public License for more details.
17 17
  *
18
- * You should have received a copy of the GNU General Public License 
19
- * along with this program; if not, write to the Free Software 
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program; if not, write to the Free Software
20 20
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
21 21
  */
22 22
 
Browse code

pua: renamed MI flags to reflect use of RPC

Daniel-Constantin Mierla authored on 12/12/2017 08:48:45
Showing 1 changed files
... ...
@@ -48,9 +48,9 @@
48 48
 #define XMPP_PUBLISH        1<<3
49 49
 #define XMPP_SUBSCRIBE      1<<4
50 50
 #define XMPP_INITIAL_SUBS   1<<5
51
-#define MI_PUBLISH          1<<6
52
-#define MI_ASYN_PUBLISH     1<<7
53
-#define MI_SUBSCRIBE        1<<8
51
+#define RPC_PUBLISH         1<<6
52
+#define RPC_ASYN_PUBLISH    1<<7
53
+#define RPC_SUBSCRIBE       1<<8
54 54
 #define RLS_SUBSCRIBE       1<<9
55 55
 #define DIALOG_PUBLISH      1<<10
56 56
 #define PURPLE_PUBLISH      1<<11
Browse code

pua: exported functions to kemi framework

Daniel-Constantin Mierla authored on 29/04/2017 06:32:21
Showing 1 changed files
... ...
@@ -178,6 +178,7 @@ static inline int get_event_flag(str* event)
178 178
     return -1;
179 179
 }
180 180
 
181
-int update_contact(struct sip_msg* msg, char* str1, char* str2);
181
+int w_pua_update_contact(struct sip_msg* msg, char* str1, char* str2);
182
+int ki_pua_update_contact(struct sip_msg* msg);
182 183
 
183 184
 #endif
Browse code

core, lib, modules: updated include paths for header files

Daniel-Constantin Mierla authored on 07/12/2016 11:07:22
Showing 1 changed files
... ...
@@ -27,10 +27,10 @@
27 27
 #include <stdlib.h>
28 28
 #include <string.h>
29 29
 #include <stdio.h>
30
-#include "../../str.h"
31
-#include "../../lock_ops.h"
32
-#include "../../dprint.h"
33
-#include "../../parser/msg_parser.h"
30
+#include "../../core/str.h"
31
+#include "../../core/lock_ops.h"
32
+#include "../../core/dprint.h"
33
+#include "../../core/parser/msg_parser.h"
34 34
 #include "../rls/list.h"
35 35
 
36 36
 #define PRESENCE_EVENT      1<<0
Browse code

core, lib, modules: restructured source code tree

- new folder src/ to hold the source code for main project applications
- main.c is in src/
- all core files are subfolder are in src/core/
- modules are in src/modules/
- libs are in src/lib/
- application Makefiles are in src/
- application binary is built in src/ (src/kamailio)

Daniel-Constantin Mierla authored on 07/12/2016 11:03:51
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,183 @@
1
+/*
2
+ * pua module - presence user agent module
3
+ *
4
+ * Copyright (C) 2006 Voice Sistem S.R.L.
5
+ *
6
+ * This file is part of Kamailio, a free SIP server.
7
+ *
8
+ * Kamailio is free software; you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation; either version 2 of the License, or
11
+ * (at your option) any later version
12
+ *
13
+ * Kamailio is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License 
19
+ * along with this program; if not, write to the Free Software 
20
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
21
+ */
22
+
23
+
24
+#ifndef _PU_HASH_H_
25
+#define _PU_HASH_H_
26
+
27
+#include <stdlib.h>
28
+#include <string.h>
29
+#include <stdio.h>
30
+#include "../../str.h"
31
+#include "../../lock_ops.h"
32
+#include "../../dprint.h"
33
+#include "../../parser/msg_parser.h"
34
+#include "../rls/list.h"
35
+
36
+#define PRESENCE_EVENT      1<<0
37
+#define PWINFO_EVENT        1<<1
38
+#define BLA_EVENT           1<<2
39
+#define MSGSUM_EVENT        1<<3
40
+#define CONFERENCE_EVENT    1<<4
41
+#define DIALOG_EVENT        1<<5
42
+#define REGINFO_EVENT       1<<6
43
+#define XCAPDIFF_EVENT      1<<7
44
+
45
+#define UL_PUBLISH          1<<0
46
+#define BLA_PUBLISH         1<<1
47
+#define BLA_SUBSCRIBE       1<<2
48
+#define XMPP_PUBLISH        1<<3
49
+#define XMPP_SUBSCRIBE      1<<4
50
+#define XMPP_INITIAL_SUBS   1<<5
51
+#define MI_PUBLISH          1<<6
52
+#define MI_ASYN_PUBLISH     1<<7
53
+#define MI_SUBSCRIBE        1<<8
54
+#define RLS_SUBSCRIBE       1<<9
55
+#define DIALOG_PUBLISH      1<<10
56
+#define PURPLE_PUBLISH      1<<11
57
+#define REGINFO_PUBLISH     1<<12
58
+#define REGINFO_SUBSCRIBE   1<<13
59
+#define XCAPDIFF_PUBLISH    1<<14
60
+#define XCAPDIFF_SUBSCRIBE  1<<15
61
+
62
+#define NO_UPDATEDB_FLAG    1<<0
63
+#define UPDATEDB_FLAG       1<<1
64
+#define INSERTDB_FLAG       1<<2
65
+#define WTHROUGHDB_FLAG     1<<3
66
+
67
+#define MAX_FORWARD  70
68
+
69
+typedef struct ua_pres{
70
+ 
71
+    /* common*/
72
+	str id;
73
+    str* pres_uri;
74
+	int event;
75
+	unsigned int expires;
76
+	unsigned int desired_expires;
77
+	int flag;
78
+	int db_flag;
79
+	void* cb_param;
80
+	struct ua_pres* next;
81
+	int ua_flag;
82
+	str* outbound_proxy; /* croc-not sored in db_only mode */
83
+	
84
+	/* publish */
85
+	str etag;
86
+	str tuple_id;
87
+	str* body;        /* croc-not stored in db_only mode */
88
+	str content_type; /* croc-not stored in db_only mode */
89
+
90
+	/* subscribe */
91
+	str* watcher_uri;
92
+	str call_id;
93
+	str to_tag;
94
+    str from_tag;
95
+	int cseq;
96
+	int version;
97
+/*  int watcher_count; croc-nolonger used!! */
98
+	str* extra_headers;
99
+	str record_route;
100
+	str remote_contact;
101
+	str contact;
102
+
103
+	/*?? should this be long? */
104
+}ua_pres_t;
105
+
106
+typedef struct hash_entry
107
+{
108
+	ua_pres_t* entity;
109
+	gen_lock_t lock;
110
+}hash_entry_t;	
111
+
112
+typedef struct htable{
113
+    hash_entry_t* p_records;        	              
114
+}htable_t;
115
+
116
+htable_t* new_htable(void);
117
+
118
+ua_pres_t* search_htable(ua_pres_t* pres, unsigned int hash_code);
119
+
120
+void insert_htable(ua_pres_t* presentity, unsigned int hash_code);
121
+
122
+
123
+void update_htable(ua_pres_t* presentity,time_t desired_expires,
124
+		int expires, str* etag, unsigned int hash_code, str* contact);
125
+
126
+void delete_htable(ua_pres_t* presentity, unsigned int hash_code);
127
+
128
+void destroy_htable(void);
129
+int is_dialog(ua_pres_t* dialog);
130
+
131
+ua_pres_t* get_dialog(ua_pres_t* dialog, unsigned int hash_code);
132
+ua_pres_t* get_temporary_dialog(ua_pres_t* dialog, unsigned int hash_code);
133
+int convert_temporary_dialog(ua_pres_t *dialog);
134
+
135
+int get_record_id(ua_pres_t* dialog, str** rec_id);
136
+typedef int (*get_record_id_t)(ua_pres_t* dialog, str** rec_id);
137
+
138
+list_entry_t *get_subs_list(str *did);
139
+typedef list_entry_t * (*get_subs_list_t)(str *did);
140
+
141
+/* for degug */
142
+void print_ua_pres(ua_pres_t* p);
143
+
144
+typedef int  (*query_dialog_t)(ua_pres_t* presentity);
145
+
146
+static inline int get_event_flag(str* event)
147
+{
148
+    switch (event->len) 
149
+    {
150
+        case 3:
151
+            if (strncmp(event->s, "reg", 3) == 0)
152
+                return REGINFO_EVENT;
153
+            break;
154
+        case 6:
155
+            if (strncmp(event->s, "dialog", 6) == 0)
156
+                return DIALOG_EVENT;
157
+            break;
158
+        case 8:
159
+            if (strncmp(event->s, "presence", 8) == 0)
160
+                return PRESENCE_EVENT;
161
+            break;
162
+        case 10:
163
+            if (strncmp(event->s, "dialog;sla", 10) == 0)
164
+                return BLA_EVENT;
165
+            if (strncmp(event->s, "conference", 10) == 0)
166
+                return CONFERENCE_EVENT;
167
+            break;
168
+        case 14:
169
+            if (strncmp(event->s, "presence.winfo", 14) == 0)
170
+                return PWINFO_EVENT;
171
+            break;
172
+        case 15:
173
+            if (strncmp(event->s, "message-summary", 15) == 0)
174
+                return MSGSUM_EVENT;
175
+    }
176
+
177
+    LM_ERR("Unknown event string\n");
178
+    return -1;
179
+}
180
+
181
+int update_contact(struct sip_msg* msg, char* str1, char* str2);
182
+
183
+#endif