su_os_nw.h 3.36 KB
Newer Older
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
/*
 * 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 SU_OS_NW_H
/** Defined when <sofia-sip/su_os_nw.h> has been included. */
#define SU_OS_NW_H

/**@ingroup su_os_nw
30
 * @file sofia-sip/su_os_nw.h Network change events.
31
 *
32
 * @author Martti Mela <Martti.Mela@nokia.com>
33
 * @author Pekka Pessi <Pekka.Pessi@nokia.com>
34 35 36 37
 *
 * @date Created: Tue Aug 15 09:05:18 EEST 2006  martti.mela@nokia.com
 *
 * @since Experimental in @VERSION_1_12_2.
38
 * Note that this is expected to change in future releases.
39 40 41 42 43 44 45 46 47 48 49 50
 */

/* ---------------------------------------------------------------------- */
/* Includes */

#ifndef SU_H
#include "sofia-sip/su.h"
#endif

#ifndef SU_TIME_H
#include "sofia-sip/su_time.h"
#endif
51 52 53 54 55 56 57 58 59

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

#ifndef SU_WAIT_H
#include "sofia-sip/su_wait.h"
#endif

60 61 62 63 64 65 66 67 68 69 70 71 72
#if SU_HAVE_POLL
#include <sys/poll.h>
#endif

SOFIA_BEGIN_DECLS

/* ---------------------------------------------------------------------- */
/* network-changed callback */

#ifndef SU_NETWORK_CHANGED_MAGIC_T
/**Default type of application context for network_changed function.
 *
 * Application may define the typedef ::su_network_changed_magic_t to appropriate type
Pekka Pessi's avatar
Pekka Pessi committed
73
 * by defining macro #SU_NETWORK_CHANGED_MAGIC_T before including <sofia-sip/su_os_nw.h>, for
74 75 76
 * example,
 * @code
 * #define SU_NETWORK_CHANGED_MAGIC_T struct context
Pekka Pessi's avatar
Pekka Pessi committed
77
 * #include <sofia-sip/su_os_nw.h>
78
 * @endcode
79 80
 *
 * @since New in @VERSION_1_12_2.
81 82 83 84 85 86 87
 */
#define SU_NETWORK_CHANGED_MAGIC_T void
#endif

/** <a href="#su_root_t">Root context</a> pointer type.
 *
 * Application may define the typedef ::su_network_changed_magic_t to appropriate type
Pekka Pessi's avatar
Pekka Pessi committed
88
 * by defining macro #SU_NETWORK_CHANGED_MAGIC_T before including <sofia-sip/su_os_nw.h>, for
89 90 91
 * example,
 * @code
 * #define SU_NETWORK_CHANGED_MAGIC_T struct context
Pekka Pessi's avatar
Pekka Pessi committed
92
 * #include <sofia-sip/su_os_nw.h>
93
 * @endcode
94 95
 *
 * @since New in @VERSION_1_12_2.
96 97 98 99 100
 */
typedef SU_NETWORK_CHANGED_MAGIC_T su_network_changed_magic_t;

typedef struct su_network_changed_s su_network_changed_t;

101 102
/** Function prototype for network-changed callback .
 *
103
 *
104
 * @since New in @VERSION_1_12_2.
105 106 107 108 109 110 111 112 113 114
 */
typedef void (su_network_changed_f)(su_network_changed_magic_t *, su_root_t *);


/* ---------------------------------------------------------------------- */
/* Functions */

/* Network-changed */
SOFIAPUBFUN su_network_changed_t *
su_root_add_network_changed(su_home_t *home,
115 116
			    su_root_t *root,
			    su_network_changed_f *,
117
			    su_network_changed_magic_t *);
118
SOFIAPUBFUN int su_root_remove_network_changed(su_network_changed_t *);
119 120 121 122

SOFIA_END_DECLS

#endif /* SU_OS_NW_H */