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