Hide cosmo struct definition from the public API.
This commit is contained in:
39
clients/c/cosmopolite-int.h
Normal file
39
clients/c/cosmopolite-int.h
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
#ifndef _COSMOPOLITE_INT_H
|
||||||
|
#define _COSMOPOLITE_INT_H
|
||||||
|
|
||||||
|
// Declarations that aren't in the public API but are available to the test suite.
|
||||||
|
|
||||||
|
struct cosmo {
|
||||||
|
char client_id[COSMO_UUID_SIZE];
|
||||||
|
char instance_id[COSMO_UUID_SIZE];
|
||||||
|
cosmo_callbacks callbacks;
|
||||||
|
void *passthrough;
|
||||||
|
|
||||||
|
pthread_mutex_t lock;
|
||||||
|
pthread_cond_t cond;
|
||||||
|
bool shutdown;
|
||||||
|
char *profile;
|
||||||
|
json_t *command_queue;
|
||||||
|
json_t *ack;
|
||||||
|
json_t *subscriptions;
|
||||||
|
uint64_t next_delay_ms;
|
||||||
|
unsigned int seedp;
|
||||||
|
|
||||||
|
enum {
|
||||||
|
INITIAL_CONNECT,
|
||||||
|
CONNECTED,
|
||||||
|
DISCONNECTED,
|
||||||
|
} connect_state;
|
||||||
|
struct timespec last_success;
|
||||||
|
|
||||||
|
enum {
|
||||||
|
LOGIN_UNKNOWN,
|
||||||
|
LOGGED_OUT,
|
||||||
|
LOGGED_IN,
|
||||||
|
} login_state;
|
||||||
|
|
||||||
|
pthread_t thread;
|
||||||
|
CURL *curl;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -8,6 +8,7 @@
|
|||||||
#include <uuid/uuid.h>
|
#include <uuid/uuid.h>
|
||||||
|
|
||||||
#include "cosmopolite.h"
|
#include "cosmopolite.h"
|
||||||
|
#include "cosmopolite-int.h"
|
||||||
|
|
||||||
#define min(a, b) ((a) < (b) ? (a) : (b))
|
#define min(a, b) ((a) < (b) ? (a) : (b))
|
||||||
#define max(a, b) ((a) > (b) ? (a) : (b))
|
#define max(a, b) ((a) > (b) ? (a) : (b))
|
||||||
|
|||||||
@@ -17,38 +17,7 @@ typedef struct {
|
|||||||
void (*message)(const json_t *, void *);
|
void (*message)(const json_t *, void *);
|
||||||
} cosmo_callbacks;
|
} cosmo_callbacks;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct cosmo cosmo;
|
||||||
char client_id[COSMO_UUID_SIZE];
|
|
||||||
char instance_id[COSMO_UUID_SIZE];
|
|
||||||
cosmo_callbacks callbacks;
|
|
||||||
void *passthrough;
|
|
||||||
|
|
||||||
pthread_mutex_t lock;
|
|
||||||
pthread_cond_t cond;
|
|
||||||
bool shutdown;
|
|
||||||
char *profile;
|
|
||||||
json_t *command_queue;
|
|
||||||
json_t *ack;
|
|
||||||
json_t *subscriptions;
|
|
||||||
uint64_t next_delay_ms;
|
|
||||||
unsigned int seedp;
|
|
||||||
|
|
||||||
enum {
|
|
||||||
INITIAL_CONNECT,
|
|
||||||
CONNECTED,
|
|
||||||
DISCONNECTED,
|
|
||||||
} connect_state;
|
|
||||||
struct timespec last_success;
|
|
||||||
|
|
||||||
enum {
|
|
||||||
LOGIN_UNKNOWN,
|
|
||||||
LOGGED_OUT,
|
|
||||||
LOGGED_IN,
|
|
||||||
} login_state;
|
|
||||||
|
|
||||||
pthread_t thread;
|
|
||||||
CURL *curl;
|
|
||||||
} cosmo;
|
|
||||||
|
|
||||||
void cosmo_uuid(char *uuid);
|
void cosmo_uuid(char *uuid);
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "cosmopolite.h"
|
#include "cosmopolite.h"
|
||||||
|
#include "cosmopolite-int.h"
|
||||||
|
|
||||||
#define RUN_TEST(func) run_test(#func, func)
|
#define RUN_TEST(func) run_test(#func, func)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user