diff options
Diffstat (limited to 'src/client/binding.h')
-rw-r--r-- | src/client/binding.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/client/binding.h b/src/client/binding.h new file mode 100644 index 0000000..ea02c98 --- /dev/null +++ b/src/client/binding.h @@ -0,0 +1,26 @@ +#pragma once + +#include "../packet/packet.h" +#include "addr.h" + +#include <netinet/in.h> + +typedef enum { + UDP, + TCP +} BindingType; + +typedef struct { + BindingType type; + union { + struct { + UdpSocket udp; + SocketAddr clientaddr; + } udp; + TcpStream tcp; + } sock; +} Connection; + +bool create_request(BindingType type, SocketAddr* addr, Connection* request); +bool request_packet(Connection* request, Packet* in, Packet* out); +void free_request(Connection* connection); |