1/*
2 * Copyright 2010-2011, Haiku Inc. All Rights Reserved.
3 * Copyright 2010 Clemens Zeidler. All rights reserved.
4 *
5 * Distributed under the terms of the MIT License.
6 */
7#ifndef SERVER_CONNECTION_H
8#define SERVER_CONNECTION_H
9
10
11#include "SupportDefs.h"
12
13
14namespace BPrivate {
15
16
17class AbstractConnection;
18
19
20class ServerConnection {
21public:
22								ServerConnection();
23								~ServerConnection();
24
25			status_t			ConnectSSL(const char* server,
26									uint32 port = 993);
27
28			status_t			ConnectSocket(const char* server,
29									uint32 port = 143);
30			status_t			Disconnect();
31
32			status_t			WaitForData(bigtime_t timeout);
33
34			ssize_t				Read(char* buffer, uint32 length);
35			ssize_t				Write(const char* buffer, uint32 length);
36
37private:
38			AbstractConnection*	fConnection;
39};
40
41
42}	// namespace BPrivate
43
44
45using BPrivate::ServerConnection;
46
47
48#endif // SERVER_CONNECTION_H
49