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