Create release.yml
[betaflight.git] / src / main / target / SITL / udplink.h
blob0c40c5b67c8d67a264ed18f2ee363d36ca677a48
1 /**
2 * Copyright (c) 2017 cs8425
4 * This library is free software; you can redistribute it and/or modify it
5 * under the terms of the MIT license.
6 */
8 #ifndef __UDPLINK_H
9 #define __UDPLINK_H
11 #include <stdint.h>
12 #include <stddef.h>
13 #include <stdbool.h>
15 #include <arpa/inet.h>
16 #include <netinet/in.h>
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
22 typedef struct {
23 int fd;
24 struct sockaddr_in si;
25 struct sockaddr_in recv;
26 int port;
27 char* addr;
28 bool isServer;
29 } udpLink_t;
31 int udpInit(udpLink_t* link, const char* addr, int port, bool isServer);
32 int udpRecv(udpLink_t* link, void* data, size_t size, uint32_t timeout_ms);
33 int udpSend(udpLink_t* link, const void* data, size_t size);
35 #ifdef __cplusplus
36 } // extern "C"
37 #endif
39 #endif