-
Notifications
You must be signed in to change notification settings - Fork 3
/
Session.h
55 lines (39 loc) · 1.08 KB
/
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
51
52
53
54
55
//
// Created by yangning on 18-1-14.
//
// Descriprion :
//
// Copyright (c) yangning All rights reserved.
//
#ifndef THEAPP_SESSION_H
#define THEAPP_SESSION_H
#include "tcp_connection.h"
#include "msg/msg.h"
#include <string>
#include <memory>
#include <set>
#include <rapidjson/document.h>
#include "common.h"
using JsonType = std::shared_ptr<rapidjson::Document>;
class Session {
public:
enum kProcessState {
kUpload, kDownload, kSendFileBlock, kRecvFileBlock
};
Session(const IpAddress& address)
{
}
void handleRequest(net::TcpConnectionPtr& connection, net::SocketBuf* buf);
std::string parse(net::SocketBuf* buf);
std::string process(const std::string& json,net::TcpConnectionPtr& connection);
~Session()
{
}
private:
bool push2Consumer(std::map<std::string,std::string>& json_map);
bool handleRegister(net::TcpConnectionPtr& connection,int type);
bool handlePushMsg(int type,int proto,const std::string& content);
kProcessState processState_;
std::set<std::shared_ptr<Msg>> msgSet_;
};
#endif //THEAPP_SESSION_H