/[svn]/vendor/pxys2-2.1.0/libopas/opas/opas.h
ViewVC logotype

Annotation of /vendor/pxys2-2.1.0/libopas/opas/opas.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3253 - (hide annotations)
Wed Apr 2 20:46:18 2014 UTC (7 years ago) by michael
File MIME type: text/x-csrc
File size: 5655 byte(s)
- Imported pxys2-2.1.0

1 michael 3253 /* Copyright (C) 2003 Stephane Thiell
2     *
3     * This file is part of libopas (from pxys)
4     *
5     * This program is free software; you can redistribute it and/or
6     * modify it under the terms of the GNU General Public License
7     * as published by the Free Software Foundation; either version 2
8     * of the License, or (at your option) any later version.
9     *
10     * This program is distributed in the hope that it will be useful,
11     * but WITHOUT ANY WARRANTY; without even the implied warranty of
12     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13     * GNU General Public License for more details.
14     *
15     * You should have received a copy of the GNU General Public License
16     * along with this program; if not, write to the Free Software
17     * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18     *
19     * $Id: opas.h,v 1.2 2006/09/06 10:11:32 spale Exp $
20     */
21     #ifndef INCLUDED_OPAS_OPAS_H
22     #define INCLUDED_OPAS_OPAS_H
23    
24     #include <opas/opas_msg.h>
25     #include <opas/opas_stdint.h>
26    
27     #include <sys/types.h>
28     #include <sys/socket.h>
29     #include <netinet/in.h>
30    
31     /* OPAS proxy types ...
32     */
33     enum opas_proxy_type_t
34     {
35     OPAS_TYPE_UNKNOWN = 0,
36     OPAS_PROXY_TYPE_WINGATE = 1,
37     OPAS_PROXY_TYPE_SOCKS4 = 2,
38     OPAS_PROXY_TYPE_SOCKS5 = 3,
39     OPAS_PROXY_TYPE_HTTPPROXY = 4,
40     OPAS_PROXY_TYPE_HTTPPOST = 5,
41     OPAS_PROXY_TYPE_CISCOROUTER = 6,
42     OPAS_PROXY_TYPE_IRCBOUNCER = 7,
43     OPAS_PROXY_TYPE_HTTPGET = 8
44     };
45    
46     enum
47     {
48     OPAS_FLAG_ERRO = 1 << 8,
49     OPAS_FLAG_CACH = 1 << 9,
50     OPAS_FLAG_PROX = 1 << 10,
51     OPAS_FLAG_REPL = 1 << 11,
52     OPAS_FLAG_UMSG = 1 << 12,
53     OPAS_FLAG_IPV6 = 1 << 13,
54     OPAS_FLAG_PING = 1 << 14,
55     OPAS_FLAG_SERV = 1 << 15
56     };
57    
58     enum
59     {
60     OPAS_ERROR_UNKNOWN = 0,
61     OPAS_ERROR_NETDOWN = 1,
62     OPAS_ERROR_NETUNREACH = 2
63     };
64    
65     typedef struct opas_session_s * opas_session_t;
66    
67     typedef void (*opas_send_func)(const void *data, uint32_t length, void *uptr);
68    
69     typedef void (*opas_query_callback)(struct opas_msg_query *queryp,
70     void *context);
71     typedef void (*opas_query6_callback)(struct opas_msg_query6 *queryp,
72     void *context);
73     typedef void (*opas_reply_noproxy_callback)(struct opas_msg_query *replyp,
74     void *context);
75     typedef void (*opas_reply6_noproxy_callback)(struct opas_msg_query6 *replyp,
76     void *context);
77     typedef void (*opas_reply_error_callback)(struct opas_msg_reply_error *replyp,
78     void *context);
79     typedef void (*opas_reply6_error_callback)(struct opas_msg_reply6_error *rp,
80     void *context);
81     typedef void (*opas_reply_proxy_callback)(struct opas_msg_reply_proxy *replyp,
82     void *context);
83     typedef void (*opas_reply6_proxy_callback)(struct opas_msg_reply6_proxy *rp,
84     void *context);
85     typedef void (*opas_msg_user_callback)(struct opas_msg_user_header *umsgp,
86     void *data,
87     void *context);
88    
89     struct opas_callbacks
90     {
91     opas_send_func send_fun;
92     opas_query_callback query_fun;
93     opas_reply_noproxy_callback reply_noproxy_fun;
94     opas_reply_proxy_callback reply_proxy_fun;
95     opas_reply_error_callback reply_error_fun;
96     opas_query6_callback query6_fun;
97     opas_reply6_noproxy_callback reply6_noproxy_fun;
98     opas_reply6_proxy_callback reply6_proxy_fun;
99     opas_reply6_error_callback reply6_error_fun;
100     opas_msg_user_callback msg_user_fun;
101     };
102    
103     #if defined(__cplusplus)
104     extern "C" {
105     #endif
106    
107     extern const char * opas_get_version(void);
108    
109     extern opas_session_t opas_open_session(const struct opas_callbacks *callbacks,
110     void *context);
111    
112     extern void opas_close_session(opas_session_t session);
113    
114     extern void * opas_get_context(opas_session_t session);
115    
116     extern void opas_set_context(opas_session_t session, void *context);
117    
118     extern int opas_feed(opas_session_t session, void *data, uint32_t size);
119    
120    
121     extern void opas_ping(opas_session_t session);
122    
123     extern void opas_query(opas_session_t session, const struct in_addr *addr,
124     uint32_t user_data);
125    
126     extern void opas_query6(opas_session_t session, const struct in6_addr *addr,
127     uint32_t user_data);
128    
129     extern void opas_reply_noproxy(opas_session_t session,
130     struct opas_msg_query *queryp, int from_cache);
131    
132     extern void opas_reply6_noproxy(opas_session_t session,
133     struct opas_msg_query6 *queryp,
134     int from_cache);
135    
136     extern void opas_reply_proxy(opas_session_t session,
137     struct opas_msg_query *queryp, int from_cache,
138     time_t ts, uint16_t type, uint16_t port,
139     const char *descr);
140    
141     extern void opas_reply6_proxy(opas_session_t session,
142     struct opas_msg_query6 *queryp, int from_cache,
143     time_t ts, uint16_t type, uint16_t port,
144     const char *descr);
145    
146     extern void opas_reply_error(opas_session_t session,
147     struct opas_msg_query *queryp, uint32_t error);
148    
149     extern void opas_reply6_error(opas_session_t session,
150     struct opas_msg_query6 *queryp, uint32_t error);
151    
152     extern void opas_send_msg_user(opas_session_t session, const void *data,
153     uint32_t data_length, int reply,
154     uint32_t user_data);
155    
156     #if defined(__cplusplus)
157     }
158     #endif
159    
160     #endif /* INCLUDED_OPAS_OPAS_H */

svnadmin@ircd-hybrid.org
ViewVC Help
Powered by ViewVC 1.1.28