sdk-core v2026.11.05
PS2 SDK - core tier (build-critical EE/IOP modules)
Loading...
Searching...
No Matches
in.h
Go to the documentation of this file.
1/*
2# _____ ___ ____ ___ ____
3# ____| | ____| | | |____|
4# | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
5#-----------------------------------------------------------------------
6# Copyright ps2dev - http://www.ps2dev.org
7# Licenced under Academic Free License version 2.0
8# Review ps2sdk README & LICENSE files for further details.
9*/
10
15#ifndef LIBCGLUE_NETINET_IN_H
16#define LIBCGLUE_NETINET_IN_H
17
18#include <sys/socket.h>
19
20/* Used to be a blanket #include <tcpip.h> - see libcglue's own
21 * sys/socket.h for the full story on why that header is real,
22 * pre-lwip-migration technical debt that conflicts with ps2ip's real
23 * lwip headers. Real, minimal, guarded definitions instead - struct
24 * in_addr/sa_family_t/socklen_t already come from <sys/socket.h>
25 * above; in_port_t, struct sockaddr_in, and the INADDR_/IPPROTO_
26 * prefixed constants are real BSD sockets values, byte-identical to
27 * tcpip.h's own values (verified
28 * for real), not connected to the lwip ABI conflict at all - safe to
29 * define directly. Found for real building ps2_drivers's
30 * select_test_ee sample, the first real external consumer to include
31 * this header far enough to hit the conflict. */
32#ifndef IN_PORT_T_DEFINED
33#define IN_PORT_T_DEFINED
34typedef u16 in_port_t;
35#endif
36
37#ifndef _SOCKADDR_IN_STRUCT_DEFINED
38#define _SOCKADDR_IN_STRUCT_DEFINED
39struct sockaddr_in
40{
41 u8 sin_len;
42 sa_family_t sin_family;
43 in_port_t sin_port;
44 struct in_addr sin_addr;
45#define SIN_ZERO_LEN 8
46 char sin_zero[SIN_ZERO_LEN];
47};
48#endif
49
50/* Real values, matching lwip/ip4_addr.h's own IPADDR_* exactly. */
51#ifndef INADDR_NONE
52#define INADDR_NONE ((u32)0xffffffffUL)
53#endif
54#ifndef INADDR_LOOPBACK
55#define INADDR_LOOPBACK ((u32)0x7f000001UL)
56#endif
57#ifndef INADDR_ANY
58#define INADDR_ANY ((u32)0x00000000UL)
59#endif
60#ifndef INADDR_BROADCAST
61#define INADDR_BROADCAST ((u32)0xffffffffUL)
62#endif
63
64#ifndef IPPROTO_IP
65#define IPPROTO_IP 0
66#endif
67#ifndef IPPROTO_ICMP
68#define IPPROTO_ICMP 1
69#endif
70#ifndef IPPROTO_TCP
71#define IPPROTO_TCP 6
72#endif
73#ifndef IPPROTO_UDP
74#define IPPROTO_UDP 17
75#endif
76#ifndef IPPROTO_IPV6
77#define IPPROTO_IPV6 41
78#endif
79#ifndef IPPROTO_ICMPV6
80#define IPPROTO_ICMPV6 58
81#endif
82#ifndef IPPROTO_UDPLITE
83#define IPPROTO_UDPLITE 136
84#endif
85#ifndef IPPROTO_RAW
86#define IPPROTO_RAW 255
87#endif
88
89#endif