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