There are three kinds of lists liblx uses: host lists, which are lists of host addresses such as are returned by ListHosts requests; string lists, such as are returned by ListExtensions requests; and resource (LX_XID) lists, such as are returned by ListInstalledColormaps requests. Each one has its own opaque type and suite of functions. For each kind of list, entry indices range from 0 to one less than the number of entries in the list. Host lists use LX_HOSTLIST. A host list entry is characterized by a type, a data blob size, and a data blob. (The size can vary from entry to entry, though for most types it depends on only the type.) It is up to the application to interpret the pair appropriately for the type. String lists use LX_STRLIST. A string list entry is characterized by its length and its data. As a convenience for cases where the string does not contain embedded NULs (which is most uses of LX_STRLISTs), the data always has a '\0' appended to what the server returned; this is not included in the length. Resource lists use LX_XIDLIST. A resource list entry is just an LX_XID. The functions for each of these are named with strings beginning with lx_hostlist, lx_strlist, or lx_XIDlist, as appropriate for the list type in question. lx_hostlist_free ---------------- void lx_hostlist_free(LX_HOSTLIST *hl) Frees the LX_HOSTLIST and everything it points to. lx_hostlist_entries ------------------- int lx_hostlist_entries(const LX_HOSTLIST *hl) Returns the number of entries on the LX_HOSTLIST. Valid index values to the lx_hostlist_entry_* functions range from 0 to one less than this value. lx_hostlist_entry_type ---------------------- LX_HOSTTYPE lx_hostlist_entry_type(const LX_HOSTLIST *hl, int x) Returns the type of the entry with index x in hl. At this writing, LX_HOSTTYPE values can be LX_HOSTTYPE_IPv4 LX_HOSTTYPE_IPv6 LX_HOSTTYPE_DECnet LX_HOSTTYPE_Chaos LX_HOSTTYPE_Other LX_HOSTTYPE_Error For the first four, the pair describes an address in whatever form is appropriate for the protocol in question. Other is used for unrecognized host types; the type byte on the wire is prepended to the data blob on the wire to give the data blob visible through this API. Error is returned for out-of-range x values. lx_hostlist_entry_size ---------------------- int lx_hostlist_entry_size(const LX_HOSTLIST *hl, int x) Returns the data blob size for the entry with index x in hl. -1 is returned for out-of-range x values. lx_hostlist_entry_data ---------------------- const void *lx_hostlist_entry_data(const LX_HOSTLIST *hl, int x) Returns a pointer to the data blob for the entry with index x in hl. nil is returned for out-of-range x values. The pointed-to data remains valid until the LX_HOSTLIST is freed. As indicated by the const on the return value, the application must not try to write into the data blob. lx_strlist_free --------------- void lx_strlist_free(LX_STRLIST *sl) Frees the LX_STRLIST and everything it points to. lx_strlist_entries ------------------- int lx_strlist_entries(const LX_STRLIST *sl) Returns the number of entries on the LX_STRLIST. Valid index values to the lx_strlist_entry_* functions range from 0 to one less than this value. lx_strlist_entry_len -------------------- int lx_strlist_entry_len(const LX_STRLIST *sl, int x) Returns the length for the entry with index x in sl. As mentioned above, this does not include the '\0' appended by liblx. lx_strlist_entry_data --------------------- const void *lx_strlist_entry_data(const LX_STRLIST *sl, int x) Returns the string pointer for the entry with index x in sl. The pointed-to string remains valid until the LX_STRLIST is freed. As indicated by the const on the return vlaue, the application must not try to write into the string. lx_XIDlist_free --------------- void lx_XIDlist_free(LX_XIDLIST *xl) Frees the LX_XIDLIST and everything it points to. lx_XIDlist_entries ------------------- int lx_XIDlist_entries(const LX_XIDLIST *xl) Returns the number of entries on the LX_XIDLIST. Valid index values to the lx_XIDlist_entry_* functions range from 0 to one less than this value. lx_XIDlist_entry_id ------------------- LX_XID lx_XIDlist_entry_id(const LX_XIDLIST *xl, int x) Returns the list entry for index x in xl.