csp.h
Go to the documentation of this file.
169 int csp_transaction(uint8_t prio, uint8_t dest, uint8_t port, uint32_t timeout, void *outbuf, int outlen, void *inbuf, int inlen);
182 int csp_transaction_persistent(csp_conn_t *conn, uint32_t timeout, void *outbuf, int outlen, void *inbuf, int inlen);
204 int csp_sendto(uint8_t prio, uint8_t dest, uint8_t dport, uint8_t src_port, uint32_t opts, csp_packet_t *packet, uint32_t timeout);
215 int csp_sendto_reply(csp_packet_t * request_packet, csp_packet_t * reply_packet, uint32_t opts, uint32_t timeout);
229 csp_conn_t *csp_connect(uint8_t prio, uint8_t dest, uint8_t dport, uint32_t timeout, uint32_t opts);
308 int csp_bridge_start(unsigned int task_stack_size, unsigned int task_priority, csp_iface_t * _if_a, csp_iface_t * _if_b);
362 int csp_sfp_send_own_memcpy(csp_conn_t * conn, void * data, int totalsize, int mtu, uint32_t timeout, void * (*memcpyfcn)(void *, const void *, size_t));
383 int csp_sfp_recv_fp(csp_conn_t * conn, void ** dataout, int * datasize, uint32_t timeout, csp_packet_t * first_packet);
521 typedef void (*csp_debug_hook_func_t)(csp_debug_level_t level, const char *format, va_list args);
int csp_send(csp_conn_t *conn, csp_packet_t *packet, uint32_t timeout)
Send a packet on an already established connection.
int csp_transaction(uint8_t prio, uint8_t dest, uint8_t port, uint32_t timeout, void *outbuf, int outlen, void *inbuf, int inlen)
Perform an entire request/reply transaction Copies both input buffer and reply to output buffeer...
csp_packet_t * csp_read(csp_conn_t *conn, uint32_t timeout)
Read data from a connection This fuction uses the RX queue of a connection to receive a packet If no ...
void(* csp_debug_hook_func_t)(csp_debug_level_t level, const char *format, va_list args)
Set csp_debug hook function.
Definition: csp.h:521
void csp_debug_hook_set(csp_debug_hook_func_t f)
int csp_conn_sport(csp_conn_t *conn)
int csp_bridge_start(unsigned int task_stack_size, unsigned int task_priority, csp_iface_t *_if_a, csp_iface_t *_if_b)
Start the bridge task.
void csp_cmp_set_memcpy(csp_memcpy_fnc_t fnc)
int csp_sfp_send_own_memcpy(csp_conn_t *conn, void *data, int totalsize, int mtu, uint32_t timeout, void *(*memcpyfcn)(void *, const void *, size_t))
Same as csp_sfp_send but with option to supply your own memcpy function.
int csp_conn_dport(csp_conn_t *conn)
int csp_conn_dst(csp_conn_t *conn)
int csp_sfp_recv(csp_conn_t *conn, void **dataout, int *datasize, uint32_t timeout)
This is the counterpart to the csp_sfp_send function.
void csp_rdp_get_opt(unsigned int *window_size, unsigned int *conn_timeout_ms, unsigned int *packet_timeout_ms, unsigned int *delayed_acks, unsigned int *ack_timeout, unsigned int *ack_delay_count)
Get RDP options.
int csp_sfp_send(csp_conn_t *conn, void *data, int totalsize, int mtu, uint32_t timeout)
Send multiple packets using the simple fragmentation protocol CSP will add total size and offset to a...
struct csp_conn_s csp_socket_t
Forward declaration of socket and connection structures.
Definition: csp_types.h:217
int csp_route_start_task(unsigned int task_stack_size, unsigned int priority)
Start the router task.
int csp_sendto_reply(csp_packet_t *request_packet, csp_packet_t *reply_packet, uint32_t opts, uint32_t timeout)
Send a packet as a direct reply to the source of an incoming packet, but still without holding an ent...
csp_packet_t * csp_promisc_read(uint32_t timeout)
Get packet from promiscuous mode packet queue Returns the first packet from the promiscuous mode pack...
csp_memptr_t(* csp_memcpy_fnc_t)(csp_memptr_t, const csp_memptr_t, size_t)
Definition: csp.h:513
int csp_promisc_enable(unsigned int buf_size)
Enable promiscuous mode packet queue This function is used to enable promiscuous mode for the router...
void csp_buf_free(uint8_t node, uint32_t timeout)
Request number of free buffer elements.
csp_conn_t * csp_connect(uint8_t prio, uint8_t dest, uint8_t dport, uint32_t timeout, uint32_t opts)
csp_connect Used to establish outgoing connections This function searches the port table for free slo...
int csp_listen(csp_socket_t *socket, size_t conn_queue_length)
Set socket to listen for incoming connections.
csp_conn_t * csp_accept(csp_socket_t *socket, uint32_t timeout)
Wait for a new connection on a socket created by csp_socket.
int csp_send_prio(uint8_t prio, csp_conn_t *conn, csp_packet_t *packet, uint32_t timeout)
Send a packet on an already established connection, and change the default priority of the connection...
int csp_sendto(uint8_t prio, uint8_t dest, uint8_t dport, uint8_t src_port, uint32_t opts, csp_packet_t *packet, uint32_t timeout)
Send a packet without previously opening a connection.
int csp_conn_src(csp_conn_t *conn)
void csp_rdp_set_opt(unsigned int window_size, unsigned int conn_timeout_ms, unsigned int packet_timeout_ms, unsigned int delayed_acks, unsigned int ack_timeout, unsigned int ack_delay_count)
Set RDP options.
int csp_route_work(uint32_t timeout)
Call the router worker function manually (without the router task) This must be run inside a loop or ...
void csp_service_handler(csp_conn_t *conn, csp_packet_t *packet)
If the given packet is a service-request (that is uses one of the csp service ports) it will be handl...
csp_packet_t * csp_recvfrom(csp_socket_t *socket, uint32_t timeout)
Read data from a connection-less server socket This fuction uses the socket directly to receive a fra...
int csp_sfp_recv_fp(csp_conn_t *conn, void **dataout, int *datasize, uint32_t timeout, csp_packet_t *first_packet)
This is the counterpart to the csp_sfp_send function.
int csp_transaction_persistent(csp_conn_t *conn, uint32_t timeout, void *outbuf, int outlen, void *inbuf, int inlen)
Use an existing connection to perform a transaction, This is only possible if the next packet is on t...
CSP PACKET STRUCTURE Note: This structure is constructed to fit with all interface frame types in ord...
Definition: csp_types.h:174
int csp_ping(uint8_t node, uint32_t timeout, unsigned int size, uint8_t conn_options)
Send a single ping/echo packet.
void csp_ping_noreply(uint8_t node)
Send a single ping/echo packet without waiting for reply.
int csp_conn_flags(csp_conn_t *conn)