File syn_icmp.c¶
FileList > net > syn_icmp.c
Go to the source code of this file
Zero-Heap Native ICMP Protocol Engine Implementation.
#include "syntropic/net/syn_icmp.h"#include <string.h>
Public Functions¶
| Type | Name |
|---|---|
| SYN_Status | syn_icmp_build_echo_request (SYN_ICMP * icmp, SYN_ETH * eth, uint32_t dst_ip, const uint8_t dst_mac, uint16_t id, uint16_t seq, const uint8_t * payload, size_t payload_len, uint8_t * frame_out, size_t * frame_len) Construct an outbound ICMP Echo Request frame. |
| uint16_t | syn_icmp_checksum (const void * buf, size_t len) Compute RFC 1071 Ones-Complement Internet Checksum. |
| SYN_Status | syn_icmp_init (SYN_ICMP * icmp) Initialize ICMP Engine Context. |
| SYN_Status | syn_icmp_process_packet (SYN_ICMP * icmp, const uint8_t * ip_pkt, size_t len, uint8_t * frame_tx, size_t * tx_len) Process incoming ICMP packet inside IPv4 payload. |
Public Functions Documentation¶
function syn_icmp_build_echo_request¶
Construct an outbound ICMP Echo Request frame.
SYN_Status syn_icmp_build_echo_request (
SYN_ICMP * icmp,
SYN_ETH * eth,
uint32_t dst_ip,
const uint8_t dst_mac,
uint16_t id,
uint16_t seq,
const uint8_t * payload,
size_t payload_len,
uint8_t * frame_out,
size_t * frame_len
)
Parameters:
icmpPointer to ICMP context.ethPointer to Ethernet context.dst_ip32-bit IPv4 address of destination.dst_mac6-byte MAC address of destination.idIdentifier.seqSequence number.payloadPointer to payload data.payload_lenPayload length in bytes.frame_outOutput frame buffer (must hold at least 60 bytes).frame_lenPointer to receive final Ethernet II frame length.
Returns:
SYN_OK on success.
function syn_icmp_checksum¶
Compute RFC 1071 Ones-Complement Internet Checksum.
Parameters:
bufPointer to buffer bytes.lenLength in bytes.
Returns:
16-bit Ones-Complement checksum.
function syn_icmp_init¶
Initialize ICMP Engine Context.
Parameters:
icmpPointer to ICMP context.
Returns:
SYN_OK on success.
function syn_icmp_process_packet¶
Process incoming ICMP packet inside IPv4 payload.
SYN_Status syn_icmp_process_packet (
SYN_ICMP * icmp,
const uint8_t * ip_pkt,
size_t len,
uint8_t * frame_tx,
size_t * tx_len
)
Automatically generates a matching Type 0 Echo Reply if a Type 8 Echo Request is received.
Parameters:
icmpPointer to ICMP context.ip_pktPointer to incoming IPv4 packet (starting at IP header).lenIP packet byte length.frame_txOutput buffer to receive constructed Ethernet II reply frame (min 60 bytes).tx_lenPointer to receive byte length of constructed reply frame (0 if none generated).
Returns:
SYN_OK on success.
The documentation for this class was generated from the following file src/syntropic/net/syn_icmp.c