This file is indexed.

/usr/include/sofia-sip-1.12/sofia-sip/nea.h is in libsofia-sip-ua-dev 1.12.11+20110422.1-2.1build1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
/*
 * This file is part of the Sofia-SIP package
 *
 * Copyright (C) 2005 Nokia Corporation.
 *
 * Contact: Pekka Pessi <pekka.pessi@nokia.com>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public License
 * as published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This library 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
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA
 *
 */

#ifndef NEA_H
/** Defined when <sofia-sip/nea.h> has been included. */
#define NEA_H
/**@file sofia-sip/nea.h
 * @brief Event API for SIP
 *
 * @author Pekka Pessi <Pekka.Pessi@nokia.com>
 * @author Martti Mela <Martti.Mela@nokia.com>
 *
 * @date Created: Fri Feb  7 13:23:44 EET 2003 ppessi
 */

#ifndef SU_ALLOC_H
#include <sofia-sip/su_alloc.h>
#endif

#include <sofia-sip/su_tag.h>

#ifndef NTA_H
#include <sofia-sip/nta.h>
#endif

#ifndef NEA_TAG_H
#include <sofia-sip/nea_tag.h>
#endif

SOFIA_BEGIN_DECLS

#define NEA_VERSION      3.0
#define NEA_VERSION_STR "3.0"

#define NEA_DEFAULT_EXPIRES 3600

/** Event notifier object. */
typedef struct nea_server_s     nea_server_t;

/** Subscription object. */
typedef struct nea_sub_s        nea_sub_t;

/** Event. */
typedef struct nea_event_s      nea_event_t;

/** Event view. */
typedef struct nea_event_view_s nea_event_view_t;

#ifndef NEA_SMAGIC_T
#define NEA_SMAGIC_T            struct nea_smagic_t
#endif
/** NEA server context */
typedef NEA_SMAGIC_T nea_smagic_t;

#ifndef NEA_EMAGIC_T
#define NEA_EMAGIC_T            struct nea_emagic_t
#endif
/** NEA server event context */
typedef NEA_EMAGIC_T nea_emagic_t;

#ifndef NEA_EVMAGIC_T
#define NEA_EVMAGIC_T           struct nea_evmagic_t
#endif
/** Event view context */
typedef NEA_EVMAGIC_T nea_evmagic_t;

/** Description of subscription */
typedef struct nea_subnode_t {
  nea_state_t          sn_state;       	/**< Subscription state */
  unsigned             sn_fake;	       	/**< True if subscriber is given
				       	 *   fake contents.
				       	 */
  unsigned             sn_eventlist;    /**< Subscriber supports eventlist */
  nea_sub_t           *sn_subscriber;  	/**< Pointer to subscriber object */
  nea_event_t         *sn_event;       	/**< Event */
  sip_from_t const    *sn_remote;      	/**< Identity of subscriber */
  sip_contact_t const *sn_contact;     	/**< Contact of subscriber */

  /** Content-Type of SUBSCRIBE body (filter). */
  sip_content_type_t const *sn_content_type;
  sip_payload_t const *sn_payload;      /**< Body of subscribe*/

  unsigned             sn_expires;     	/**< When subscription expires */
  unsigned             sn_latest;      	/**< Latest notification version */
  unsigned             sn_throttle;    	/**< Throttle value */
  unsigned             sn_version;      /**< Latest notified version # by application */
  sip_time_t           sn_notified;     /**< When latest notify was sent */
  sip_time_t           sn_subscribed;   /**< When first SUBSCRIBE was recv */
  nea_event_view_t    *sn_view;		/**< Event view for this subscriber */
} nea_subnode_t;

/** Multiple content types per event. */
typedef struct nea_payloads_s   nea_payloads_t;

/**Unknown event callback.
 *
 * The event server invokes this callback function when it has received a
 * request for an unknown event or event with unknown content type.
 *
 * The callback may be called twice for one watcher, once for an unknown
 * event, another time for an unknown content type.
 *
 * @retval 1 application takes care of responding to request
 * @retval 0 application has added new event or payload format
 * @retval -1 nea server rejects request
 */
typedef int (nea_new_event_f)(nea_smagic_t *context,
			      nea_server_t *nes,
			      nea_event_t **event_p,
			      nea_event_view_t **view_p,
			      nta_incoming_t *irq,
			      sip_t const *sip);

