-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsca_appearance.h
134 lines (115 loc) · 4.39 KB
/
sca_appearance.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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
/*
* $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
*
*
*/
#include "../../str.h"
#ifndef SCA_APPEARANCE_H
#define SCA_APPEARANCE_H
#include "sca_dialog.h"
enum {
SCA_APPEARANCE_STATE_IDLE = 0,
SCA_APPEARANCE_STATE_SEIZED,
SCA_APPEARANCE_STATE_PROGRESSING,
SCA_APPEARANCE_STATE_ALERTING,
SCA_APPEARANCE_STATE_ACTIVE,
SCA_APPEARANCE_STATE_HELD,
SCA_APPEARANCE_STATE_HELD_PRIVATE,
SCA_APPEARANCE_STATE_UNKNOWN = 0xff,
};
enum {
SCA_APPEARANCE_FLAG_DEFAULT = 0,
SCA_APPEARANCE_FLAG_OWNER_PENDING = (1 << 0),
SCA_APPEARANCE_FLAG_CALLEE_PENDING = (1 << 1),
};
enum {
SCA_APPEARANCE_OK = 0,
SCA_APPEARANCE_ERR_NOT_IN_USE = 0x1001,
SCA_APPEARANCE_ERR_INVALID_INDEX = 0x1002,
SCA_APPEARANCE_ERR_MALLOC = 0x1004,
SCA_APPEARANCE_ERR_UNKNOWN = 0x1f00,
};
extern const str SCA_APPEARANCE_INDEX_STR;
extern const str SCA_APPEARANCE_STATE_STR;
extern const str SCA_APPEARANCE_URI_STR;
extern const str SCA_APPEARANCE_STATE_STR_IDLE;
extern const str SCA_APPEARANCE_STATE_STR_SEIZED;
extern const str SCA_APPEARANCE_STATE_STR_PROGRESSING;
extern const str SCA_APPEARANCE_STATE_STR_ALERTING;
extern const str SCA_APPEARANCE_STATE_STR_ACTIVE;
extern const str SCA_APPEARANCE_STATE_STR_HELD;
extern const str SCA_APPEARANCE_STATE_STR_HELD_PRIVATE;
struct _sca_appearance_list;
struct _sca_appearance {
int index;
int state;
str uri;
int flags;
str owner;
str callee;
sca_dialog dialog;
str prev_owner;
str prev_callee;
sca_dialog prev_dialog;
struct _sca_appearance_list *appearance_list;
struct _sca_appearance *next;
};
typedef struct _sca_appearance sca_appearance;
struct _sca_appearance_list {
str aor;
int appearance_count;
sca_appearance *appearances;
};
typedef struct _sca_appearance_list sca_appearance_list;
void sca_appearance_state_to_str( int, str * );
int sca_appearance_state_from_str( str * );
sca_appearance *sca_appearance_seize_index_unsafe( sca_mod *, str *, str *,
int, int );
int sca_appearance_seize_next_available_index( sca_mod *, str *, str * );
sca_appearance *sca_appearance_seize_next_available_unsafe( sca_mod *, str *,
str *, int );
int sca_appearance_update_owner_unsafe( sca_appearance *, str * );
int sca_appearance_update_callee_unsafe( sca_appearance *, str * );
int sca_appearance_update_dialog_unsafe( sca_appearance *, str *,
str *, str * );
int sca_appearance_update_unsafe( sca_appearance *, int, str *, str *,
sca_dialog *, str *, str * );
int sca_appearance_update_index( sca_mod *, str *, int, int, str *,
str *, sca_dialog * );
int sca_appearance_release_index( sca_mod *, str *, int );
int sca_appearance_state_for_index( sca_mod *, str *, int );
sca_appearance *sca_appearance_for_index_unsafe( sca_mod *, str *, int, int );
sca_appearance *sca_appearance_for_dialog_unsafe( sca_mod *, str *,
sca_dialog *, int );
sca_appearance *sca_appearance_for_tags_unsafe( sca_mod *, str *,
str *, str *, str *, int );
int sca_appearance_register( sca_mod *, str * );
void sca_appearance_list_insert_appearance( sca_appearance_list *,
sca_appearance * );
sca_appearance *sca_appearance_list_unlink_index( sca_appearance_list *, int );
sca_appearance *sca_appearance_unlink_by_tags( sca_mod *, str *,
str *, str *, str * );
sca_appearance *sca_appearance_create( int, str * );
void sca_appearance_free( sca_appearance * );
int sca_uri_is_shared_appearance( sca_mod *, str * );
int sca_uri_lock_shared_appearance( sca_mod *, str * );
int sca_uri_lock_if_shared_appearance( sca_mod *, str *, int * );
#endif /* SCA_APPEARANCE_H */