ascii-chat 0.6.0
Real-time terminal-based video chat with ASCII art conversion
Loading...
Searching...
No Matches
Stun

Functions

struct __attribute__ ((packed))
 STUN server configuration.
 

Variables

 stun_server_t
 

STUN Protocol Constants

#define STUN_DEFAULT_PORT   3478
 Standard STUN port (RFC 5389)
 
#define STUN_TLS_DEFAULT_PORT   5349
 STUN over TLS port (RFC 5389)
 
#define STUN_MAX_URL_LEN   64
 Maximum STUN URL length.
 

Detailed Description

This module defines STUN server configuration structures for WebRTC connectivity. STUN servers help clients discover their public IP addresses and port mappings when behind NAT.

RFC 5389: Session Traversal Utilities for NAT (STUN) RFC 8489: Session Traversal Utilities for NAT (STUN) - updated

STUN SERVER ROLE:

USAGE IN ACDS:

Note
All structures are packed with attribute((packed)) for wire format
Author
Zachary Fogg me@zf.nosp@m.o.gg
Date
January 2026
Version
1.0

Macro Definition Documentation

◆ STUN_DEFAULT_PORT

#define STUN_DEFAULT_PORT   3478

#include <stun.h>

Standard STUN port (RFC 5389)

Definition at line 84 of file stun.h.

◆ STUN_MAX_URL_LEN

#define STUN_MAX_URL_LEN   64

#include <stun.h>

Maximum STUN URL length.

Definition at line 90 of file stun.h.

◆ STUN_TLS_DEFAULT_PORT

#define STUN_TLS_DEFAULT_PORT   5349

#include <stun.h>

STUN over TLS port (RFC 5389)

Definition at line 87 of file stun.h.

Function Documentation

◆ __attribute__()

struct __attribute__ ( (packed)  )

#include <stun.h>

STUN server configuration.

Used in ACDS SESSION_CREATED response to provide WebRTC connectivity information.

Protocol Format:

  • host_len: 1 byte (length of host string)
  • host: 64 bytes (null-terminated STUN URL)

URL Format Examples:

  • stun:discovery.ascii.chat:3478 (standard port)
  • stun:stun.l.google.com:19302 (Google public STUN)
  • stun:stun.example.com:5349 (custom port)

Wire Format (65 bytes total):

+----------+----------------------------------------+
| host_len | host[64] |
+----------+----------------------------------------+
| 1 byte | 64 bytes |
+----------+----------------------------------------+

< Length of host string (actual URL length)

< STUN server URL (e.g., "stun:discovery.ascii.chat:3478")

Definition at line 1 of file stun.h.

72 {
73 uint8_t host_len;
74 char host[64];
unsigned char uint8_t
Definition common.h:56
stun_server_t
Definition stun.h:75

Variable Documentation

◆ stun_server_t

stun_server_t

#include <stun.h>

Definition at line 75 of file stun.h.

Referenced by server_main().