You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
robomaster-sdk/src/connection.h

30 lines
689 B
C

#pragma once
#include "message.h"
#include "client.h"
#include <stddef.h>
#include <netinet/in.h>
struct Connection {
int sockfd;
socklen_t addrlen;
struct sockaddr_in remote_addr;
};
struct Connection*
connection_new(unsigned int source_port, const char* source_ip, unsigned int dest_port, const char* dest_ip);
struct Connection*
connection_poll_ready(struct Client* client);
void
connection_read(struct Connection* connection, union Message* resp);
void
req_finalize(struct Client* client, uint8_t cmdset, uint8_t cmdid, uint8_t hostbyte, bool need_ack, size_t length, union Request* req);
void
req_send(struct Connection* conn, union Request* req, size_t length);