nea
1.12.11devel
Main Page
Related Pages
Data Structures
Files
File List
Globals
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
libsofia-sip-ua
nea
sofia-sip
nea.h
Go to the documentation of this file.
1
/*
2
* This file is part of the Sofia-SIP package
3
*
4
* Copyright (C) 2005 Nokia Corporation.
5
*
6
* Contact: Pekka Pessi <pekka.pessi@nokia-email.address.hidden>
7
*
8
* This library is free software; you can redistribute it and/or
9
* modify it under the terms of the GNU Lesser General Public License
10
* as published by the Free Software Foundation; either version 2.1 of
11
* the License, or (at your option) any later version.
12
*
13
* This library is distributed in the hope that it will be useful, but
14
* WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
* Lesser General Public License for more details.
17
*
18
* You should have received a copy of the GNU Lesser General Public
19
* License along with this library; if not, write to the Free Software
20
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
21
* 02110-1301 USA
22
*
23
*/
24
25
#ifndef NEA_H
26
27
#define NEA_H
28
37
#ifndef SU_ALLOC_H
38
#include <
sofia-sip/su_alloc.h
>
39
#endif
40
41
#include <
sofia-sip/su_tag.h
>
42
43
#ifndef NTA_H
44
#include <
sofia-sip/nta.h
>
45
#endif
46
47
#ifndef NEA_TAG_H
48
#include <
sofia-sip/nea_tag.h
>
49
#endif
50
51
SOFIA_BEGIN_DECLS
52
53
#define NEA_VERSION 3.0
54
#define NEA_VERSION_STR "3.0"
55
56
#define NEA_DEFAULT_EXPIRES 3600
57
59
typedef
struct
nea_server_s
nea_server_t
;
60
62
typedef
struct
nea_sub_s
nea_sub_t
;
63
65
typedef
struct
nea_event_s
nea_event_t
;
66
68
typedef
struct
nea_event_view_s
nea_event_view_t
;
69
70
#ifndef NEA_SMAGIC_T
71
#define NEA_SMAGIC_T struct nea_smagic_t
72
#endif
73
74
typedef
NEA_SMAGIC_T
nea_smagic_t
;
75
76
#ifndef NEA_EMAGIC_T
77
#define NEA_EMAGIC_T struct nea_emagic_t
78
#endif
79
80
typedef
NEA_EMAGIC_T
nea_emagic_t
;
81
82
#ifndef NEA_EVMAGIC_T
83
#define NEA_EVMAGIC_T struct nea_evmagic_t
84
#endif
85
86
typedef
NEA_EVMAGIC_T
nea_evmagic_t
;
87
89
typedef
struct
nea_subnode_t
{
90
nea_state_t
sn_state
;
91
unsigned
sn_fake
;
94
unsigned
sn_eventlist
;
95
nea_sub_t
*
sn_subscriber
;
96
nea_event_t
*
sn_event
;
97
sip_from_t
const
*
sn_remote
;
98
sip_contact_t
const
*
sn_contact
;
101
sip_content_type_t
const
*
sn_content_type
;
102
sip_payload_t
const
*
sn_payload
;
104
unsigned
sn_expires
;
105
unsigned
sn_latest
;
106
unsigned
sn_throttle
;
107
unsigned
sn_version
;
108
sip_time_t
sn_notified
;
109
sip_time_t
sn_subscribed
;
110
nea_event_view_t
*
sn_view
;
111
}
nea_subnode_t
;
112
114
typedef
struct
nea_payloads_s
nea_payloads_t
;
115
128
typedef
int (
nea_new_event_f
)(
nea_smagic_t
*context,
129
nea_server_t
*nes,
130
nea_event_t
**event_p,
131
nea_event_view_t
**view_p,
132
nta_incoming_t
*irq,
133
sip_t
const
*sip);
134
136
SOFIAPUBFUN
137
nea_server_t
*
nea_server_create
(
nta_agent_t
*agent,
138
su_root_t
*root,
139
url_t
const
*url,
140
int
max_subs,
141
nea_new_event_f
*callback,
142
nea_smagic_t
*context,
143
tag_type_t
tag,
tag_value_t
value,
144
...);
145
146
148
SOFIAPUBFUN
int
nea_server_shutdown
(
nea_server_t
*nes,
int
retry_after);
149
151
SOFIAPUBFUN
void
nea_server_destroy
(
nea_server_t
*nes);
152
154
SOFIAPUBFUN
void
nea_server_flush
(
nea_server_t
*nes,
nea_event_t
*event);
155
157
SOFIAPUBFUN
158
int
nea_server_update
(
nea_server_t
*nes,
159
nea_event_t
*ev,
160
tag_type_t
tag,
161
tag_value_t
value,
162
...);
163
165
SOFIAPUBFUN
166
int
nea_server_add_irq
(
nea_server_t
*nes,
167
nta_leg_t
*leg,
168
sip_contact_t
const
*local_target,
169
nta_incoming_t
*irq,
170
sip_t
const
*sip);
171
181
typedef
void (
nea_watcher_f
)(
nea_server_t
*nes,
182
nea_emagic_t
*context,
183
nea_event_t
*event,
184
nea_subnode_t
*subnode,
185
sip_t
const
*sip);
186
188
SOFIAPUBFUN
189
nea_event_t
*
nea_event_create
(
nea_server_t
*nes,
190
nea_watcher_f
*callback,
191
nea_emagic_t
*context,
192
char
const
*name,
193
char
const
*subname,
194
char
const
*default_content_type,
195
char
const
*accept);
196
198
SOFIAPUBFUN
199
nea_event_t
*
nea_event_tcreate
(
nea_server_t
*nes,
200
nea_watcher_f
*callback,
201
nea_emagic_t
*context,
202
char
const
*name,
203
char
const
*subname,
204
tag_type_t
,
tag_value_t
, ...);
205
207
SOFIAPUBFUN
nea_emagic_t
*
nea_emagic_get
(
nea_event_t
*event);
208
210
SOFIAPUBFUN
nea_event_t
*
nea_event_get
(
nea_server_t
const
*,
char
const
*name);
211
213
SOFIAPUBFUN
int
nea_server_active
(
nea_server_t
*nes,
nea_event_t
const
*ev);
214
216
int
nea_server_non_embryonic
(
nea_server_t
*nes,
nea_event_t
const
*ev);
217
220
SOFIAPUBFUN
221
nea_subnode_t
const
**
nea_server_get_subscribers
(
nea_server_t
*nes,
222
nea_event_t
const
*ev);
223
225
SOFIAPUBFUN
226
void
nea_server_free_subscribers
(
nea_server_t
*nes,
nea_subnode_t
const
**);
227
229
SOFIAPUBFUN
230
int
nea_server_notify
(
nea_server_t
*nes,
231
nea_event_t
*ev);
232
234
SOFIAPUBFUN
235
int
nea_server_notify_one
(
nea_server_t
*nes,
236
nea_event_t
*ev,
237
nea_sub_t
*ns);
238
239
#define nea_server_auth nea_sub_auth
240
242
SOFIAPUBFUN
nta_incoming_t
*
nea_sub_get_request
(
nea_sub_t
*sub);
243
245
SOFIAPUBFUN
246
int
nea_sub_auth
(
nea_sub_t
*,
nea_state_t
state,
247
tag_type_t
,
tag_value_t
, ...);
248
250
SOFIAPUBFUN
nta_incoming_t
*
nea_subnode_get_incoming
(
nea_subnode_t
*sn);
252
SOFIAPUBFUN
int
nea_sub_version
(
nea_sub_t
*,
unsigned
);
253
255
SOFIAPUBFUN
unsigned
nea_sub_pending
(
nea_sub_t
const
*);
256
257
#if 0
258
263
void
nea_server_qauth(
nea_server_t
*nes,
264
nea_emagic_t
*context,
265
nea_sub_t
*subscriber,
266
sip_t
const
*sip);
267
#endif
268
270
SOFIAPUBFUN
271
nea_event_view_t
*
nea_event_view
(
nea_event_t
*,
char
const
*content_type);
272
274
SOFIAPUBFUN
275
sip_content_type_t
const
*
nea_view_content_type
(
nea_event_view_t
const
*);
276
278
SOFIAPUBFUN
sip_payload_t
const
*
nea_view_payload
(
nea_event_view_t
*);
279
281
SOFIAPUBFUN
nea_event_view_t
*
nea_view_create
(
nea_server_t
*nes,
282
nea_event_t
*ev,
283
nea_evmagic_t
*magic,
284
tag_type_t
tag,
285
tag_value_t
value,
286
...);
287
289
SOFIAPUBFUN
void
nea_view_destroy
(
nea_server_t
*nes,
nea_event_view_t
*ev);
290
291
SOFIAPUBFUN
nea_evmagic_t
*nea_view_magic(
nea_event_view_t
const
*);
292
293
SOFIAPUBFUN
void
nea_view_set_magic(
nea_event_view_t
*,
nea_evmagic_t
*magic);
294
295
SOFIAPUBFUN
unsigned
nea_view_version(
nea_event_view_t
const
*);
296
298
#define NEATAG_RELIABLE(x) neatag_reliable, tag_bool_v((x))
299
SOFIAPUBVAR
tag_typedef_t
neatag_reliable;
300
301
#define NEATAG_RELIABLE_REF(x) neatag_reliable_ref, tag_bool_vr((&x))
302
SOFIAPUBVAR
tag_typedef_t
neatag_reliable_ref;
303
305
#define NEATAG_VIEW(x) neatag_view, tag_ptr_v((x))
306
SOFIAPUBVAR
tag_typedef_t
neatag_view;
307
308
#define NEATAG_VIEW_REF(x) neatag_view_ref, tag_ptr_vr((&x), (x))
309
SOFIAPUBVAR
tag_typedef_t
neatag_view_ref;
310
312
#define NEATAG_EVMAGIC(x) neatag_evmagic, tag_ptr_v((x))
313
SOFIAPUBVAR
tag_typedef_t
neatag_evmagic;
314
315
#define NEATAG_EVMAGIC_REF(x) neatag_evmagic_ref, tag_ptr_vr((&x), (x))
316
SOFIAPUBVAR
tag_typedef_t
neatag_evmagic_ref;
317
319
#define NEATAG_SUB(x) neatag_sub, tag_ptr_v((x))
320
SOFIAPUBVAR
tag_typedef_t
neatag_sub;
321
322
#define NEATAG_SUB_REF(x) neatag_sub_ref, tag_ptr_vr((&x), (x))
323
SOFIAPUBVAR
tag_typedef_t
neatag_sub_ref;
324
325
326
/* ====================================================================== */
327
/* Watcher side */
328
330
typedef
struct
nea_s
nea_t
;
331
332
#ifndef NEA_MAGIC_T
333
#define NEA_MAGIC_T struct nea_magic_t
334
#endif
335
337
typedef
NEA_MAGIC_T
nea_magic_t
;
338
344
typedef
int (*
nea_notify_f
)(
nea_t
*nea,
345
nea_magic_t
*context,
346
sip_t
const
*sip);
347
348
/* ====================================================================== */
349
/* Client side */
350
352
SOFIAPUBFUN
353
nea_t
*
nea_create
(
nta_agent_t
*agent,
354
su_root_t
*root,
355
nea_notify_f
no_callback,
356
nea_magic_t
*context,
357
tag_type_t
tag,
358
tag_value_t
value,
359
...);
360
362
SOFIAPUBFUN
363
int
nea_update
(
nea_t
*nea,
364
tag_type_t
tag,
365
tag_value_t
value,
366
...);
367
369
SOFIAPUBFUN
void
nea_end
(
nea_t
*agent);
370
372
SOFIAPUBFUN
void
nea_destroy
(
nea_t
*agent);
373
374
SOFIAPUBFUN
char
const
*nea_default_content_type(
char
const
*event);
375
376
SOFIA_END_DECLS
377
378
#endif
/* !defined(NEA_H) */
Sofia-SIP 1.12.11devel - Copyright (C) 2006 Nokia Corporation. All rights reserved. Licensed under the terms of the GNU Lesser General Public License.