-
Notifications
You must be signed in to change notification settings - Fork 0
/
Session.h
50 lines (40 loc) · 854 Bytes
/
Session.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#ifndef _SESSION_H_
#define _SESSION_H_
#include <cerrno>
#include <netdb.h>
#include <Catalog.h>
#include <NetworkAddressResolver.h>
#include <Socket.h>
#include <SupportDefs.h>
#include "App.h"
enum Flags {
Prop,
First_Order,
Fast,
Paranoid,
Compile,
Interprete
};
typedef struct {
BString *text;
int socket;
} send_data_params;
class Session {
public:
Session(const char* host, const uint16 port, SessionView *output);
int Connect();
status_t Send(BString *text);
bool IsLocalServerLaunched();
void LaunchLocalServer(const uint16 port);
BListView* GetOutput();
private:
Flags fFlags;
const char* fHost;
const uint16 fPort;
bool fLocalServerLaunched=false;
int fSocket;
SessionView *fOutput;
static status_t _Send(void *send_data_params);
static status_t Receive(void *data);
};
#endif // _SESSION_H_