42 lines
1.2 KiB
C
42 lines
1.2 KiB
C
#ifndef CABLE_HYPERSWARM_H
|
|||
|
|
#define CABLE_HYPERSWARM_H
|
||
|
|
|
||
|
|
#include "dat_s7.h"
|
||
|
|
#include "s7.h"
|
||
|
|
#include <stddef.h>
|
||
|
|
#ifdef _WIN32
|
||
|
|
#include <windows.h>
|
||
|
|
#else
|
||
|
|
#include <sys/types.h>
|
||
|
|
#endif
|
||
|
|
|
||
|
|
typedef struct cable_hyperswarm {
|
||
|
|
#ifdef _WIN32
|
||
|
|
HANDLE process_handle;
|
||
|
|
#else
|
||
|
|
pid_t pid;
|
||
|
|
#endif
|
||
|
|
int input_fd;
|
||
|
|
int output_fd;
|
||
|
|
char pending[16384];
|
||
|
|
size_t pending_length;
|
||
|
|
dat_scheme_runtime_t scheme;
|
||
|
|
} cable_hyperswarm_t;
|
||
|
|
|
||
|
|
typedef void (*cable_hyperswarm_event_fn)(void *context, s7_pointer event);
|
||
|
|
|
||
|
|
int cable_hyperswarm_start(cable_hyperswarm_t *bridge, const char *room_key,
|
||
|
|
const char *storage, const char *nick,
|
||
|
|
const char *channel);
|
||
|
|
int cable_hyperswarm_send(cable_hyperswarm_t *bridge, const char *channel,
|
||
|
|
const char *text);
|
||
|
|
int cable_hyperswarm_nick(cable_hyperswarm_t *bridge, const char *nick);
|
||
|
|
int cable_hyperswarm_join(cable_hyperswarm_t *bridge, const char *channel);
|
||
|
|
/* Carry one bounded, binary-safe live media packet over Cable's room peers. */
|
||
|
|
int cable_hyperswarm_live(cable_hyperswarm_t *bridge,
|
||
|
|
const uint8_t *packet, size_t packet_length);
|
||
|
|
int cable_hyperswarm_poll(cable_hyperswarm_t *bridge,
|
||
|
|
cable_hyperswarm_event_fn callback, void *context);
|
||
|
|
void cable_hyperswarm_stop(cable_hyperswarm_t *bridge);
|
||
|
|
|
||
|
|
#endif
|