Changeset 1405 for pjproject/trunk/pjlib/src/pjlib-test/sock.c
- Timestamp:
- Jul 20, 2007 8:08:30 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjlib/src/pjlib-test/sock.c
r1266 r1405 78 78 pj_sockaddr_in addr2; 79 79 const pj_str_t *hostname; 80 #if defined(PJ_SYMBIAN) && PJ_SYMBIAN!=0 81 /* Symbian IP address is saved in host order */ 82 unsigned char A[] = {1, 0, 0, 127}; 83 #else 84 unsigned char A[] = {127, 0, 0, 1}; 85 #endif 80 const unsigned char A[] = {127, 0, 0, 1}; 86 81 87 82 PJ_LOG(3,("test", "...format_test()")); … … 137 132 pj_status_t rc = PJ_SUCCESS; 138 133 139 types[0] = PJ_SOCK_STREAM;140 types[1] = PJ_SOCK_DGRAM;134 types[0] = pj_SOCK_STREAM(); 135 types[1] = pj_SOCK_DGRAM(); 141 136 142 137 PJ_LOG(3,("test", "...simple_sock_test()")); … … 144 139 for (i=0; i<(int)(sizeof(types)/sizeof(types[0])); ++i) { 145 140 146 rc = pj_sock_socket( PJ_AF_INET, types[i], 0, &sock);141 rc = pj_sock_socket(pj_AF_INET(), types[i], 0, &sock); 147 142 if (rc != PJ_SUCCESS) { 148 app_perror("...error: unable to create socket type %d", rc);143 app_perror("...error: unable to create socket", rc); 149 144 break; 150 145 } else { … … 238 233 } 239 234 if (received != DATA_LEN-total_received) { 240 if (sock_type != PJ_SOCK_STREAM) {235 if (sock_type != pj_SOCK_STREAM()) { 241 236 PJ_LOG(3,("", "...error: expecting %u bytes, got %u bytes", 242 237 DATA_LEN-total_received, received)); … … 296 291 } 297 292 if (received != BIG_DATA_LEN-total_received) { 298 if (sock_type != PJ_SOCK_STREAM) {293 if (sock_type != pj_SOCK_STREAM()) { 299 294 PJ_LOG(3,("", "...error: expecting %u bytes, got %u bytes", 300 295 BIG_DATA_LEN-total_received, received)); … … 326 321 PJ_LOG(3,("test", "...udp_test()")); 327 322 328 rc = pj_sock_socket( PJ_AF_INET, PJ_SOCK_DGRAM, 0, &ss);323 rc = pj_sock_socket(pj_AF_INET(), pj_SOCK_DGRAM(), 0, &ss); 329 324 if (rc != 0) { 330 325 app_perror("...error: unable to create socket", rc); … … 332 327 } 333 328 334 rc = pj_sock_socket( PJ_AF_INET, PJ_SOCK_DGRAM, 0, &cs);329 rc = pj_sock_socket(pj_AF_INET(), pj_SOCK_DGRAM(), 0, &cs); 335 330 if (rc != 0) 336 331 return -110; … … 338 333 /* Bind server socket. */ 339 334 pj_bzero(&dstaddr, sizeof(dstaddr)); 340 dstaddr.sin_family = PJ_AF_INET;335 dstaddr.sin_family = pj_AF_INET(); 341 336 dstaddr.sin_port = pj_htons(UDP_PORT); 342 337 dstaddr.sin_addr = pj_inet_addr(pj_cstr(&s, ADDRESS)); … … 349 344 /* Bind client socket. */ 350 345 pj_bzero(&srcaddr, sizeof(srcaddr)); 351 srcaddr.sin_family = PJ_AF_INET;346 srcaddr.sin_family = pj_AF_INET(); 352 347 srcaddr.sin_port = pj_htons(UDP_PORT-1); 353 348 srcaddr.sin_addr = pj_inet_addr(pj_cstr(&s, ADDRESS)); … … 359 354 360 355 /* Test send/recv, with sendto */ 361 rc = send_recv_test( PJ_SOCK_DGRAM, ss, cs, &dstaddr, NULL,356 rc = send_recv_test(pj_SOCK_DGRAM(), ss, cs, &dstaddr, NULL, 362 357 sizeof(dstaddr)); 363 358 if (rc != 0) … … 365 360 366 361 /* Test send/recv, with sendto and recvfrom */ 367 rc = send_recv_test( PJ_SOCK_DGRAM, ss, cs, &dstaddr,362 rc = send_recv_test(pj_SOCK_DGRAM(), ss, cs, &dstaddr, 368 363 &srcaddr, sizeof(dstaddr)); 369 364 if (rc != 0) … … 383 378 384 379 /* Test send/recv with send() */ 385 rc = send_recv_test( PJ_SOCK_DGRAM, ss, cs, NULL, NULL, 0);380 rc = send_recv_test(pj_SOCK_DGRAM(), ss, cs, NULL, NULL, 0); 386 381 if (rc != 0) 387 382 goto on_error; 388 383 389 384 /* Test send/recv with send() and recvfrom */ 390 rc = send_recv_test( PJ_SOCK_DGRAM, ss, cs, NULL, &srcaddr,385 rc = send_recv_test(pj_SOCK_DGRAM(), ss, cs, NULL, &srcaddr, 391 386 sizeof(srcaddr)); 392 387 if (rc != 0) … … 421 416 PJ_LOG(3,("test", "...tcp_test()")); 422 417 423 rc = app_socketpair( PJ_AF_INET, PJ_SOCK_STREAM, 0, &ss, &cs);418 rc = app_socketpair(pj_AF_INET(), pj_SOCK_STREAM(), 0, &ss, &cs); 424 419 if (rc != PJ_SUCCESS) { 425 420 app_perror("...error: app_socketpair():", rc); … … 428 423 429 424 /* Test send/recv with send() and recv() */ 430 retval = send_recv_test( PJ_SOCK_STREAM, ss, cs, NULL, NULL, 0);425 retval = send_recv_test(pj_SOCK_STREAM(), ss, cs, NULL, NULL, 0); 431 426 432 427 rc = pj_sock_close(cs);
Note: See TracChangeset
for help on using the changeset viewer.