forked from tvntsr/push
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpush_common.h
66 lines (43 loc) · 1.5 KB
/
push_common.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#ifndef PUSH_COMMON_H
#define PUSH_COMMON_H
#include <openssl/ssl.h>
#include "../../lib/srdb1/db.h"
#define ENABLE_FEEDBACK_SERVICE
#define PUSH_TABLE_VERSION 1
struct PushServer
{
char* server;
uint16_t port;
int socket;
char* cert_file;
char* cert_key;
char* cert_ca;
SSL* ssl;
SSL_CTX* ssl_ctx;
int flags;
int error;
int read_timeout; // usec
int write_timeout; // usec
db_func_t dbf;
db1_con_t *db;
};
typedef struct PushServer PushServer;
enum PUSH_FLAG_VALUE
{
ConnectEstablish = 0,
DelayedConnect,
NoReconnect
};
PushServer* create_push_server(const char *cert_file,
const char *cert_key,
const char *cert_ca,
const char *server,
uint16_t port);
void destroy_push_server(PushServer*);
int push_check_db(PushServer* apns, const char* push_db, const char* push_table);
int push_connect_db(PushServer* apns, const char* push_db, const char* push_table, int rank);
int push_send(PushServer* apns, const char *device_token, const char* alert, const char* custom, int badge);
int push_register_device(PushServer* apns, const char* contact, const char *device_token, const str* callid, const char* tbl);
int push_get_device(PushServer* apns, const char* aor, const char** device_token, const char* tbl);
void push_check_status(PushServer* apns);
#endif //PUSH_COMMON_H