tport  1.12.11devel
tport_plugins.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 TPORT_PLUGINS_H
26 
27 #define TPORT_PLUGINS_H
28 
37 /* -- STUN Plugin ------------------------------------------------------- */
38 
39 #ifndef TPORT_STUN_SERVER_T
40 #define TPORT_STUN_SERVER_T struct tport_stun_server_s
41 #endif
42 
43 typedef TPORT_STUN_SERVER_T tport_stun_server_t;
44 
45 typedef struct {
46  int vst_size;
47  tport_stun_server_t *(*vst_create)(su_root_t *root, tagi_t const *tags);
48  void (*vst_destroy)(tport_stun_server_t *);
49  int (*vst_add_socket)(tport_stun_server_t *, su_socket_t socket);
50  int (*vst_remove_socket)(tport_stun_server_t *, su_socket_t socket);
51  void (*vst_request)(tport_stun_server_t *server, su_socket_t socket,
52  void *msg, ssize_t msglen,
53  void *addr, socklen_t addrlen);
54 } tport_stun_server_vtable_t;
55 
56 SOFIAPUBFUN int tport_plug_in_stun_server(tport_stun_server_vtable_t const *);
57 
58 
59 /* -- SigComp Plugin ---------------------------------------------------- */
60 
61 /* We already use these SigComp types in applications */
62 
63 struct sigcomp_udvm;
64 struct sigcomp_compartment;
65 
66 typedef struct tport_comp_vtable_s tport_comp_vtable_t;
67 
68 struct tport_comp_vtable_s {
69  /* NOTE: this will change! Unstable! Do not use! */
70  int vsc_size;
71 
72  char const *vsc_compname;
73  size_t vsc_sizeof_context;
74 
75  int (*vsc_init_comp)(tp_stack_t *,
76  tport_t *,
77  tport_compressor_t *,
78  char const *comp_name,
79  tagi_t const *tags);
80 
81  void (*vsc_deinit_comp)(tp_stack_t *,
82  tport_t *,
83  tport_compressor_t *);
84 
85  char const *(*vsc_comp_name)(tport_compressor_t const *master_sc,
86  char const *compression,
87  tagi_t const *tags);
88 
89  /* Mapping of public tport API */
90 
91  int (*vsc_can_send_comp)(tport_compressor_t const *);
92  int (*vsc_can_recv_comp)(tport_compressor_t const *);
93 
94  int (*vsc_set_comp_name)(tport_t const *self,
95  tport_compressor_t const *return_sc,
96  char const *comp);
97 
98  int (*vsc_sigcomp_option)(tport_t const *self,
99  struct sigcomp_compartment *cc,
100  char const *option);
101 
102  struct sigcomp_compartment *
103  (*vsc_sigcomp_compartment)(tport_t *self,
104  char const *name, int namelen,
105  int create_if_needed);
106 
107  struct sigcomp_compartment *
108  (*vsc_compartment_incref)(struct sigcomp_compartment *cc);
109 
110  void (*vsc_compartment_decref)(struct sigcomp_compartment **pointer_to_cc);
111 
112  int (*vsc_set_compartment)(tport_t *self,
113  tport_compressor_t *,
114  struct sigcomp_compartment *);
115 
116  struct sigcomp_compartment *
117  (*vsc_get_compartment)(tport_t const *self,
118  tport_compressor_t const *);
119 
120  int (*vsc_has_sigcomp_assigned)(tport_compressor_t const *comp);
121 
122  int (*vsc_sigcomp_accept)(tport_t *self,
123  tport_compressor_t const *comp,
124  struct sigcomp_compartment *cc,
125  msg_t *msg);
126 
127  int (*vsc_delivered_using_udvm)(tport_t *tp,
128  msg_t const *msg,
129  struct sigcomp_udvm **return_pointer_to_udvm,
130  int remove);
131 
132  int (*vsc_sigcomp_close)(tport_t *self,
133  struct sigcomp_compartment *cc,
134  int how);
135 
136  int (*vsc_sigcomp_lifetime)(tport_t *self,
137  struct sigcomp_compartment *,
138  unsigned lifetime_in_ms,
139  int only_expand);
140 
141  /* Internal API */
142 
143  struct sigcomp_udvm **(*vsc_get_udvm_slot)(tport_t *self);
144 
145  struct sigcomp_compartment *
146  (*vsc_sigcomp_assign_if_needed)(tport_t *self,
147  struct sigcomp_compartment *cc);
148 
149  void (*vsc_accept_incomplete)(tport_t const *self,
150  tport_compressor_t *sc,
151  msg_t *msg);
152 
153  int (*vsc_recv_comp)(tport_t const *self,
154  tport_compressor_t *sc,
155  msg_t **in_out_msg,
156  su_sockaddr_t *from,
157  socklen_t fromlen);
158 
159  ssize_t (*vsc_send_comp)(tport_t const *self,
160  msg_t *msg,
161  msg_iovec_t iov[],
162  size_t iovused,
163  struct sigcomp_compartment *cc,
164  tport_compressor_t *sc);
165 
166 
167 };
168 
169 SOFIAPUBFUN int tport_plug_in_comp(tport_comp_vtable_t const *);
170 
171 #endif /* !defined(TPORT_PLUGINS_H) */
su_socket_t
int su_socket_t
tp_stack_t
TP_STACK_T tp_stack_t
Type of stack object.
Definition: tport.h:71
tagi_t
su_root_t
struct su_root_t su_root_t
msg_s
SOFIAPUBFUN
#define SOFIAPUBFUN
tport_plug_in_stun_server
int tport_plug_in_stun_server(tport_stun_server_vtable_t const *)
Plug in stun server.
Definition: tport_stub_stun.c:274
su_iovec_s
tport_stun_server_t
TPORT_STUN_SERVER_T tport_stun_server_t
Safe type for tport server object.
Definition: tport_plugins.h:43

Sofia-SIP 1.12.11devel - Copyright (C) 2006 Nokia Corporation. All rights reserved. Licensed under the terms of the GNU Lesser General Public License.