initial commit
This commit is contained in:
Executable
+41
@@ -0,0 +1,41 @@
|
||||
#ifndef ZERIN_TRANSPORT_H
|
||||
#define ZERIN_TRANSPORT_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
// Transport interface — function pointers allow swapping HTTP/DNS/SMB/etc.
|
||||
typedef struct transport transport_t;
|
||||
|
||||
typedef int (*transport_init_fn)(transport_t *t, const char *url, const char *user_agent);
|
||||
typedef int (*transport_send_fn)(transport_t *t, const char *endpoint,
|
||||
const uint8_t *data, size_t data_len,
|
||||
uint8_t **response, size_t *response_len);
|
||||
typedef void (*transport_cleanup_fn)(transport_t *t);
|
||||
|
||||
struct transport {
|
||||
transport_init_fn init;
|
||||
transport_send_fn send;
|
||||
transport_cleanup_fn cleanup;
|
||||
void *ctx; // Implementation-specific context
|
||||
};
|
||||
|
||||
// HTTP/S transport implementation
|
||||
extern transport_t transport_https;
|
||||
|
||||
int http_init(transport_t *t, const char *url, const char *user_agent);
|
||||
int http_send(transport_t *t, const char *endpoint,
|
||||
const uint8_t *data, size_t data_len,
|
||||
uint8_t **response, size_t *response_len);
|
||||
void http_cleanup(transport_t *t);
|
||||
|
||||
// High-level transport functions used by beacon
|
||||
int transport_do_key_exchange(transport_t *t, const char *base_url,
|
||||
const uint8_t *kx_data, size_t kx_len,
|
||||
uint8_t **response, size_t *response_len);
|
||||
|
||||
int transport_do_beacon(transport_t *t, const char *base_url,
|
||||
const uint8_t *beacon_data, size_t beacon_len,
|
||||
uint8_t **response, size_t *response_len);
|
||||
|
||||
#endif // ZERIN_TRANSPORT_H
|
||||
Reference in New Issue
Block a user