summaryrefslogtreecommitdiff
path: root/tpsip/base-connection.h
blob: b444aa2fc0ce0d2eee3ca4057384603b2523ca57 (plain)
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
/*
 * sip-base-connection.h - Header for SipBaseConnection
 * Copyright (C) 2005 Collabora Ltd.
 * Copyright (C) 2005-2009 Nokia Corporation
 *
 * This work 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 work 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 work; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */

#ifndef __TPSIP_BASE_CONNECTION_H__
#define __TPSIP_BASE_CONNECTION_H__

#include <glib-object.h>

#include <telepathy-glib/base-connection.h>
#include <telepathy-glib/contacts-mixin.h>

#include <tpsip/sofia-decls.h>
#include <tpsip/event-target.h>

G_BEGIN_DECLS

typedef struct _TpsipBaseConnection TpsipBaseConnection;
typedef struct _TpsipBaseConnectionClass TpsipBaseConnectionClass;
typedef struct _TpsipBaseConnectionPrivate TpsipBaseConnectionPrivate;

struct _TpsipBaseConnectionClass {
  TpBaseConnectionClass parent_class;
  TpContactsMixinClass contacts_mixin_class;

  nua_handle_t *(*create_handle) (TpsipBaseConnection *, TpHandle contact);
  void (*add_auth_handler) (TpsipBaseConnection *, TpsipEventTarget *);
};

struct _TpsipBaseConnection {
  TpBaseConnection parent;
  TpContactsMixin contacts_mixin;
  TpsipBaseConnectionPrivate *priv;
};

GType tpsip_base_connection_get_type (void) G_GNUC_CONST;

/* TYPE MACROS */
#define TPSIP_TYPE_BASE_CONNECTION \
  (tpsip_base_connection_get_type())
#define TPSIP_BASE_CONNECTION(obj) \
  (G_TYPE_CHECK_INSTANCE_CAST((obj), \
      TPSIP_TYPE_BASE_CONNECTION, TpsipBaseConnection))
#define TPSIP_BASE_CONNECTION_CLASS(klass) \
  (G_TYPE_CHECK_CLASS_CAST((klass), \
      TPSIP_TYPE_BASE_CONNECTION, TpsipBaseConnectionClass))
#define TPSIP_IS_BASE_CONNECTION(obj) \
  (G_TYPE_CHECK_INSTANCE_TYPE((obj), TPSIP_TYPE_BASE_CONNECTION))
#define TPSIP_IS_BASE_CONNECTION_CLASS(klass) \
  (G_TYPE_CHECK_CLASS_TYPE((klass), TPSIP_TYPE_BASE_CONNECTION))
#define TPSIP_BASE_CONNECTION_GET_CLASS(obj) \
  (G_TYPE_INSTANCE_GET_CLASS ((obj), \
      TPSIP_TYPE_BASE_CONNECTION, TpsipBaseConnectionClass))

/***********************************************************************
 * Functions for accessing Sofia-SIP interface handles
 ***********************************************************************/

nua_handle_t *tpsip_base_connection_create_handle (TpsipBaseConnection *,
    TpHandle contact);
void tpsip_base_connection_add_auth_handler (TpsipBaseConnection *self,
    TpsipEventTarget *target);
void tpsip_base_connection_save_event (TpsipBaseConnection *self,
    nua_saved_event_t ret_saved [1]);

/** Callback for events delivered by the SIP stack. */
void tpsip_base_connection_sofia_callback (nua_event_t event,
    int status, char const *phrase,
    nua_t *nua, TpsipBaseConnection *conn,
    nua_handle_t *nh, TpsipEventTarget *target,
    sip_t const *sip,
    tagi_t tags[]);

G_END_DECLS

#endif /* #ifndef __TPSIP_BASE_CONNECTION_H__*/