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:288
Definition: HttpLayer.h:362
Definition: HttpLayer.h:308
Definition: HttpLayer.h:30
Definition: HttpLayer.h:314
Definition: HttpLayer.h:356
Definition: HttpLayer.h:304
Definition: HttpLayer.h:320
Definition: HttpLayer.h:558
int getSize()
Definition: HttpLayer.h:542
Definition: HttpLayer.h:400
Definition: HttpLayer.h:140
Definition: HttpLayer.h:398
Definition: HttpLayer.h:124
Definition: TextBasedProtocol.h:31
Definition: HttpLayer.h:282
Definition: HttpLayer.h:26
Definition: HttpLayer.h:378
Definition: HttpLayer.h:386
Definition: HttpLayer.h:138
Definition: HttpLayer.h:358
std::string getStatusCodeString()
HttpResponseStatusCode
Definition: HttpLayer.h:237
HttpRequestFirstLine * getFirstLine()
Definition: HttpLayer.h:191
HeaderField * setContentLength(int contentLength, const std::string prevFieldName="")
Definition: HttpLayer.h:346
Definition: HttpLayer.h:669
Definition: HttpLayer.h:380
Definition: HttpLayer.h:364
Definition: HttpLayer.h:366
Definition: HttpLayer.h:302
Definition: HttpLayer.h:390
Definition: HttpLayer.h:258
Definition: HttpLayer.h:300
Definition: HttpLayer.h:278
HttpRequestLayer & operator=(const HttpRequestLayer &other)
Definition: HttpLayer.h:374
Definition: HttpLayer.h:352
Definition: HttpLayer.h:396
Definition: HttpLayer.h:372
Definition: HttpLayer.h:284
Definition: HttpLayer.h:340
static const std::map< uint16_t, bool > * getHTTPPortMap()
Definition: HttpLayer.h:146
HttpRequestLayer(uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
Definition: HttpLayer.h:368
HttpVersion getVersion()
Definition: HttpLayer.h:633
Definition: HttpLayer.h:491
Definition: HttpLayer.h:274
Definition: HttpLayer.h:144
Definition: HttpLayer.h:71
Definition: HttpLayer.h:136
int getSize()
Definition: HttpLayer.h:653
Definition: HttpLayer.h:312
Definition: HttpLayer.h:376
Definition: HttpLayer.h:336
Definition: HttpLayer.h:354
Definition: HttpLayer.h:148
Definition: HttpLayer.h:394
HttpResponseLayer(uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
void setVersion(HttpVersion newVersion)
Definition: HttpLayer.h:306
Definition: HttpLayer.h:280
Definition: HttpLayer.h:392
Definition: HttpLayer.h:603
Definition: HttpLayer.h:360
Definition: HttpLayer.h:270
Definition: HttpLayer.h:230
HttpResponseLayer::HttpResponseStatusCode getStatusCode()
Definition: HttpLayer.h:610
Definition: TextBasedProtocol.h:104
Definition: HttpLayer.h:318
HttpVersion getVersion()
Definition: HttpLayer.h:522
Definition: HttpLayer.h:296
HttpRequestLayer::HttpMethod getMethod()
Definition: HttpLayer.h:498
OsiModelLayer getOsiModelLayer()
Definition: HttpLayer.h:89
Definition: HttpLayer.h:142
Definition: HttpLayer.h:338
Definition: HttpLayer.h:268
Definition: ProtocolType.h:228
Definition: HttpLayer.h:244
bool isComplete()
Definition: HttpLayer.h:550
Definition: HttpLayer.h:264
Definition: HttpLayer.h:256
OsiModelLayer
Definition: ProtocolType.h:213
Definition: HttpLayer.h:250
Definition: HttpLayer.h:292
Definition: HttpLayer.h:150
Definition: HttpLayer.h:266
Definition: HttpLayer.h:350
Definition: HttpLayer.h:330
Definition: HttpLayer.h:28
static HttpRequestLayer::HttpMethod parseMethod(char *data, size_t dataLen)
virtual HeaderField * insertField(HeaderField *prevField, const std::string &fieldName, const std::string &fieldValue)
Definition: HttpLayer.h:24
Definition: HttpLayer.h:332
HttpResponseLayer & operator=(const HttpResponseLayer &other)
Definition: HttpLayer.h:334
Definition: HttpLayer.h:342
Definition: HttpLayer.h:310
void setVersion(HttpVersion newVersion)
HttpResponseFirstLine * getFirstLine()
Definition: HttpLayer.h:442
bool setUri(std::string newUri)
Definition: HttpLayer.h:242
Definition: HttpLayer.h:246
Definition: HttpLayer.h:276
Definition: HttpLayer.h:316
Definition: HttpLayer.h:134
Definition: HttpLayer.h:240
Definition: HttpLayer.h:262
Definition: HttpLayer.h:384
Definition: HttpLayer.h:290
Definition: HttpLayer.h:328
Definition: HttpLayer.h:286
Definition: HttpLayer.h:348
Definition: HttpLayer.h:370
Definition: HttpLayer.h:388
Definition: HttpLayer.h:252
Definition: HttpLayer.h:260
Definition: HttpLayer.h:344
bool isComplete()
Definition: HttpLayer.h:661
Definition: HttpLayer.h:248
Definition: HttpLayer.h:382
static HttpResponseLayer::HttpResponseStatusCode parseStatusCode(char *data, size_t dataLen)
HttpMethod
Definition: HttpLayer.h:131
Definition: HttpLayer.h:254
Definition: HttpLayer.h:272
Definition: HttpLayer.h:152
Definition: HttpLayer.h:322
Definition: HttpLayer.h:294
The main namespace for the PcapPlusPlus lib.
bool setMethod(HttpRequestLayer::HttpMethod newMethod)
bool setStatusCode(HttpResponseLayer::HttpResponseStatusCode newStatusCode, std::string statusCodeString="")
virtual HeaderField * addField(const std::string &fieldName, const std::string &fieldValue)
Definition: HttpLayer.h:298
Definition: HttpLayer.h:326
Definition: HttpLayer.h:324
HttpVersion
Definition: HttpLayer.h:21