mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 19:47:46 +00:00
Kernel+LibC+Userland: Start working on an IPv4 socket backend.
The first userland networking program will be "ping" :^)
This commit is contained in:
parent
8e667747f0
commit
a017a77442
23 changed files with 374 additions and 3 deletions
22
LibC/arpa/inet.h
Normal file
22
LibC/arpa/inet.h
Normal file
|
@ -0,0 +1,22 @@
|
|||
#pragma once
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
const char* inet_ntop(int af, const void* src, char* dst, socklen_t);
|
||||
|
||||
static inline uint16_t htons(uint16_t hs)
|
||||
{
|
||||
uint8_t* s = (uint8_t*)&hs;
|
||||
return (uint16_t)(s[0] << 8 | s[1]);
|
||||
}
|
||||
|
||||
static inline uint16_t ntohs(uint16_t ns)
|
||||
{
|
||||
return htons(ns);
|
||||
}
|
||||
|
||||
__END_DECLS
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue