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" 80 static bool isHttpPort(uint16_t port) {
return port == 80 || port == 8080; }
95 HttpMessage& operator=(
const HttpMessage& other) { TextBasedProtocolMessage::operator=(other);
return *
this; }
98 char getHeaderFieldNameValueSeparator()
const {
return ':'; }
99 bool spacesAllowedBetweenHeaderFieldNameAndValue()
const {
return true; }
199 std::string getUrl()
const;
399 HttpStatusCodeUnknown
455 HeaderField* setContentLength(
int contentLength,
const std::string prevFieldName =
"");
462 int getContentLength()
const;
509 std::string getUri()
const;
516 bool setUri(std::string newUri);
541 int getSize()
const {
return m_FirstLineEndOffset; }
561 void setMessage(std::string message) { m_Message = message; }
562 virtual const char* what()
const throw()
564 return m_Message.c_str();
567 std::string m_Message;
581 int m_FirstLineEndOffset;
614 int getStatusCodeAsInt()
const;
619 std::string getStatusCodeString()
const;
652 int getSize()
const {
return m_FirstLineEndOffset; }
672 void setMessage(std::string message) { m_Message = message; }
673 virtual const char* what()
const throw()
675 return m_Message.c_str();
678 std::string m_Message;
685 static HttpVersion parseVersion(
char* data,
size_t dataLen);
692 int m_FirstLineEndOffset;
The main namespace for the PcapPlusPlus lib.
HttpVersion getVersion() const
Definition: HttpLayer.h:521
OsiModelLayer
Definition: ProtocolType.h:253
Definition: HttpLayer.h:123
Definition: HttpLayer.h:375
Definition: HttpLayer.h:293
Definition: HttpLayer.h:145
int getSize() const
Definition: HttpLayer.h:541
Definition: HttpLayer.h:343
Definition: HttpLayer.h:323
Definition: HttpLayer.h:369
Definition: HttpLayer.h:377
Definition: HttpLayer.h:367
Definition: HttpLayer.h:295
Definition: HttpLayer.h:147
Definition: HttpLayer.h:149
Definition: HttpLayer.h:331
Definition: ProtocolType.h:268
HttpResponseLayer::HttpResponseStatusCode getStatusCode() const
Definition: HttpLayer.h:609
Definition: HttpLayer.h:361
Definition: HttpLayer.h:319
Definition: HttpLayer.h:303
Definition: HttpLayer.h:315
Definition: HttpLayer.h:25
virtual HeaderField * addField(const std::string &fieldName, const std::string &fieldValue)
Definition: HttpLayer.h:289
Definition: HttpLayer.h:269
HttpResponseFirstLine * getFirstLine() const
Definition: HttpLayer.h:441
Definition: HttpLayer.h:137
Definition: HttpLayer.h:253
bool isComplete() const
Definition: HttpLayer.h:549
Definition: HttpLayer.h:668
Definition: HttpLayer.h:241
Definition: HttpLayer.h:329
OsiModelLayer getOsiModelLayer() const
Definition: HttpLayer.h:89
Definition: HttpLayer.h:317
Definition: HttpLayer.h:351
HttpRequestLayer::HttpMethod getMethod() const
Definition: HttpLayer.h:497
Definition: HttpLayer.h:393
Definition: HttpLayer.h:381
Definition: HttpLayer.h:297
HttpVersion getVersion() const
Definition: HttpLayer.h:632
Definition: HttpLayer.h:279
HttpRequestFirstLine * getFirstLine() const
Definition: HttpLayer.h:190
Definition: HttpLayer.h:371
Definition: HttpLayer.h:229
Definition: HttpLayer.h:363
Definition: TextBasedProtocol.h:113
Definition: HttpLayer.h:335
Definition: HttpLayer.h:355
Definition: HttpLayer.h:135
Definition: HttpLayer.h:357
Definition: HttpLayer.h:263
Definition: HttpLayer.h:391
Definition: HttpLayer.h:261
Definition: HttpLayer.h:259
Definition: HttpLayer.h:359
Definition: HttpLayer.h:345
Definition: HttpLayer.h:373
Definition: HttpLayer.h:325
Definition: HttpLayer.h:255
Definition: HttpLayer.h:557
Definition: HttpLayer.h:283
Definition: HttpLayer.h:29
Definition: HttpLayer.h:307
HttpResponseStatusCode
Definition: HttpLayer.h:236
Definition: HttpLayer.h:387
Definition: HttpLayer.h:397
Definition: HttpLayer.h:313
Definition: HttpLayer.h:305
Definition: HttpLayer.h:245
Definition: HttpLayer.h:287
Definition: HttpLayer.h:285
Definition: HttpLayer.h:389
HttpMethod
Definition: HttpLayer.h:130
Definition: HttpLayer.h:395
Definition: HttpLayer.h:70
Definition: HttpLayer.h:339
Definition: HttpLayer.h:353
Definition: HttpLayer.h:281
Definition: HttpLayer.h:327
Definition: HttpLayer.h:602
Definition: HttpLayer.h:301
bool isComplete() const
Definition: HttpLayer.h:660
Definition: HttpLayer.h:271
virtual HeaderField * insertField(HeaderField *prevField, const std::string &fieldName, const std::string &fieldValue)
Definition: HttpLayer.h:133
Definition: HttpLayer.h:341
Definition: HttpLayer.h:143
Definition: HttpLayer.h:277
Definition: HttpLayer.h:273
Definition: HttpLayer.h:27
Definition: HttpLayer.h:337
Definition: HttpLayer.h:291
Definition: HttpLayer.h:347
Definition: HttpLayer.h:379
Definition: HttpLayer.h:349
Definition: HttpLayer.h:490
Definition: HttpLayer.h:265
Definition: HttpLayer.h:299
virtual std::string toString() const =0
static bool isHttpPort(uint16_t port)
Definition: HttpLayer.h:80
Definition: HttpLayer.h:267
Definition: HttpLayer.h:247
Definition: HttpLayer.h:333
Definition: HttpLayer.h:311
Definition: HttpLayer.h:239
Definition: HttpLayer.h:141
Definition: HttpLayer.h:257
Definition: HttpLayer.h:23
Definition: HttpLayer.h:383
Definition: HttpLayer.h:309
Definition: HttpLayer.h:139
Definition: HttpLayer.h:275
Definition: HttpLayer.h:365
Definition: HttpLayer.h:249
HttpVersion
Definition: HttpLayer.h:20
int getSize() const
Definition: HttpLayer.h:652
Definition: HttpLayer.h:321
Definition: HttpLayer.h:385
Definition: HttpLayer.h:243
Definition: HttpLayer.h:251