dnscrypto-proxy: Update to release 1.3.0
[tomato.git] / release / src / router / dnscrypt / src / libevent-modified / include / event2 / rpc_struct.h
blobc339ae5847b8aae8d45e79b0b77f340bc2b42f31
1 /*
2 * Copyright (c) 2006-2007 Niels Provos <provos@citi.umich.edu>
3 * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. The name of the author may not be used to endorse or promote products
14 * derived from this software without specific prior written permission.
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 #ifndef _EVENT2_RPC_STRUCT_H_
28 #define _EVENT2_RPC_STRUCT_H_
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
34 /** @file event2/rpc_struct.h
36 Structures used by rpc.h. Using these structures directly may harm
37 forward compatibility: be careful!
41 /**
42 * provides information about the completed RPC request.
44 struct evrpc_status {
45 #define EVRPC_STATUS_ERR_NONE 0
46 #define EVRPC_STATUS_ERR_TIMEOUT 1
47 #define EVRPC_STATUS_ERR_BADPAYLOAD 2
48 #define EVRPC_STATUS_ERR_UNSTARTED 3
49 #define EVRPC_STATUS_ERR_HOOKABORTED 4
50 int error;
52 /* for looking at headers or other information */
53 struct evhttp_request *http_req;
56 /* the structure below needs to be synchronized with evrpc_req_generic */
58 /* Encapsulates a request */
59 struct evrpc {
60 TAILQ_ENTRY(evrpc) next;
62 /* the URI at which the request handler lives */
63 const char* uri;
65 /* creates a new request structure */
66 void *(*request_new)(void *);
67 void *request_new_arg;
69 /* frees the request structure */
70 void (*request_free)(void *);
72 /* unmarshals the buffer into the proper request structure */
73 int (*request_unmarshal)(void *, struct evbuffer *);
75 /* creates a new reply structure */
76 void *(*reply_new)(void *);
77 void *reply_new_arg;
79 /* frees the reply structure */
80 void (*reply_free)(void *);
82 /* verifies that the reply is valid */
83 int (*reply_complete)(void *);
85 /* marshals the reply into a buffer */
86 void (*reply_marshal)(struct evbuffer*, void *);
88 /* the callback invoked for each received rpc */
89 void (*cb)(struct evrpc_req_generic *, void *);
90 void *cb_arg;
92 /* reference for further configuration */
93 struct evrpc_base *base;
96 #ifdef __cplusplus
98 #endif
100 #endif /* _EVENT2_RPC_STRUCT_H_ */