btrfs: [] on the end of a struct field is a variable length array.
[haiku.git] / headers / private / net / r5_compatibility.h
blob7a16df9a83700f7a356e241fbd4a5b6155cda88c
1 /*
2 * Copyright 2006, Haiku, Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
4 */
5 #ifndef NET_R5_COMPATIBILITY_H
6 #define NET_R5_COMPATIBILITY_H
9 #include <SupportDefs.h>
12 #define R5_SOCK_DGRAM 1
13 #define R5_SOCK_STREAM 2
15 #define R5_AF_INET 1
17 #define R5_IPPROTO_UDP 1
18 #define R5_IPPROTO_TCP 2
19 #define R5_IPPROTO_ICMP 3
21 // setsockopt() defines
23 #define R5_SOL_SOCKET 1
25 #define R5_SO_DEBUG 1
26 #define R5_SO_REUSEADDR 2
27 #define R5_SO_NONBLOCK 3
28 #define R5_SO_REUSEPORT 4
29 #define R5_SO_FIONREAD 5
31 #define R5_MSG_OOB 0x01
34 struct r5_sockaddr_in {
35 uint16 sin_family;
36 uint16 sin_port;
37 uint32 sin_addr;
38 char sin_zero[4];
41 extern bool __gR5Compatibility;
42 extern addr_t __gNetworkStart;
43 extern addr_t __gNetworkEnd;
44 extern addr_t __gNetAPIStart;
45 extern addr_t __gNetAPIEnd;
48 static inline bool
49 check_r5_compatibility()
51 if (!__gR5Compatibility)
52 return false;
54 #ifndef __INTEL__
55 return false;
56 #else
58 struct stack_frame {
59 struct stack_frame* previous;
60 addr_t return_address;
63 stack_frame* frame = (stack_frame*)get_stack_frame();
64 if (frame->return_address >= __gNetworkStart
65 && frame->return_address < __gNetworkEnd) {
66 return false;
69 return true;
70 #endif
74 #endif // NET_R5_COMPATIBILITY_H