Browse code

Improvement: Add option not to add ";transport=" to contact

Carsten Bock authored on 20/08/2014 08:10:33
Showing 1 changed files
... ...
@@ -44,9 +44,10 @@ class trsp_socket
44 44
 {
45 45
 public:
46 46
     enum socket_options {
47
-	force_via_address = (1 << 0),
48
-	force_outbound_if = (1 << 1),
49
-	use_raw_sockets   = (1 << 2)
47
+	force_via_address       = (1 << 0),
48
+	force_outbound_if       = (1 << 1),
49
+	use_raw_sockets         = (1 << 2),
50
+	no_transport_in_contact = (1 << 3)
50 51
     };
51 52
 
52 53
     static int log_level_raw_msgs;
Browse code

sip: propagate send flags down to transport layer

Raphael Coeffic authored on 13/11/2013 17:36:44
Showing 1 changed files
... ...
@@ -148,7 +148,8 @@ public:
148 148
      * Sends a message.
149 149
      * @return -1 if error(s) occured.
150 150
      */
151
-    virtual int send(const sockaddr_storage* sa, const char* msg, const int msg_len)=0;
151
+    virtual int send(const sockaddr_storage* sa, const char* msg, 
152
+		     const int msg_len, unsigned int flags)=0;
152 153
 };
153 154
 
154 155
 class transport: public AmThread
Browse code

sip: added tcp_connect_timeout & tcp_idle_timeout

Both options can be set per signalling interface ([tcp-option]_[interface name]=[time in milliseconds]). When set to 0, the feature is disabled.

Raphael Coeffic authored on 13/11/2013 17:33:32
Showing 1 changed files
... ...
@@ -36,6 +36,9 @@
36 36
 #include <string>
37 37
 using std::string;
38 38
 
39
+#define DEFAULT_TCP_CONNECT_TIMEOUT 2000 /* 2 seconds */
40
+#define DEFAULT_TCP_IDLE_TIMEOUT 3600000 /* 1 hour */
41
+
39 42
 class trsp_socket
40 43
     : public atomic_ref_cnt
41 44
 {
Browse code

core: draft support for TCP transport (WIP)

Raphael Coeffic authored on 22/08/2013 07:16:33
Showing 1 changed files
... ...
@@ -75,7 +75,7 @@ protected:
75 75
 
76 76
 public:
77 77
     trsp_socket(unsigned short if_num, unsigned int opts,
78
-		unsigned int sys_if_idx = 0);
78
+		unsigned int sys_if_idx = 0, int sd = 0);
79 79
     virtual ~trsp_socket();
80 80
 
81 81
     /**
Browse code

udp: raw socket support

To use this feature, set following in sems.conf:
use_raw_sockets=yes

Raphael Coeffic authored on 15/10/2013 07:42:43
Showing 1 changed files
... ...
@@ -42,7 +42,8 @@ class trsp_socket
42 42
 public:
43 43
     enum socket_options {
44 44
 	force_via_address = (1 << 0),
45
-	force_outbound_if = (1 << 1)
45
+	force_outbound_if = (1 << 1),
46
+	use_raw_sockets   = (1 << 2)
46 47
     };
47 48
 
48 49
     static int log_level_raw_msgs;
Browse code

core: use PublicIP in Via-HF

Raphael Coeffic authored on 18/07/2013 15:59:53
Showing 1 changed files
... ...
@@ -60,6 +60,9 @@ protected:
60 60
     // bound port number
61 61
     unsigned short   port;
62 62
 
63
+    // public IP (Via-HF)
64
+    string      public_ip;
65
+
63 66
     // internal interface number
64 67
     unsigned short   if_num;
65 68
 
... ...
@@ -95,6 +98,17 @@ public:
95 98
      */
96 99
     unsigned short get_port() const;
97 100
 
101
+    /**
102
+     * Setter for public IP address
103
+     */
104
+    void set_public_ip(const string& ip);
105
+    
106
+    /**
107
+     * Getter for advertised IP address
108
+     * @return either bound IP or public IP
109
+     */
110
+    const char* get_advertised_ip() const;
111
+
98 112
     /**
99 113
      *  Getter for the socket descriptor
100 114
      */
Browse code

add some more support for transports other than UDP.

Raphael Coeffic authored on 29/04/2013 17:34:54
Showing 1 changed files
... ...
@@ -80,6 +80,11 @@ public:
80 80
      */
81 81
     virtual int bind(const string& address, unsigned short port)=0;
82 82
 
83
+    /**
84
+     * Getter for the transport name
85
+     */
86
+    virtual const char* get_transport() const = 0;
87
+
83 88
     /**
84 89
      * Getter for IP address
85 90
      */
Browse code

sip: transport: make getter constant

Raphael Coeffic authored on 28/04/2013 12:44:19
Showing 1 changed files
... ...
@@ -83,38 +83,43 @@ public:
83 83
     /**
84 84
      * Getter for IP address
85 85
      */
86
-    const char* get_ip();
86
+    const char* get_ip() const;
87 87
     
88 88
     /**
89 89
      * Getter for the port number
90 90
      */
91
-    unsigned short get_port();
91
+    unsigned short get_port() const;
92 92
 
93 93
     /**
94 94
      *  Getter for the socket descriptor
95 95
      */
96
-    int get_sd();
96
+    int get_sd() const;
97 97
 
98 98
     /**
99 99
      * Getter for the interface number
100 100
      */
101
-    unsigned short get_if();
101
+    unsigned short get_if() const;
102
+
103
+    /**
104
+     * Is the transport reliable?
105
+     */
106
+    virtual bool is_reliable() const { return false; }
102 107
 
103 108
     /**
104 109
      * Checks for socket options
105 110
      */
106
-    bool is_opt_set(unsigned int mask);
111
+    bool is_opt_set(unsigned int mask) const;
107 112
 
108 113
     /**
109 114
      * Copy the internal address into the given one (sa).
110 115
      */
111
-    void copy_addr_to(sockaddr_storage* sa);
116
+    void copy_addr_to(sockaddr_storage* sa) const;
112 117
 
113 118
     /**
114 119
      * Match with the given address
115 120
      * @return true if address matches
116 121
      */
117
-    bool match_addr(sockaddr_storage* other_addr);
122
+    bool match_addr(sockaddr_storage* other_addr) const;
118 123
 
119 124
     /**
120 125
      * Sends a message.
Browse code

sip: add reference counting to transport sockets

allows for dynamic socket creation/deletion.

Raphael Coeffic authored on 28/04/2013 12:27:27
Showing 1 changed files
... ...
@@ -30,12 +30,14 @@
30 30
 #define _transport_h_
31 31
 
32 32
 #include "../AmThread.h"
33
+#include "../atomic_types.h"
33 34
 #include <sys/socket.h>
34 35
 
35 36
 #include <string>
36 37
 using std::string;
37 38
 
38 39
 class trsp_socket
40
+    : public atomic_ref_cnt
39 41
 {
40 42
 public:
41 43
     enum socket_options {
Browse code

support for forcing outbound network interface on packets sent (RTP/SIP)

Raphael Coeffic authored on 13/11/2012 13:01:13
Showing 1 changed files
... ...
@@ -39,7 +39,8 @@ class trsp_socket
39 39
 {
40 40
 public:
41 41
     enum socket_options {
42
-	force_via_address = (1 << 0)
42
+	force_via_address = (1 << 0),
43
+	force_outbound_if = (1 << 1)
43 44
     };
44 45
 
45 46
     static int log_level_raw_msgs;
... ...
@@ -57,14 +58,18 @@ protected:
57 58
     // bound port number
58 59
     unsigned short   port;
59 60
 
60
-    // interface number
61
+    // internal interface number
61 62
     unsigned short   if_num;
62 63
 
64
+    // network interface index
65
+    unsigned int sys_if_idx;
66
+
63 67
     // ORed field of socket_option
64 68
     unsigned int socket_options;
65 69
 
66 70
 public:
67
-    trsp_socket(unsigned short if_num, unsigned int opts);
71
+    trsp_socket(unsigned short if_num, unsigned int opts,
72
+		unsigned int sys_if_idx = 0);
68 73
     virtual ~trsp_socket();
69 74
 
70 75
     /**
... ...
@@ -113,7 +118,7 @@ public:
113 118
      * Sends a message.
114 119
      * @return -1 if error(s) occured.
115 120
      */
