Changeset 1585 for pjproject/trunk/pjlib/include/pj/sock.h
- Timestamp:
- Nov 18, 2007 2:53:47 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjlib/include/pj/sock.h
r1410 r1585 61 61 */ 62 62 63 /** Address family is unspecified. @see pj_AF_UNSPEC() */ 64 extern const pj_uint16_t PJ_AF_UNSPEC; 65 63 66 /** Unix domain socket. @see pj_AF_UNIX() */ 64 67 extern const pj_uint16_t PJ_AF_UNIX; … … 85 88 */ 86 89 90 /** Get #PJ_AF_UNSPEC value */ 91 PJ_DECL(pj_uint16_t) pj_AF_UNSPEC(void); 87 92 /** Get #PJ_AF_UNIX value. */ 88 93 PJ_DECL(pj_uint16_t) pj_AF_UNIX(void); … … 314 319 315 320 /** 321 * Maximum length of text representation of an IPv4 address. 322 */ 323 #define PJ_INET_ADDRSTRLEN 16 324 325 /** 326 * Maximum length of text representation of an IPv6 address. 327 */ 328 #define PJ_INET6_ADDRSTRLEN 46 329 330 331 /** 316 332 * This structure describes Internet socket address. 317 333 * If PJ_SOCKADDR_HAS_LEN is not zero, then sin_zero_len member is added … … 334 350 }; 335 351 352 336 353 #undef s6_addr 337 354 … … 339 356 * This structure describes IPv6 address. 340 357 */ 341 typedef struct pj_in6_addr 342 { 343 /** Union of address formats. */ 344 union { 345 pj_uint8_t u6_addr8[16]; /**< u6_addr8 */ 346 pj_uint16_t u6_addr16[8]; /**< u6_addr16 */ 347 pj_uint32_t u6_addr32[4]; /**< u6_addr32 */ 348 } in6_u; 349 /** Shortcut to access in6_u.u6_addr8. */ 350 #define s6_addr in6_u.u6_addr8 351 /** Shortcut to access in6_u.u6_addr16. */ 352 #define s6_addr16 in6_u.u6_addr16 353 /** Shortcut to access in6_u.u6_addr32. */ 354 #define s6_addr32 in6_u.u6_addr32 358 typedef union pj_in6_addr 359 { 360 /* This is the main entry */ 361 pj_uint8_t s6_addr[16]; /**< 8-bit array */ 362 363 /* While these are used for proper alignment */ 364 pj_uint32_t u6_addr32[4]; 365 #if defined(PJ_HAS_INT64) && PJ_HAS_INT64!=0 366 pj_int64_t u6_addr64[2]; 367 #endif 368 355 369 } pj_in6_addr; 370 356 371 357 372 /** Initializer value for pj_in6_addr. */ … … 372 387 { 373 388 #if defined(PJ_SOCKADDR_HAS_LEN) && PJ_SOCKADDR_HAS_LEN!=0 374 pj_uint8_t sin _zero_len; /**< Just ignore this. */375 pj_uint8_t sin _family; /**< Address family. */389 pj_uint8_t sin6_zero_len; /**< Just ignore this. */ 390 pj_uint8_t sin6_family; /**< Address family. */ 376 391 #else 377 392 pj_uint16_t sin6_family; /**< Address family */ … … 380 395 pj_uint32_t sin6_flowinfo; /**< IPv6 flow information */ 381 396 pj_in6_addr sin6_addr; /**< IPv6 address. */ 382 pj_uint32_t sin6_scope_id; /**< IPv6 scope-id*/397 pj_uint32_t sin6_scope_id; /**< Set of interfaces for a scope */ 383 398 } pj_sockaddr_in6; 384 399 … … 473 488 */ 474 489 PJ_DECL(int) pj_inet_aton(const pj_str_t *cp, struct pj_in_addr *inp); 490 491 /** 492 * This function converts an address in its standard text presentation form 493 * into its numeric binary form. It supports both IPv4 and IPv6 address 494 * conversion. 495 * 496 * @param af Specify the family of the address. The PJ_AF_INET and 497 * PJ_AF_INET6 address families shall be supported. 498 * @param src Points to the string being passed in. 499 * @param dst Points to a buffer into which the function stores the 500 * numeric address; this shall be large enough to hold the 501 * numeric address (32 bits for PJ_AF_INET, 128 bits for 502 * PJ_AF_INET6). 503 * 504 * @return PJ_SUCCESS if conversion was successful. 505 */ 506 PJ_DECL(pj_status_t) pj_inet_pton(int af, const pj_str_t *src, void *dst); 507 508 /** 509 * This function converts a numeric address into a text string suitable 510 * for presentation. It supports both IPv4 and IPv6 address 511 * conversion. 512 * 513 * @param af Specify the family of the address. This can be PJ_AF_INET 514 * or PJ_AF_INET6. 515 * @param src Points to a buffer holding an IPv4 address if the af argument 516 * is PJ_AF_INET, or an IPv6 address if the af argument is 517 * PJ_AF_INET6; the address must be in network byte order. 518 * @param dst Points to a buffer where the function stores the resulting 519 * text string; it shall not be NULL. 520 * @param size Specifies the size of this buffer, which shall be large 521 * enough to hold the text string (PJ_INET_ADDRSTRLEN characters 522 * for IPv4, PJ_INET6_ADDRSTRLEN characters for IPv6). 523 * 524 * @return PJ_SUCCESS if conversion was successful.. 525 */ 526 PJ_DECL(pj_status_t) pj_inet_ntop(int af, const void *src, 527 char *dst, int size); 475 528 476 529 /**
Note: See TracChangeset
for help on using the changeset viewer.