webkit  2cdf99a9e3038c7e01b3c37e8ad903ecbe5eecf1
https://github.com/WebKit/webkit
transport_common.h
Go to the documentation of this file.
1 /* Copyright (c) 2014, Google Inc.
2  *
3  * Permission to use, copy, modify, and/or distribute this software for any
4  * purpose with or without fee is hereby granted, provided that the above
5  * copyright notice and this permission notice appear in all copies.
6  *
7  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
8  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
9  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
10  * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
11  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
12  * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
13  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
14 
15 #ifndef OPENSSL_HEADER_TOOL_TRANSPORT_COMMON_H
16 #define OPENSSL_HEADER_TOOL_TRANSPORT_COMMON_H
17 
18 #include <openssl/ssl.h>
19 #include <string.h>
20 
21 // InitSocketLibrary calls the Windows socket init functions, if needed.
22 bool InitSocketLibrary();
23 
24 // Connect sets |*out_sock| to be a socket connected to the destination given
25 // in |hostname_and_port|, which should be of the form "www.example.com:123".
26 // It returns true on success and false otherwise.
27 bool Connect(int *out_sock, const std::string &hostname_and_port);
28 
29 // Accept sets |*out_sock| to be a socket connected to the port given
30 // in |port|, which should be of the form "123".
31 // It returns true on success and false otherwise.
32 bool Accept(int *out_sock, const std::string &port);
33 
34 bool VersionFromString(uint16_t *out_version, const std::string &version);
35 
36 void PrintConnectionInfo(const SSL *ssl);
37 
38 bool SocketSetNonBlocking(int sock, bool is_non_blocking);
39 
40 int PrintErrorCallback(const char *str, size_t len, void *ctx);
41 
42 bool TransferData(SSL *ssl, int sock);
43 
44 // DoSMTPStartTLS performs the SMTP STARTTLS mini-protocol over |sock|. It
45 // returns true on success and false otherwise.
46 bool DoSMTPStartTLS(int sock);
47 
48 #endif /* !OPENSSL_HEADER_TOOL_TRANSPORT_COMMON_H */
bool Accept(int *out_sock, const std::string &port)
Definition: transport_common.cc:151
bool InitSocketLibrary()
Definition: transport_common.cc:60
bool VersionFromString(uint16_t *out_version, const std::string &version)
Definition: transport_common.cc:184
EGLOutputPortEXT port
Definition: eglext.h:698
uint16_t version
Definition: ssl_lib.c:2731
void PrintConnectionInfo(const SSL *ssl)
Definition: transport_common.cc:234
OPENSSL_EXPORT const ASN1_OBJECT int const unsigned char int len
Definition: x509.h:1053
bool DoSMTPStartTLS(int sock)
Definition: transport_common.cc:541
EGLContext ctx
Definition: eglext.h:192
unsigned short uint16_t
Definition: ptypes.h:97
bool SocketSetNonBlocking(int sock, bool is_non_blocking)
Definition: transport_common.cc:284
bool TransferData(SSL *ssl, int sock)
Definition: transport_common.cc:315
str
Definition: make-dist.py:305
GLsizei const GLchar *const * string
Definition: gl2.h:479
bool Connect(int *out_sock, const std::string &hostname_and_port)
Definition: transport_common.cc:75
Definition: ssl.h:4031
int PrintErrorCallback(const char *str, size_t len, void *ctx)
Definition: transport_common.cc:310