xref: /titanic_41/usr/src/lib/libresolv2/include/irp.h (revision 1816cb7076d3ec8a78ef9ac9f895574e13c43645)
1 /*
2  * Copyright 2003 by Sun Microsystems, Inc.	All rights reserved.
3  * Use is subject to license terms.
4  *
5  */
6 
7 /*
8  * Copyright (c) 1999 by Internet Software Consortium.
9  *
10  * Permission to use, copy, modify, and distribute this software for any
11  * purpose with or without fee is hereby granted, provided that the above
12  * copyright notice and this permission notice appear in all copies.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
15  * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
16  * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
17  * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
18  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
19  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
20  * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
21  * SOFTWARE.
22  */
23 
24 /*
25  * $Id: irp.h,v 8.4 2003/05/02 05:56:21 marka Exp $
26  */
27 
28 #ifndef _IRP_H_INCLUDED
29 #define _IRP_H_INCLUDED
30 
31 #pragma ident	"%Z%%M%	%I%	%E% SMI"
32 
33 #define IRPD_TIMEOUT 30			/* seconds */
34 #define IRPD_MAXSESS 50			/* number of simultaneous sessions. */
35 #define IRPD_PORT 6660			/* 10 times the number of the beast. */
36 #define IRPD_PATH "/var/run/irpd"	/* af_unix socket path */
37 
38 /* If sets the environment variable IRPDSERVER to an IP address
39    (e.g. "192.5.5.1"), then that's the host the client expects irpd to be
40    running on. */
41 #define IRPD_HOST_ENV "IRPDSERVER"
42 
43 /* Protocol response codes.  */
44 #define IRPD_WELCOME_CODE 200
45 #define IRPD_NOT_WELCOME_CODE 500
46 
47 #define IRPD_GETHOST_ERROR 510
48 #define IRPD_GETHOST_NONE 210
49 #define IRPD_GETHOST_OK 211
50 #define IRPD_GETHOST_SETOK 212
51 
52 #define IRPD_GETNET_ERROR 520
53 #define IRPD_GETNET_NONE 220
54 #define IRPD_GETNET_OK 221
55 #define IRPD_GETNET_SETOK 222
56 
57 #define IRPD_GETUSER_ERROR 530
58 #define IRPD_GETUSER_NONE 230
59 #define IRPD_GETUSER_OK 231
60 #define IRPD_GETUSER_SETOK 232
61 
62 #define IRPD_GETGROUP_ERROR 540
63 #define IRPD_GETGROUP_NONE 240
64 #define IRPD_GETGROUP_OK 241
65 #define IRPD_GETGROUP_SETOK 242
66 
67 #define IRPD_GETSERVICE_ERROR 550
68 #define IRPD_GETSERVICE_NONE 250
69 #define IRPD_GETSERVICE_OK 251
70 #define IRPD_GETSERVICE_SETOK 252
71 
72 #define IRPD_GETPROTO_ERROR 560
73 #define IRPD_GETPROTO_NONE 260
74 #define IRPD_GETPROTO_OK 261
75 #define IRPD_GETPROTO_SETOK 262
76 
77 #define IRPD_GETNETGR_ERROR 570
78 #define IRPD_GETNETGR_NONE 270
79 #define IRPD_GETNETGR_OK 271
80 #define IRPD_GETNETGR_NOMORE 272
81 #define IRPD_GETNETGR_MATCHES 273
82 #define IRPD_GETNETGR_NOMATCH 274
83 #define IRPD_GETNETGR_SETOK 275
84 #define IRPD_GETNETGR_SETERR 276
85 
86 #define	irs_irp_read_body __irs_irp_read_body
87 #define irs_irp_read_response __irs_irp_read_response
88 #define irs_irp_disconnect __irs_irp_disconnect
89 #define irs_irp_connect __irs_irp_connect
90 #define irs_irp_connection_setup __irs_irp_connection_setup
91 #define irs_irp_send_command __irs_irp_send_command
92 
93 struct irp_p;
94 
95 char   *irs_irp_read_body(struct irp_p *pvt, size_t *size);
96 int	irs_irp_read_response(struct irp_p *pvt, char *text, size_t len);
97 void	irs_irp_disconnect(struct irp_p *pvt);
98 int	irs_irp_connect(struct irp_p *pvt);
99 int	irs_irp_is_connected(struct irp_p *pvt);
100 int	irs_irp_connection_setup(struct irp_p *cxndata, int *warned);
101 #ifdef	__GNUC__
102 int	irs_irp_send_command(struct irp_p *, const char *, ...)
103 			__attribute__((__format__(__printf__, 2, 3)));
104 #else
105 int	irs_irp_send_command(struct irp_p *pvt, const char *fmt, ...);
106 #endif
107 int	irs_irp_get_full_response(struct irp_p *pvt, int *code, char *text,
108 				  size_t textlen, char **body,
109 				  size_t *bodylen);
110 int	irs_irp_read_line(struct irp_p *pvt, char *buffer, int len);
111 
112 #endif
113