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