1 #ifndef PACKETPP_HTTP_LAYER 2 #define PACKETPP_HTTP_LAYER 35 #define PCPP_HTTP_HOST_FIELD "Host" 37 #define PCPP_HTTP_CONNECTION_FIELD "Connection" 39 #define PCPP_HTTP_USER_AGENT_FIELD "User-Agent" 41 #define PCPP_HTTP_REFERER_FIELD "Referer" 43 #define PCPP_HTTP_ACCEPT_FIELD "Accept" 45 #define PCPP_HTTP_ACCEPT_ENCODING_FIELD "Accept-Encoding" 47 #define PCPP_HTTP_ACCEPT_LANGUAGE_FIELD "Accept-Language" 49 #define PCPP_HTTP_COOKIE_FIELD "Cookie" 51 #define PCPP_HTTP_CONTENT_LENGTH_FIELD "Content-Length" 53 #define PCPP_HTTP_CONTENT_ENCODING_FIELD "Content-Encoding" 55 #define PCPP_HTTP_CONTENT_TYPE_FIELD "Content-Type" 57 #define PCPP_HTTP_TRANSFER_ENCODING_FIELD "Transfer-Encoding" 59 #define PCPP_HTTP_SERVER_FIELD "Server" 81 static bool isHttpPort(uint16_t port) {
return port == 80 || port == 8080; }
96 HttpMessage& operator=(
const HttpMessage& other) { TextBasedProtocolMessage::operator=(other);
return *
this; }
99 char getHeaderFieldNameValueSeparator()
const {
return ':'; }
100 bool spacesAllowedBetweenHeaderFieldNameAndValue()
const {
return true; }
201 std::string getUrl()
const;
401 HttpStatusCodeUnknown
458 HeaderField* setContentLength(
int contentLength,
const std::string prevFieldName =
"");
465 int getContentLength()
const;
512 std::string getUri()
const;
519 bool setUri(std::string newUri);
544 int getSize()
const {
return m_FirstLineEndOffset; }
564 void setMessage(std::string message) { m_Message = message; }
565 virtual const char* what()
const throw()
567 return m_Message.c_str();
570 std::string m_Message;
584 int m_FirstLineEndOffset;
617 int getStatusCodeAsInt()
const;
622 std::string getStatusCodeString()
const;
656 int getSize()
const {
return m_FirstLineEndOffset; }
676 void setMessage(std::string message) { m_Message = message; }
677 virtual const char* what()
const throw()
679 return m_Message.c_str();
682 std::string m_Message;
689 static HttpVersion parseVersion(
char* data,
size_t dataLen);
696 int m_FirstLineEndOffset;
The main namespace for the PcapPlusPlus lib.
HttpVersion getVersion() const
Definition: HttpLayer.h:524
OsiModelLayer
Definition: ProtocolType.h:263
Definition: HttpLayer.h:124
Definition: HttpLayer.h:377
Definition: HttpLayer.h:295
Definition: HttpLayer.h:146
int getSize() const
Definition: HttpLayer.h:544
Definition: HttpLayer.h:345
Definition: HttpLayer.h:325
Definition: HttpLayer.h:371
Definition: HttpLayer.h:379
Definition: HttpLayer.h:369
Definition: HttpLayer.h:297
Definition: HttpLayer.h:148
Definition: HttpLayer.h:150
Definition: HttpLayer.h:333
Definition: ProtocolType.h:278
HttpResponseLayer::HttpResponseStatusCode getStatusCode() const
Definition: HttpLayer.h:612
Definition: HttpLayer.h:363
Definition: HttpLayer.h:321
Definition: HttpLayer.h:305
Definition: HttpLayer.h:317
Definition: HttpLayer.h:25
virtual HeaderField * addField(const std::string &fieldName, const std::string &fieldValue)
Definition: HttpLayer.h:291
Definition: HttpLayer.h:271
HttpResponseFirstLine * getFirstLine() const
Definition: HttpLayer.h:444
Definition: HttpLayer.h:138
Definition: HttpLayer.h:255
bool isComplete() const
Definition: HttpLayer.h:552
Definition: HttpLayer.h:672
Definition: HttpLayer.h:243
Definition: HttpLayer.h:331
OsiModelLayer getOsiModelLayer() const
Definition: HttpLayer.h:90
Definition: HttpLayer.h:319
Definition: HttpLayer.h:353
HttpRequestLayer::HttpMethod getMethod() const
Definition: HttpLayer.h:500
Definition: HttpLayer.h:395
Definition: HttpLayer.h:383
Definition: HttpLayer.h:299
HttpVersion getVersion() const
Definition: HttpLayer.h:636
Definition: HttpLayer.h:281
HttpRequestFirstLine * getFirstLine() const
Definition: HttpLayer.h:192
Definition: HttpLayer.h:373
Definition: HttpLayer.h:231
Definition: HttpLayer.h:365
Definition: TextBasedProtocol.h:115
Definition: HttpLayer.h:337
Definition: HttpLayer.h:357
Definition: HttpLayer.h:136
Definition: HttpLayer.h:359
Definition: HttpLayer.h:265
Definition: HttpLayer.h:393
Definition: HttpLayer.h:263
Definition: HttpLayer.h:261
Definition: HttpLayer.h:361
Definition: HttpLayer.h:347
Definition: HttpLayer.h:375
Definition: HttpLayer.h:327
Definition: HttpLayer.h:257
Definition: HttpLayer.h:560
Definition: HttpLayer.h:285
Definition: HttpLayer.h:29
Definition: HttpLayer.h:309
HttpResponseStatusCode
Definition: HttpLayer.h:238
Definition: HttpLayer.h:389
Definition: HttpLayer.h:399
Definition: HttpLayer.h:315
Definition: HttpLayer.h:307
Definition: HttpLayer.h:247
Definition: HttpLayer.h:289
Definition: HttpLayer.h:287
Definition: HttpLayer.h:391
HttpMethod
Definition: HttpLayer.h:131
Definition: HttpLayer.h:397
Definition: HttpLayer.h:70
Definition: HttpLayer.h:341
Definition: HttpLayer.h:355
Definition: HttpLayer.h:283
Definition: HttpLayer.h:329
Definition: HttpLayer.h:605
Definition: HttpLayer.h:303
bool isComplete() const
Definition: HttpLayer.h:664
Definition: HttpLayer.h:273
virtual HeaderField * insertField(HeaderField *prevField, const std::string &fieldName, const std::string &fieldValue)
Definition: HttpLayer.h:134
Definition: HttpLayer.h:343
Definition: HttpLayer.h:144
Definition: HttpLayer.h:279
Definition: HttpLayer.h:275
Definition: HttpLayer.h:27
Definition: HttpLayer.h:339
Definition: HttpLayer.h:293
Definition: HttpLayer.h:349
Definition: HttpLayer.h:381
Definition: HttpLayer.h:351
Definition: HttpLayer.h:493
Definition: HttpLayer.h:267
Definition: HttpLayer.h:301
virtual std::string toString() const =0
static bool isHttpPort(uint16_t port)
Definition: HttpLayer.h:81
Definition: HttpLayer.h:269
Definition: HttpLayer.h:249
Definition: HttpLayer.h:335
Definition: HttpLayer.h:313
Definition: HttpLayer.h:241
Definition: HttpLayer.h:142
Definition: HttpLayer.h:259
Definition: HttpLayer.h:23
Definition: HttpLayer.h:385
Definition: HttpLayer.h:311
Definition: HttpLayer.h:140
Definition: HttpLayer.h:277
Definition: HttpLayer.h:367
Definition: HttpLayer.h:251
HttpVersion
Definition: HttpLayer.h:20
int getSize() const
Definition: HttpLayer.h:656
Definition: HttpLayer.h:323
Definition: HttpLayer.h:387
Definition: HttpLayer.h:245
Definition: HttpLayer.h:253