Rev 4704 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4704 | Rev 4756 | ||
---|---|---|---|
Line 50... | Line 50... | ||
50 | * @see addrinfo |
50 | * @see addrinfo |
51 | */ |
51 | */ |
52 | typedef struct addrinfo addrinfo_t; |
52 | typedef struct addrinfo addrinfo_t; |
53 | 53 | ||
54 | /** Prints the address into the character buffer. |
54 | /** Prints the address into the character buffer. |
55 | * @param family The address family. Input parameter. |
55 | * @param[in] family The address family. |
56 | * @param data The address data. Input parameter. |
56 | * @param[in] data The address data. |
57 | * @param address The character buffer to be filled. Output parameter. |
57 | * @param[out] address The character buffer to be filled. |
58 | * @param length The buffer length. Input parameter. |
58 | * @param[in] length The buffer length. |
59 | * @returns EOK on success. |
59 | * @returns EOK on success. |
60 | * @returns EINVAL if the data or address parameter is NULL. |
60 | * @returns EINVAL if the data or address parameter is NULL. |
61 | * @returns ENOMEM if the character buffer is not long enough. |
61 | * @returns ENOMEM if the character buffer is not long enough. |
62 | * @returns ENOTSUP if the address family is not supported. |
62 | * @returns ENOTSUP if the address family is not supported. |
63 | */ |
63 | */ |
64 | int inet_ntop( uint16_t family, const uint8_t * data, char * address, size_t length ); |
64 | int inet_ntop( uint16_t family, const uint8_t * data, char * address, size_t length ); |
65 | 65 | ||
66 | /** Parses the character string into the address. |
66 | /** Parses the character string into the address. |
67 | * If the string is shorter than the full address, zero bytes are added. |
67 | * If the string is shorter than the full address, zero bytes are added. |
68 | * @param family The address family. Input parameter. |
68 | * @param[in] family The address family. |
69 | * @param address The character buffer to be parsed. Input parameter. |
69 | * @param[in] address The character buffer to be parsed. |
70 | * @param data The address data to be filled. Output parameter. |
70 | * @param[out] data The address data to be filled. |
71 | * @returns EOK on success. |
71 | * @returns EOK on success. |
72 | * @returns EINVAL if the data parameter is NULL. |
72 | * @returns EINVAL if the data parameter is NULL. |
73 | * @returns ENOENT if the address parameter is NULL. |
73 | * @returns ENOENT if the address parameter is NULL. |
74 | * @returns ENOTSUP if the address family is not supported. |
74 | * @returns ENOTSUP if the address family is not supported. |
75 | */ |
75 | */ |
Line 85... | Line 85... | ||
85 | /** 14 byte protocol address. |
85 | /** 14 byte protocol address. |
86 | */ |
86 | */ |
87 | uint8_t sa_data[ 14 ]; |
87 | uint8_t sa_data[ 14 ]; |
88 | }; |
88 | }; |
89 | 89 | ||
- | 90 | // TODO define address information |
|
90 | /** Address information. |
91 | // /** Address information. |
91 | * \todo |
92 | // * \todo |
92 | */ |
93 | // */ |
93 | struct addrinfo{ |
94 | //struct addrinfo{ |
94 | int ai_flags; // AI_PASSIVE, AI_CANONNAME, etc. |
95 | // int ai_flags; // AI_PASSIVE, AI_CANONNAME, etc. |
95 | uint16_t ai_family; // AF_INET, AF_INET6, AF_UNSPEC |
96 | // uint16_t ai_family; // AF_INET, AF_INET6, AF_UNSPEC |
96 | int ai_socktype; // SOCK_STREAM, SOCK_DGRAM |
97 | // int ai_socktype; // SOCK_STREAM, SOCK_DGRAM |
97 | int ai_protocol; // use 0 for "any" |
98 | // int ai_protocol; // use 0 for "any" |
98 | size_t ai_addrlen; // size of ai_addr in bytes |
99 | // size_t ai_addrlen; // size of ai_addr in bytes |
99 | struct sockaddr * ai_addr; // struct sockaddr_in or _in6 |
100 | // struct sockaddr * ai_addr; // struct sockaddr_in or _in6 |
100 | char * ai_canonname; // full canonical hostname |
101 | // char * ai_canonname; // full canonical hostname |
101 | struct addrinfo * ai_next; // linked list, next node |
102 | // struct addrinfo * ai_next; // linked list, next node |
102 | }; |
103 | //}; |
103 | 104 | ||
104 | /*int getaddrinfo(const char *node, // e.g. "www.example.com" or IP |
105 | /*int getaddrinfo(const char *node, // e.g. "www.example.com" or IP |
105 | const char *service, // e.g. "http" or port number |
106 | const char *service, // e.g. "http" or port number |
106 | const struct addrinfo *hints, |
107 | const struct addrinfo *hints, |
107 | struct addrinfo **res); |
108 | struct addrinfo **res); |
108 | - | ||
109 | getnameinfo |
109 | getnameinfo |
110 | */ |
110 | */ |
111 | 111 | ||
112 | #endif |
112 | #endif |
113 | 113 |