17c478bd9Sstevel@tonic-gate /*
2*9525b14bSRao Shoaib  * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
37c478bd9Sstevel@tonic-gate  * Copyright (c) 1999 by Internet Software Consortium.
47c478bd9Sstevel@tonic-gate  *
57c478bd9Sstevel@tonic-gate  * Permission to use, copy, modify, and distribute this software for any
67c478bd9Sstevel@tonic-gate  * purpose with or without fee is hereby granted, provided that the above
77c478bd9Sstevel@tonic-gate  * copyright notice and this permission notice appear in all copies.
87c478bd9Sstevel@tonic-gate  *
9*9525b14bSRao Shoaib  * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
10*9525b14bSRao Shoaib  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11*9525b14bSRao Shoaib  * MERCHANTABILITY AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR
12*9525b14bSRao Shoaib  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13*9525b14bSRao Shoaib  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14*9525b14bSRao Shoaib  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
15*9525b14bSRao Shoaib  * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
167c478bd9Sstevel@tonic-gate  */
177c478bd9Sstevel@tonic-gate 
187c478bd9Sstevel@tonic-gate /*
19*9525b14bSRao Shoaib  * $Id: irp.h,v 1.4 2005/04/27 04:56:15 sra Exp $
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate 
227c478bd9Sstevel@tonic-gate #ifndef _IRP_H_INCLUDED
237c478bd9Sstevel@tonic-gate #define _IRP_H_INCLUDED
247c478bd9Sstevel@tonic-gate 
25*9525b14bSRao Shoaib /*! \file */
267c478bd9Sstevel@tonic-gate 
27*9525b14bSRao Shoaib #define IRPD_TIMEOUT 30			/*%< seconds */
28*9525b14bSRao Shoaib #define IRPD_MAXSESS 50			/*%< number of simultaneous sessions. */
29*9525b14bSRao Shoaib #define IRPD_PORT 6660			/*%< 10 times the number of the beast. */
30*9525b14bSRao Shoaib #define IRPD_PATH "/var/run/irpd"	/*%< af_unix socket path */
317c478bd9Sstevel@tonic-gate 
327c478bd9Sstevel@tonic-gate /* If sets the environment variable IRPDSERVER to an IP address
337c478bd9Sstevel@tonic-gate    (e.g. "192.5.5.1"), then that's the host the client expects irpd to be
347c478bd9Sstevel@tonic-gate    running on. */
357c478bd9Sstevel@tonic-gate #define IRPD_HOST_ENV "IRPDSERVER"
367c478bd9Sstevel@tonic-gate 
377c478bd9Sstevel@tonic-gate /* Protocol response codes.  */
387c478bd9Sstevel@tonic-gate #define IRPD_WELCOME_CODE 200
397c478bd9Sstevel@tonic-gate #define IRPD_NOT_WELCOME_CODE 500
407c478bd9Sstevel@tonic-gate 
417c478bd9Sstevel@tonic-gate #define IRPD_GETHOST_ERROR 510
427c478bd9Sstevel@tonic-gate #define IRPD_GETHOST_NONE 210
437c478bd9Sstevel@tonic-gate #define IRPD_GETHOST_OK 211
447c478bd9Sstevel@tonic-gate #define IRPD_GETHOST_SETOK 212
457c478bd9Sstevel@tonic-gate 
467c478bd9Sstevel@tonic-gate #define IRPD_GETNET_ERROR 520
477c478bd9Sstevel@tonic-gate #define IRPD_GETNET_NONE 220
487c478bd9Sstevel@tonic-gate #define IRPD_GETNET_OK 221
497c478bd9Sstevel@tonic-gate #define IRPD_GETNET_SETOK 222
507c478bd9Sstevel@tonic-gate 
517c478bd9Sstevel@tonic-gate #define IRPD_GETUSER_ERROR 530
527c478bd9Sstevel@tonic-gate #define IRPD_GETUSER_NONE 230
537c478bd9Sstevel@tonic-gate #define IRPD_GETUSER_OK 231
547c478bd9Sstevel@tonic-gate #define IRPD_GETUSER_SETOK 232
557c478bd9Sstevel@tonic-gate 
567c478bd9Sstevel@tonic-gate #define IRPD_GETGROUP_ERROR 540
577c478bd9Sstevel@tonic-gate #define IRPD_GETGROUP_NONE 240
587c478bd9Sstevel@tonic-gate #define IRPD_GETGROUP_OK 241
597c478bd9Sstevel@tonic-gate #define IRPD_GETGROUP_SETOK 242
607c478bd9Sstevel@tonic-gate 
617c478bd9Sstevel@tonic-gate #define IRPD_GETSERVICE_ERROR 550
627c478bd9Sstevel@tonic-gate #define IRPD_GETSERVICE_NONE 250
637c478bd9Sstevel@tonic-gate #define IRPD_GETSERVICE_OK 251
647c478bd9Sstevel@tonic-gate #define IRPD_GETSERVICE_SETOK 252
657c478bd9Sstevel@tonic-gate 
667c478bd9Sstevel@tonic-gate #define IRPD_GETPROTO_ERROR 560
677c478bd9Sstevel@tonic-gate #define IRPD_GETPROTO_NONE 260
687c478bd9Sstevel@tonic-gate #define IRPD_GETPROTO_OK 261
697c478bd9Sstevel@tonic-gate #define IRPD_GETPROTO_SETOK 262
707c478bd9Sstevel@tonic-gate 
717c478bd9Sstevel@tonic-gate #define IRPD_GETNETGR_ERROR 570
727c478bd9Sstevel@tonic-gate #define IRPD_GETNETGR_NONE 270
737c478bd9Sstevel@tonic-gate #define IRPD_GETNETGR_OK 271
747c478bd9Sstevel@tonic-gate #define IRPD_GETNETGR_NOMORE 272
757c478bd9Sstevel@tonic-gate #define IRPD_GETNETGR_MATCHES 273
767c478bd9Sstevel@tonic-gate #define IRPD_GETNETGR_NOMATCH 274
777c478bd9Sstevel@tonic-gate #define IRPD_GETNETGR_SETOK 275
787c478bd9Sstevel@tonic-gate #define IRPD_GETNETGR_SETERR 276
797c478bd9Sstevel@tonic-gate 
807c478bd9Sstevel@tonic-gate #define	irs_irp_read_body __irs_irp_read_body
817c478bd9Sstevel@tonic-gate #define irs_irp_read_response __irs_irp_read_response
827c478bd9Sstevel@tonic-gate #define irs_irp_disconnect __irs_irp_disconnect
837c478bd9Sstevel@tonic-gate #define irs_irp_connect __irs_irp_connect
847c478bd9Sstevel@tonic-gate #define irs_irp_connection_setup __irs_irp_connection_setup
857c478bd9Sstevel@tonic-gate #define irs_irp_send_command __irs_irp_send_command
867c478bd9Sstevel@tonic-gate 
877c478bd9Sstevel@tonic-gate struct irp_p;
887c478bd9Sstevel@tonic-gate 
89*9525b14bSRao Shoaib char   *irs_irp_read_body(struct irp_p *, size_t *);
90*9525b14bSRao Shoaib int	irs_irp_read_response(struct irp_p *, char *, size_t);
91*9525b14bSRao Shoaib void	irs_irp_disconnect(struct irp_p *);
92*9525b14bSRao Shoaib int	irs_irp_connect(struct irp_p *);
93*9525b14bSRao Shoaib int	irs_irp_is_connected(struct irp_p *);
94*9525b14bSRao Shoaib int	irs_irp_connection_setup(struct irp_p *, int *);
95*9525b14bSRao Shoaib #ifdef __GNUC__
967c478bd9Sstevel@tonic-gate int	irs_irp_send_command(struct irp_p *, const char *, ...)
97*9525b14bSRao Shoaib 			     __attribute__((__format__(__printf__, 2, 3)));
987c478bd9Sstevel@tonic-gate #else
99*9525b14bSRao Shoaib int	irs_irp_send_command(struct irp_p *, const char *, ...);
1007c478bd9Sstevel@tonic-gate #endif
101*9525b14bSRao Shoaib int	irs_irp_get_full_response(struct irp_p *, int *, char *, size_t,
102*9525b14bSRao Shoaib 				  char **, size_t *);
103*9525b14bSRao Shoaib int	irs_irp_read_line(struct irp_p *, char *, int);
1047c478bd9Sstevel@tonic-gate 
1057c478bd9Sstevel@tonic-gate #endif
106*9525b14bSRao Shoaib 
107*9525b14bSRao Shoaib /*! \file */
108