xref: /netbsd-src/external/bsd/libevent/dist/include/event2/rpc_compat.h (revision c3ab26950fe8540fb553d1d1dcae454bc98e5a25)
1 /*	$NetBSD: rpc_compat.h,v 1.1.1.1 2013/04/11 16:43:34 christos Exp $	*/
2 /*
3  * Copyright (c) 2006-2007 Niels Provos <provos@citi.umich.edu>
4  * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in the
13  *    documentation and/or other materials provided with the distribution.
14  * 3. The name of the author may not be used to endorse or promote products
15  *    derived from this software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  */
28 #ifndef _EVENT2_RPC_COMPAT_H_
29 #define _EVENT2_RPC_COMPAT_H_
30 
31 /** @file event2/rpc_compat.h
32 
33   Deprecated versions of the functions in rpc.h: provided only for
34   backwards compatibility.
35 
36  */
37 
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41 
42 /** backwards compatible accessors that work only with gcc */
43 #if defined(__GNUC__) && !defined(__STRICT_ANSI__)
44 
45 #undef EVTAG_ASSIGN
46 #undef EVTAG_GET
47 #undef EVTAG_ADD
48 
49 #define EVTAG_ASSIGN(msg, member, args...) \
50 	(*(msg)->base->member##_assign)(msg, ## args)
51 #define EVTAG_GET(msg, member, args...) \
52 	(*(msg)->base->member##_get)(msg, ## args)
53 #define EVTAG_ADD(msg, member, args...) \
54 	(*(msg)->base->member##_add)(msg, ## args)
55 #endif
56 #define EVTAG_LEN(msg, member) ((msg)->member##_length)
57 
58 #ifdef __cplusplus
59 }
60 #endif
61 
62 #endif /* _EVENT2_EVENT_COMPAT_H_ */
63