Crate libcsp_sys

Source
Expand description

This crate provides FFI bindings for the libcsp library. Generally, you probably do not want to use this library directly and instead use the libcsp Rust crate which provides a safe and ergonomic Rust API.

You can find some more high-level information and examples in the main repository.

§Compile-time configuration

This library requires some compile-time configuration file to be included to work properly. You can see an example version of the file for the workspace here. The user has to provide the path to a directory containing this autoconfig.rs file using the CSP_CONFIG_DIR environmental variable.

Modules§

config
hooks
Hook module for CSP.
iflist
udp

Structs§

csp_conn_s
@brief Connection struct
csp_id_t
CSP identifier/header.
csp_if_udp_conf_t
csp_iface_s
This struct is referenced in documentation. Update doc when you change this.
csp_packet_s
CSP Packet.
csp_packet_s_anon_union_field_rdp_only
csp_packet_s_anon_union_field_rx_tx_only
csp_rdp_t
RDP Connection
csp_socket_s
@brief Connection struct
csp_timestamp_t

Constants§

CSP_BUFFER_COUNT
CSP_BUFFER_SIZE
CSP_CONN_MAX
CSP_CONN_RXQUEUE_LEN
CSP_PORT_MAX_BIND
CSP_QFIFO_LEN
CSP_RDP_MAX_WINDOW
CSP_RTABLE_SIZE

Statics§

csp_dbg_buffer_out
Error counters
csp_dbg_can_errno
csp_dbg_conn_noroute
csp_dbg_conn_out
csp_dbg_conn_ovf
csp_dbg_errno
csp_dbg_eth_errno
csp_dbg_inval_reply
csp_dbg_packet_print
csp_dbg_rdp_print

Functions§

csp_accept
Wait/accept a new connection.
csp_bind
Bind port to socket.
csp_buf_free
Request free buffers and print to stdout.
csp_buffer_free
Free buffer (from task context).
csp_buffer_get
Get free buffer from task context.
csp_close
Close an open connection. Any packets in the RX queue will be freed.
csp_conn_dport
Return destination port of connection.
csp_conn_dst
Return destination address of connection.
csp_conn_flags
Return flags of connection.
csp_conn_print_table
Print connection table to stdout.
csp_conn_sport
Return source port of connection.
csp_conn_src
Return source address of connection.
csp_connect
Establish outgoing connection. The call will return immediately, unless it is a RDP connection (#CSP_O_RDP) in which case it will wait until the other end acknowleges the connection (timeout is determined by the current connection timeout set by csp_rdp_set_opt()).
csp_get_buf_free
Request free buffers.
csp_get_memfree
Request free memory.
csp_get_uptime
Request uptime
csp_init
Initialize CSP. This will configure basic structures.
csp_listen
Set socket to listen for incoming connections.
csp_memfree
Request free memory and print to stdout.
csp_ping
Send a single ping/echo packet.
csp_ping_noreply
Send a single ping/echo packet without waiting for reply. Payload is 1 byte.
csp_print_func
csp_ps
Request process list.
csp_read
Read packet from a connection. This fuction will wait on the connection’s RX queue for the specified timeout.
csp_reboot
Reboot subsystem. If handled by the standard CSP service handler, the reboot handler set by csp_sys_set_reboot() on the subsystem, will be invoked.
csp_recvfrom
Read data from a connection-less server socket.
csp_route_work
Route packet from the incoming router queue and check RDP timeouts. In order for incoming packets to routed and RDP timeouts to be checked, this function must be called reguarly. @return #CSP_ERR_NONE on success, otherwise an error code.
csp_send
Send packet on a connection. The packet buffer is automatically freed, and cannot be used after the call to csp_send()
csp_send_prio
Change the default priority of the connection and send a packet.
csp_sendto_reply
Send a packet as a reply to a request (without a connection). Calls csp_sendto() with the source address and port from the request.
csp_service_handler
Handle CSP service request. If the given packet is a service-request (the destination port matches one of CSP service ports #csp_service_port_t), the packet will be processed by the specific CSP service handler. The packet will either process it or free it, so this function is typically called in the last “default” clause of a switch/case statement in a CSP listener task. In order to listen to csp service ports, bind your listener to the specific services ports #csp_service_port_t or use #CSP_ANY to all ports.
csp_shutdown
Shutdown subsystem. If handled by the standard CSP service handler, the shutdown handler set by csp_sys_set_shutdown() on the subsystem, will be invoked.
csp_socket_close
Close a socket, freeing it’s RX queue and unbinding it from the associated port.
csp_transaction_persistent
Perform an entire request & reply transaction on an existing connection. Send \a outbuf, wait for reply and copy reply to \a inbuf.
csp_transaction_w_opts
Perform an entire request & reply transaction. Creates a connection, send \a outbuf, wait for reply, copy reply to \a inbuf and close the connection.
csp_uptime
Request uptime and print to stdout.

Type Aliases§

atomic_int
csp_bin_sem_tUnix
csp_conn_state_t
Connection states
csp_conn_t
Forward declaration of connection structure
csp_conn_type_t
Connection types
csp_iface_t
Forward declaration of CSP interface, see #csp_iface_s for details.
csp_packet_t
CSP Packet.
csp_queue_handle_t
csp_rdp_state_t
RDP Connection states
csp_socket_t
Forward declaration of socket structure
csp_static_queue_t
nexthop_t
Interface Tx function.

Unions§

csp_packet_s_anon_union
csp_packet_s_data_union
Data part of packet: