Browse code

adds AmSdp::clear()

Raphael Coeffic authored on 14/07/2011 12:54:40
Showing 2 changed files
... ...
@@ -112,8 +112,8 @@ string SdpAttribute::print() const {
112 112
 // class AmSdp: Methods
113 113
 //
114 114
 AmSdp::AmSdp()
115
-  : remote_active(false),
116
-    accepted_media(0)
115
+  : version(0),
116
+    remote_active(false)
117 117
 {
118 118
   l_origin.user = "sems";
119 119
   l_origin.sessId = get_random();
... ...
@@ -127,15 +127,14 @@ AmSdp::AmSdp(const AmSdp& p_sdp_msg)
127 127
     sessionName(p_sdp_msg.sessionName),
128 128
     conn(p_sdp_msg.conn),
129 129
     media(p_sdp_msg.media),
130
-    remote_active(false),
131
-    accepted_media(0)
130
+    remote_active(false)
132 131
 {
133 132
 }
134 133
 
135 134
 int AmSdp::parse(const char* _sdp_msg)
136 135
 {
137 136
   char* s = (char*)_sdp_msg;
138
-  media.clear();
137
+  clear();
139 138
   
140 139
   bool ret = parse_sdp_line_ex(this,s);
141 140
   
... ...
@@ -238,6 +237,20 @@ const SdpPayload *AmSdp::findPayload(const string& name) const
238 237
   return NULL;
239 238
 }
240 239
 
240
+void AmSdp::clear()
241
+{
242
+  version = 0;
243
+  origin  = SdpOrigin();
244
+  sessionName.clear();
245
+  uri.clear();
246
+  conn = SdpConnection();
247
+  attributes.clear();
248
+  media.clear();
249
+  remote_active = false;
250
+  l_origin = SdpOrigin();
251
+}
252
+
253
+
241 254
 //parser
242 255
 static bool parse_sdp_line_ex(AmSdp* sdp_msg, char*& s)
243 256
 {
... ...
@@ -1087,3 +1100,4 @@ static bool attr_check(std::string attr)
1087 1100
     return false;
1088 1101
     }
1089 1102
 }
1103
+
... ...
@@ -175,8 +175,6 @@ public:
175 175
   // us to do passive RTP ?
176 176
   bool remote_active;
177 177
 
178
-  unsigned int accepted_media;   // index of the media which we accept (todo: multi stream)
179
-
180 178
   SdpOrigin        l_origin;      // local origin (o= )
181 179
     
182 180
   AmSdp();
... ...
@@ -201,6 +199,11 @@ public:
201 199
    * Test if remote UA supports 'telefone_event'.
202 200
    */
203 201
   //bool hasTelephoneEvent();
202
+
203
+  /**
204
+   * Clear all parsed values.
205
+   */
206
+  void clear();
204 207
 };
205 208
 
206 209
 #endif