Browse code

- added missing onsend.h

Andrei Pelinescu-Onciul authored on 12/12/2005 12:26:53
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,78 @@
0
+/*
1
+ *  $Id$
2
+ *
3
+ * Copyright (C) 2005 iptelorg GmbH
4
+ *
5
+ * This file is part of ser, a free SIP server.
6
+ *
7
+ * ser is free software; you can redistribute it and/or modify
8
+ * it under the terms of the GNU General Public License as published by
9
+ * the Free Software Foundation; either version 2 of the License, or
10
+ * (at your option) any later version
11
+ *
12
+ * For a license to use the ser software under conditions
13
+ * other than those described here, or to purchase support for this
14
+ * software, please contact iptel.org by e-mail at the following addresses:
15
+ *    info@iptel.org
16
+ *
17
+ * ser is distributed in the hope that it will be useful,
18
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
19
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20
+ * GNU General Public License for more details.
21
+ *
22
+ * You should have received a copy of the GNU General Public License 
23
+ * along with this program; if not, write to the Free Software 
24
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
25
+ */
26
+/*
27
+ * History:
28
+ * -------
29
+ *  2005-12-11 created by andrei
30
+ */
31
+
32
+
33
+#ifndef onsend_h
34
+#define onsend_h
35
+
36
+
37
+#include "ip_addr.h"
38
+#include "action.h"
39
+#include "route.h"
40
+
41
+struct onsend_info{
42
+	union sockaddr_union* to;
43
+	struct socket_info* send_sock;
44
+	char* buf;
45
+	int len;
46
+};
47
+
48
+extern struct onsend_info* p_onsend;
49
+
50
+
51
+#define get_onsend_info()	(p_onsend)
52
+
53
+/*
54
+ * returns: 0 drop the message, >= ok, <0 error (but forward the message)
55
+ * WARNING: buf must be 0 terminated (to allow regex matches on it) */
56
+static inline int run_onsend(struct sip_msg* orig_msg,
57
+							struct socket_info* send_sock, int proto,
58
+							union sockaddr_union* to, char* buf, int len)
59
+{
60
+	struct onsend_info onsnd_info;
61
+	int ret;
62
+	
63
+	ret=1;
64
+	if (onsend_rlist[DEFAULT_RT]){
65
+		onsnd_info.to=to;
66
+		onsnd_info.send_sock=send_sock;
67
+		onsnd_info.buf=buf;
68
+		onsnd_info.len=len;
69
+		p_onsend=&onsnd_info;
70
+		ret=run_actions(onsend_rlist[DEFAULT_RT], orig_msg);
71
+		p_onsend=0; /* reset it */
72
+	}
73
+	return ret;
74
+}
75
+
76
+
77
+#endif