YAZ User's Guide and Reference
Prev | Chapter 9. The COMSTACK Module | Next

# Addresses

The low-level format of the addresses are different depending on the mode of communication you have chosen. A function is provided by each of the lower layers to map a user-friendly string-form address to the binary form required by the lower layers.

        void *cs_straddr(COMSTACK handle, const char *str);

The format for TCP/IP addresses is straightforward:

        <host> [ ':' <portnum> ]

The `hostname` can be either a domain name or an IP address. The port number, if omitted, defaults to 210.

In all transport modes, the special hostname "@" is mapped to any local address (the manifest constant `INADDR_ANY`). It is used to establish local listening endpoints in the server role.

When a connection has been established, you can use

        char *cs_addrstr(COMSTACK h);

to retrieve the host name of the peer system. The function returns a pointer to a static area, which is overwritten on the next call to the function.

A fairly recent addition to the COMSTACK module is the utility function

        COMSTACK cs_create_host (const char *str, int blocking, void **vp);

which is just a wrapper around `cs_create` and `cs_straddr`. The `str` is similar to that described for `cs_straddr` but with a prefix denoting the COMSTACK type. Prefixes supported are `tcp:` and `ssl:` for TCP/IP and SSL respectively. If no prefix is given, then TCP/IP is used. The `blocking` is passed to function `cs_create`. The third parameter `vp` is a pointer to COMSTACK stack type specific values. For SSL (ssl_type) `vp` is an already create OpenSSL CTX. For TCP/IP `vp` is unused (can be set to `NULL`.

Prev | Home | Next
Server Side | Up | Diagnostics