@@@ wip type definitions in manpage synopses
[mLib] / sel / ident.3
CommitLineData
83856dde 1.\" -*-nroff-*-
fbf20b5b 2.TH ident 3 "2 October 1999" "Straylight/Edgeware" "mLib utilities library"
83856dde 3.SH "NAME"
4ident \- identd (RFC931) client
5.\" @ident_abort
6.\" @ident
7.\" @ident_socket
8.SH "SYNOPSIS"
9.nf
10.B "#include <mLib/ident>"
11
4729aa69
MW
12.B "typedef struct { ...\& } ident_request;"
13
14.B "enum ["
15.B "\h'4n'IDENT_USERID = ...,"
16.B "\h'4n'IDENT_ERROR = ...,"
17.B "\h'4n'IDENT_BAD = ..."
18.B "};"
19
20.B "typedef struct {"
21.B "\h'4n'unsigned short sport, dport;"
22.B "\h'4n'unsigned type;"
23.B "\h'4n'union {"
24.B "\h'8n'struct { char *os, *user; } userid;"
25.B "\h'8n'char *error;"
26.B "\h'4n'} u;"
27.B "} ident_reply;"
28
83856dde 29.BI "void ident_abort(ident_request *" rq );
2b1924c2
MW
30.ds mT \fBvoid ident(
31.BI "\*(mTident_request *" rq ", sel_state *" s ,
32.BI "\h'\w'\*(mT'u'const struct sockaddr_in *" local ,
33.BI "\h'\w'\*(mT'u'const struct sockaddr_in *" remote ,
34.BI "\h'\w'\*(mT'u'void (*" func ")(ident_reply *" i ", void *" p ),
35.BI "\h'\w'\*(mT'u'void *" p );
36.ds mT \fBvoid ident_socket(
37.BI "\*(mTident_request *" rq ", sel_state *" s ", int " sk ,
38.BI "\h'\w'\*(mT'u'void (*" func ")(ident_reply *" i ", void *" p ),
39.BI "\h'\w'\*(mT'u'void *" p );
83856dde 40.fi
41.SH "DESCRIPTION"
42The
43.B ident.h
44header defines some types and functions which implement an ident client
45(as specified by RFC931).
46.PP
47The state of an ident request in progress is represented in an object of
48type
49.BR ident_request ,
50a structure type whose layout is unspecified. Storage for these objects
51is provided by the caller.
52.PP
53The primary interface for starting an ident request is the
54.B ident
55function. It takes a number of arguments:
56.TP
57.BI "ident_request *" rq
58Pointer to the client request block which is to maintain the state of
59the request as it progresses. This must not be discarded while the
60request is in progress, for obvious reasons.
61.TP
62.BI "sel_state *" s
63Pointer to an I/O multiplexor. See
64.BR sel (3)
65for more information about the I/O multiplexing system.
66.TP
67.BI "struct sockaddr_in *" local ", *" remote
68The local and remote socket addresses describing the connection to be
69enquired about. The local address is not optional. If you don't have
70it handy, you can use
71.B ident_socket
72described below.
73.TP
74.BI "void (*" func ")(ident_reply *" i ", void *" p )
75The handler function to be called with the result of the ident request.
76The
77.B ident_reply
78structure is described in detail below.
79.TP
80.BI "void *" p
81A pointer argument to be supplied to the handler function.
82.PP
83The
84.B ident_socket
85function provides an alternative interface to setting up an ident
86request. Instead of the local and remote socket addresses, the function
87works out the local and remote addresses from a socket file descriptor
88provided as an argument.
89.PP
90The handler function is provided the results in a structure of type
91.BR ident_reply .
92The pointer may be null if there was a problem connecting to the server;
93in this case, the global
94.B errno
95variable describes the problem in its usual inimitable way.
96.PP
97The reply structure contains the following members:
98.TP
99.B "unsigned short sport, dport"
100The source and destination ports, as seen from the point of view of the
101server. These should match up with the ports in the request structure.
102.TP
103.B "unsigned type"
104The type of response received from the server. There are three possible
105values:
106.B IDENT_USERID
107indicates that the server specified a userid and operating system name;
108.B IDENT_ERROR
109indicates that the server reported an error message; and
110.B IDENT_BAD
111indicates that the server's response was invalid.
112.TP
113.B "char *u.userid.os"
114The name of the remote operating system; only valid if
115.B type
116has the value
117.BR IDENT_USERID .
118.TP
119.B "char *u.userid.user"
120The name of the remote user; only valid if
121.B type
122has the value
123.BR IDENT_USERID .
124.TP
125.B "char *u.error"
126The error message reported by the server; only valid if
127.B type
128has the value
129.BR IDENT_ERROR .
130.PP
131An ident request in progress can be aborted by calling
132.B ident_abort
133on the request block. In this case, no notification is made to the
134handler function.
135.SH "SEE ALSO"
136.BR sel (3),
137.BR mLib (3).
138.SH "AUTHOR"
9b5ac6ff 139Mark Wooding, <mdw@distorted.org.uk>