FreeRTOS Emulator with SDL2 Based Graphics and Input Library  1.0
A POSIX wrapper to run FreeRTOS on an x86 machine with some basic input and output libraries aimed at making teaching FreeRTOS simpler.
AsyncIO.h
Go to the documentation of this file.
1 
25 #ifndef __ASYNCIO_H__
26 #define __ASYNCIO_H__
27 
28 #include <netinet/in.h>
29 
47 #define MQ_MAXMSG 256
48 #define MQ_MSGSIZE 256
49 
53 typedef void *aIO_handle_t;
54 
58 typedef enum { UDP, TCP } aIO_socket_e;
59 
67 typedef void (*aIO_callback_t)(size_t recv_size, char *buffer, void *args);
68 
76 void aIODeinit(void);
77 
83 void aIOCloseConn(aIO_handle_t conn); //TODO
84 
96 int aIOMessageQueuePut(const char *mq_name, char *buffer);
97 
112 int aIOSocketPut(aIO_socket_e protocol, char *s_addr, in_port_t port,
113  char *buffer, size_t buffer_size);
130 aIO_handle_t aIOOpenMessageQueue(const char *name, long max_msg_num,
131  long max_msg_size, aIO_callback_t callback,
132  void *args);
133 
145 aIO_handle_t aIOOpenUDPSocket(char *s_addr, in_port_t port, size_t buffer_size,
146  aIO_callback_t callback, void *args);
147 
159 aIO_handle_t aIOOpenTCPSocket(char *s_addr, in_port_t port, size_t buffer_size,
160  aIO_callback_t callback, void *args);
161 
163 #endif
int aIOSocketPut(aIO_socket_e protocol, char *s_addr, in_port_t port, char *buffer, size_t buffer_size)
Send the data stored in buffer to the socket described by s_addr and port.
Definition: AsyncIO.c:291
void(* aIO_callback_t)(size_t recv_size, char *buffer, void *args)
Callback for an asynchronous IO connection.
Definition: AsyncIO.h:67
void * aIO_handle_t
Handle used to reference and opened asyncronour communications channel.
Definition: AsyncIO.h:53
aIO_socket_e
Socket protocols supported.
Definition: AsyncIO.h:58
aIO_handle_t aIOOpenUDPSocket(char *s_addr, in_port_t port, size_t buffer_size, aIO_callback_t callback, void *args)
Opens a socket enpoint.
int aIOMessageQueuePut(const char *mq_name, char *buffer)
Sends the data stored in buffer to the message queue with the provided name.
Definition: AsyncIO.c:258
void aIODeinit(void)
Function that closes all open connections.
Definition: AsyncIO.c:189
aIO_handle_t aIOOpenTCPSocket(char *s_addr, in_port_t port, size_t buffer_size, aIO_callback_t callback, void *args)
Opens a socket enpoint.
aIO_handle_t aIOOpenMessageQueue(const char *name, long max_msg_num, long max_msg_size, aIO_callback_t callback, void *args)
Open a POSIX message queue.
void aIOCloseConn(aIO_handle_t conn)
Closes a connection and frees all resources used by that connection.
Definition: AsyncIO.c:154
@ TCP
Definition: AsyncIO.h:58
@ UDP
Definition: AsyncIO.h:58