-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsca_db.h
91 lines (78 loc) · 2.75 KB
/
sca_db.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/*
* $Id$
*
* Copyright (C) 2012 Andrew Mortensen
*
* This file is part of the sca module for sip-router, a free SIP server.
*
* The sca module is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version
*
* The sca module is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
#ifndef SCA_DB_H
#define SCA_DB_H
#include "../../lib/srdb1/db.h"
#define SCA_DB_SUBSCRIPTIONS_TABLE_VERSION 0
#define SCA_DB_SUBSCRIPTIONS_NUM_COLUMNS 11
enum {
SCA_DB_SUBS_SUBSCRIBER_COL = 0,
SCA_DB_SUBS_AOR_COL = 1,
SCA_DB_SUBS_EVENT_COL,
SCA_DB_SUBS_EXPIRES_COL,
SCA_DB_SUBS_STATE_COL,
SCA_DB_SUBS_APP_IDX_COL,
SCA_DB_SUBS_CALL_ID_COL,
SCA_DB_SUBS_FROM_TAG_COL,
SCA_DB_SUBS_TO_TAG_COL,
SCA_DB_SUBS_NOTIFY_CSEQ_COL,
SCA_DB_SUBS_SUBSCRIBE_CSEQ_COL,
SCA_DB_SUBS_BOUNDARY,
};
enum {
SCA_DB_FLAG_NONE = 0,
SCA_DB_FLAG_INSERT = 1,
SCA_DB_FLAG_UPDATE,
SCA_DB_FLAG_DELETE,
};
#define SCA_DB_BIND_STR_VALUE( cv, ct, k, v, c ) \
((db_key_t *)(k))[ (c) ] = (str *)(ct); \
((db_val_t *)(v))[ (c) ].type = DB1_STR; \
((db_val_t *)(v))[ (c) ].nul = 0; \
((db_val_t *)(v))[ (c) ].val.str_val = (str)(cv); \
(c)++;
#define SCA_DB_BIND_INT_VALUE( cv, ct, k, v, c ) \
((db_key_t *)(k))[ (c) ] = (str *)(ct); \
((db_val_t *)(v))[ (c) ].type = DB1_INT; \
((db_val_t *)(v))[ (c) ].nul = 0; \
((db_val_t *)(v))[ (c) ].val.int_val = (int)(cv); \
(c)++;
extern const str SCA_DB_SUBSCRIBER_COL_NAME;
extern const str SCA_DB_AOR_COL_NAME;
extern const str SCA_DB_EVENT_COL_NAME;
extern const str SCA_DB_EXPIRES_COL_NAME;
extern const str SCA_DB_STATE_COL_NAME;
extern const str SCA_DB_APP_IDX_COL_NAME;
extern const str SCA_DB_CALL_ID_COL_NAME;
extern const str SCA_DB_FROM_TAG_COL_NAME;
extern const str SCA_DB_TO_TAG_COL_NAME;
extern const str SCA_DB_NOTIFY_CSEQ_COL_NAME;
extern const str SCA_DB_SUBSCRIBE_CSEQ_COL_NAME;
str **sca_db_subscriptions_columns( void );
void sca_db_subscriptions_get_value_for_column( int, db_val_t *, void * );
void sca_db_subscriptions_set_value_for_column( int, db_val_t *, void * );
void sca_db_subscriptions_bind_value_for_column( int, db_val_t *, void * );
db1_con_t *sca_db_get_connection( void );
void sca_db_disconnect( void );
#endif /* SCA_DB_H */