File syn_netcfg.h¶
FileList > net > syn_netcfg.h
Go to the source code of this file
Unified Zero-Heap Network IP Address Manager. More...
#include "syntropic/common/syn_defs.h"#include "syntropic/net/syn_autoip.h"#include "syntropic/net/syn_dhcp.h"#include "syntropic/net/syn_eth.h"#include "syntropic/pt/syn_pt.h"#include <stdbool.h>#include <stddef.h>#include <stdint.h>
Classes¶
| Type | Name |
|---|---|
| struct | SYN_NETCFG |
Public Types¶
| Type | Name |
|---|---|
| typedef void(* | SYN_NETCFG_LinkCb |
| enum | SYN_NETCFG_LinkState |
| enum | SYN_NETCFG_Mode |
Public Functions¶
| Type | Name |
|---|---|
| SYN_Status | syn_netcfg_init (SYN_NETCFG * netcfg, SYN_NETCFG_Mode mode, const uint8_t mac) Initialize Unified Network IP Manager. |
| SYN_Status | syn_netcfg_set_link_callback (SYN_NETCFG * netcfg, SYN_NETCFG_LinkCb cb, void * user_data) Register Application Link Event Callback. |
| SYN_Status | syn_netcfg_set_link_state (SYN_NETCFG * netcfg, SYN_ETH * eth, SYN_NETCFG_LinkState state) Notify Network Manager of Physical Link State Change (Link Up / Link Down). |
| SYN_Status | syn_netcfg_set_static (SYN_NETCFG * netcfg, SYN_ETH * eth, uint32_t ip, uint32_t netmask, uint32_t gateway) Set Static IP configuration parameters. |
| SYN_Status | syn_netcfg_trigger_autoip_fallback (SYN_NETCFG * netcfg, SYN_ETH * eth, const uint8_t mac) Trigger AutoIP fallback when DHCP times out. |
Macros¶
| Type | Name |
|---|---|
| define | PT_NETCFG_BLOCK_BOUND (pt, task, netcfg) [**PT\_BLOCK\_CONDITION**](syn__pt_8h.md#define-pt_block_condition)(pt, task, (netcfg)->is\_bound == true)Block task execution (SYN_TASK_BLOCKED) until IP configuration binding completes. |
| define | PT_NETCFG_BLOCK_LINK_UP (pt, task, netcfg) [**PT\_BLOCK\_CONDITION**](syn__pt_8h.md#define-pt_block_condition)(pt, task, (netcfg)->link\_state == SYN\_NETCFG\_LINK\_UP)Block task execution (SYN_TASK_BLOCKED) until physical link is UP. |
| define | PT_NETCFG_WAIT_BOUND (pt, netcfg) [**PT\_WAIT\_UNTIL**](syn__pt_8h.md#define-pt_wait_until)(pt, (netcfg)->is\_bound == true)Block a protothread coroutine until IP configuration binding completes. |
| define | PT_NETCFG_WAIT_LINK_UP (pt, netcfg) [**PT\_WAIT\_UNTIL**](syn__pt_8h.md#define-pt_wait_until)(pt, (netcfg)->link\_state == SYN\_NETCFG\_LINK\_UP)Block a protothread coroutine until physical link is UP. |
Detailed Description¶
Unifies Static IP, DHCP Client, RFC 3927 AutoIP fallback, and Physical Link Event handling.
Public Types Documentation¶
typedef SYN_NETCFG_LinkCb¶
typedef void(* SYN_NETCFG_LinkCb) (struct SYN_NETCFG_s *netcfg, SYN_NETCFG_LinkState state, void *user_data);
Application Link Event Callback Signature.
enum SYN_NETCFG_LinkState¶
Physical Link States.
enum SYN_NETCFG_Mode¶
IP Manager Modes.
Public Functions Documentation¶
function syn_netcfg_init¶
Initialize Unified Network IP Manager.
Parameters:
netcfgPointer to Netcfg context.modeConfiguration mode (STATIC, DHCP, or AUTO).mac6-byte client MAC address.
Returns:
SYN_OK on success.
function syn_netcfg_set_link_callback¶
Register Application Link Event Callback.
SYN_Status syn_netcfg_set_link_callback (
SYN_NETCFG * netcfg,
SYN_NETCFG_LinkCb cb,
void * user_data
)
Parameters:
netcfgPointer to Netcfg context.cbCallback function pointer.user_dataUser data context passed to callback.
Returns:
SYN_OK on success.
function syn_netcfg_set_link_state¶
Notify Network Manager of Physical Link State Change (Link Up / Link Down).
SYN_Status syn_netcfg_set_link_state (
SYN_NETCFG * netcfg,
SYN_ETH * eth,
SYN_NETCFG_LinkState state
)
On LINK_DOWN: Invalidates IP binding, resets state machines back to INIT, and triggers callback. On LINK_UP: Automatically re-triggers IP acquisition state machine and triggers callback.
Parameters:
netcfgPointer to Netcfg context.ethPointer to Ethernet context.statePhysical Link State (SYN_NETCFG_LINK_DOWN or SYN_NETCFG_LINK_UP).
Returns:
SYN_OK on success.
function syn_netcfg_set_static¶
Set Static IP configuration parameters.
SYN_Status syn_netcfg_set_static (
SYN_NETCFG * netcfg,
SYN_ETH * eth,
uint32_t ip,
uint32_t netmask,
uint32_t gateway
)
Parameters:
netcfgPointer to Netcfg context.ethPointer to Ethernet context.ip32-bit IPv4 address.netmask32-bit netmask.gateway32-bit router gateway IP.
Returns:
SYN_OK on success.
function syn_netcfg_trigger_autoip_fallback¶
Trigger AutoIP fallback when DHCP times out.
SYN_Status syn_netcfg_trigger_autoip_fallback (
SYN_NETCFG * netcfg,
SYN_ETH * eth,
const uint8_t mac
)
Parameters:
netcfgPointer to Netcfg context.ethPointer to Ethernet context.mac6-byte client MAC address.
Returns:
SYN_OK on success.
Macro Definition Documentation¶
define PT_NETCFG_BLOCK_BOUND¶
Block task execution (SYN_TASK_BLOCKED) until IP configuration binding completes.
#define PT_NETCFG_BLOCK_BOUND (
pt,
task,
netcfg
) `PT_BLOCK_CONDITION (pt, task, (netcfg)->is_bound == true)`
define PT_NETCFG_BLOCK_LINK_UP¶
Block task execution (SYN_TASK_BLOCKED) until physical link is UP.
#define PT_NETCFG_BLOCK_LINK_UP (
pt,
task,
netcfg
) `PT_BLOCK_CONDITION (pt, task, (netcfg)->link_state == SYN_NETCFG_LINK_UP)`
define PT_NETCFG_WAIT_BOUND¶
Block a protothread coroutine until IP configuration binding completes.
Parameters:
ptProtothread context.netcfgPointer to Netcfg context.
define PT_NETCFG_WAIT_LINK_UP¶
Block a protothread coroutine until physical link is UP.
#define PT_NETCFG_WAIT_LINK_UP (
pt,
netcfg
) `PT_WAIT_UNTIL (pt, (netcfg)->link_state == SYN_NETCFG_LINK_UP)`
Parameters:
ptProtothread context.netcfgPointer to Netcfg context.
The documentation for this class was generated from the following file src/syntropic/net/syn_netcfg.h