Fix changelog email address
[freerdp-ubuntu-pcb-backport.git] / libfreerdp-core / tcp.h
1 /**
2  * FreeRDP: A Remote Desktop Protocol Client
3  * Transmission Control Protocol (TCP)
4  *
5  * Copyright 2011 Vic Lee
6  * Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  *     http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  */
20
21 #ifndef __TCP_H
22 #define __TCP_H
23
24 #ifdef _WIN32
25 #include <winsock2.h>
26 #include <windows.h>
27 #include <ws2tcpip.h>
28 #endif
29
30 #include <freerdp/types.h>
31 #include <freerdp/settings.h>
32 #include <freerdp/utils/stream.h>
33
34 #ifndef MSG_NOSIGNAL
35 #define MSG_NOSIGNAL 0
36 #endif
37
38 typedef struct rdp_tcp rdpTcp;
39
40 struct rdp_tcp
41 {
42         int sockfd;
43         char ip_address[32];
44         uint8 mac_address[6];
45         struct rdp_settings* settings;
46 #ifdef _WIN32
47         WSAEVENT wsa_event;
48 #endif
49 };
50
51 boolean tcp_connect(rdpTcp* tcp, const char* hostname, uint16 port);
52 boolean tcp_disconnect(rdpTcp* tcp);
53 int tcp_read(rdpTcp* tcp, uint8* data, int length);
54 int tcp_write(rdpTcp* tcp, uint8* data, int length);
55 boolean tcp_set_blocking_mode(rdpTcp* tcp, boolean blocking);
56 boolean tcp_set_keep_alive_mode(rdpTcp* tcp);
57
58 rdpTcp* tcp_new(rdpSettings* settings);
59 void tcp_free(rdpTcp* tcp);
60
61 #endif /* __TCP_H */