CSP Hooks
File: csp/csp_hooks.h
Description: Hooks that can be implemented in CSP, see Hooks in csp for more information
Hook Functions
-
void csp_output_hook(const csp_id_t *idout, csp_packet_t *packet, csp_iface_t *iface, uint16_t via, int from_me)
[source] Hook called when a packet is sent
- Parameters:
idout – ID of the recipient
packet – CSP packet to be sent
iface – Outgoing interface
via – Next hop address (if applicable)
from_me – Whether the packet originates from this node
-
void csp_input_hook(csp_iface_t *iface, csp_packet_t *packet)
[source] Hook called when a packet is received
- Parameters:
iface – Interface that received the packet
packet – Received packet
-
uint32_t csp_memfree_hook(void)
[source] Returns the available free memory
- Returns:
Free memory in bytes
-
unsigned int csp_ps_hook(csp_packet_t *packet)
[source] Collects process information into a packet
- Parameters:
packet – Packet to be filled with process info
- Returns:
Number of entries written
-
void csp_panic(const char *msg)
[source] Called in case of a fatal error This function must not return, and should reboot the system or the program running CSP to recover responsiveness of the system.
- Parameters:
msg – Error message
-
int csp_crypto_decrypt(uint8_t *ciphertext_in, uint8_t ciphertext_len, uint8_t *msg_out)
[source] Decrypt a message (Implement these if you used csp_if_tun)
- Parameters:
ciphertext_in – Encrypted input data
ciphertext_len – Length of encrypted data
msg_out – Output buffer for the decrypted message
- Returns:
Length of the decrypted data or an error code on failure
-
int csp_crypto_encrypt(uint8_t *msg_begin, uint8_t msg_len, uint8_t *ciphertext_out)
[source] Encrypt a message (Implement these if you used csp_if_tun)
- Parameters:
msg_begin – Plaintext message to encrypt
msg_len – Length of the message
ciphertext_out – Output buffer for encrypted data
- Returns:
Length of the encrypted data or an error code on failure