Sleds/K2Client/proxy.h

30 lines
1.1 KiB
C
Raw Normal View History

2025-03-13 21:28:38 +00:00
/*
Copyright (c) 2014 IOnU Security Inc. All rights reserved
Created March 2014 by Kendrick Webster
K2Client/proxy.h - interface for K2Proxy adapter
Description: Clients behind firewalls that block UDP traffic
will fall back on using an HTTP/TCP proxy. This module provides
low-level support for sending and receiving datagrams via K2Proxy.
*/
#pragma once
#include <stdint.h>
// start (or re-initialize) the proxy module's thread(s) ... begins listening ...
// packets received from the K2Proxy at <proxy_addr> are sent to the <onPacketReceived> callback
void proxy_start(const struct sockaddr_in* proxy_addr, const char* proxy_host, const char* urn,
void (*onPacketReceived)(uint8_t* buf, size_t len));
// send a UDP packet via the K2Proxy at proxy_start(<proxy_addr>)
// packet will be dropped if <is_proxy_session_active> isn't TRUE
void proxy_send(const uint8_t* buf, unsigned int len);
// stop the proxy module's thread(s)
void proxy_stop(void);
// read-only by other modules, indicates that a proxy session is currently active
// (thus calling proxy_send() will work)
extern volatile int is_proxy_session_active;