/** Create a notifier server */
SOFIAPUBFUN
nea_server_t *nea_server_create(nta_agent_t *agent,
				su_root_t *root,
				url_t const *url,
				int max_subs,
				nea_new_event_f *callback,
				nea_smagic_t *context,
				tag_type_t tag, tag_value_t value,
				...);


/** Shutdown an event server */
SOFIAPUBFUN int nea_server_shutdown(nea_server_t *nes, int retry_after);

/** Destroy a server */
SOFIAPUBFUN void nea_server_destroy(nea_server_t *nes);

/** Zap terminated subscribtions. */
SOFIAPUBFUN void nea_server_flush(nea_server_t *nes, nea_event_t *event);

/** Update event information */
SOFIAPUBFUN
int nea_server_update(nea_server_t *nes,
		      nea_event_t *ev,
		      tag_type_t tag,
		      tag_value_t value,
		      ...);

/** Add a new subscriber from subscribe transaction to an existing notifier. */
SOFIAPUBFUN
int nea_server_add_irq(nea_server_t *nes,
		       nta_leg_t *leg,
		       sip_contact_t const *local_target,
		       nta_incoming_t *irq,
		       sip_t const *sip);

/** QAUTH callback function type.
 *
 * The event server invokes this callback function upon each incoming
 * SUBSCRIBE transaction when the subscription has expired.  The @a sip is
 * NULL if the subscription has expired.
 *
 * The application determines if the subscription is authorized and relays
 * the decision to event server via nea_server_auth() function.
 */
typedef void (nea_watcher_f)(nea_server_t *nes,
			     nea_emagic_t *context,
			     nea_event_t *event,
			     nea_subnode_t *subnode,
			     sip_t const *sip);

/** Create a new event (or subevent) */
SOFIAPUBFUN
nea_event_t *nea_event_create(nea_server_t *nes,
			      nea_watcher_f *callback,
			      nea_emagic_t *context,
			      char const *name,
			      char const *subname,
			      char const *default_content_type,
			      char const *accept);

/** Create a new event (or subevent) with tags */
SOFIAPUBFUN
nea_event_t *nea_event_tcreate(nea_server_t *nes,
			       nea_watcher_f *callback,
			       nea_emagic_t *context,
			       char const *name,
			       char const *subname,
			       tag_type_t, tag_value_t, ...);

/** Return magic context bind to nea_event */
SOFIAPUBFUN nea_emagic_t *nea_emagic_get(nea_event_t *event);

/** Find a nea event object with given event name */
SOFIAPUBFUN nea_event_t *nea_event_get(nea_server_t const *, char const *name);

/** Get number of active subscribers */
SOFIAPUBFUN int nea_server_active(nea_server_t *nes, nea_event_t const *ev);

/** Get number of (non-embryonic) subscribers. */
int nea_server_non_embryonic(nea_server_t *nes, nea_event_t const *ev);

/** Obtain a list of subscriptions.
 */
SOFIAPUBFUN
nea_subnode_t const **nea_server_get_subscribers(nea_server_t *nes,
						 nea_event_t const *ev);

/** Free a list of subscriptions. */
SOFIAPUBFUN
void nea_server_free_subscribers(nea_server_t *nes, nea_subnode_t const **);

/** Notify subscribers */
SOFIAPUBFUN
int nea_server_notify(nea_server_t *nes,
		      nea_event_t *ev);

/** Notify a subscriber */
SOFIAPUBFUN
int nea_server_notify_one(nea_server_t *nes,
			  nea_event_t *ev,
			  nea_sub_t *ns);

#define nea_server_auth nea_sub_auth

/** Get nta_incoming_t from nea_sub_t */
SOFIAPUBFUN nta_incoming_t *nea_sub_get_request(nea_sub_t *sub);

/** Authorize a subscription */
SOFIAPUBFUN
int nea_sub_auth(nea_sub_t *, nea_state_t state,
		 tag_type_t, tag_value_t, ...);

/** Get nta_incoming_t from sn->sn_subscriber */
SOFIAPUBFUN nta_incoming_t *nea_subnode_get_incoming(nea_subnode_t *sn);
/** Set subscriber version sequence */
SOFIAPUBFUN int nea_sub_version(nea_sub_t *, unsigned);

/** Return time until next notification can be sent */
SOFIAPUBFUN unsigned nea_sub_pending(nea_sub_t const *);

