tport
1.12.11
|
00001 /* 00002 * This file is part of the Sofia-SIP package 00003 * 00004 * Copyright (C) 2005 Nokia Corporation. 00005 * 00006 * Contact: Pekka Pessi <pekka.pessi@nokia-email.address.hidden> 00007 * 00008 * This library is free software; you can redistribute it and/or 00009 * modify it under the terms of the GNU Lesser General Public License 00010 * as published by the Free Software Foundation; either version 2.1 of 00011 * the License, or (at your option) any later version. 00012 * 00013 * This library is distributed in the hope that it will be useful, but 00014 * WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 * Lesser General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU Lesser General Public 00019 * License along with this library; if not, write to the Free Software 00020 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 00021 * 02110-1301 USA 00022 * 00023 */ 00024 00025 #ifndef TPORT_PLUGINS_H 00026 00027 #define TPORT_PLUGINS_H 00028 00037 /* -- STUN Plugin ------------------------------------------------------- */ 00038 00039 #ifndef TPORT_STUN_SERVER_T 00040 #define TPORT_STUN_SERVER_T struct tport_stun_server_s 00041 #endif 00042 00043 typedef TPORT_STUN_SERVER_T tport_stun_server_t; 00044 00045 typedef struct { 00046 int vst_size; 00047 tport_stun_server_t *(*vst_create)(su_root_t *root, tagi_t const *tags); 00048 void (*vst_destroy)(tport_stun_server_t *); 00049 int (*vst_add_socket)(tport_stun_server_t *, su_socket_t socket); 00050 int (*vst_remove_socket)(tport_stun_server_t *, su_socket_t socket); 00051 void (*vst_request)(tport_stun_server_t *server, su_socket_t socket, 00052 void *msg, ssize_t msglen, 00053 void *addr, socklen_t addrlen); 00054 } tport_stun_server_vtable_t; 00055 00056 SOFIAPUBFUN int tport_plug_in_stun_server(tport_stun_server_vtable_t const *); 00057 00058 00059 /* -- SigComp Plugin ---------------------------------------------------- */ 00060 00061 /* We already use these SigComp types in applications */ 00062 00063 struct sigcomp_udvm; 00064 struct sigcomp_compartment; 00065 00066 typedef struct tport_comp_vtable_s tport_comp_vtable_t; 00067 00068 struct tport_comp_vtable_s { 00069 /* NOTE: this will change! Unstable! Do not use! */ 00070 int vsc_size; 00071 00072 char const *vsc_compname; 00073 size_t vsc_sizeof_context; 00074 00075 int (*vsc_init_comp)(tp_stack_t *, 00076 tport_t *, 00077 tport_compressor_t *, 00078 char const *comp_name, 00079 tagi_t const *tags); 00080 00081 void (*vsc_deinit_comp)(tp_stack_t *, 00082 tport_t *, 00083 tport_compressor_t *); 00084 00085 char const *(*vsc_comp_name)(tport_compressor_t const *master_sc, 00086 char const *compression, 00087 tagi_t const *tags); 00088 00089 /* Mapping of public tport API */ 00090 00091 int (*vsc_can_send_comp)(tport_compressor_t const *); 00092 int (*vsc_can_recv_comp)(tport_compressor_t const *); 00093 00094 int (*vsc_set_comp_name)(tport_t const *self, 00095 tport_compressor_t const *return_sc, 00096 char const *comp); 00097 00098 int (*vsc_sigcomp_option)(tport_t const *self, 00099 struct sigcomp_compartment *cc, 00100 char const *option); 00101 00102 struct sigcomp_compartment * 00103 (*vsc_sigcomp_compartment)(tport_t *self, 00104 char const *name, int namelen, 00105 int create_if_needed); 00106 00107 struct sigcomp_compartment * 00108 (*vsc_compartment_incref)(struct sigcomp_compartment *cc); 00109 00110 void (*vsc_compartment_decref)(struct sigcomp_compartment **pointer_to_cc); 00111 00112 int (*vsc_set_compartment)(tport_t *self, 00113 tport_compressor_t *, 00114 struct sigcomp_compartment *); 00115 00116 struct sigcomp_compartment * 00117 (*vsc_get_compartment)(tport_t const *self, 00118 tport_compressor_t const *); 00119 00120 int (*vsc_has_sigcomp_assigned)(tport_compressor_t const *comp); 00121 00122 int (*vsc_sigcomp_accept)(tport_t *self, 00123 tport_compressor_t const *comp, 00124 struct sigcomp_compartment *cc, 00125 msg_t *msg); 00126 00127 int (*vsc_delivered_using_udvm)(tport_t *tp, 00128 msg_t const *msg, 00129 struct sigcomp_udvm **return_pointer_to_udvm, 00130 int remove); 00131 00132 int (*vsc_sigcomp_close)(tport_t *self, 00133 struct sigcomp_compartment *cc, 00134 int how); 00135 00136 int (*vsc_sigcomp_lifetime)(tport_t *self, 00137 struct sigcomp_compartment *, 00138 unsigned lifetime_in_ms, 00139 int only_expand); 00140 00141 /* Internal API */ 00142 00143 struct sigcomp_udvm **(*vsc_get_udvm_slot)(tport_t *self); 00144 00145 struct sigcomp_compartment * 00146 (*vsc_sigcomp_assign_if_needed)(tport_t *self, 00147 struct sigcomp_compartment *cc); 00148 00149 void (*vsc_accept_incomplete)(tport_t const *self, 00150 tport_compressor_t *sc, 00151 msg_t *msg); 00152 00153 int (*vsc_recv_comp)(tport_t const *self, 00154 tport_compressor_t *sc, 00155 msg_t **in_out_msg, 00156 su_sockaddr_t *from, 00157 socklen_t fromlen); 00158 00159 ssize_t (*vsc_send_comp)(tport_t const *self, 00160 msg_t *msg, 00161 msg_iovec_t iov[], 00162 size_t iovused, 00163 struct sigcomp_compartment *cc, 00164 tport_compressor_t *sc); 00165 00166 00167 }; 00168 00169 SOFIAPUBFUN int tport_plug_in_comp(tport_comp_vtable_t const *); 00170 00171 #endif /* !defined(TPORT_PLUGINS_H) */