XgetDAGbyName(), XgetNamebyDAG(), XregisterName(), Xgetpeername(), Xgetsockname(), xia_ntop(), xia_pton() - network address management.
More...
#include "Xsocket.h"
|
const char * | xia_ntop (int af, const sockaddr_x *src, char *dst, socklen_t size) |
| convert a DAG from binary to text form More...
|
|
int | xia_pton (int af, const char *src, sockaddr_x *dst) |
| convert a DAG from binary to text form More...
|
|
int | _rquery (char *name, int namelen, const sockaddr_x *addr, char flags) |
|
int | _fquery (const char *name, sockaddr_x *addr, socklen_t *addrlen, char flags) |
|
int | XgetNamebyDAG (char *name, int namelen, const sockaddr_x *addr) |
| reverse lookup, find a name based on the specified network address More...
|
|
int | XgetHostIDbyDAG (char *name, int namelen, const sockaddr_x *addr) |
|
int | XgetAddrIDbyDAG (char *name, int namelen, const sockaddr_x *addr) |
|
int | XgetDAGbyName (const char *name, sockaddr_x *addr, socklen_t *addrlen) |
| lookup a DAG using a host or service name More...
|
|
int | XgetDAGbyHostID (const char *name, sockaddr_x *addr, socklen_t *addrlen) |
|
int | XgetDAGbyAddrID (const char *name, sockaddr_x *addr, socklen_t *addrlen) |
|
int | XregisterName (const char *name, sockaddr_x *DAG) |
| register a service or hostname with the name server More...
|
|
int | XregisterAddrID (const char *name, sockaddr_x *DAG) |
|
int | XregisterHostID (const char *name, sockaddr_x *DAG) |
|
int | Xgetpeername (int sockfd, struct sockaddr *addr, socklen_t *addrlen) |
| get name of connected peer socket More...
|
|
int | Xgetsockname (int sockfd, struct sockaddr *addr, socklen_t *addrlen) |
| get socket name More...
|
|
int _fquery |
( |
const char * |
name, |
|
|
sockaddr_x * |
addr, |
|
|
socklen_t * |
addrlen, |
|
|
char |
flags |
|
) |
| |
int _rquery |
( |
char * |
name, |
|
|
int |
namelen, |
|
|
const sockaddr_x * |
addr, |
|
|
char |
flags |
|
) |
| |
int XgetAddrIDbyDAG |
( |
char * |
name, |
|
|
int |
namelen, |
|
|
const sockaddr_x * |
addr |
|
) |
| |
int XgetDAGbyAddrID |
( |
const char * |
name, |
|
|
sockaddr_x * |
addr, |
|
|
socklen_t * |
addrlen |
|
) |
| |
int XgetDAGbyHostID |
( |
const char * |
name, |
|
|
sockaddr_x * |
addr, |
|
|
socklen_t * |
addrlen |
|
) |
| |
int XgetDAGbyName |
( |
const char * |
name, |
|
|
sockaddr_x * |
addr, |
|
|
socklen_t * |
addrlen |
|
) |
| |
Lookup the DAG associated with name.
The local hosts.xia file is checked first and if addr is not found, a query is sent to the nameserver.
- Note
- Xgetaddrinfo should be used rather than this function as it is very primative.
- Parameters
-
name | a test string representing the name of an XIA service or host |
addr | a sockaddr_x to received the address |
addrlen | pointer to the length of addr on call, contains actual length on return |
- Returns
- 0 with addr filled in and addrlen specifying the length of addr
-
NULL on failure with errno set appropriately
int XgetHostIDbyDAG |
( |
char * |
name, |
|
|
int |
namelen, |
|
|
const sockaddr_x * |
addr |
|
) |
| |
int XgetNamebyDAG |
( |
char * |
name, |
|
|
int |
namelen, |
|
|
const sockaddr_x * |
addr |
|
) |
| |
Performs a reverse name lookup to find the name associated with addr.
The local hosts.xia file is checked first and if name is not found, a query is sent to the nameserver.
- Parameters
-
name | pointer to menory that will contain the returned name |
namlen | the size of name |
addr | the network address to lookup |
- Returns
- 0 with name filled in with a null terminted string. If name is not long enough, the returned name will be truncated.
-
-1 on failure with errno set appropraitely
int Xgetpeername |
( |
int |
sockfd, |
|
|
struct sockaddr * |
addr, |
|
|
socklen_t * |
addrlen |
|
) |
| |
This function returns the address of the peer connected to the Xsocket sockfd, in the buffer pointed to by addr.
- Note
- See the man page for the standard getpeername() call for more details.
- Parameters
-
sockfd | a connected Xsocket |
dag | A sockaddr to hold the returned DAG |
len | On input contans the size of the sockaddr on output contains sizeof(sockaddr_x). |
- Returns
- 0 on success
-
-1 on failure with errno set
-
errno = EFAULT if dag is NULL
-
errno = EOPNOTSUPP if sockfd is not of type XSSOCK_STREAM
-
errno = ENOTCONN if sockfd is not in a connected state
int Xgetsockname |
( |
int |
sockfd, |
|
|
struct sockaddr * |
addr, |
|
|
socklen_t * |
addrlen |
|
) |
| |
Returns the current address to which the socket sockfd is bound, in the buffer pointed to by addr.
- Note
- See the man page for the standard getsockname() call for more details.
- Parameters
-
sockfd | An Xsocket |
dag | A sockaddr_x to hold the returned DAG. |
len | On input contans the size of the addr, on output contains sizeof(sockaddr_x). |
- Returns
- 0 on success
-
-1 on failure with errno set
-
errno = EFAULT if dag is NULL
-
errno = EOPNOTSUPP if sockfd is not an Xsocket
const char* xia_ntop |
( |
int |
af, |
|
|
const sockaddr_x * |
src, |
|
|
char * |
dst, |
|
|
socklen_t |
size |
|
) |
| |
This function converts the network address structure src in the AF_XIA address family into a character string. The resulting string is copied to the buffer pointed to by dst, which must be a non-null pointer. The caller specifies the number of bytes available in this buffer in the argument size.
The returned text is formatted in the DAG text string format.
- Parameters
-
af | family (must be AF_XIA) |
src | DAG to convert |
dst | buffer to hold the converted address |
size | length of dst |
- Returns
- non-null pointer to dst on success
-
NULL with errno set on failure.
int xia_pton |
( |
int |
af, |
|
|
const char * |
src, |
|
|
sockaddr_x * |
dst |
|
) |
| |
This function converts the character string src into an XIA network address structure, then copies the network address structure to dst.
- Parameters
-
af | family (must be AF_XIA) |
src | text representation of the DAG to convert. Can be, DAG, RE, or HTTP formatted |
dst | destination |
- Returns
- 1 on success (network address was successfully converted)
-
0 if src does not contain a character string representing a valid network address
-
-1 with errno set to EAFNOSUPPORT If af is not AF_XIA
int XregisterAddrID |
( |
const char * |
name, |
|
|
sockaddr_x * |
DAG |
|
) |
| |
int XregisterHostID |
( |
const char * |
name, |
|
|
sockaddr_x * |
DAG |
|
) |
| |
int XregisterName |
( |
const char * |
name, |
|
|
sockaddr_x * |
DAG |
|
) |
| |
Register a host or service name with the XIA nameserver.
- Note
- this function does not currently check to ensure that the client is allowed to bind to name.
- Parameters
-
name | the name of an XIA service or host |
DAG | the DAG to be bound to name |
- Returns
- 0 on success
-
-1 on failure with errno set