File: sip-session.h

package info (click to toggle)
telepathy-rakia 0.8.0-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, jessie, jessie-kfreebsd, sid, stretch
  • size: 3,028 kB
  • ctags: 1,720
  • sloc: sh: 11,552; ansic: 9,892; python: 4,532; makefile: 421; xml: 15
file content (144 lines) | stat: -rw-r--r-- 4,555 bytes parent folder | download
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
/*
 * rakia-sip-session.h - Header for RakiaSipSession
 * Copyright (C) 2005-2012 Collabora Ltd.
 * Copyright (C) 2005-2010 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 __RAKIA_SIP_SESSION_H__
#define __RAKIA_SIP_SESSION_H__

#include <glib-object.h>
#include <sofia-sip/sdp.h>

#include <rakia/base-connection.h>
#include <rakia/sip-media.h>

G_BEGIN_DECLS

typedef enum {
    RAKIA_SIP_SESSION_STATE_CREATED = 0,
    RAKIA_SIP_SESSION_STATE_INVITE_SENT,
    RAKIA_SIP_SESSION_STATE_INVITE_RECEIVED,
    RAKIA_SIP_SESSION_STATE_RESPONSE_RECEIVED,
    RAKIA_SIP_SESSION_STATE_ACTIVE,
    RAKIA_SIP_SESSION_STATE_REINVITE_SENT,
    RAKIA_SIP_SESSION_STATE_REINVITE_RECEIVED,
    RAKIA_SIP_SESSION_STATE_REINVITE_PENDING,
    RAKIA_SIP_SESSION_STATE_ENDED,

    NUM_RAKIA_SIP_SESSION_STATES
} RakiaSipSessionState;


/* RakiaSipSession is defined in sip-media.h */
/* typedef struct _RakiaSipSession RakiaSipSession; */
typedef struct _RakiaSipSessionClass RakiaSipSessionClass;
typedef struct _RakiaSipSessionPrivate RakiaSipSessionPrivate;

struct _RakiaSipSessionClass {
    GObjectClass parent_class;
};

struct _RakiaSipSession {
    GObject parent;
    RakiaSipSessionPrivate *priv;
};

GType rakia_sip_session_get_type(void);

/* TYPE MACROS */
#define RAKIA_TYPE_SIP_SESSION \
  (rakia_sip_session_get_type())
#define RAKIA_SIP_SESSION(obj) \
  (G_TYPE_CHECK_INSTANCE_CAST((obj), RAKIA_TYPE_SIP_SESSION, RakiaSipSession))
#define RAKIA_SIP_SESSION_CLASS(klass) \
  (G_TYPE_CHECK_CLASS_CAST((klass), RAKIA_TYPE_SIP_SESSION, RakiaSipSessionClass))
#define RAKIA_IS_SIP_SESSION(obj) \
  (G_TYPE_CHECK_INSTANCE_TYPE((obj), RAKIA_TYPE_SIP_SESSION))
#define RAKIA_IS_SIP_SESSION_CLASS(klass) \
  (G_TYPE_CHECK_CLASS_TYPE((klass), RAKIA_TYPE_SIP_SESSION))
#define RAKIA_SIP_SESSION_GET_CLASS(obj) \
  (G_TYPE_INSTANCE_GET_CLASS ((obj), RAKIA_TYPE_SIP_SESSION, RakiaSipSessionClass))


/* For use by RakiaSipMedia */

gboolean rakia_sdp_rtcp_bandwidth_throttled (const sdp_bandwidth_t *b);

gchar * rakia_sdp_get_string_attribute (const sdp_attribute_t *attrs,
    const char *name);


/* For use by the upper layers */

RakiaSipSession *
rakia_sip_session_new (nua_handle_t *nh, RakiaBaseConnection *conn,
    gboolean incoming, gboolean immutable_streams);

void rakia_sip_session_terminate (RakiaSipSession *session, guint status,
    const gchar *reason);
RakiaSipSessionState rakia_sip_session_get_state (RakiaSipSession *session);


RakiaSipMedia* rakia_sip_session_add_media (RakiaSipSession *self,
    TpMediaStreamType media_type,
    const gchar *name,
    RakiaDirection direction);

gboolean rakia_sip_session_remove_media (RakiaSipSession *self,
    RakiaSipMedia *media,
    guint status,
    const gchar *reason);

void rakia_sip_session_ringing (RakiaSipSession *self);
void rakia_sip_session_queued (RakiaSipSession *self);
void rakia_sip_session_accept (RakiaSipSession *self);

void rakia_sip_session_media_changed (RakiaSipSession *self);

GPtrArray *rakia_sip_session_get_medias (RakiaSipSession *self);


/* What is for ? */
gboolean rakia_sip_session_pending_offer (RakiaSipSession *self);

/* Should be private */

void rakia_sip_session_change_state (RakiaSipSession *session,
    RakiaSipSessionState new_state);

/* Obsolete */

void rakia_sip_session_respond (RakiaSipSession *self,    gint status,
    const char *message);

gboolean rakia_sip_session_is_accepted (RakiaSipSession *self);

gboolean rakia_sip_session_has_media (RakiaSipSession *self,
    TpMediaStreamType media_type);

gint rakia_sip_session_rate_native_transport (RakiaSipSession *session,
    const GValue *transport);

void rakia_sip_session_set_hold_requested (RakiaSipSession *session,
    gboolean hold_requested);

gboolean rakia_sip_session_is_held (RakiaSipSession *session);

G_END_DECLS

#endif /* #ifndef __RAKIA_SIP_SESSION_H__*/