|
Tizen RT Libs&Environment
v1.0 D5
|
Provides APIs for BSD Socket. More...
|
Files | |
| file | socket.h |
| Socket APIs. | |
| file | netdb.h |
| DNS client API. | |
| file | inet.h |
| inet API | |
Data Structures | |
| struct | hostent |
| struct | netent |
| struct | protoent |
| struct | servent |
| struct | addrinfo |
| struct | servent_data |
Macros | |
| #define | EXTERN extern |
| #define | IPPORT_RESERVED 0xffff /* No reserved port numbers */ |
| #define | AI_PASSIVE (1 << 0) |
| #define | AI_CANONNAME (1 << 1) |
| #define | AI_NUMERICHOST (1 << 2) |
| #define | AI_NUMERICSERV (1 << 3) |
| #define | AI_V4MAPPED (1 << 4) |
| #define | AI_ALL (1 << 5) |
| #define | AI_ADDRCONFIG (1 << 6) |
| #define | NI_NOFQDN (1 << 0) |
| #define | NI_NUMERICHOST (1 << 1) |
| #define | NI_NAMEREQD (1 << 2) |
| #define | NI_NUMERICSERV (1 << 3) |
| #define | NI_NUMERICSCOPE (1 << 4) |
| #define | NI_DGRAM (1 << 5) |
| #define | HOST_NOT_FOUND 1 |
| #define | HOST_NOT_FOUND 1 |
| #define | NO_DATA 2 |
| #define | NO_DATA 2 |
| #define | NO_RECOVERY 3 |
| #define | NO_RECOVERY 3 |
| #define | TRY_AGAIN 4 |
| #define | TRY_AGAIN 4 |
| #define | EAI_AGAIN 1 |
| #define | EAI_BADFLAGS 2 |
| #define | EAI_FAMILY 3 |
| #define | EAI_MEMORY 4 |
| #define | EAI_NONAME 5 |
| #define | EAI_SERVICE 6 |
| #define | EAI_SOCKTYPE 7 |
| #define | EAI_SYSTEM 8 |
| #define | EAI_OVERFLOW 9 |
| #define | EAI_FAIL -1 |
| #define | _PATH_SERVICES "/etc/services" |
| #define | h_addr h_addr_list[0] /* For backward compatibility */ |
| #define | EXTERN extern |
| #define | EXTERN extern |
| #define | INET_ADDRSTRLEN 16 |
| #define | INET6_ADDRSTRLEN 46 |
| #define | HTONS(ns) |
| #define | HTONL(nl) |
| #define | NTOHS(hs) HTONS(hs) |
| #define | NTOHL(hl) HTONL(hl) |
| #define | EXTERN extern |
Functions | |
| int | socket (int domain, int type, int protocol) |
| creates an unbound socket in a communications domain. More... | |
| int | bind (int sockfd, FAR const struct sockaddr *addr, socklen_t addrlen) |
| assigns an address to an unnamed socket. More... | |
| int | connect (int sockfd, FAR const struct sockaddr *addr, socklen_t addrlen) |
| requests a connection to be made on a socket More... | |
| int | listen (int sockfd, int backlog) |
| listen for socket connections and limit the queue of incoming connections More... | |
| int | accept (int sockfd, struct sockaddr *addr, socklen_t *addrlen) |
| requests a connection to be made on a socket More... | |
| ssize_t | send (int sockfd, FAR const void *buf, size_t len, int flags) |
| send a message on a socket More... | |
| ssize_t | sendto (int sockfd, FAR const void *buf, size_t len, int flags, FAR const struct sockaddr *to, socklen_t tolen) |
| send a message on a socket More... | |
| ssize_t | recv (int sockfd, FAR void *buf, size_t len, int flags) |
| send a message on a socket More... | |
| ssize_t | recvfrom (int sockfd, FAR void *buf, size_t len, int flags, FAR struct sockaddr *from, FAR socklen_t *fromlen) |
| receive a message from a socket More... | |
| int | shutdown (int sockfd, int how) |
| shut down socket send and receive operations More... | |
| int | closesocket (int s) |
| close a socket More... | |
| int | setsockopt (int sockfd, int level, int option, FAR const void *value, socklen_t value_len) |
| set the socket options More... | |
| int | getsockopt (int sockfd, int level, int option, FAR void *value, FAR socklen_t *value_len) |
| get the socket options More... | |
| int | getsockname (int sockfd, FAR struct sockaddr *addr, FAR socklen_t *addrlen) |
| get the socket name More... | |
| int | getpeername (int s, struct sockaddr *name, socklen_t *namelen) |
| get the name of the peer socket More... | |
| int | getaddrinfo (const char *host, const char *service, const struct addrinfo *hints, struct addrinfo **res) |
| getaddrinfo() is a function that returns information on a particular host name (such as its IP address) and loads up a struct sockaddr. More... | |
| void | freeaddrinfo (FAR struct addrinfo *ai) |
| freeaddrinfo() frees the memory allocated by the getaddrinfo() function. More... | |
| FAR struct hostent * | gethostbyaddr (FAR const void *addr, socklen_t len, int type) |
| gethostbyaddr() is the function returns a corresponding hostname with given IP addresses More... | |
| FAR struct hostent * | gethostbyname (FAR const char *name) |
| gethostbyname() is the function sending DNS query to DNS server with hostname More... | |
| EXTERN FAR char * | ether_ntoa (FAR const struct ether_addr *addr) |
| ether_ntoa() function converts the Ethernet host address addr given in network byte order to a string in standard hex-digits-and-colons notation. More... | |
| uint32_t | ntohl (uint32_t nl) |
| Convert the unsigned integer netlong from network byte order to host byte order. More... | |
| uint16_t | ntohs (uint16_t ns) |
| Convert the unsigned short integer netshort from network byte order to host byte order. More... | |
| uint32_t | htonl (uint32_t hl) |
| Convert the unsigned integer hostlong from host byte order to network byte order. More... | |
| uint16_t | htons (uint16_t hs) |
| Convert the unsigned short integer hostshort from host byte order to network byte order. More... | |
| int | inet_aton (FAR const char *cp, FAR struct in_addr *inp) |
| Convert the Internet host address from the IPv4 numbers-and-dots notation into binary form. More... | |
| in_addr_t | inet_addr (FAR const char *cp) |
| Convert the Internet host address from the IPv4 numbers-and-dots notation into binary data in network byte order. More... | |
Variables | |
| EXTERN int | h_errno |
Provides APIs for BSD Socket.
| #define h_addr h_addr_list[0] /* For backward compatibility */ |
| #define HTONL | ( | nl | ) |
| #define HTONS | ( | ns | ) |
| #define IPPORT_RESERVED 0xffff /* No reserved port numbers */ |
| int accept | ( | int | sockfd, |
| struct sockaddr * | addr, | ||
| socklen_t * | addrlen | ||
| ) |
requests a connection to be made on a socket
| [in] | sockfd | the file descriptor associated with the socket. |
| [in,out] | addr | null or pointer to a sockaddr structure where the address of the connecting socket will be returned |
| [in,out] | addrlen | on input specifies the length of the supplied sockaddr structure, and on output specifies the length of the stored address. |
| int bind | ( | int | sockfd, |
| FAR const struct sockaddr * | addr, | ||
| socklen_t | addrlen | ||
| ) |
assigns an address to an unnamed socket.
| [in] | sockfd | the file descriptor of the socket to be bound. |
| [in] | addr | pointer to a sockaddr structure containing the address to be bound to the socket |
| [in] | addrlen | the length of the sockaddr structure |
| int closesocket | ( | int | s | ) |
close a socket
| [in] | s | the file descriptor of the socket |
| int connect | ( | int | sockfd, |
| FAR const struct sockaddr * | addr, | ||
| socklen_t | addrlen | ||
| ) |
requests a connection to be made on a socket
| [in] | sockfd | the file descriptor associated with the socket. |
| [in] | addr | pointer to a sockaddr structure containing the peer address |
| [in] | addrlen | the length of the sockaddr structure |
| EXTERN FAR char* ether_ntoa | ( | FAR const struct ether_addr * | addr | ) |
ether_ntoa() function converts the Ethernet host address addr given in network byte order to a string in standard hex-digits-and-colons notation.
| [in] | addr | is the Ethernet host address addr given in network byte order |
| void freeaddrinfo | ( | FAR struct addrinfo * | ai | ) |
freeaddrinfo() frees the memory allocated by the getaddrinfo() function.
| [in] | ai | is the head of the addrinfo list |
| int getaddrinfo | ( | const char * | host, |
| const char * | service, | ||
| const struct addrinfo * | hints, | ||
| struct addrinfo ** | res | ||
| ) |
getaddrinfo() is a function that returns information on a particular host name (such as its IP address) and loads up a struct sockaddr.
| [in] | host | can be either a domain name or NULL |
| [in] | service | can be a port number passed as string or a service name |
| [in] | hints | can be either NULL or an addrinfo structure with the type of service requested |
| [in] | res | is a pointer that points to a new addrinfo structure |
| FAR struct hostent* gethostbyaddr | ( | FAR const void * | addr, |
| socklen_t | len, | ||
| int | type | ||
| ) |
gethostbyaddr() is the function returns a corresponding hostname with given IP addresses
| [in] | *addr | host address sending DNS server (e.g., 192.168.0.0) |
| FAR struct hostent* gethostbyname | ( | FAR const char * | name | ) |
gethostbyname() is the function sending DNS query to DNS server with hostname
| [in] | *name | hostname sending DNS server (e.g., www.samsung.com) |
| int getpeername | ( | int | s, |
| struct sockaddr * | name, | ||
| socklen_t * | namelen | ||
| ) |
get the name of the peer socket
| [in] | s | the file descriptor associated with the socket. |
| [in,out] | name | null or pointer to a sockaddr structure where the address of the peer socket will be returned |
| [in,out] | namelen | on input specifies the length of the supplied sockaddr structure, and on output specifies the length of the stored address. |
| int getsockname | ( | int | sockfd, |
| FAR struct sockaddr * | addr, | ||
| FAR socklen_t * | addrlen | ||
| ) |
get the socket name
| [in] | sockfd | the file descriptor associated with the socket. |
| [in,out] | addr | null or pointer to a sockaddr structure where the address of the local socket will be returned |
| [in,out] | addrlen | on input specifies the length of the supplied sockaddr structure, and on output specifies the length of the stored address. |
| int getsockopt | ( | int | sockfd, |
| int | level, | ||
| int | option, | ||
| FAR void * | value, | ||
| FAR socklen_t * | value_len | ||
| ) |
get the socket options
| [in] | sockfd | the file descriptor of the socket |
| [in] | level | the protocol level at which the option resides |
| [in] | option | a single option to be retrieved |
| [out] | value | pointer to value of the option retrieved |
| [out] | value_len | the length of the value retrieved |
| uint32_t htonl | ( | uint32_t | hl | ) |
Convert the unsigned integer hostlong from host byte order to network byte order.
| [in] | hl | hostlong |
| uint16_t htons | ( | uint16_t | hs | ) |
Convert the unsigned short integer hostshort from host byte order to network byte order.
| [in] | hs | hostshort |
| in_addr_t inet_addr | ( | FAR const char * | cp | ) |
Convert the Internet host address from the IPv4 numbers-and-dots notation into binary data in network byte order.
| [in] | cp | the Internet host address |
| int inet_aton | ( | FAR const char * | cp, |
| FAR struct in_addr * | inp | ||
| ) |
Convert the Internet host address from the IPv4 numbers-and-dots notation into binary form.
| [in] | cp | the Internet host address |
| [in] | inp | structure that will store the converted value (IPv4 numbers-and-dots notation) |
| int listen | ( | int | sockfd, |
| int | backlog | ||
| ) |
listen for socket connections and limit the queue of incoming connections
| [in] | sockfd | the file descriptor associated with the socket. |
| [in] | backlog | the number of outstanding connections in the socket's listen queue |
| uint32_t ntohl | ( | uint32_t | nl | ) |
Convert the unsigned integer netlong from network byte order to host byte order.
| [in] | nl | netlong |
| uint16_t ntohs | ( | uint16_t | ns | ) |
Convert the unsigned short integer netshort from network byte order to host byte order.
| [in] | ns | netshort |
| ssize_t recv | ( | int | sockfd, |
| FAR void * | buf, | ||
| size_t | len, | ||
| int | flags | ||
| ) |
send a message on a socket
| [in] | sockfd | the file descriptor associated with the socket. |
| [out] | buf | Points to a buffer where the message should be stored |
| [out] | len | the length in bytes of the buffer |
| [in] | flags | the type of message reception. |
| ssize_t recvfrom | ( | int | sockfd, |
| FAR void * | buf, | ||
| size_t | len, | ||
| int | flags, | ||
| FAR struct sockaddr * | from, | ||
| FAR socklen_t * | fromlen | ||
| ) |
receive a message from a socket
| [in] | sockfd | the file descriptor associated with the socket. |
| [out] | buf | Pointer to the buffer where the message should be stored. |
| [out] | len | the length of the message in bytes. |
| [in] | flags | the type of message reception |
| [in,out] | from | A null pointer, or pointer to sockaddr structure in which the sending address is to be stored |
| [in,out] | fromlen | null or the length of the sockaddr structure |
| ssize_t send | ( | int | sockfd, |
| FAR const void * | buf, | ||
| size_t | len, | ||
| int | flags | ||
| ) |
send a message on a socket
| [in] | sockfd | the file descriptor associated with the socket. |
| [in] | buf | Pointer to the buffer containing the message to send. |
| [in] | len | the length of the message in bytes. |
| [in] | flags | the type of message transmission |
| ssize_t sendto | ( | int | sockfd, |
| FAR const void * | buf, | ||
| size_t | len, | ||
| int | flags, | ||
| FAR const struct sockaddr * | to, | ||
| socklen_t | tolen | ||
| ) |
send a message on a socket
| [in] | sockfd | the file descriptor associated with the socket. |
| [in] | buf | Pointer to the buffer containing the message to send. |
| [in] | len | the length of the message in bytes. |
| [in] | flags | the type of message transmission |
| [in] | to | pointer to a sockaddr structure containing the destination address |
| [in] | tolen | the length of the sockaddr structure |
| int setsockopt | ( | int | sockfd, |
| int | level, | ||
| int | option, | ||
| FAR const void * | value, | ||
| socklen_t | value_len | ||
| ) |
set the socket options
| [in] | sockfd | the file descriptor of the socket |
| [in] | level | the protocol level |
| [in] | option | the option to be set for the socket |
| [in] | value | pointer to value of the option |
| [in] | value_len | the length of the value |
| int shutdown | ( | int | sockfd, |
| int | how | ||
| ) |
shut down socket send and receive operations
| [in] | sockfd | the file descriptor of the socket |
| [in] | how | the type of shutdown |
| int socket | ( | int | domain, |
| int | type, | ||
| int | protocol | ||
| ) |
creates an unbound socket in a communications domain.
| [in] | domain | the communications domain in which a socket is to be created. |
| [in] | type | the type of socket to be created |
| [in] | protocol | the protocol to be used with the socket |