mirror of https://github.com/oxen-io/lokinet
update header with notes
This commit is contained in:
parent
7a992c7ebc
commit
5f49d3a49f
|
@ -59,46 +59,40 @@ extern "C"
|
||||||
|
|
||||||
/// inbound listen udp socket
|
/// inbound listen udp socket
|
||||||
/// expose udp port exposePort to the void
|
/// expose udp port exposePort to the void
|
||||||
/// if srv is not NULL add an srv record for this port, the format being "thingservice" in which
|
/// localAddr to forward inbound udp packets to "ip:port"
|
||||||
/// will add a srv record "_udp.thingservice.ouraddress.tld" that advertises this port provide
|
|
||||||
/// localAddr to forward inbound udp packets to "ip:port" if localAddr is NULL then the resulting
|
|
||||||
/// socket MUST be drained by lokinet_udp_recvmmsg
|
|
||||||
///
|
|
||||||
/// returns 0 on success
|
/// returns 0 on success
|
||||||
/// returns nonzero on error in which it is an errno value
|
/// returns nonzero on error in which it is an errno value
|
||||||
int EXPORT
|
int EXPORT
|
||||||
lokinet_udp_bind(
|
lokinet_udp_bind(
|
||||||
int exposedPort,
|
int exposedPort,
|
||||||
char* srv,
|
|
||||||
char* localAddr,
|
char* localAddr,
|
||||||
struct lokinet_udp_listen_result* result,
|
struct lokinet_udp_listen_result* result,
|
||||||
struct lokinet_context* ctx);
|
struct lokinet_context* ctx);
|
||||||
|
|
||||||
/// poll many udp sockets for activity
|
/// get remote peer information about a local udp flow coming from localaddr
|
||||||
/// returns 0 on sucess
|
/// returns 0 on success
|
||||||
///
|
/// returns nonzero on error in which it is an errno value
|
||||||
/// returns non zero errno on error
|
|
||||||
int EXPORT
|
int EXPORT
|
||||||
lokinet_udp_poll(
|
lokinet_udp_peername(char* localAddr, struct lokinet_udp_flow* flow, struct lokinet_context* ctx);
|
||||||
const int* socket_ids,
|
|
||||||
size_t numsockets,
|
|
||||||
const struct timespec* timeout,
|
|
||||||
struct lokinet_context* ctx);
|
|
||||||
|
|
||||||
struct lokinet_udp_pkt
|
/*
|
||||||
{
|
|
||||||
char remote_addr[256];
|
|
||||||
int remote_port;
|
|
||||||
struct iovec pkt;
|
|
||||||
};
|
|
||||||
|
|
||||||
/// analog to recvmmsg
|
Packet arrives for new flow:
|
||||||
ssize_t EXPORT
|
- call "new_flow" callback, which can return:
|
||||||
lokinet_udp_recvmmsg(
|
- drop
|
||||||
int socket_id,
|
- accept, returns (context pointer, flow timeout).
|
||||||
struct lokinet_udp_pkt* events,
|
|
||||||
size_t max_events,
|
If accepted then this packet and subsequent packets on the flow:
|
||||||
struct lokient_context* ctx);
|
- call "new_packet" callback, given it the context pointer from accept.
|
||||||
|
|
||||||
|
If no packets for (timeout) we call
|
||||||
|
- "flow_timeout" with the context pointer
|
||||||
|
|
||||||
|
int new_flow(const struct remote_details* remote, void** user_ctx, int* flow_timeout);
|
||||||
|
void new_packet(const struct remote_details* remote, char* data, size_t len, void* user_ctx);
|
||||||
|
void flow_timeout(const struct remote_details* remote, void* user_ctx);
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue