VLCB SDK
An opinionated SDK for VLCB protocol
Loading...
Searching...
No Matches
socket.h
Go to the documentation of this file.
1#pragma once
2
3#include <stdbool.h>
4#include <stddef.h>
5
6#include "packet/vlcb.h"
7#include "vlcb/net/addr.h"
9
20
29
31 IVlcbNetSocket,
34 _INTERFACE_SELF_PTR_MUT(IVlcbNetSocket),
35 const VlcbNetPacket *const packet);
37 _INTERFACE_SELF_PTR_MUT(IVlcbNetSocket),
38 VlcbNetPacket *const packet););
39;
40
41typedef IVlcbNetSocket *VlcbNetSocketHandle;
42
43typedef struct {
44 size_t capacity;
45 size_t len;
48
50 size_t size);
51
52#define VLCB_NET_SOCK_LIST(name, size) \
53 VlcbNetSocketHandle name##_data[size]; \
54 VlcbNetSocketList name = vlcb_net_sock_list_New(data_##name, size);
55
58
59typedef struct {
60 size_t pointer;
61 const VlcbNetSocketList *const list;
63
66
const char *const vlcb_error
Definition error.h:3
#define _INTERFACE_DECLARE(T,...)
Definition interface.h:5
#define _INTERFACE_METHOD_DECLARE(retT, name,...)
Definition interface.h:10
#define _INTERFACE_SELF_PTR_MUT(T)
Definition interface.h:16
VlcbNetSocketDispatchErr DispatchPacket(const VlcbNetSocketDatagram *const self, VlcbNetPacket *const packet)
VlcbNetSocketProcessErr ProcessPacket(const VlcbNetSocketDatagram *const self, const VlcbNetPacket *const packet)
bool SupportsProtocol(VlcbNetProtocol proto)
int vlcb_net_sock_list_Insert(VlcbNetSocketList *const list, VlcbNetSocketHandle sock)
Definition socket.c:17
bool vlcb_net_sock_list_iter_HasNext(VlcbNetSocketListIter *const iter)
Definition socket.c:43
VlcbNetSocketList vlcb_net_sock_list_New(VlcbNetSocketHandle *const buf, size_t size)
Definition socket.c:6
VlcbNetSocketProcessErr
Definition socket.h:10
@ VLCB_NET_SOCK_PROC_ERR_RX_BUF_FULL
Definition socket.h:13
@ VLCB_NET_SOCK_PROC_ERR_PAYLOAD_TOO_LARGE
Definition socket.h:14
@ VLCB_NET_SOCK_PROC_ERR_OK
Definition socket.h:11
@ VLCB_NET_SOCK_PROC_ERR_UNKNOWN
Definition socket.h:15
@ VLCB_NET_SOCK_PROC_ERR_COUNT
Definition socket.h:17
VlcbNetSocketHandle vlcb_net_sock_list_iter_Next(VlcbNetSocketListIter *const iter)
Definition socket.c:50
vlcb_error vlcb_net_sock_ProcessErrToStr(VlcbNetSocketProcessErr err)
Definition socket.c:56
VlcbNetSocketListIter vlcb_net_sock_list_GetIterator(const VlcbNetSocketList *const list)
Definition socket.c:30
void vlcb_net_sock_list_iter_Reset(VlcbNetSocketListIter *const iter)
Definition socket.c:38
VlcbNetSocketDispatchErr
Definition socket.h:21
@ VLCB_NET_SOCK_DISP_ERR_OK
Definition socket.h:22
@ VLCB_NET_SOCK_DISP_ERR_WOULD_BLOCK
Definition socket.h:24
@ VLCB_NET_SOCK_DISP_ERR_COUNT
Definition socket.h:26
IVlcbNetSocket * VlcbNetSocketHandle
Definition socket.h:41
vlcb_error vlcb_net_sock_DispatchErrToStr(VlcbNetSocketDispatchErr err)
const VlcbNetSocketList *const list
Definition socket.h:61
size_t capacity
Definition socket.h:44
VlcbNetSocketHandle *const buf
Definition socket.h:46
VlcbNetProtocol
Definition vlcb.h:26