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