ZLMediaKit/src/Http/HttpRequestSplitter.h

54 lines
1.2 KiB
C
Raw Normal View History

//
// Created by xzl on 2018/9/20.
//
#ifndef ZLMEDIAKIT_HTTPREQUESTSPLITTER_H
#define ZLMEDIAKIT_HTTPREQUESTSPLITTER_H
#include <string>
using namespace std;
class HttpRequestSplitter {
public:
HttpRequestSplitter(){};
virtual ~HttpRequestSplitter(){};
/**
*
* @param data
2018-09-23 00:55:00 +08:00
* @param len
*/
2018-09-23 00:55:00 +08:00
void input(const char *data,uint64_t len);
protected:
/**
*
2018-09-23 00:55:00 +08:00
* @param data
* @param len
*
* @return content长度,
* <0 : content
* 0 : ,
* >0 : content,
*/
2018-09-23 00:55:00 +08:00
virtual int64_t onRecvHeader(const char *data,uint64_t len) = 0;
/**
* content分片或全部数据
* onRecvHeader函数返回>0,
2018-09-23 00:55:00 +08:00
* @param data content分片或全部数据
* @param len
*/
2018-09-23 00:55:00 +08:00
virtual void onRecvContent(const char *data,uint64_t len) {};
2018-09-21 09:41:40 +08:00
/**
* content len
*/
void setContentLen(int64_t content_len);
private:
string _remain_data;
int64_t _content_len = 0;
};
#endif //ZLMEDIAKIT_HTTPREQUESTSPLITTER_H