Module local

Module local 

Source
Expand description

Local Socket Implementation

This module implements local (Unix-like) domain sockets for inter-process communication through named socket paths in the filesystem namespace.

ยงDesign

  • Named Sockets: Sockets can be bound to filesystem paths
  • Connection Oriented: Uses stream sockets for reliable, ordered data transfer
  • NetworkManager Integration: Uses global NetworkManager for socket registry
  • Direct Buffer Management: Uses VecDeque for efficient data queuing

ยงSocket States

  1. Unconnected: Initial state after creation
  2. Bound: Socket bound to a local address
  3. Listening: Server socket accepting connections
  4. Connected: Client socket or accepted connection

Macrosยง

localsocket_log ๐Ÿ”’

Structsยง

LocalSocket
Local Socket Implementation
SocketBuffer ๐Ÿ”’
Shared buffer structure for socket data

Constantsยง

LOCALSOCKET_LOG ๐Ÿ”’
MAX_BUFFER_SIZE ๐Ÿ”’
Maximum buffer size per socket (64 KB)
MAX_HANDLE_QUEUE_SIZE ๐Ÿ”’
Maximum number of handles that can be queued for transfer This prevents unbounded memory growth from DoS attacks

Functionsยง

local_socket_factory
Socket factory function for local sockets