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