]> git.ipfire.org Git - thirdparty/strongswan.git/blob - src/libstrongswan/networking/streams/stream_tcp.h
Update copyright headers after acquisition by secunet
[thirdparty/strongswan.git] / src / libstrongswan / networking / streams / stream_tcp.h
1 /*
2 * Copyright (C) 2013 Martin Willi
3 *
4 * Copyright (C) secunet Security Networks AG
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * for more details.
15 */
16
17 /**
18 * @defgroup stream_tcp stream_tcp
19 * @{ @ingroup streams
20 */
21
22 #ifndef STREAM_TCP_H_
23 #define STREAM_TCP_H_
24
25 #include <library.h>
26
27 /**
28 * Create a stream for TCP sockets.
29 *
30 * TCP URIs start with tcp://, followed by a hostname (FQDN or IP), followed
31 * by a colon separated port. A full TCP uri looks something like:
32 *
33 * tcp://srv.example.com:5555
34 * tcp://0.0.0.0:1234
35 * tcp://[fec2::1]:7654
36 *
37 * There is no default port, so a colon after tcp:// is mandatory.
38 *
39 * @param uri TCP socket specific URI, must start with "tcp://"
40 * @return stream instance, NULL on failure
41 */
42 stream_t *stream_create_tcp(char *uri);
43
44 /**
45 * Helper function to parse a tcp:// URI to a sockaddr
46 *
47 * @param uri URI
48 * @param addr sockaddr, large enough for URI
49 * @return length of sockaddr, -1 on error
50 */
51 int stream_parse_uri_tcp(char *uri, struct sockaddr *addr);
52
53 #endif /** STREAM_TCP_H_ @}*/