FreeRTOS Tetris
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 
69 
77 void aIODeinit(void);
78 
84 void aIOCloseConn(aIO_handle_t conn); //TODO
85 
97 int aIOMessageQueuePut(char *mq_name, char *buffer);
98 
110 int aIOSocketPut(aIO_socket_e protocol, char *s_addr, in_port_t port,
111  char *buffer, size_t buffer_size);
128 aIO_handle_t aIOOpenMessageQueue(char *name, long max_msg_num,
129  long max_msg_size, aIO_callback_t callback,
130  void *args);
131 
143 aIO_handle_t aIOOpenUDPSocket(char *s_addr, in_port_t port, size_t buffer_size,
144  aIO_callback_t callback, void *args);
145 
157 aIO_handle_t aIOOpenTCPSocket(char *s_addr, in_port_t port, size_t buffer_size,
158  aIO_callback_t callback, void *args);
159 
161 #endif
aIOOpenMessageQueue
aIO_handle_t aIOOpenMessageQueue(char *name, long max_msg_num, long max_msg_size, aIO_callback_t callback, void *args)
Open a POSIX message queue.
aIODeinit
void aIODeinit(void)
Function that closes all open connections.
Definition: AsyncIO.c:189
aIOSocketPut
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:292
aIO_socket_e
aIO_socket_e
Socket protocols supported.
Definition: AsyncIO.h:58
aIO_handle_t
void * aIO_handle_t
Handle used to reference and opened asyncronour communications channel.
Definition: AsyncIO.h:53
aIOMessageQueuePut
int aIOMessageQueuePut(char *mq_name, char *buffer)
Sends the data stored in buffer to the message queue with the provided name.
Definition: AsyncIO.c:259
aIOCloseConn
void aIOCloseConn(aIO_handle_t conn)
Closes a connection and frees all resources used by that connection.
Definition: AsyncIO.c:154
aIOOpenUDPSocket
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.
aIO_callback_t
void(* aIO_callback_t)(size_t recv_size, char *buffer, void *args)
Callback for an asynchronous IO connection.
Definition: AsyncIO.h:67
aIOOpenTCPSocket
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.