|
PcapPlusPlus
20.08
|
Go to the documentation of this file. 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; }
93 HttpMessage() : TextBasedProtocolMessage() {}
94 HttpMessage(
const HttpMessage& other) : TextBasedProtocolMessage(other) {}
95 HttpMessage& operator=(
const HttpMessage& other) { TextBasedProtocolMessage::operator=(other);
return *
this; }
98 char getHeaderFieldNameValueSeparator()
const {
return ':'; }
99 bool spacesAllowedBetweenHeaderFieldNameAndValue()
const {
return true; }
105 class HttpRequestFirstLine;
199 std::string
getUrl()
const;
214 class HttpResponseFirstLine;
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;
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;
OsiModelLayer
Definition: ProtocolType.h:233
@ Http417ExpectationFailed
Definition: HttpLayer.h:317
@ Http200OK
Definition: HttpLayer.h:245
@ Http201Created
Definition: HttpLayer.h:247
@ Http306SwitchProxy
Definition: HttpLayer.h:277
@ Http300MultipleChoices
Definition: HttpLayer.h:265
@ Http521WebServerIsDown
Definition: HttpLayer.h:387
@ Http412PreconditionFailed
Definition: HttpLayer.h:307
@ OsiModelApplicationLayer
Definition: ProtocolType.h:248
Definition: HttpLayer.h:490
@ Http402PaymentRequired
Definition: HttpLayer.h:287
@ Http423Locked
Definition: HttpLayer.h:327
@ Http416RequestedRangeNotSatisfiable
Definition: HttpLayer.h:315
@ Http405MethodNotAllowed
Definition: HttpLayer.h:293
@ HttpGET
Definition: HttpLayer.h:133
static bool isHttpPort(uint16_t port)
Definition: HttpLayer.h:80
HttpVersion getVersion() const
Definition: HttpLayer.h:521
@ Http506VariantAlsoNegotiates
Definition: HttpLayer.h:373
@ Http499
Definition: HttpLayer.h:359
static HttpRequestLayer::HttpMethod parseMethod(char *data, size_t dataLen)
@ Http418Imateapot
Definition: HttpLayer.h:319
@ Http202Accepted
Definition: HttpLayer.h:249
HttpRequestLayer(uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
HttpResponseLayer(uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
@ Http522ConnectionTimedOut
Definition: HttpLayer.h:389
@ Http203NonAuthoritativeInformation
Definition: HttpLayer.h:251
bool isComplete() const
Definition: HttpLayer.h:549
std::string getUrl() const
@ Http431RequestHeaderFieldsTooLarge
Definition: HttpLayer.h:337
@ Http414RequestURITooLong
Definition: HttpLayer.h:311
Definition: HttpLayer.h:229
@ OneDotZero
Definition: HttpLayer.h:25
@ Http419AuthenticationTimeout
Definition: HttpLayer.h:321
HttpMethod
Definition: HttpLayer.h:130
@ Http403Forbidden
Definition: HttpLayer.h:289
HttpRequestLayer & operator=(const HttpRequestLayer &other)
@ Http451
Definition: HttpLayer.h:347
@ Http206PartialContent
Definition: HttpLayer.h:257
@ Http100Continue
Definition: HttpLayer.h:239
@ Http444NoResponse
Definition: HttpLayer.h:341
@ Http401Unauthorized
Definition: HttpLayer.h:285
bool setMethod(HttpRequestLayer::HttpMethod newMethod)
std::string getStatusCodeString() const
@ HttpHEAD
Definition: HttpLayer.h:135
@ Http406NotAcceptable
Definition: HttpLayer.h:295
HttpResponseLayer::HttpResponseStatusCode getStatusCode() const
Definition: HttpLayer.h:609
@ Http307TemporaryRedirect
Definition: HttpLayer.h:279
@ Http498TokenExpiredInvalid
Definition: HttpLayer.h:357
@ Http505HTTPVersionNotSupported
Definition: HttpLayer.h:371
@ HttpPOST
Definition: HttpLayer.h:137
virtual HeaderField * addField(const std::string &fieldName, const std::string &fieldValue)
void setVersion(HttpVersion newVersion)
@ Http409Conflict
Definition: HttpLayer.h:301
HeaderField * setContentLength(int contentLength, const std::string prevFieldName="")
HttpRequestFirstLine * getFirstLine() const
Definition: HttpLayer.h:190
@ Http415UnsupportedMediaType
Definition: HttpLayer.h:313
@ Http428PreconditionRequired
Definition: HttpLayer.h:333
@ HttpVersionUnknown
Definition: HttpLayer.h:29
@ Http503ServiceUnavailable
Definition: HttpLayer.h:367
OsiModelLayer getOsiModelLayer() const
Definition: HttpLayer.h:89
@ HttpMethodUnknown
Definition: HttpLayer.h:151
bool setUri(std::string newUri)
HttpRequestLayer::HttpMethod getMethod() const
Definition: HttpLayer.h:497
@ Http420
Definition: HttpLayer.h:323
@ Http301MovedPermanently
Definition: HttpLayer.h:267
Definition: HttpLayer.h:70
@ Http226IMUsed
Definition: HttpLayer.h:263
@ Http511NetworkAuthenticationRequired
Definition: HttpLayer.h:383
@ Http495CertError
Definition: HttpLayer.h:351
@ Http408RequestTimeout
Definition: HttpLayer.h:299
@ HttpPATCH
Definition: HttpLayer.h:149
Definition: HttpLayer.h:668
@ Http510NotExtended
Definition: HttpLayer.h:381
Definition: HttpLayer.h:557
@ Http502BadGateway
Definition: HttpLayer.h:365
Definition: HttpLayer.h:602
@ Http413RequestEntityTooLarge
Definition: HttpLayer.h:309
std::string toString() const
@ Http410Gone
Definition: HttpLayer.h:303
@ Http422UnprocessableEntity
Definition: HttpLayer.h:325
@ Http497HTTPtoHTTPS
Definition: HttpLayer.h:355
HttpResponseFirstLine * getFirstLine() const
Definition: HttpLayer.h:441
@ Http599NetworkConnectTimeoutError
Definition: HttpLayer.h:397
HttpVersion getVersion() const
Definition: HttpLayer.h:632
int getContentLength() const
@ OneDotOne
Definition: HttpLayer.h:27
@ Http302
Definition: HttpLayer.h:269
@ Http523ProxyDeclinedRequest
Definition: HttpLayer.h:391
@ Http501NotImplemented
Definition: HttpLayer.h:363
Definition: TextBasedProtocol.h:113
@ Http411LengthRequired
Definition: HttpLayer.h:305
std::string getUri() const
@ Http400BadRequest
Definition: HttpLayer.h:283
The main namespace for the PcapPlusPlus lib.
@ Http440LoginTimeout
Definition: HttpLayer.h:339
@ Http304NotModified
Definition: HttpLayer.h:273
void setVersion(HttpVersion newVersion)
@ Http509BandwidthLimitExceeded
Definition: HttpLayer.h:379
@ HttpCONNECT
Definition: HttpLayer.h:147
@ Http598NetworkReadTimeoutError
Definition: HttpLayer.h:395
std::string toString() const
static HttpResponseLayer::HttpResponseStatusCode parseStatusCode(char *data, size_t dataLen)
@ Http204NoContent
Definition: HttpLayer.h:253
@ Http303SeeOther
Definition: HttpLayer.h:271
int getSize() const
Definition: HttpLayer.h:652
@ HttpStatusCodeUnknown
Definition: HttpLayer.h:399
bool setStatusCode(HttpResponseLayer::HttpResponseStatusCode newStatusCode, std::string statusCodeString="")
@ Http407ProxyAuthenticationRequired
Definition: HttpLayer.h:297
@ Http205ResetContent
Definition: HttpLayer.h:255
@ Http207MultiStatus
Definition: HttpLayer.h:259
@ Http508LoopDetected
Definition: HttpLayer.h:377
bool isComplete() const
Definition: HttpLayer.h:660
int getStatusCodeAsInt() const
@ Http524aTimeoutOccurred
Definition: HttpLayer.h:393
@ Http507InsufficientStorage
Definition: HttpLayer.h:375
@ Http208AlreadyReported
Definition: HttpLayer.h:261
int getSize() const
Definition: HttpLayer.h:541
@ HttpDELETE
Definition: HttpLayer.h:141
@ Http450BlockedByWindowsParentalControls
Definition: HttpLayer.h:345
@ Http101SwitchingProtocols
Definition: HttpLayer.h:241
@ Http520OriginError
Definition: HttpLayer.h:385
Definition: HttpLayer.h:123
@ Http424FailedDependency
Definition: HttpLayer.h:329
HttpResponseStatusCode
Definition: HttpLayer.h:236
@ Http494RequestHeaderTooLarge
Definition: HttpLayer.h:349
@ Http496NoCert
Definition: HttpLayer.h:353
@ Http404NotFound
Definition: HttpLayer.h:291
@ Http102Processing
Definition: HttpLayer.h:243
@ Http426UpgradeRequired
Definition: HttpLayer.h:331
@ Http500InternalServerError
Definition: HttpLayer.h:361
@ Http305UseProxy
Definition: HttpLayer.h:275
@ HttpOPTIONS
Definition: HttpLayer.h:145
@ HttpTRACE
Definition: HttpLayer.h:143
@ Http449RetryWith
Definition: HttpLayer.h:343
HttpResponseLayer & operator=(const HttpResponseLayer &other)
@ ZeroDotNine
Definition: HttpLayer.h:23
@ Http429TooManyRequests
Definition: HttpLayer.h:335
HttpVersion
Definition: HttpLayer.h:20
@ Http308PermanentRedirect
Definition: HttpLayer.h:281
@ HttpPUT
Definition: HttpLayer.h:139
@ Http504GatewayTimeout
Definition: HttpLayer.h:369
virtual HeaderField * insertField(HeaderField *prevField, const std::string &fieldName, const std::string &fieldValue)