~ubuntu-branches/debian/wheezy/libnice/wheezy

« back to all changes in this revision

Viewing changes to stun/tests/test-bind.c

  • Committer: Bazaar Package Importer
  • Author(s): Sjoerd Simons, Laurent Bigonville, Sjoerd Simons
  • Date: 2009-03-06 16:34:10 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20090306163410-f3zw3f2ow31nsj5r
Tags: 0.0.5-1
[ Laurent Bigonville ]
* debian/watch: Fix URL

[ Sjoerd Simons ]
* New Upstream Version
* Updates symbol and ship the stun header files

Show diffs side-by-side

added added

removed removed

Lines of Context:
49
49
#ifdef _WIN32
50
50
#include <winsock2.h>
51
51
#include <ws2tcpip.h>
52
 
#define ENOENT -1
53
 
#define EINVAL -2
54
 
#define ENOBUFS -3
55
 
#define EAFNOSUPPORT -4
56
 
#define EPROTO -5
57
 
#define EACCES -6
58
 
#define EINPROGRESS -7
59
 
#define EAGAIN -8
60
 
#define ENOSYS -9
61
52
 
62
53
#define MSG_DONTWAIT 0
63
54
#define MSG_NOSIGNAL 0
69
60
#include <sys/socket.h>
70
61
#include <arpa/inet.h>
71
62
#include <netdb.h>
72
 
#include <errno.h>
73
63
#endif
74
64
 
75
65
#undef NDEBUG /* ensure assertions are built-in */
197
187
  uint16_t known_attributes[] = {
198
188
    STUN_ATTRIBUTE_MAPPED_ADDRESS,
199
189
    STUN_ATTRIBUTE_XOR_MAPPED_ADDRESS,
200
 
    STUN_ATTRIBUTE_XOR_INTERNAL_ADDRESS,
201
190
    STUN_ATTRIBUTE_PRIORITY,
202
191
    STUN_ATTRIBUTE_USERNAME,
203
192
    STUN_ATTRIBUTE_MESSAGE_INTEGRITY,
241
230
 
242
231
  val = stun_usage_bind_process (&msg,
243
232
      (struct sockaddr *)&addr, &addrlen, (struct sockaddr *)&addr, &addrlen);
244
 
  assert (val == STUN_USAGE_BIND_RETURN_RETRY);
 
233
  assert (val == STUN_USAGE_BIND_RETURN_INVALID);
245
234
 
246
235
  /* Send response with wrong request type */
247
236
  buf[0] |= 0x03;
251
240
  buf[1] |= 0x10;
252
241
  val = stun_usage_bind_process (&msg,
253
242
      (struct sockaddr *)&addr, &addrlen, (struct sockaddr *)&addr, &addrlen);
254
 
  assert (val == STUN_USAGE_BIND_RETURN_RETRY);
 
243
  assert (val == STUN_USAGE_BIND_RETURN_INVALID);
255
244
 
256
245
  close (fd);
257
246
  close (servfd);
275
264
  uint16_t known_attributes[] = {
276
265
    STUN_ATTRIBUTE_MAPPED_ADDRESS,
277
266
    STUN_ATTRIBUTE_XOR_MAPPED_ADDRESS,
278
 
    STUN_ATTRIBUTE_XOR_INTERNAL_ADDRESS,
279
267
    STUN_ATTRIBUTE_PRIORITY,
280
268
    STUN_ATTRIBUTE_USERNAME,
281
269
    STUN_ATTRIBUTE_MESSAGE_INTEGRITY,
370
358
      == STUN_VALIDATION_SUCCESS);
371
359
 
372
360
  stun_agent_init_response (&agent, &msg, buf, sizeof (buf), &msg);
373
 
  val = stun_message_append_addr (&msg, STUN_ATTRIBUTE_MAPPED_ADDRESS,
374
 
                          (struct sockaddr *)&addr, addrlen);
375
 
  assert (val == 0);
 
361
  assert (stun_message_append_addr (&msg, STUN_ATTRIBUTE_MAPPED_ADDRESS,
 
362
          (struct sockaddr *)&addr, addrlen) == STUN_MESSAGE_RETURN_SUCCESS);
376
363
  len = stun_agent_finish_message (&agent, &msg, NULL, 0);
377
364
  assert (len > 0);
378
365
 
407
394
  uint16_t known_attributes[] = {
408
395
    STUN_ATTRIBUTE_MAPPED_ADDRESS,
409
396
    STUN_ATTRIBUTE_XOR_MAPPED_ADDRESS,
410
 
    STUN_ATTRIBUTE_XOR_INTERNAL_ADDRESS,
411
397
    STUN_ATTRIBUTE_PRIORITY,
412
398
    STUN_ATTRIBUTE_USERNAME,
413
399
    STUN_ATTRIBUTE_MESSAGE_INTEGRITY,