1 #ifndef PACKETPP_HTTP_LAYER 2 #define PACKETPP_HTTP_LAYER 36 #define PCPP_HTTP_HOST_FIELD "Host" 38 #define PCPP_HTTP_CONNECTION_FIELD "Connection" 40 #define PCPP_HTTP_USER_AGENT_FIELD "User-Agent" 42 #define PCPP_HTTP_REFERER_FIELD "Referer" 44 #define PCPP_HTTP_ACCEPT_FIELD "Accept" 46 #define PCPP_HTTP_ACCEPT_ENCODING_FIELD "Accept-Encoding" 48 #define PCPP_HTTP_ACCEPT_LANGUAGE_FIELD "Accept-Language" 50 #define PCPP_HTTP_COOKIE_FIELD "Cookie" 52 #define PCPP_HTTP_CONTENT_LENGTH_FIELD "Content-Length" 54 #define PCPP_HTTP_CONTENT_ENCODING_FIELD "Content-Encoding" 56 #define PCPP_HTTP_CONTENT_TYPE_FIELD "Content-Type" 58 #define PCPP_HTTP_TRANSFER_ENCODING_FIELD "Transfer-Encoding" 60 #define PCPP_HTTP_SERVER_FIELD "Server" 93 HttpMessage() : TextBasedProtocolMessage() {}
94 HttpMessage(
const HttpMessage& other) : TextBasedProtocolMessage(other) {}
95 HttpMessage& operator=(
const HttpMessage& other) { TextBasedProtocolMessage::operator=(other);
return *
this; }
98 char getHeaderFieldNameValueSeparator() {
return ':'; }
99 bool spacesAllowedBetweenHeaderFieldNameAndValue() {
return true; }
105 class HttpRequestFirstLine;
215 class HttpResponseFirstLine;
517 bool setUri(std::string newUri);
542 inline int getSize() {
return m_FirstLineEndOffset; }
562 void setMessage(std::string message) { m_Message = message; }
563 virtual const char* what()
const throw()
565 return m_Message.c_str();
568 std::string m_Message;
582 int m_FirstLineEndOffset;
653 inline int getSize() {
return m_FirstLineEndOffset; }
673 void setMessage(std::string message) { m_Message = message; }
674 virtual const char* what()
const throw()
676 return m_Message.c_str();
679 std::string m_Message;
686 static HttpVersion parseVersion(
char* data,
size_t dataLen);
693 int m_FirstLineEndOffset;
Definition: HttpLayer.h:294
Definition: HttpLayer.h:28
Definition: HttpLayer.h:346
Definition: HttpLayer.h:146
Definition: HttpLayer.h:276
Definition: HttpLayer.h:260
Definition: HttpLayer.h:344
Definition: HttpLayer.h:328
Definition: HttpLayer.h:364
HttpResponseLayer(uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
Definition: HttpLayer.h:380
Definition: TextBasedProtocol.h:104
Definition: HttpLayer.h:26
Definition: HttpLayer.h:144
Definition: HttpLayer.h:152
Definition: HttpLayer.h:396
Definition: HttpLayer.h:558
Definition: HttpLayer.h:284
Definition: HttpLayer.h:124
static const std::map< uint16_t, bool > * getHTTPPortMap()
Definition: HttpLayer.h:314
Definition: HttpLayer.h:356
Definition: HttpLayer.h:352
Definition: HttpLayer.h:326
static HttpRequestLayer::HttpMethod parseMethod(char *data, size_t dataLen)
Definition: HttpLayer.h:270
Definition: HttpLayer.h:320
Definition: HttpLayer.h:374
void setVersion(HttpVersion newVersion)
Definition: HttpLayer.h:248
Definition: HttpLayer.h:244
Definition: ProtocolType.h:223
The main namespace for the PcapPlusPlus lib.
Definition: HttpLayer.h:292
Definition: TextBasedProtocol.h:31
Definition: HttpLayer.h:134
Definition: HttpLayer.h:282
Definition: HttpLayer.h:264
Definition: HttpLayer.h:312
Definition: HttpLayer.h:334
Definition: HttpLayer.h:669
Definition: HttpLayer.h:296
HttpVersion getVersion()
Definition: HttpLayer.h:633
Definition: HttpLayer.h:362
Definition: HttpLayer.h:376
Definition: HttpLayer.h:491
Definition: HttpLayer.h:142
Definition: HttpLayer.h:372
Definition: HttpLayer.h:268
Definition: HttpLayer.h:354
Definition: HttpLayer.h:71
Definition: HttpLayer.h:358
Definition: HttpLayer.h:256
Definition: HttpLayer.h:138
HttpRequestLayer::HttpMethod getMethod()
Definition: HttpLayer.h:498
OsiModelLayer
Definition: ProtocolType.h:208
Definition: HttpLayer.h:30
HeaderField * setContentLength(int contentLength, const std::string prevFieldName="")
Definition: HttpLayer.h:302
Definition: HttpLayer.h:603
Definition: HttpLayer.h:258
Definition: HttpLayer.h:338
Definition: HttpLayer.h:148
Definition: HttpLayer.h:390
Definition: HttpLayer.h:336
Definition: HttpLayer.h:342
bool isComplete()
Definition: HttpLayer.h:661
Definition: HttpLayer.h:340
void setVersion(HttpVersion newVersion)
Definition: HttpLayer.h:252
Definition: HttpLayer.h:246
Definition: HttpLayer.h:366
Definition: HttpLayer.h:392
Definition: HttpLayer.h:140
Definition: HttpLayer.h:370
bool setStatusCode(HttpResponseLayer::HttpResponseStatusCode newStatusCode, std::string statusCodeString="")
Definition: HttpLayer.h:318
Definition: HttpLayer.h:240
bool setUri(std::string newUri)
Definition: HttpLayer.h:242
int getSize()
Definition: HttpLayer.h:653
Definition: HttpLayer.h:278
Definition: HttpLayer.h:262
HttpMethod
Definition: HttpLayer.h:131
Definition: HttpLayer.h:310
Definition: HttpLayer.h:322
Definition: HttpLayer.h:316
HttpResponseStatusCode
Definition: HttpLayer.h:237
HttpVersion
Definition: HttpLayer.h:21
HttpRequestLayer & operator=(const HttpRequestLayer &other)
Definition: HttpLayer.h:280
HttpResponseFirstLine * getFirstLine()
Definition: HttpLayer.h:442
HttpVersion getVersion()
Definition: HttpLayer.h:522
virtual HeaderField * addField(const std::string &fieldName, const std::string &fieldValue)
Definition: HttpLayer.h:394
Definition: HttpLayer.h:368
Definition: HttpLayer.h:272
Definition: HttpLayer.h:304
std::string getStatusCodeString()
Definition: HttpLayer.h:360
bool setMethod(HttpRequestLayer::HttpMethod newMethod)
Definition: HttpLayer.h:286
Definition: HttpLayer.h:274
Definition: HttpLayer.h:150
Definition: HttpLayer.h:388
Definition: HttpLayer.h:348
Definition: HttpLayer.h:400
Definition: HttpLayer.h:324
Definition: HttpLayer.h:382
HttpRequestFirstLine * getFirstLine()
Definition: HttpLayer.h:191
Definition: HttpLayer.h:306
HttpResponseLayer & operator=(const HttpResponseLayer &other)
Definition: HttpLayer.h:308
virtual HeaderField * insertField(HeaderField *prevField, const std::string &fieldName, const std::string &fieldValue)
Definition: HttpLayer.h:332
Definition: HttpLayer.h:250
Definition: HttpLayer.h:298
Definition: HttpLayer.h:254
Definition: HttpLayer.h:266
HttpResponseLayer::HttpResponseStatusCode getStatusCode()
Definition: HttpLayer.h:610
Definition: HttpLayer.h:384
OsiModelLayer getOsiModelLayer()
Definition: HttpLayer.h:89
Definition: HttpLayer.h:378
Definition: HttpLayer.h:24
Definition: HttpLayer.h:398
static HttpResponseLayer::HttpResponseStatusCode parseStatusCode(char *data, size_t dataLen)
bool isComplete()
Definition: HttpLayer.h:550
Definition: HttpLayer.h:300
Definition: HttpLayer.h:330
HttpRequestLayer(uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
Definition: HttpLayer.h:230
Definition: HttpLayer.h:386
Definition: HttpLayer.h:288
int getSize()
Definition: HttpLayer.h:542
Definition: HttpLayer.h:136
Definition: HttpLayer.h:290
Definition: HttpLayer.h:350