NetworkUtilities 1.4.2
A small compiled library for C network utility functions.
|
Functions related to formatting messages for transmission or for handling their receipt. More...
Functions | |
int | sendMessage (SOCKET udpSocket, struct sockaddr_in serverAddr, char *message) |
Sends cursor position over UDP socket. | |
int | sendCursorPosition (SOCKET udpSocket, struct sockaddr_in serverAddr, uint16_t x, uint16_t y, uint8_t renderFlag, const char *tag) |
Sends cursor position over UDP socket. | |
int | sendRenderParameters (SOCKET udpSocket, struct sockaddr_in serverAddr, uint8_t radius_cursor, uint8_t radius_targets, uint8_t line_width, const char *tag) |
Sends rendering parameters over UDP socket. | |
int | sendTargetUpdate (SOCKET udpSocket, struct sockaddr_in serverAddr, uint16_t x1, uint16_t y1, uint8_t render1, uint16_t x2, uint16_t y2, uint8_t render2, const char *tag) |
Sends target update information over UDP socket. | |
void | receiveCursorMessage (SOCKET udpSocket, RenderedCircleData *cursor) |
Receives cursor message over UDP socket. | |
void | receiveTargetMessage (SOCKET udpSocket, RenderedCircleData **targets) |
Receives target message over UDP socket. | |
Functions related to formatting messages for transmission or for handling their receipt.
void receiveCursorMessage | ( | SOCKET | udpSocket, |
RenderedCircleData * | cursor ) |
Receives cursor message over UDP socket.
This function receives cursor message data over the specified UDP socket. It receives the message, parses it assuming it's in the format "x,y", and updates the cursor position based on the received data.
udpSocket | The UDP socket to receive the cursor message on. |
cursor | Pointer to the struct where cursor data will be updated. |
void receiveTargetMessage | ( | SOCKET | udpSocket, |
RenderedCircleData ** | targets ) |
Receives target message over UDP socket.
This function receives target message data over the specified UDP socket. It receives the message, parses it assuming it's in the format "x,y,targetIndex,renderFlag", and updates the corresponding target position and render flag based on the received data.
udpSocket | The UDP socket to receive the target message on. |
targets | Array of pointers to RenderedCircleData representing targets. |
int sendCursorPosition | ( | SOCKET | udpSocket, |
struct sockaddr_in | serverAddr, | ||
uint16_t | x, | ||
uint16_t | y, | ||
uint8_t | renderFlag, | ||
const char * | tag ) |
Sends cursor position over UDP socket.
This function sends cursor position data over the specified UDP socket.
udpSocket | The UDP socket to send the cursor position over. |
serverAddr | The server address structure for UDP remote socket. |
x | The x-coordinate of the cursor position (pixels). |
y | The y-coordinate of the cursor position (pixels). |
renderFlag | Flag indicating whether or not to render the cursor. |
tag | (Optional) either NULL or some identifier string that forces it to print debug statement of what the sent message is. |
int sendMessage | ( | SOCKET | udpSocket, |
struct sockaddr_in | serverAddr, | ||
char * | message ) |
Sends cursor position over UDP socket.
This function sends cursor position data over the specified UDP socket.
udpSocket | The UDP socket to send the cursor position over. |
serverAddr | The server address structure for UDP remote socket. |
message | The message to send to the server. |
int sendRenderParameters | ( | SOCKET | udpSocket, |
struct sockaddr_in | serverAddr, | ||
uint8_t | radius_cursor, | ||
uint8_t | radius_targets, | ||
uint8_t | line_width, | ||
const char * | tag ) |
Sends rendering parameters over UDP socket.
This function sends size parameters for rendering circles over the specified UDP socket.
udpSocket | The UDP socket to send the cursor position over. |
serverAddr | The server address structure for UDP remote socket. |
radius_cursor | Radius of cursor circle (pixels). |
radius_targets | Radius of target circles (pixels). |
line_width | Width of lines (pixels). |
tag | (Optional) either NULL or some identifier string that forces it to print debug statement of what the sent message is. |
int sendTargetUpdate | ( | SOCKET | udpSocket, |
struct sockaddr_in | serverAddr, | ||
uint16_t | x1, | ||
uint16_t | y1, | ||
uint8_t | render1, | ||
uint16_t | x2, | ||
uint16_t | y2, | ||
uint8_t | render2, | ||
const char * | tag ) |
Sends target update information over UDP socket.
This function sends target update information over the specified UDP socket.
udpSocket | The UDP socket to send the target update over. |
serverAddr | The server address structure for UDP remote socket. |
x1 | The x-coordinate of T1 (pixels). |
y1 | The y-coordinate of T1 (pixels). |
render1 | The render flag indicating whether to render T1. |
x2 | The x-coordinate of T2 (pixels). |
y2 | The y-coordinate of T2 (pixels). |
render2 | The render flag indicating whether to render T2. |
tag | (Optional) either NULL or some identifier string that forces it to print debug statement of what the sent message is. |