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