mirror of
https://review.haiku-os.org/haiku
synced 2025-02-15 01:58:36 +01:00
(cherry picked from commit e776c8dee5617a43dee0f2fe973d97956875697e) Change-Id: I099d494c56bc7bbf4eb6b341f0d48017343c13d2 Reviewed-on: https://review.haiku-os.org/c/haiku/+/8125 Reviewed-by: waddlesplash <waddlesplash@gmail.com>
78 lines
1.2 KiB
C
78 lines
1.2 KiB
C
/*
|
|
* Copyright 2006, Haiku, Inc. All Rights Reserved.
|
|
* Distributed under the terms of the MIT License.
|
|
*/
|
|
#ifndef NET_R5_COMPATIBILITY_H
|
|
#define NET_R5_COMPATIBILITY_H
|
|
|
|
|
|
#include <SupportDefs.h>
|
|
|
|
|
|
#define R5_SOCK_DGRAM 1
|
|
#define R5_SOCK_STREAM 2
|
|
|
|
#define R5_AF_INET 1
|
|
|
|
#define R5_IPPROTO_UDP 1
|
|
#define R5_IPPROTO_TCP 2
|
|
#define R5_IPPROTO_ICMP 3
|
|
|
|
// setsockopt() defines
|
|
|
|
#define R5_SOL_SOCKET 1
|
|
|
|
#define R5_SO_DEBUG 1
|
|
#define R5_SO_REUSEADDR 2
|
|
#define R5_SO_NONBLOCK 3
|
|
#define R5_SO_REUSEPORT 4
|
|
#define R5_SO_FIONREAD 5
|
|
|
|
#define R5_MSG_OOB 0x01
|
|
|
|
|
|
struct r5_sockaddr_in {
|
|
uint16 sin_family;
|
|
uint16 sin_port;
|
|
uint32 sin_addr;
|
|
char sin_zero[4];
|
|
};
|
|
|
|
|
|
#ifdef _BEOS_R5_COMPATIBLE_
|
|
extern bool __gR5Compatibility;
|
|
extern addr_t __gNetworkStart;
|
|
extern addr_t __gNetworkEnd;
|
|
|
|
|
|
static inline bool
|
|
check_r5_compatibility()
|
|
{
|
|
if (!__gR5Compatibility)
|
|
return false;
|
|
|
|
#ifndef __i386__
|
|
return false;
|
|
#else
|
|
|
|
struct stack_frame {
|
|
struct stack_frame* previous;
|
|
addr_t return_address;
|
|
};
|
|
|
|
stack_frame* frame = (stack_frame*)get_stack_frame();
|
|
if (frame->return_address >= __gNetworkStart
|
|
&& frame->return_address < __gNetworkEnd) {
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
#endif
|
|
}
|
|
#else
|
|
#define check_r5_compatibility() (false)
|
|
#endif
|
|
|
|
|
|
#endif // NET_R5_COMPATIBILITY_H
|