whoson(3)
NAME
wso_login, wso_logout, wso_query, wso_version - API func
tions to access whoson database
SYNOPSYS
#include <whoson.h>
int wso_login(char *addr, char *name, char *retbuf, int
buflen)
int wso_logout(char *addr, char *retbuf, int buflen)
int wso_query(char *addr, char *retbuf, int buflen)
char *wso_version(void)
DESCRIPTION
wso_login() adds an entry to the whoson database (or
replaces existing entry with the same key)
wso_logout() deletes entry from the database
wso_query() requests the database entry
wso_version() returns the character string with the ver
sion number of the API and build date.
addr is the IP address of the remote system specified as a
character string in dotted quad notation (e.g.
"123.45.67.89"), and name is the user accounting informa
tion (e.g. userid). Upon completion, wso_login()
wso_logout() and wso_query() return integer return code,
and the buffer retbuf is filled with relevant information.
Return code -1 means that the request could not be com
pleted, return code 0 or +1 mean that the request was suc
cessfully completed. For wso_query() function, return
code 0 means that the requested address is present in the
database. In this case, retbuf may contain the data that
was previously passed to the wso_login() with the same
addr value in the name parameter. In other cases, retbuf
may or may not contain description of the situation, e.g.
the text "Access denied" or "Not found" or something like
that. If retbuf parameter is NULL or buflen is zero, no
attempt is made to fill the buffer.
Normally, when filling the database, you can blindly call
wso_login() (and wso_logout() if appropriate) and ignore
the return code. When querying the database, return code
0 means that the address is in the database, return code
+1 means that the address is not in the database, and
return code -1 means that the information is unavailable
or inaccessable.
The file /etc/whoson.conf(5) defines how the API functions
should contact the whosond(8) server.
COPYRIGHT
Public domain