3 * $Id: ident.h,v 1.1 1999/10/04 21:41:58 mdw Exp $
5 * Nonblocking RFC931 client
7 * (c) 1999 Mark Wooding
10 /*----- Licensing notice --------------------------------------------------*
12 * This file is part of the mLib utilities library.
14 * mLib is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU Library General Public License as
16 * published by the Free Software Foundation; either version 2 of the
17 * License, or (at your option) any later version.
19 * mLib is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU Library General Public License for more details.
24 * You should have received a copy of the GNU Library General Public
25 * License along with mLib; if not, write to the Free
26 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
30 /*----- Revision history --------------------------------------------------*
33 * Revision 1.1 1999/10/04 21:41:58 mdw
34 * Added ident client from `fw'.
45 /*----- Header files ------------------------------------------------------*/
47 #include <sys/types.h>
48 #include <sys/socket.h>
49 #include <netinet/in.h>
50 #include <arpa/inet.h>
64 /*----- Data structures ---------------------------------------------------*/
66 /* --- Parsed response from ident server --- */
68 typedef struct ident_reply {
69 unsigned short sport, dport; /* Source and destination ports */
70 unsigned type; /* Type of reply from server */
73 char *os; /* Operating system name */
74 char *user; /* User name */
76 char *error; /* Error message from server */
80 /* --- Response type codes --- */
88 /* --- Request structure --- */
90 typedef struct ident_request {
91 struct sockaddr_in local, remote;
93 void (*func)(ident_reply */*i*/, void */*p*/);
106 /*----- Functions provided ------------------------------------------------*/
108 /* --- @ident_abort@ --- *
110 * Arguments: @ident_request *rq@ = pointer to request block
114 * Use: Cancels an ident request in progress.
117 extern void ident_abort(ident_request */*rq*/);
121 * Arguments: @ident_request *rq@ = pointer to request block
122 * @sel_state *s@ = I/O multiplexor
123 * @const struct sockaddr_in *local, *remote@ = addresses
124 * @void (*func)(ident_reply *i, void *p)@ = handler function
125 * @void *p@ = argument for handler
129 * Use: Initializes an ident request.
132 extern void ident(ident_request */*rq*/, sel_state */*s*/,
133 const struct sockaddr_in */*local*/,
134 const struct sockaddr_in */*remote*/,
135 void (*/*func*/)(ident_reply */*i*/, void */*p*/),
138 /* --- @ident_socket@ --- *
140 * Arguments: @ident_request *rq@ = pointer to request block
141 * @sel_state *s@ = I/O multiplexor
142 * @int sk@ = connected socket file descriptor
143 * @void (*func)(ident_reply *i, void *p)@ = handler function
144 * @void *p@ = argument for handler
148 * Use: An alternative interface to @ident@. Initializes an ident
149 * request from a connected socket, rather than from an explicit
150 * address. This will call @getsockname@ and @getpeername@ to
151 * find out what the socket is actually connected to, which adds
152 * convenience but wastes time.
155 extern void ident_socket(ident_request */*rq*/, sel_state */*s*/, int /*sk*/,
156 void (*/*func*/)(ident_reply */*i*/, void */*p*/),
159 /*----- That's all, folks -------------------------------------------------*/