#if 0
/** Do a remote qauth.
 *
 * The function nea_server_qauth() is given as q_callback pointer
 * to nea_server_create() if remote authentication from url is desired.
 */
void nea_server_qauth(nea_server_t *nes,
		      nea_emagic_t *context,
		      nea_sub_t *subscriber,
		      sip_t const *sip);
#endif

/** Get primary event view for given content type  */
SOFIAPUBFUN
nea_event_view_t *nea_event_view(nea_event_t *, char const *content_type);

/** Get a content type for event's payload */
SOFIAPUBFUN
sip_content_type_t const *nea_view_content_type(nea_event_view_t const *);

/** Get actual payload for an event */
SOFIAPUBFUN sip_payload_t const *nea_view_payload(nea_event_view_t *);

/** Create a private event view */
SOFIAPUBFUN nea_event_view_t *nea_view_create(nea_server_t *nes,
					      nea_event_t *ev,
					      nea_evmagic_t *magic,
					      tag_type_t tag,
					      tag_value_t value,
					      ...);

/** Destroy a private event view */
SOFIAPUBFUN void nea_view_destroy(nea_server_t *nes, nea_event_view_t *ev);

SOFIAPUBFUN nea_evmagic_t *nea_view_magic(nea_event_view_t const *);

SOFIAPUBFUN void nea_view_set_magic(nea_event_view_t *, nea_evmagic_t *magic);

SOFIAPUBFUN unsigned nea_view_version(nea_event_view_t const *);

/** Reliable notify */
#define NEATAG_RELIABLE(x)    neatag_reliable, tag_bool_v((x))
SOFIAPUBVAR tag_typedef_t neatag_reliable;

#define NEATAG_RELIABLE_REF(x) neatag_reliable_ref, tag_bool_vr((&x))
SOFIAPUBVAR tag_typedef_t neatag_reliable_ref;

/** Event view handle */
#define NEATAG_VIEW(x)     neatag_view, tag_ptr_v((x))
SOFIAPUBVAR tag_typedef_t neatag_view;

#define NEATAG_VIEW_REF(x) neatag_view_ref, tag_ptr_vr((&x), (x))
SOFIAPUBVAR tag_typedef_t neatag_view_ref;

/** Event view magic. */
#define NEATAG_EVMAGIC(x)     neatag_evmagic, tag_ptr_v((x))
SOFIAPUBVAR tag_typedef_t neatag_evmagic;

#define NEATAG_EVMAGIC_REF(x) neatag_evmagic_ref, tag_ptr_vr((&x), (x))
SOFIAPUBVAR tag_typedef_t neatag_evmagic_ref;

/** tag for nea_sub_t */
#define NEATAG_SUB(x)     neatag_sub, tag_ptr_v((x))
SOFIAPUBVAR tag_typedef_t neatag_sub;

#define NEATAG_SUB_REF(x) neatag_sub_ref, tag_ptr_vr((&x), (x))
SOFIAPUBVAR tag_typedef_t neatag_sub_ref;


/* ====================================================================== */
/* Watcher side */

/** NEA Event Watcher */
typedef struct nea_s     nea_t;

#ifndef NEA_MAGIC_T
#define NEA_MAGIC_T struct nea_magic_t
#endif

/** NEA Event Agent context */
typedef NEA_MAGIC_T          nea_magic_t;

/** Event notification callback type.
 *
 * This callback is called also when initial or refresh subscribe transaction
 * completes with the transaction result in @a sip.
 */
typedef int (*nea_notify_f)(nea_t *nea,
			    nea_magic_t *context,
			    sip_t const *sip);

/* ====================================================================== */
/* Client side */

/** Create a subscription agent. */
SOFIAPUBFUN
nea_t *nea_create(nta_agent_t *agent,
		  su_root_t *root,
		  nea_notify_f no_callback,
		  nea_magic_t *context,
		  tag_type_t tag,
		  tag_value_t value,
		  ...);

/** Update SUBSCRIBE payload (filter rules) */
SOFIAPUBFUN
int nea_update(nea_t *nea,
	       tag_type_t tag,
	       tag_value_t value,
	       ...);

/** Unsubscribe agent. */
SOFIAPUBFUN void nea_end(nea_t *agent);

/** Destroy a subscription agent. */
SOFIAPUBFUN void nea_destroy(nea_t *agent);

SOFIAPUBFUN char const *nea_default_content_type(char const *event);

SOFIA_END_DECLS

#endif /* !defined(NEA_H) */