1 /**
2  * xrdp: A Remote Desktop Protocol server.
3  *
4  * Copyright (C) Jay Sorg 2004-2013
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  *     http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18 
19 /**
20  *
21  * @file tcp.h
22  * @brief Tcp stream functions declarations
23  * @author Jay Sorg, Simone Fedele
24  *
25  */
26 
27 #ifndef TCP_H
28 #define TCP_H
29 
30 /**
31  *
32  * @brief Force receiving data from tcp stream
33  * @param sck The socket to read from
34  * @param data Data buffer
35  * @param len Data buffer size
36  * @return 0 on success, 1 on error
37  *
38  */
39 int
40 tcp_force_recv(int sck, char *data, int len);
41 
42 /**
43  *
44  * @brief Force sending data to tcp stream
45  * @param sck the socket to write to
46  * @param data Data buffer
47  * @param len Data buffer size
48  * @return 0 on success, 1 on error
49  *
50  */
51 int
52 tcp_force_send(int sck, char *data, int len);
53 
54 /**
55  *
56  * @brief Binds the listening socket
57  * @param sck Listening socket
58  * @param addr Listening address
59  * @param port Listening port
60  * @return 0 on success, -1 on error
61  *
62  */
63 int
64 tcp_bind(int sck, char *addr, char *port);
65 
66 #endif
67