1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 01:17:35 +00:00

LibC: Add sa_family_t and in_port_t types

This commit is contained in:
Andreas Kling 2020-08-11 21:07:42 +02:00
parent 36c738d9bf
commit c37dc4ae73
2 changed files with 10 additions and 5 deletions

View file

@ -28,6 +28,7 @@
#include <bits/stdint.h> #include <bits/stdint.h>
#include <sys/cdefs.h> #include <sys/cdefs.h>
#include <sys/socket.h>
__BEGIN_DECLS __BEGIN_DECLS
@ -43,13 +44,15 @@ in_addr_t inet_addr(const char*);
#define IPPORT_RESERVED 1024 #define IPPORT_RESERVED 1024
#define IPPORT_USERRESERVED 5000 #define IPPORT_USERRESERVED 5000
typedef uint16_t in_port_t;
struct in_addr { struct in_addr {
uint32_t s_addr; uint32_t s_addr;
}; };
struct sockaddr_in { struct sockaddr_in {
uint16_t sin_family; sa_family_t sin_family;
uint16_t sin_port; in_port_t sin_port;
struct in_addr sin_addr; struct in_addr sin_addr;
char sin_zero[8]; char sin_zero[8];
}; };
@ -59,8 +62,8 @@ struct in6_addr {
}; };
struct sockaddr_in6 { struct sockaddr_in6 {
uint16_t sin6_family; // AF_INET6. sa_family_t sin6_family; // AF_INET6.
uint16_t sin6_port; // Port number. in_port_t sin6_port; // Port number.
uint32_t sin6_flowinfo; // IPv6 traffic class and flow information. uint32_t sin6_flowinfo; // IPv6 traffic class and flow information.
struct in6_addr sin6_addr; // IPv6 address. struct in6_addr sin6_addr; // IPv6 address.
uint32_t sin6_scope_id; // Set of interfaces for a scop uint32_t sin6_scope_id; // Set of interfaces for a scop

View file

@ -63,8 +63,10 @@ __BEGIN_DECLS
#define MSG_DONTWAIT 0x40 #define MSG_DONTWAIT 0x40
typedef uint16_t sa_family_t;
struct sockaddr { struct sockaddr {
uint16_t sa_family; sa_family_t sa_family;
char sa_data[14]; char sa_data[14];
}; };