PatchworkOS
966e257
A non-POSIX operating system.
Theme:
Default
Round
Robot
Loading...
Searching...
No Matches
local_conn.h
Go to the documentation of this file.
1
#pragma once
2
3
#include <
kernel/sched/wait.h
>
4
#include <
kernel/sync/lock.h
>
5
#include <
kernel/utils/ref.h
>
6
#include <
kernel/utils/ring.h
>
7
8
#include <
sys/io.h
>
9
#include <
sys/list.h
>
10
11
typedef
struct
local_listen
local_listen_t
;
12
13
/**
14
* @brief Local Connections.
15
* @defgroup module_net_local_conn Local Connections
16
* @ingroup module_net_local
17
*
18
* Local connections represents a "link" between a listener and a client socket. They provide two-way communication
19
* channels using ring buffers.
20
*
21
* @{
22
*/
23
24
/**
25
* @brief Local Connection structure.
26
* @struct local_conn_t
27
*/
28
typedef
struct
local_conn
29
{
30
ref_t
ref
;
31
list_entry_t
entry
;
32
ring_t
clientToServer
;
33
void
*
clientToServerBuffer
;
34
ring_t
serverToClient
;
35
void
*
serverToClientBuffer
;
36
local_listen_t
*
listen
;
37
bool
isClosed
;
38
lock_t
lock
;
39
wait_queue_t
waitQueue
;
40
}
local_conn_t
;
41
42
/**
43
* @brief Allocate and initialize a new local connection.
44
*
45
* @param listen Pointer to the local listener this connection is associated with.
46
* @return On success, a pointer to the new local connection. On failure, `NULL` and `errno` is set.
47
*/
48
local_conn_t
*
local_conn_new
(
local_listen_t
* listen);
49
50
/**
51
* @brief Free and deinitialize a local connection.
52
*
53
* @param conn Pointer to the local connection to free.
54
*/
55
void
local_conn_free
(
local_conn_t
* conn);
56
57
/** @} */
local_conn_new
local_conn_t * local_conn_new(local_listen_t *listen)
Allocate and initialize a new local connection.
Definition
local_conn.c:14
local_conn_free
void local_conn_free(local_conn_t *conn)
Free and deinitialize a local connection.
Definition
local_conn.c:54
io.h
list.h
lock.h
ref.h
ring.h
list_entry_t
A entry in a doubly linked list.
Definition
list.h:36
local_conn_t
Local Connection structure.
Definition
local_conn.h:29
local_conn_t::serverToClient
ring_t serverToClient
Definition
local_conn.h:34
local_conn_t::listen
local_listen_t * listen
Definition
local_conn.h:36
local_conn_t::clientToServerBuffer
void * clientToServerBuffer
Definition
local_conn.h:33
local_conn_t::isClosed
bool isClosed
Definition
local_conn.h:37
local_conn_t::lock
lock_t lock
Definition
local_conn.h:38
local_conn_t::clientToServer
ring_t clientToServer
Definition
local_conn.h:32
local_conn_t::ref
ref_t ref
Definition
local_conn.h:30
local_conn_t::waitQueue
wait_queue_t waitQueue
Definition
local_conn.h:39
local_conn_t::serverToClientBuffer
void * serverToClientBuffer
Definition
local_conn.h:35
local_conn_t::entry
list_entry_t entry
Definition
local_conn.h:31
local_listen_t
Local Listener structure.
Definition
local_listen.h:32
lock_t
A simple ticket lock implementation.
Definition
lock.h:43
ref_t
Reference counting structure.
Definition
ref.h:30
ring_t
Ring buffer structure.
Definition
ring.h:19
wait_queue_t
The primitive that threads block on.
Definition
wait.h:182
wait.h
src
modules
net
local
local_conn.h
Generated on Mon Dec 15 2025 21:55:53 for PatchworkOS by
1.9.8