PatchworkOS
10941b4
A non-POSIX operating system.
Theme:
Default
Round
Robot
Loading...
Searching...
No Matches
local.h
Go to the documentation of this file.
1
#pragma once
2
3
#include <
kernel/sync/lock.h
>
4
5
#include <
stdint.h
>
6
#include <
sys/io.h
>
7
#include <
sys/list.h
>
8
9
typedef
struct
local_listen
local_listen_t
;
10
typedef
struct
local_conn
local_conn_t
;
11
12
/**
13
* @brief Local Protocol.
14
* @defgroup module_net_local Local Protocol
15
* @ingroup module_net
16
*
17
* @{
18
*/
19
20
/**
21
* @brief The size of local sockets buffer.
22
*/
23
#define LOCAL_BUFFER_SIZE (4 * PAGE_SIZE)
24
25
/**
26
* @brief The maximum size of a packet allowed to be sent/received via local sockets.
27
*/
28
#define LOCAL_MAX_PACKET_SIZE (LOCAL_BUFFER_SIZE - sizeof(local_packet_header_t))
29
30
/**
31
* @brief The maximum backlog of connections for a local listener.
32
*/
33
#define LOCAL_MAX_BACKLOG 128
34
35
/**
36
* @brief Magic number for local socket packets, used for validation.
37
*/
38
#define LOCAL_PACKET_MAGIC 0xC0D74B56
39
40
/**
41
* @brief Local packet header structure.
42
* struct local_packet_header_t
43
*/
44
typedef
struct
45
{
46
uint32_t
magic
;
47
uint32_t
size
;
48
}
local_packet_header_t
;
49
50
/**
51
* @brief Local socket data structure.
52
* struct local_socket_t
53
*
54
* Stored in the `private` field of a `socket_t` for local sockets.
55
*/
56
typedef
struct
57
{
58
local_listen_t
*
listen
;
59
local_conn_t
*
conn
;
60
bool
isServer
;
61
}
local_socket_t
;
62
63
/** @} */
io.h
list.h
lock.h
stdint.h
uint32_t
__UINT32_TYPE__ uint32_t
Definition
stdint.h:15
local_conn_t
Local Connection structure.
Definition
local_conn.h:29
local_listen_t
Local Listener structure.
Definition
local_listen.h:33
local_packet_header_t
Local packet header structure. struct local_packet_header_t.
Definition
local.h:45
local_packet_header_t::size
uint32_t size
Definition
local.h:47
local_packet_header_t::magic
uint32_t magic
Definition
local.h:46
local_socket_t
Local socket data structure. struct local_socket_t.
Definition
local.h:57
local_socket_t::isServer
bool isServer
Definition
local.h:60
local_socket_t::conn
local_conn_t * conn
Definition
local.h:59
local_socket_t::listen
local_listen_t * listen
Definition
local.h:58
src
modules
net
local
local.h
Generated on Fri Jan 9 2026 06:47:13 for PatchworkOS by
1.9.8