Browse code

sip: transport: make getter constant

Raphael Coeffic authored on 28/04/2013 12:44:19
Showing 2 changed files
... ...
@@ -48,23 +48,23 @@ trsp_socket::~trsp_socket()
48 48
 {
49 49
 }
50 50
 
51
-const char* trsp_socket::get_ip()
51
+const char* trsp_socket::get_ip() const
52 52
 {
53 53
     return ip.c_str();
54 54
 }
55 55
 
56
-unsigned short trsp_socket::get_port()
56
+unsigned short trsp_socket::get_port() const
57 57
 {
58 58
     return port;
59 59
 }
60 60
 
61
-bool trsp_socket::is_opt_set(unsigned int mask)
61
+bool trsp_socket::is_opt_set(unsigned int mask) const
62 62
 {
63 63
     DBG("trsp_socket::socket_options = 0x%x\n",socket_options);
64 64
     return (socket_options & mask) == mask;
65 65
 }
66 66
 
67
-void trsp_socket::copy_addr_to(sockaddr_storage* sa)
67
+void trsp_socket::copy_addr_to(sockaddr_storage* sa) const
68 68
 {
69 69
     memcpy(sa,&addr,sizeof(sockaddr_storage));
70 70
 }
... ...
@@ -73,7 +73,7 @@ void trsp_socket::copy_addr_to(sockaddr_storage* sa)
73 73
  * Match with the given address
74 74
  * @return true if address matches
75 75
  */
76
-bool trsp_socket::match_addr(sockaddr_storage* other_addr)
76
+bool trsp_socket::match_addr(sockaddr_storage* other_addr) const
77 77
 {
78 78
     
79 79
     if(addr.ss_family != other_addr->ss_family)
... ...
@@ -95,12 +95,12 @@ bool trsp_socket::match_addr(sockaddr_storage* other_addr)
95 95
     return false;
96 96
 }
97 97
 
98
-int trsp_socket::get_sd()
98
+int trsp_socket::get_sd() const
99 99
 {
100 100
     return sd;
101 101
 }
102 102
 
103
-unsigned short trsp_socket::get_if()
103
+unsigned short trsp_socket::get_if() const
104 104
 {
105 105
     return if_num;
106 106
 }
... ...
@@ -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.