Skip to content

File syn_autoip.h

FileList > net > syn_autoip.h

Go to the source code of this file

Zero-Heap Native RFC 3927 AutoIP (Link-Local 169.254.x.x) Engine. More...

  • #include "syntropic/common/syn_defs.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_AUTOIP

Public Types

Type Name
enum SYN_AUTOIP_State

Public Functions

Type Name
SYN_Status syn_autoip_build_announce (SYN_AUTOIP * autoip, const uint8_t mac_addr, uint8_t * buf_out, size_t * len_out)
Build an ARP Announcement frame to announce claimed IP.
SYN_Status syn_autoip_build_probe (SYN_AUTOIP * autoip, const uint8_t mac_addr, uint8_t * buf_out, size_t * len_out)
Build an ARP Probe frame to verify IP availability.
SYN_Status syn_autoip_init (SYN_AUTOIP * autoip, const uint8_t mac_addr)
Initialize RFC 3927 AutoIP Engine Context.
SYN_Status syn_autoip_process_arp (SYN_AUTOIP * autoip, SYN_ETH * eth, const uint8_t * arp_frame, size_t len)
Process ARP response frame during probing.

Macros

Type Name
define PT_AUTOIP_BLOCK_BOUND (pt, task, autoip) [**PT\_BLOCK\_CONDITION**](syn__pt_8h.md#define-pt_block_condition)(pt, task, (autoip)-&gt;state == SYN\_AUTOIP\_STATE\_BOUND)
Block task execution (SYN_TASK_BLOCKED) until AutoIP link-local binding completes.
define PT_AUTOIP_WAIT_BOUND (pt, autoip) [**PT\_WAIT\_UNTIL**](syn__pt_8h.md#define-pt_wait_until)(pt, (autoip)-&gt;state == SYN\_AUTOIP\_STATE\_BOUND)
Block a protothread coroutine until AutoIP link-local binding completes.
define SYN_AUTOIP_BASE_IP 0xA9FE0101UL
define SYN_AUTOIP_NETMASK 0xFFFF0000UL

Detailed Description

Specifications: * RFC 3927 Dynamic Configuration of IPv4 Link-Local Addresses * Address Range: 169.254.1.0 to 169.254.254.255 * Zero dynamic memory allocation (0 bytes heap)

Public Types Documentation

enum SYN_AUTOIP_State

enum SYN_AUTOIP_State {
    SYN_AUTOIP_STATE_INIT = 0,
    SYN_AUTOIP_STATE_PROBE,
    SYN_AUTOIP_STATE_ANNOUNCE,
    SYN_AUTOIP_STATE_BOUND
};

AutoIP State Machine Enum.


Public Functions Documentation

function syn_autoip_build_announce

Build an ARP Announcement frame to announce claimed IP.

SYN_Status syn_autoip_build_announce (
    SYN_AUTOIP * autoip,
    const uint8_t mac_addr,
    uint8_t * buf_out,
    size_t * len_out
) 

Parameters:

  • autoip Pointer to AutoIP context.
  • mac_addr 6-byte client MAC address.
  • buf_out Output frame buffer (must hold at least 60 bytes).
  • len_out Pointer to receive length.

Returns:

SYN_OK on success.


function syn_autoip_build_probe

Build an ARP Probe frame to verify IP availability.

SYN_Status syn_autoip_build_probe (
    SYN_AUTOIP * autoip,
    const uint8_t mac_addr,
    uint8_t * buf_out,
    size_t * len_out
) 

Parameters:

  • autoip Pointer to AutoIP context.
  • mac_addr 6-byte client MAC address.
  • buf_out Output frame buffer (must hold at least 60 bytes).
  • len_out Pointer to receive length.

Returns:

SYN_OK on success.


function syn_autoip_init

Initialize RFC 3927 AutoIP Engine Context.

SYN_Status syn_autoip_init (
    SYN_AUTOIP * autoip,
    const uint8_t mac_addr
) 

Parameters:

  • autoip Pointer to AutoIP context.
  • mac_addr 6-byte client MAC address (used to seed candidate IP selection).

Returns:

SYN_OK on success.


function syn_autoip_process_arp

Process ARP response frame during probing.

SYN_Status syn_autoip_process_arp (
    SYN_AUTOIP * autoip,
    SYN_ETH * eth,
    const uint8_t * arp_frame,
    size_t len
) 

Parameters:

  • autoip Pointer to AutoIP context.
  • eth Pointer to Ethernet context (auto-updated when BOUND).
  • arp_frame Pointer to received frame.
  • len Length in bytes.

Returns:

SYN_OK when BOUND, SYN_BUSY if conflict detected and new candidate picked.


Macro Definition Documentation

define PT_AUTOIP_BLOCK_BOUND

Block task execution (SYN_TASK_BLOCKED) until AutoIP link-local binding completes.

#define PT_AUTOIP_BLOCK_BOUND (
    pt,
    task,
    autoip
) `PT_BLOCK_CONDITION (pt, task, (autoip)->state == SYN_AUTOIP_STATE_BOUND )`

Parameters:

  • pt Protothread context.
  • task Pointer to SYN_Task.
  • autoip Pointer to AutoIP context.

define PT_AUTOIP_WAIT_BOUND

Block a protothread coroutine until AutoIP link-local binding completes.

#define PT_AUTOIP_WAIT_BOUND (
    pt,
    autoip
) `PT_WAIT_UNTIL (pt, (autoip)->state == SYN_AUTOIP_STATE_BOUND )`

Parameters:

  • pt Protothread context.
  • autoip Pointer to AutoIP context.

define SYN_AUTOIP_BASE_IP

#define SYN_AUTOIP_BASE_IP `0xA9FE0101UL`

Link-local base IP address 169.254.1.1


define SYN_AUTOIP_NETMASK

#define SYN_AUTOIP_NETMASK `0xFFFF0000UL`

Link-local network mask 255.255.0.0



The documentation for this class was generated from the following file src/syntropic/net/syn_autoip.h