tport  1.13.16
tport_ws.h
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_WS_H
27 #define TPORT_WS_H
38 #ifndef SU_TYPES_H
39 #include <sofia-sip/su_types.h>
40 #endif
41 
42 #include "tport_internal.h"
43 #include "ws.h"
44 
45 SOFIA_BEGIN_DECLS
46 
47 typedef enum {
48  TPORT_WS_OPCODE_CONTINUATION = 0x0,
49  TPORT_WS_OPCODE_TEXT = 0x1,
50  TPORT_WS_OPCODE_BINARY = 0x2,
51  TPORT_WS_OPCODE_CLOSE = 0x8,
52  TPORT_WS_OPCODE_PING = 0x9,
53  TPORT_WS_OPCODE_PONG = 0xA
54 } tport_ws_opcode_t;
55 
56 typedef struct tport_ws_s {
57  tport_t wstp_tp[1];
58  wsh_t ws;
59  char wstp_buffer[65536];
60  size_t wstp_buflen;
61  SU_S8_T ws_initialized;
62  time_t connected;
63  unsigned ws_secure:1;
64  unsigned:0;
65 } tport_ws_t;
66 
67 typedef struct tport_ws_primary_s {
68  tport_primary_t wspri_pri[1];
69  SSL_CTX *ssl_ctx;
70  const SSL_METHOD *ssl_method;
71  unsigned ws_secure:1;
72  unsigned :0;
73 } tport_ws_primary_t;
74 
75 int tport_recv_stream_ws(tport_t *self);
76 ssize_t tport_send_stream_ws(tport_t const *self, msg_t *msg,
77  msg_iovec_t iov[], size_t iovused);
78 
79 int tport_ws_ping(tport_t *self, su_time_t now);
80 int tport_ws_pong(tport_t *self);
81 
82 int tport_ws_init_primary(tport_primary_t *,
83  tp_name_t tpn[1],
84  su_addrinfo_t *, tagi_t const *,
85  char const **return_culprit);
86 int tport_ws_init_client(tport_primary_t *,
87  tp_name_t tpn[1],
88  su_addrinfo_t *, tagi_t const *,
89  char const **return_culprit);
90 int tport_ws_init_secondary(tport_t *self, int socket, int accepted,
91  char const **return_reason);
92 
93 int tport_ws_next_timer(tport_t *self, su_time_t *, char const **);
94 void tport_ws_timer(tport_t *self, su_time_t);
95 static void tport_ws_deinit_secondary(tport_t *self);
96 
97 SOFIA_END_DECLS
98 
99 #endif
Transport name.
Definition: tport.h:156
struct addrinfo su_addrinfo_t

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