fixes init script for non ipv6 enabled systems #472755
[packages/xinetd.git] / xinetd / int.h
1 /*
2  * (c) Copyright 1992 by Panagiotis Tsirigotis
3  * (c) Sections Copyright 1998-2001 by Rob Braun
4  * All rights reserved.  The file named COPYRIGHT specifies the terms 
5  * and conditions for redistribution.
6  */
7
8 #ifndef INT_H
9 #define INT_H
10
11 /*
12  * $Id: int.h,v 1.1.1.1 2003/02/19 17:29:28 bbraun Exp $
13  */
14
15 #include <sys/types.h>
16 #include <netinet/in.h>
17
18 #include "pset.h"
19 #include "defs.h"
20 #include "server.h"
21
22 typedef enum { GOOD_CHANNEL, BAD_CHANNEL } channel_state_e ;
23
24 struct channel
25 {
26    channel_state_e      ch_state ;
27    union xsockaddr      ch_from ;
28    int                  ch_local_socket ;
29    int                  ch_remote_socket ;
30 } ;
31
32 typedef struct channel channel_s ;
33
34 #define CHP( p )                 ((struct channel *)(p))
35
36 #define CHANNEL_NULL             CHP( NULL )
37
38 #define NEW_CHANNEL()            NEW( channel_s )
39 #define FREE_CHANNEL( chp )      FREE( chp )
40
41
42 struct intercept_common
43 {
44    bool_int             ic_intercept ;
45    int                  ic_remote_socket ;
46    union xsockaddr      ic_local_addr ;
47    pset_h               ic_connections ;
48    struct server        ic_server ;
49 } ;
50
51
52 struct intercept_ops
53 {
54    void (*mux)() ;
55    void (*exit)() ;
56 } ;
57
58
59 struct intercept_s
60 {
61    int                        int_socket_type ;
62    struct intercept_common    int_common ;
63    void                      *int_priv ;
64    const struct intercept_ops *int_ops ;
65 } ;
66
67 #define INT_SERVER( p )              (&(p)->int_common.ic_server)
68 #define INT_LOCALADDR( p )           (&(p)->int_common.ic_local_addr)
69 #define INT_REMOTE( p )              ((p)->int_common.ic_remote_socket)
70 #define INT_CONNECTIONS( p )         ((p)->int_common.ic_connections)
71 #define INTERCEPT( p )               ((p)->int_common.ic_intercept)
72
73 void intercept(struct server *serp);
74 void int_sighandler(int sig);
75
76 #endif   /* INT_H */