~ubuntu-branches/debian/stretch/libnice/stretch

« back to all changes in this revision

Viewing changes to socket/tcp-turn.c

Tags: 0.1.0-2
Add a Breaks: libgstfarsight0.10-0 (<< 0.22) for the gstreamer plugin as
farsight uses one libnice ABI and the gstreamer element uses another
libnice ABI things tend to go horribly wrong.

Show diffs side-by-side

added added

removed removed

Lines of Context:
113
113
  if (priv->expecting_len == 0) {
114
114
    guint headerlen = 0;
115
115
 
116
 
    if (priv->compatibility == NICE_TURN_SOCKET_COMPATIBILITY_DRAFT9)
 
116
    if (priv->compatibility == NICE_TURN_SOCKET_COMPATIBILITY_DRAFT9 ||
 
117
        priv->compatibility == NICE_TURN_SOCKET_COMPATIBILITY_RFC5766)
117
118
      headerlen = 4;
118
119
    else if (priv->compatibility == NICE_TURN_SOCKET_COMPATIBILITY_GOOGLE)
119
120
      headerlen = 2;
130
131
    if (priv->recv_buf_len < headerlen)
131
132
      return 0;
132
133
 
133
 
    if (priv->compatibility == NICE_TURN_SOCKET_COMPATIBILITY_DRAFT9) {
 
134
    if (priv->compatibility == NICE_TURN_SOCKET_COMPATIBILITY_DRAFT9 ||
 
135
        priv->compatibility == NICE_TURN_SOCKET_COMPATIBILITY_RFC5766) {
134
136
      guint16 magic = ntohs (*(guint16*)priv->recv_buf);
135
137
      guint16 packetlen = ntohs (*(guint16*)(priv->recv_buf + 2));
136
138
 
149
151
    }
150
152
  }
151
153
 
152
 
  if (priv->compatibility == NICE_TURN_SOCKET_COMPATIBILITY_DRAFT9)
 
154
  if (priv->compatibility == NICE_TURN_SOCKET_COMPATIBILITY_DRAFT9 ||
 
155
        priv->compatibility == NICE_TURN_SOCKET_COMPATIBILITY_RFC5766)
153
156
    padlen = (priv->expecting_len % 4) ?  4 - (priv->expecting_len % 4) : 0;
154
157
  else
155
158
    padlen = 0;
185
188
  gchar buffer[MAX_UDP_MESSAGE_SIZE + sizeof(guint16) + sizeof(padbuf)];
186
189
  guint buffer_len = 0;
187
190
 
188
 
  if (priv->compatibility != NICE_TURN_SOCKET_COMPATIBILITY_DRAFT9)
 
191
  if (priv->compatibility != NICE_TURN_SOCKET_COMPATIBILITY_DRAFT9 ||
 
192
        priv->compatibility == NICE_TURN_SOCKET_COMPATIBILITY_RFC5766)
189
193
    padlen = 0;
190
194
 
191
195
  if (priv->compatibility == NICE_TURN_SOCKET_COMPATIBILITY_GOOGLE) {
197
201
  memcpy (buffer + buffer_len, buf, len);
198
202
  buffer_len += len;
199
203
 
200
 
  if (priv->compatibility == NICE_TURN_SOCKET_COMPATIBILITY_DRAFT9) {
 
204
  if (priv->compatibility == NICE_TURN_SOCKET_COMPATIBILITY_DRAFT9 ||
 
205
        priv->compatibility == NICE_TURN_SOCKET_COMPATIBILITY_RFC5766) {
201
206
    memcpy (buffer + buffer_len, padbuf, padlen);
202
207
    buffer_len += padlen;
203
208
  }