Changeset 21253
- Timestamp:
- 10/13/08 21:15:57 (5 years ago)
- Location:
- lang/cplusplus/llv8call/trunk
- Files:
-
- 2 modified
-
ext/socket/socket.cc (modified) (3 diffs)
-
t/100_socket/02_misc.js (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lang/cplusplus/llv8call/trunk/ext/socket/socket.cc
r21249 r21253 462 462 END 463 463 464 FUNCTION(_ntohl) 465 ARG_COUNT(1); 466 ARG_int(n, 0); 467 return Uint32::New(ntohl(n)); 468 END 469 470 FUNCTION(_ntohs) 471 ARG_COUNT(1); 472 ARG_int(n, 0); 473 return Uint32::New(ntohs(n)); 474 END 475 476 FUNCTION(_htons) 477 ARG_COUNT(1); 478 ARG_int(n, 0); 479 return Uint32::New(htons(n)); 480 END 481 482 FUNCTION(_htonl) 483 ARG_COUNT(1); 484 ARG_int(n, 0); 485 return Uint32::New(htonl(n)); 486 END 487 464 488 MODULE() 465 489 { … … 482 506 BIND_CM("inet_ntoa", _inet_ntoa); 483 507 BIND_CM("socketpair", _socketpair); 508 BIND_CM("ntohl", _ntohl); 509 BIND_CM("ntohs", _ntohs); 510 BIND_CM("htons", _htons); 511 BIND_CM("htonl", _htonl); 484 512 485 513 BIND_IM("bind", _bind); … … 504 532 // getservbyname 505 533 // getservbyport 506 // socketpair507 534 // fromfd 508 // ntohl509 // ntohs510 // htonl511 // htons512 535 // inet_pton 513 536 // inet_ntop -
lang/cplusplus/llv8call/trunk/t/100_socket/02_misc.js
r21202 r21253 1 1 require('t/util.js'); 2 2 3 plan({tests: 3});3 plan({tests:7}); 4 4 5 5 check_lib("org.coderepos.socket"); … … 9 9 is(Socket.inet_aton("127.0.0.1"), (1 << 24) + 127, 'inet_aton'); 10 10 is(Socket.inet_ntoa((1<<24) + 127), "127.0.0.1", 'inet_ntoa'); 11 is(Socket.ntohs(0xabcd), 0xcdab, 'ntohs'); 12 is(Socket.htons(0xabcd), 0xcdab, 'htons'); 13 is(Socket.htonl(0xdeadbe0f), 0x0fbeadde, 'htonl'); 14 is(Socket.ntohl(0xdeadbe0f), 0x0fbeadde, 'htonl'); 11 15
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)