Fix changelog email address
[freerdp-ubuntu-pcb-backport.git] / libfreerdp-core / transport.h
1 /**
2  * FreeRDP: A Remote Desktop Protocol Client
3  * Network Transport Layer
4  *
5  * Copyright 2011 Vic Lee
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *     http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19
20 #ifndef __TRANSPORT_H
21 #define __TRANSPORT_H
22
23 typedef enum
24 {
25         TRANSPORT_LAYER_TCP,
26         TRANSPORT_LAYER_TLS,
27         TRANSPORT_LAYER_CLOSED
28 } TRANSPORT_LAYER;
29
30 typedef struct rdp_transport rdpTransport;
31
32 #include "tcp.h"
33 #include "tls.h"
34 #include "credssp.h"
35
36 #include <time.h>
37 #include <freerdp/types.h>
38 #include <freerdp/settings.h>
39 #include <freerdp/utils/stream.h>
40 #include <freerdp/utils/wait_obj.h>
41
42 typedef boolean (*TransportRecv) (rdpTransport* transport, STREAM* stream, void* extra);
43
44 struct rdp_transport
45 {
46         STREAM* recv_stream;
47         STREAM* send_stream;
48         TRANSPORT_LAYER layer;
49         struct rdp_tcp* tcp;
50         struct rdp_tls* tls;
51         struct rdp_settings* settings;
52         struct rdp_credssp* credssp;
53         uint32 usleep_interval;
54         void* recv_extra;
55         STREAM* recv_buffer;
56         TransportRecv recv_callback;
57         struct wait_obj* recv_event;
58         boolean blocking;
59 };
60
61 STREAM* transport_recv_stream_init(rdpTransport* transport, int size);
62 STREAM* transport_send_stream_init(rdpTransport* transport, int size);
63 boolean transport_connect(rdpTransport* transport, const char* hostname, uint16 port);
64 void transport_attach(rdpTransport* transport, int sockfd);
65 boolean transport_disconnect(rdpTransport* transport);
66 boolean transport_connect_rdp(rdpTransport* transport);
67 boolean transport_connect_tls(rdpTransport* transport);
68 boolean transport_connect_nla(rdpTransport* transport);
69 boolean transport_accept_rdp(rdpTransport* transport);
70 boolean transport_accept_tls(rdpTransport* transport);
71 boolean transport_accept_nla(rdpTransport* transport);
72 int transport_read(rdpTransport* transport, STREAM* s);
73 int transport_write(rdpTransport* transport, STREAM* s);
74 void transport_get_fds(rdpTransport* transport, void** rfds, int* rcount);
75 int transport_check_fds(rdpTransport* transport);
76 boolean transport_set_blocking_mode(rdpTransport* transport, boolean blocking);
77 rdpTransport* transport_new(rdpSettings* settings);
78 void transport_free(rdpTransport* transport);
79
80 #endif