2011-02-09 04:54:18 +03:00
|
|
|
/*
|
2011-11-03 02:56:50 +04:00
|
|
|
* Copyright 2010-2011, Haiku Inc. All Rights Reserved.
|
2011-02-09 04:54:18 +03:00
|
|
|
* Copyright 2010 Clemens Zeidler. All rights reserved.
|
|
|
|
*
|
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
|
|
|
#ifndef SERVER_CONNECTION_H
|
|
|
|
#define SERVER_CONNECTION_H
|
|
|
|
|
|
|
|
|
|
|
|
#include "SupportDefs.h"
|
|
|
|
|
|
|
|
|
2011-11-03 02:56:50 +04:00
|
|
|
namespace BPrivate {
|
2011-02-09 04:54:18 +03:00
|
|
|
|
|
|
|
|
2011-11-03 02:56:50 +04:00
|
|
|
class AbstractConnection;
|
2011-02-09 04:54:18 +03:00
|
|
|
|
|
|
|
|
|
|
|
class ServerConnection {
|
|
|
|
public:
|
|
|
|
ServerConnection();
|
|
|
|
~ServerConnection();
|
|
|
|
|
|
|
|
status_t ConnectSSL(const char* server,
|
|
|
|
uint32 port = 993);
|
|
|
|
|
|
|
|
status_t ConnectSocket(const char* server,
|
|
|
|
uint32 port = 143);
|
|
|
|
status_t Disconnect();
|
|
|
|
|
|
|
|
status_t WaitForData(bigtime_t timeout);
|
|
|
|
|
2011-11-03 02:56:50 +04:00
|
|
|
ssize_t Read(char* buffer, uint32 length);
|
|
|
|
ssize_t Write(const char* buffer, uint32 length);
|
2011-02-09 04:54:18 +03:00
|
|
|
|
|
|
|
private:
|
|
|
|
AbstractConnection* fConnection;
|
|
|
|
};
|
|
|
|
|
2011-11-03 02:56:50 +04:00
|
|
|
|
|
|
|
} // namespace BPrivate
|
|
|
|
|
|
|
|
|
|
|
|
using BPrivate::ServerConnection;
|
|
|
|
|
|
|
|
|
2011-02-09 04:54:18 +03:00
|
|
|
#endif // SERVER_CONNECTION_H
|