116
-    virtual int send(const sockaddr_storage* sa, const char* msg, const int msg_len);
121
+    virtual int send(const sockaddr_storage* sa, const char* msg, const int msg_len)=0;
117 122
 };
118 123
 
119 124
 class transport: public AmThread
Browse code

fixed IPv6 support

limitations: IPv6 DNS lookups are not supported yet.

Raphael Coeffic authored on 19/11/2012 16:23:06
Showing 1 changed files
... ...
@@ -35,12 +35,6 @@
35 35
 #include <string>
36 36
 using std::string;
37 37
 
38
-#define SAv4(addr) \
39
-            ((struct sockaddr_in*)addr)
40
-
41
-#define SAv6(addr) \
42
-            ((struct sockaddr_in6*)addr)
43
-
44 38
 class trsp_socket
45 39
 {
46 40
 public:
Browse code

core: added force_via_address interface option.

Raphael Coeffic authored on 03/02/2012 19:50:40
Showing 1 changed files
... ...
@@ -44,6 +44,10 @@ using std::string;
44 44
 class trsp_socket
45 45
 {
46 46
 public:
47
+    enum socket_options {
48
+	force_via_address = (1 << 0)
49
+    };
50
+
47 51
     static int log_level_raw_msgs;
48 52
     
49 53
 protected:
... ...
@@ -62,8 +66,11 @@ protected:
62 66
     // interface number
63 67
     unsigned short   if_num;
64 68
 
69
+    // ORed field of socket_option
70
+    unsigned int socket_options;
71
+
65 72
 public:
66
-    trsp_socket(unsigned short if_num);
73
+    trsp_socket(unsigned short if_num, unsigned int opts);
67 74
     virtual ~trsp_socket();
68 75
 
69 76
     /**
... ...
@@ -92,6 +99,11 @@ public:
92 99
      */
93 100
     unsigned short get_if();
94 101
 
102
+    /**
103
+     * Checks for socket options
104
+     */
105
+    bool is_opt_set(unsigned int mask);
106
+
95 107
     /**
96 108
      * Copy the internal address into the given one (sa).
97 109
      */
Browse code

core: moved log_raw_messages to trsp_socket::log_level_raw_msgs.

Raphael Coeffic authored on 03/02/2012 17:19:35
Showing 1 changed files
... ...
@@ -43,6 +43,9 @@ using std::string;
43 43
 
44 44
 class trsp_socket
45 45
 {
46
+public:
47
+    static int log_level_raw_msgs;
48
+    
46 49
 protected:
47 50
     // socket descriptor
48 51
     int sd;
Browse code

core: use the request's interface as outbound interface by default.

Raphael Coeffic authored on 01/02/2012 15:17:13
Showing 1 changed files
... ...
@@ -56,8 +56,11 @@ protected:
56 56
     // bound port number
57 57
     unsigned short   port;
58 58
 
59
+    // interface number
60
+    unsigned short   if_num;
61
+
59 62
 public:
60
-    trsp_socket();
63
+    trsp_socket(unsigned short if_num);
61 64
     virtual ~trsp_socket();
62 65
 
63 66
     /**
... ...
@@ -81,6 +84,11 @@ public:
81 84
      */
82 85
     int get_sd();
83 86
 
87
+    /**
88
+     * Getter for the interface number
89
+     */
90
+    unsigned short get_if();
91
+
84 92
     /**
85 93
      * Copy the internal address into the given one (sa).
86 94
      */
Browse code

Merge branch 'master' into offer_answer

Raphael Coeffic authored on 18/02/2011 11:36:25
Showing 1 changed files
... ...
@@ -86,6 +86,12 @@ public:
86 86
      */
87 87
     void copy_addr_to(sockaddr_storage* sa);
88 88
 
89
+    /**
90
+     * Match with the given address
91
+     * @return true if address matches
92
+     */
93
+    bool match_addr(sockaddr_storage* other_addr);
94
+
89 95
     /**
90 96
      * Sends a message.
91 97
      * @return -1 if error(s) occured.
Browse code

added OpenSSL linking exception to license

Stefan Sayer authored on 23/09/2010 14:41:49
Showing 1 changed files
... ...
@@ -3,19 +3,21 @@
3 3
  *
4 4
  * Copyright (C) 2007 Raphael Coeffic
5 5
  *
6
- * This file is part of sems, a free SIP media server.
6
+ * This file is part of SEMS, a free SIP media server.
7 7
  *
8
- * sems is free software; you can redistribute it and/or modify
8
+ * SEMS is free software; you can redistribute it and/or modify
9 9
  * it under the terms of the GNU General Public License as published by
10 10
  * the Free Software Foundation; either version 2 of the License, or
11
- * (at your option) any later version
11
+ * (at your option) any later version. This program is released under
12
+ * the GPL with the additional exemption that compiling, linking,
13
+ * and/or using OpenSSL is allowed.
12 14
  *
13
- * For a license to use the ser software under conditions
15
+ * For a license to use the SEMS software under conditions
14 16
  * other than those described here, or to purchase support for this
15 17
  * software, please contact iptel.org by e-mail at the following addresses:
16 18
  *    info@iptel.org
17 19
  *
18
- * sems is distributed in the hope that it will be useful,
20
+ * SEMS is distributed in the hope that it will be useful,
19 21
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 22
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21 23
  * GNU General Public License for more details.
Browse code

- added support for multiple SIP/UDP receivers. - some cleanups.

git-svn-id: http://svn.berlios.de/svnroot/repos/sems/trunk@1804 8eb893ce-cfd4-0310-b710-fb5ebe64c474

Raphael Coeffic authored on 16/04/2010 15:33:37
Showing 1 changed files
... ...
@@ -28,46 +28,77 @@
28 28
 #define _transport_h_
29 29
 
30 30
 #include "../AmThread.h"
31
-#include <string>
31
+#include <sys/socket.h>
32 32
 
33
+#include <string>
33 34
 using std::string;
34 35
 
35
-class trans_layer;
36
-struct sockaddr_storage;
37
-
38 36
 #define SAv4(addr) \
39 37
             ((struct sockaddr_in*)addr)
40 38
 
39
+#define SAv6(addr) \
40
+            ((struct sockaddr_in6*)addr)
41 41
 
42
-class transport: public AmThread
42
+class trsp_socket
43 43
 {
44
- protected:
45
-    /**
46
-     * Transaction layer pointer.
47
-     * This is used for received messages.
48
-     */
49
-    trans_layer* tl;
44
+protected:
45
+    // socket descriptor
46
+    int sd;
50 47
 
51
- public:
52
-    transport(trans_layer* tl);
48
+    // bound address
49
+    sockaddr_storage addr;
50
+
51
+    // bound IP
52
+    string           ip;
53
+
54
+    // bound port number
55
+    unsigned short   port;
56
+
57
+public:
58
+    trsp_socket();
59
+    virtual ~trsp_socket();
53 60
 
54
-    virtual ~transport();
55
-    
56 61
     /**
57
-     * Binds the transport server to an address
62
+     * Binds the transport socket to an address
58 63
      * @return -1 if error(s) occured.
59 64
      */
60 65
     virtual int bind(const string& address, unsigned short port)=0;
61 66
 
67
+    /**
68
+     * Getter for IP address
69
+     */
70
+    const char* get_ip();
71
+    
72
+    /**
73
+     * Getter for the port number
74
+     */
75
+    unsigned short get_port();
76
+
77
+    /**
78
+     *  Getter for the socket descriptor
79
+     */
80
+    int get_sd();
81
+
82
+    /**
83
+     * Copy the internal address into the given one (sa).
84
+     */
85
+    void copy_addr_to(sockaddr_storage* sa);
86
+
62 87
     /**
63 88
      * Sends a message.
64 89
      * @return -1 if error(s) occured.
65 90
      */
66
-    virtual int send(const sockaddr_storage* sa, const char* msg, const int msg_len)=0;
91
+    virtual int send(const sockaddr_storage* sa, const char* msg, const int msg_len);
92
+};
67 93
 
68
-    virtual const char* get_local_ip()=0;
69
-    virtual unsigned short get_local_port()=0;
70
-    virtual void copy_local_addr(sockaddr_storage* sa)=0;
94
+class transport: public AmThread
95
+{
96
+protected:
97
+    trsp_socket* sock;
98
+
99
+public:
100
+    transport(trsp_socket* sock): sock(sock) {}
101
+    virtual ~transport();
71 102
 };
72 103
 
73 104
 #endif
Browse code

- moved sipctrl plug-in into the core (core/sip). - static library sip_stack.a (with dependencies on the core). - removed AmServer and moved SipCtrlInterface into the core directory.

- TODO:
- CMake support to make core/sip/sip_stack.a and link against it in the core.
- merge AmSipRequest/AmSipReply and sip_msg structures.



git-svn-id: http://svn.berlios.de/svnroot/repos/sems/trunk@1758 8eb893ce-cfd4-0310-b710-fb5ebe64c474

Raphael Coeffic authored on 01/04/2010 13:07:45
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,80 @@
1
+/*
2
+ * $Id: transport.h 1048 2008-07-15 18:48:07Z sayer $
3
+ *
4
+ * Copyright (C) 2007 Raphael Coeffic
5
+ *
6
+ * This file is part of sems, a free SIP media server.
7
+ *
8
+ * sems 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
+ * sems 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
+#ifndef _transport_h_
28
+#define _transport_h_
29
+
30
+#include "../AmThread.h"
31
+#include <string>
32
+
33
+using std::string;
34
+
35
+class trans_layer;
36
+struct sockaddr_storage;
37
+
38
+#define SAv4(addr) \
39
+            ((struct sockaddr_in*)addr)
40
+
41
+
42
+class transport: public AmThread
43
+{
44
+ protected:
45
+    /**
46
+     * Transaction layer pointer.
47
+     * This is used for received messages.
48
+     */
49
+    trans_layer* tl;
50
+
51
+ public:
52
+    transport(trans_layer* tl);
53
+
54
+    virtual ~transport();
55
+    
56
+    /**
57
+     * Binds the transport server to an address
58
+     * @return -1 if error(s) occured.
59
+     */
60
+    virtual int bind(const string& address, unsigned short port)=0;
61
+
62
+    /**
63
+     * Sends a message.
64
+     * @return -1 if error(s) occured.
65
+     */
66
+    virtual int send(const sockaddr_storage* sa, const char* msg, const int msg_len)=0;
67
+
68
+    virtual const char* get_local_ip()=0;
69
+    virtual unsigned short get_local_port()=0;
70
+    virtual void copy_local_addr(sockaddr_storage* sa)=0;
71
+};
72
+
73
+#endif
74
+
75
+/** EMACS **
76
+ * Local variables:
77
+ * mode: c++
78
+ * c-basic-offset: 4
79
+ * End:
80
+ */