2015-06-19 22:18:24 +00:00
|
|
|
#ifndef _COSMOPOLITE_INT_H
|
|
|
|
|
#define _COSMOPOLITE_INT_H
|
|
|
|
|
|
|
|
|
|
// Declarations that aren't in the public API but are available to the test suite.
|
|
|
|
|
|
2015-06-28 09:54:03 -07:00
|
|
|
struct cosmo_command {
|
|
|
|
|
struct cosmo_command *prev;
|
|
|
|
|
struct cosmo_command *next;
|
|
|
|
|
json_t *command;
|
2015-06-28 11:43:17 -07:00
|
|
|
promise *promise;
|
2015-06-28 09:54:03 -07:00
|
|
|
};
|
|
|
|
|
|
2015-07-05 02:59:07 +00:00
|
|
|
struct cosmo_get_profile {
|
|
|
|
|
struct cosmo_get_profile *next;
|
|
|
|
|
promise *promise;
|
|
|
|
|
};
|
|
|
|
|
|
2015-06-19 22:18:24 +00:00
|
|
|
struct cosmo {
|
|
|
|
|
char client_id[COSMO_UUID_SIZE];
|
|
|
|
|
char instance_id[COSMO_UUID_SIZE];
|
|
|
|
|
cosmo_callbacks callbacks;
|
2015-06-24 04:01:32 +00:00
|
|
|
cosmo_options options;
|
2015-06-19 22:18:24 +00:00
|
|
|
void *passthrough;
|
|
|
|
|
|
|
|
|
|
pthread_mutex_t lock;
|
|
|
|
|
pthread_cond_t cond;
|
|
|
|
|
bool shutdown;
|
2015-06-28 11:55:09 -07:00
|
|
|
json_t *profile;
|
2015-07-05 02:59:07 +00:00
|
|
|
struct cosmo_get_profile *get_profile_head;
|
2015-06-28 11:55:09 -07:00
|
|
|
json_t *generation;
|
2015-06-28 09:54:03 -07:00
|
|
|
struct cosmo_command *command_queue_head;
|
|
|
|
|
struct cosmo_command *command_queue_tail;
|
2015-06-19 22:18:24 +00:00
|
|
|
json_t *ack;
|
|
|
|
|
json_t *subscriptions;
|
|
|
|
|
uint64_t next_delay_ms;
|
|
|
|
|
unsigned int seedp;
|
2015-06-19 22:57:11 +00:00
|
|
|
bool debug;
|
2015-06-19 22:18:24 +00:00
|
|
|
|
|
|
|
|
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
|