Initial import
This commit is contained in:
commit
a027fabb79
6 changed files with 800 additions and 0 deletions
51
RewindClient.h
Normal file
51
RewindClient.h
Normal file
|
@ -0,0 +1,51 @@
|
|||
#ifndef REWINDCLIENT_H
|
||||
#define REWINDCLIENT_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <netdb.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <netinet/ip.h>
|
||||
|
||||
#include "Rewind.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#define CLIENT_ERROR_SUCCESS 0
|
||||
#define CLIENT_ERROR_SOCKET_IO -1
|
||||
#define CLIENT_ERROR_WRONG_ADDRESS -2
|
||||
#define CLIENT_ERROR_WRONG_DATA -3
|
||||
#define CLIENT_ERROR_DNS_RESOLVE -4
|
||||
#define CLIENT_ERROR_ATTEMPT_EXCEEDED -5
|
||||
|
||||
struct RewindContext
|
||||
{
|
||||
int handle;
|
||||
struct addrinfo* address;
|
||||
|
||||
uint32_t counters[2];
|
||||
|
||||
struct RewindVersionData* data;
|
||||
size_t length;
|
||||
};
|
||||
|
||||
struct RewindContext* CreateRewindClient(uint32_t number, const char* verion);
|
||||
void ReleaseRewindClient(struct RewindContext* context);
|
||||
|
||||
void TransmitRewindData(struct RewindContext* context, uint16_t type, uint16_t flag, void* data, size_t length);
|
||||
ssize_t ReceiveRewindData(struct RewindContext* context, struct RewindData* buffer, ssize_t length);
|
||||
|
||||
int ConnectRewindClient(struct RewindContext* context, const char* location, const char* port, const char* password, uint32_t options);
|
||||
|
||||
#define TransmitRewindKeepAlive(context) TransmitRewindData(context, REWIND_TYPE_KEEP_ALIVE, REWIND_FLAG_NONE, context->data, context->length);
|
||||
#define TransmitRewindCloae(context) TransmitRewindData(context, REWIND_TYPE_CLOSE, REWIND_FLAG_NONE, NULL, 0 );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue