PcapPlusPlus  Next
HttpLayer.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "DeprecationUtils.h"
4 #include "TextBasedProtocol.h"
5 #include <string>
6 #include <exception>
7 
9 
12 namespace pcpp
13 {
16  {
25  };
26 
27  // some popular HTTP fields
28 
30 #define PCPP_HTTP_HOST_FIELD "Host"
32 #define PCPP_HTTP_CONNECTION_FIELD "Connection"
34 #define PCPP_HTTP_USER_AGENT_FIELD "User-Agent"
36 #define PCPP_HTTP_REFERER_FIELD "Referer"
38 #define PCPP_HTTP_ACCEPT_FIELD "Accept"
40 #define PCPP_HTTP_ACCEPT_ENCODING_FIELD "Accept-Encoding"
42 #define PCPP_HTTP_ACCEPT_LANGUAGE_FIELD "Accept-Language"
44 #define PCPP_HTTP_COOKIE_FIELD "Cookie"
46 #define PCPP_HTTP_CONTENT_LENGTH_FIELD "Content-Length"
48 #define PCPP_HTTP_CONTENT_ENCODING_FIELD "Content-Encoding"
50 #define PCPP_HTTP_CONTENT_TYPE_FIELD "Content-Type"
52 #define PCPP_HTTP_TRANSFER_ENCODING_FIELD "Transfer-Encoding"
54 #define PCPP_HTTP_SERVER_FIELD "Server"
55 
56  // -------- classes to be defined later -----------------
57 
58  class HttpRequestFirstLine;
59  class HttpResponseFirstLine;
60 
61  // -------- Class HttpMessage -----------------
62 
67  {
68  public:
69  ~HttpMessage() override = default;
70 
74  static bool isHttpPort(uint16_t port)
75  {
76  return port == 80 || port == 8080;
77  }
78 
79  // overridden methods
80 
81  HeaderField* addField(const std::string& fieldName, const std::string& fieldValue) override;
82  HeaderField* addField(const HeaderField& newField) override;
83  HeaderField* insertField(HeaderField* prevField, const std::string& fieldName,
84  const std::string& fieldValue) override;
85  HeaderField* insertField(HeaderField* prevField, const HeaderField& newField) override;
86 
88  {
90  }
91 
96  {
99  struct HeaderFieldObject : ObjectFieldDescriptor<HeaderFieldObject>
100  {
102 
104  static std::vector<FieldDescriptor> all()
105  {
106  return { Name, Value };
107  }
108 
110  static const FieldDescriptor Name;
111 
113  static const FieldDescriptor Value;
114  };
115 
119 
123  };
124 
125  protected:
126  HttpMessage(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet, ProtocolType protocol)
127  : TextBasedProtocolMessage(data, dataLen, prevLayer, packet, protocol)
128  {}
130  {}
131  HttpMessage(const HttpMessage& other) : TextBasedProtocolMessage(other)
132  {}
133  HttpMessage& operator=(const HttpMessage& other)
134  {
135  TextBasedProtocolMessage::operator=(other);
136  return *this;
137  }
138 
139  // implementation of abstract methods
140  char getHeaderFieldNameValueSeparator() const override
141  {
142  return ':';
143  }
144  bool spacesAllowedBetweenHeaderFieldNameAndValue() const override
145  {
146  return true;
147  }
148 
149  void serializeHeader(ObjectScope& serializer) const;
150  };
151 
152  // -------- Class HttpRequestLayer -----------------
153 
166  {
167  friend class HttpRequestFirstLine;
168 
169  public:
172  {
193  };
194 
200  HttpRequestLayer(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet);
201 
207  HttpRequestLayer(HttpMethod method, const std::string& uri, HttpVersion version);
208 
209  ~HttpRequestLayer() override;
210 
215 
221 
224  {
225  return m_FirstLine;
226  }
227 
233  std::string getUrl() const;
234 
235  // implement Layer's abstract methods
236  std::string toString() const override;
237 
242  {
244  static std::vector<FieldDescriptor> all()
245  {
246  auto result = HttpMessage::SerializedFields::all();
247  std::initializer_list<FieldDescriptor> extra{ Method, Uri, Version, HeaderComplete, HeaderFields };
248  std::copy(extra.begin(), extra.end(), std::back_inserter(result));
249  return result;
250  }
251 
254  static const FieldDescriptor Method;
255 
257  static const FieldDescriptor Uri;
258 
261  static const FieldDescriptor Version;
262  };
263 
264  protected:
265  void serializeLayer(ObjectScope& serializer) const override;
266 
267  private:
268  HttpRequestFirstLine* m_FirstLine;
269  };
270 
271  // -------- Class HttpResponseStatusCode -----------------
272 
276  {
277  public:
279  enum Value : int
280  {
290 
292  Http200OK = 200,
313 
319  Http302 = 302,
333 
355  Http410Gone = 410,
375  Http420 = 420,
408  Http451 = 451,
421  Http499 = 499,
422 
463 
464  // clang-format off
466  HttpStatus1xxCodeUnknown = 900001, // 1xx: Informational - Request received, continuing process
467  HttpStatus2xxCodeUnknown = 900002, // 2xx: Success - The action was successfully received, understood, and accepted
468  HttpStatus3xxCodeUnknown = 900003, // 3xx: Redirection - Further action must be taken in order to complete the request
469  HttpStatus4xxCodeUnknown = 900004, // 4xx: Client Error - The request contains bad syntax or cannot be fulfilled
470  HttpStatus5xxCodeUnknown = 900005, // 5xx: Server Error - The server failed to fulfill an apparently valid request
471  HttpStatusCodeUnknown = 999999, // other arbitrary number
472  // clang-format on
473  };
474 
475  HttpResponseStatusCode() = default;
476 
477  // cppcheck-suppress noExplicitConstructor
480  HttpResponseStatusCode(Value statusCode) : m_Value(statusCode)
481  {}
482 
486  explicit HttpResponseStatusCode(const int& statusCodeNumber, const std::string& statusMessage = "");
487 
491  explicit HttpResponseStatusCode(const Value& statusCode, const std::string& statusMessage);
492 
493  // Allow switch and comparisons.
494  operator Value() const
495  {
496  return m_Value;
497  }
498  // Prevent usage: if(httpResponseStatusCode)
499  explicit operator bool() const = delete;
500 
502  std::string toString() const
503  {
504  return std::to_string(m_Value);
505  }
506 
508  int toInt() const
509  {
510  return static_cast<int>(m_Value);
511  }
512 
514  std::string getMessage() const;
517  bool isUnsupportedCode() const
518  {
519  return m_Value > 599;
520  }
521 
522  private:
523  Value m_Value = HttpStatusCodeUnknown;
524  std::string m_CustomizedMessage;
525  };
526 
527  // -------- Class HttpResponseLayer -----------------
528 
540  {
541  friend class HttpResponseFirstLine;
542 
543  public:
544  // backward compatibility
546 
552  HttpResponseLayer(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet);
553 
562  PCPP_DEPRECATED("Use other constructors instead")
563  explicit HttpResponseLayer(HttpVersion version, const HttpResponseStatusCode& statusCode,
564  const std::string& statusCodeString);
565 
570  explicit HttpResponseLayer(HttpVersion version, const HttpResponseStatusCode& statusCode);
571 
572  ~HttpResponseLayer() override;
573 
578 
583  HttpResponseLayer& operator=(const HttpResponseLayer& other);
584 
587  {
588  return m_FirstLine;
589  }
590 
605  HeaderField* setContentLength(int contentLength, const std::string& prevFieldName = "");
606 
611  int getContentLength() const;
612 
613  // implement Layer's abstract methods
614 
615  std::string toString() const override;
616 
621  {
623  static std::vector<FieldDescriptor> all()
624  {
625  auto result = HttpMessage::SerializedFields::all();
626  std::initializer_list<FieldDescriptor> extra{ Version, StatusCode, StatusCodeDescription,
628  std::copy(extra.begin(), extra.end(), std::back_inserter(result));
629  return result;
630  }
631 
634  static const FieldDescriptor Version;
635 
638 
643  };
644 
645  protected:
646  void serializeLayer(ObjectScope& serializer) const override;
647 
648  private:
649  HttpResponseFirstLine* m_FirstLine;
650  };
651 
652  // -------- Class HttpRequestFirstLine -----------------
653 
664  {
665  friend class HttpRequestLayer;
666 
667  public:
670  {
671  return m_Method;
672  }
673 
679 
682  std::string getUri() const;
683 
687  bool setUri(std::string newUri);
688 
691  {
692  return m_Version;
693  }
694 
698  void setVersion(HttpVersion newVersion);
699 
704  static HttpRequestLayer::HttpMethod parseMethod(const char* data, size_t dataLen);
705 
707  int getSize() const
708  {
709  return m_FirstLineEndOffset;
710  }
711 
716  bool isComplete() const
717  {
718  return m_IsComplete;
719  }
720 
725  class HttpRequestFirstLineException : public std::exception
726  {
727  public:
729  {}
730  void setMessage(const std::string& message)
731  {
732  m_Message = message;
733  }
734  virtual const char* what() const noexcept
735  {
736  return m_Message.c_str();
737  }
738 
739  private:
740  std::string m_Message;
741  };
742 
743  private:
744  explicit HttpRequestFirstLine(HttpRequestLayer* httpRequest);
746  const std::string& uri = "/");
747 
748  void parseVersion();
749 
750  HttpRequestLayer* m_HttpRequest;
752  HttpVersion m_Version;
753  int m_VersionOffset;
754  int m_UriOffset;
755  int m_FirstLineEndOffset;
756  bool m_IsComplete;
757  HttpRequestFirstLineException m_Exception;
758  };
759 
760  // -------- Class HttpResponseFirstLine -----------------
761 
772  {
773  friend class HttpResponseLayer;
774 
775  public:
778  {
779  return m_StatusCode;
780  }
781 
783  int getStatusCodeAsInt() const;
784 
786  std::string getStatusCodeString() const;
787 
795  PCPP_DEPRECATED("Use the other overload instead")
796  bool setStatusCode(const HttpResponseStatusCode& newStatusCode, const std::string& statusCodeString);
797 
801  bool setStatusCode(const HttpResponseStatusCode& newStatusCode);
802 
805  {
806  return m_Version;
807  }
808 
812  void setVersion(HttpVersion newVersion);
813 
818  static HttpResponseStatusCode parseStatusCode(const char* data, size_t dataLen);
819 
824  static HttpVersion parseVersion(const char* data, size_t dataLen);
825 
827  int getSize() const
828  {
829  return m_FirstLineEndOffset;
830  }
831 
836  bool isComplete() const
837  {
838  return m_IsComplete;
839  }
840 
846  class HttpResponseFirstLineException : public std::exception
847  {
848  public:
850  {}
851  void setMessage(const std::string& message)
852  {
853  m_Message = message;
854  }
855  virtual const char* what() const noexcept
856  {
857  return m_Message.c_str();
858  }
859 
860  private:
861  std::string m_Message;
862  };
863 
864  private:
865  explicit HttpResponseFirstLine(HttpResponseLayer* httpResponse);
866  HttpResponseFirstLine(HttpResponseLayer* httpResponse, HttpVersion version,
867  const HttpResponseStatusCode& statusCode);
868 
869  HttpResponseLayer* m_HttpResponse;
870  HttpVersion m_Version;
871  HttpResponseStatusCode m_StatusCode;
872  int m_FirstLineEndOffset;
873  bool m_IsComplete;
874  HttpResponseFirstLineException m_Exception;
875  };
876 
877 } // namespace pcpp
Definition: TextBasedProtocol.h:28
Definition: HttpLayer.h:67
OsiModelLayer getOsiModelLayer() const override
Definition: HttpLayer.h:87
HeaderField * insertField(HeaderField *prevField, const std::string &fieldName, const std::string &fieldValue) override
HeaderField * addField(const HeaderField &newField) override
static bool isHttpPort(uint16_t port)
Definition: HttpLayer.h:74
HeaderField * insertField(HeaderField *prevField, const HeaderField &newField) override
HeaderField * addField(const std::string &fieldName, const std::string &fieldValue) override
Definition: HttpLayer.h:664
bool setMethod(HttpRequestLayer::HttpMethod newMethod)
int getSize() const
Definition: HttpLayer.h:707
HttpRequestLayer::HttpMethod getMethod() const
Definition: HttpLayer.h:669
bool isComplete() const
Definition: HttpLayer.h:716
bool setUri(std::string newUri)
std::string getUri() const
static HttpRequestLayer::HttpMethod parseMethod(const char *data, size_t dataLen)
void setVersion(HttpVersion newVersion)
HttpVersion getVersion() const
Definition: HttpLayer.h:690
Definition: HttpLayer.h:166
void serializeLayer(ObjectScope &serializer) const override
HttpRequestLayer & operator=(const HttpRequestLayer &other)
HttpMethod
HTTP request methods.
Definition: HttpLayer.h:172
@ HttpDELETE
DELETE.
Definition: HttpLayer.h:182
@ HttpCONNECT
CONNECT.
Definition: HttpLayer.h:188
@ HttpPOST
POST.
Definition: HttpLayer.h:178
@ HttpMethodUnknown
Unknown HTTP method.
Definition: HttpLayer.h:192
@ HttpTRACE
TRACE.
Definition: HttpLayer.h:184
@ HttpOPTIONS
OPTIONS.
Definition: HttpLayer.h:186
@ HttpHEAD
HEAD.
Definition: HttpLayer.h:176
@ HttpPATCH
PATCH.
Definition: HttpLayer.h:190
@ HttpGET
GET.
Definition: HttpLayer.h:174
@ HttpPUT
PUT.
Definition: HttpLayer.h:180
HttpRequestLayer(uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
HttpRequestLayer(const HttpRequestLayer &other)
std::string toString() const override
HttpRequestLayer(HttpMethod method, const std::string &uri, HttpVersion version)
std::string getUrl() const
HttpRequestFirstLine * getFirstLine() const
Definition: HttpLayer.h:223
Definition: HttpLayer.h:772
bool isComplete() const
Definition: HttpLayer.h:836
HttpVersion getVersion() const
Definition: HttpLayer.h:804
static HttpVersion parseVersion(const char *data, size_t dataLen)
HttpResponseStatusCode getStatusCode() const
Definition: HttpLayer.h:777
std::string getStatusCodeString() const
bool setStatusCode(const HttpResponseStatusCode &newStatusCode, const std::string &statusCodeString)
void setVersion(HttpVersion newVersion)
int getSize() const
Definition: HttpLayer.h:827
static HttpResponseStatusCode parseStatusCode(const char *data, size_t dataLen)
Definition: HttpLayer.h:540
std::string toString() const override
HttpResponseLayer(uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
HttpResponseFirstLine * getFirstLine() const
Definition: HttpLayer.h:586
HeaderField * setContentLength(int contentLength, const std::string &prevFieldName="")
int getContentLength() const
void serializeLayer(ObjectScope &serializer) const override
The enum wrapper class of HTTP response status codes.
Definition: HttpLayer.h:276
int toInt() const
get status code number as int
Definition: HttpLayer.h:508
bool isUnsupportedCode() const
Definition: HttpLayer.h:517
HttpResponseStatusCode(const int &statusCodeNumber, const std::string &statusMessage="")
Construct HttpResponseStatusCode from the code number and the customized message.
std::string toString() const
get status code number as string
Definition: HttpLayer.h:502
HttpResponseStatusCode(const Value &statusCode, const std::string &statusMessage)
Construct HttpResponseStatusCode from Value enum and the customized message.
std::string getMessage() const
get status code message, e.g. "OK", "Not Found"
Value
Define enum types and the corresponding int values.
Definition: HttpLayer.h:280
@ Http507InsufficientStorage
507 Insufficient Storage
Definition: HttpLayer.h:438
@ Http301MovedPermanently
301 Moved Permanently
Definition: HttpLayer.h:317
@ Http306SwitchProxy
306 Switch Proxy
Definition: HttpLayer.h:327
@ Http499
499 (various messages)
Definition: HttpLayer.h:421
@ Http599NetworkConnectTimeoutError
599 Network connect timeout error
Definition: HttpLayer.h:462
@ Http410Gone
410 Gone
Definition: HttpLayer.h:355
@ Http100Continue
100 Continue
Definition: HttpLayer.h:282
@ Http502BadGateway
502 Bad Gateway
Definition: HttpLayer.h:428
@ Http411LengthRequired
411 Length Required
Definition: HttpLayer.h:357
@ Http407ProxyAuthenticationRequired
407 Proxy Authentication Required
Definition: HttpLayer.h:349
@ Http308PermanentRedirect
308 Permanent Redirect,
Definition: HttpLayer.h:331
@ Http205ResetContent
205 Reset Content
Definition: HttpLayer.h:302
@ Http300MultipleChoices
227-299 Unassigned
Definition: HttpLayer.h:315
@ Http402PaymentRequired
402 Payment Required
Definition: HttpLayer.h:339
@ Http207MultiStatus
207 Multi-Status
Definition: HttpLayer.h:306
@ Http420
420 (various messages)
Definition: HttpLayer.h:375
@ Http400BadRequest
309-399 Unassigned
Definition: HttpLayer.h:335
@ Http509BandwidthLimitExceeded
509 Bandwidth Limit Exceeded
Definition: HttpLayer.h:442
@ Http426UpgradeRequired
426 Upgrade Required
Definition: HttpLayer.h:387
@ Http494RequestHeaderTooLarge
Definition: HttpLayer.h:411
@ Http511NetworkAuthenticationRequired
511 Network Authentication Required
Definition: HttpLayer.h:446
@ Http598NetworkReadTimeoutError
Definition: HttpLayer.h:460
@ Http501NotImplemented
501 Not Implemented
Definition: HttpLayer.h:426
@ Http523ProxyDeclinedRequest
523 Proxy Declined Request
Definition: HttpLayer.h:455
@ Http421MisdirectedRequest
421 Misdirected Request
Definition: HttpLayer.h:377
@ Http404NotFound
404 Not Found
Definition: HttpLayer.h:343
@ Http418ImATeapot
418 I'm a teapot
Definition: HttpLayer.h:371
@ Http305UseProxy
305 Use Proxy
Definition: HttpLayer.h:325
@ Http226IMUsed
Definition: HttpLayer.h:311
@ Http498TokenExpiredInvalid
498 Token expired/invalid
Definition: HttpLayer.h:419
@ Http416RequestedRangeNotSatisfiable
416 Requested Range Not Satisfiable
Definition: HttpLayer.h:367
@ Http524aTimeoutOccurred
524 A timeout occurred
Definition: HttpLayer.h:457
@ Http444NoResponse
Definition: HttpLayer.h:401
@ Http414RequestURITooLong
414 Request-URI Too Long
Definition: HttpLayer.h:363
@ Http425TooEarly
425 Too Early
Definition: HttpLayer.h:385
@ Http401Unauthorized
401 Unauthorized
Definition: HttpLayer.h:337
@ Http429TooManyRequests
429 Too Many Requests
Definition: HttpLayer.h:392
@ Http450BlockedByWindowsParentalControls
450 Blocked by Windows Parental Controls
Definition: HttpLayer.h:406
@ Http204NoContent
204 No Content
Definition: HttpLayer.h:300
@ Http508LoopDetected
508 Loop Detected
Definition: HttpLayer.h:440
@ Http510NotExtended
510 Not Extended
Definition: HttpLayer.h:444
@ Http403Forbidden
403 Forbidden
Definition: HttpLayer.h:341
@ Http408RequestTimeout
408 Request Timeout
Definition: HttpLayer.h:351
@ Http440LoginTimeout
Definition: HttpLayer.h:398
@ Http500InternalServerError
500 Internal Server Error
Definition: HttpLayer.h:424
@ Http505HTTPVersionNotSupported
505 HTTP Version Not Supported
Definition: HttpLayer.h:434
@ Http206PartialContent
206 Partial Content
Definition: HttpLayer.h:304
@ Http520OriginError
Definition: HttpLayer.h:449
@ Http302
302 (various messages)
Definition: HttpLayer.h:319
@ Http409Conflict
409 Conflict
Definition: HttpLayer.h:353
@ Http419AuthenticationTimeout
419 Authentication Timeout
Definition: HttpLayer.h:373
@ Http406NotAcceptable
406 Not Acceptable
Definition: HttpLayer.h:347
@ Http451
451 (various messages)
Definition: HttpLayer.h:408
@ Http496NoCert
496 No Cert
Definition: HttpLayer.h:415
@ Http103EarlyHints
103 Early Hints
Definition: HttpLayer.h:288
@ Http202Accepted
202 Accepted
Definition: HttpLayer.h:296
@ Http522ConnectionTimedOut
522 Connection timed out
Definition: HttpLayer.h:453
@ Http203NonAuthoritativeInformation
203 Non-Authoritative Information
Definition: HttpLayer.h:298
@ Http304NotModified
304 Not Modified
Definition: HttpLayer.h:323
@ Http201Created
201 Created
Definition: HttpLayer.h:294
@ Http101SwitchingProtocols
101 Switching Protocols
Definition: HttpLayer.h:284
@ Http413RequestEntityTooLarge
413 RequestEntity Too Large
Definition: HttpLayer.h:361
@ Http495CertError
495 Cert Error
Definition: HttpLayer.h:413
@ Http497HTTPtoHTTPS
497 HTTP to HTTPS
Definition: HttpLayer.h:417
@ Http200OK
104-199 Unassigned
Definition: HttpLayer.h:292
@ Http431RequestHeaderFieldsTooLarge
Definition: HttpLayer.h:395
@ Http405MethodNotAllowed
405 Method Not Allowed
Definition: HttpLayer.h:345
@ Http449RetryWith
Definition: HttpLayer.h:404
@ Http506VariantAlsoNegotiates
506 Variant Also Negotiates
Definition: HttpLayer.h:436
@ Http503ServiceUnavailable
503 Service Unavailable
Definition: HttpLayer.h:430
@ Http102Processing
102 Processing
Definition: HttpLayer.h:286
@ HttpStatus1xxCodeUnknown
Unknown status code.
Definition: HttpLayer.h:466
@ Http521WebServerIsDown
521 Web server is down
Definition: HttpLayer.h:451
@ Http415UnsupportedMediaType
415 Unsupported Media Type
Definition: HttpLayer.h:365
@ Http504GatewayTimeout
504 Gateway Timeout
Definition: HttpLayer.h:432
@ Http412PreconditionFailed
412 Precondition Failed
Definition: HttpLayer.h:359
@ Http417ExpectationFailed
417 Expectation Failed
Definition: HttpLayer.h:369
@ Http428PreconditionRequired
Definition: HttpLayer.h:390
@ Http303SeeOther
303 See Other
Definition: HttpLayer.h:321
@ Http307TemporaryRedirect
307 Temporary Redirect
Definition: HttpLayer.h:329
@ Http424FailedDependency
424 Failed Dependency
Definition: HttpLayer.h:383
@ Http422UnprocessableEntity
422 Unprocessable Entity
Definition: HttpLayer.h:379
@ Http423Locked
423 Locked
Definition: HttpLayer.h:381
@ Http208AlreadyReported
208 Already Reported
Definition: HttpLayer.h:308
HttpResponseStatusCode(Value statusCode)
Construct HttpResponseStatusCode from Value enum.
Definition: HttpLayer.h:480
Definition: Layer.h:117
Definition: Serializers.h:230
Definition: Packet.h:49
Definition: TextBasedProtocol.h:105
uint8_t ProtocolType
Definition: ProtocolType.h:38
The main namespace for the PcapPlusPlus lib.
Definition: AssertionUtils.h:19
OsiModelLayer
An enum representing OSI model layers.
Definition: ProtocolType.h:430
@ PCPP_DEPRECATED
Deprecated typo, use OsiModelSessionLayer instead.
Definition: ProtocolType.h:442
@ OsiModelApplicationLayer
Application layer (layer 7)
Definition: ProtocolType.h:446
HttpVersion
An enum for HTTP version.
Definition: HttpLayer.h:16
@ HttpVersionUnknown
Unknown HTTP version.
Definition: HttpLayer.h:24
@ ZeroDotNine
HTTP/0.9.
Definition: HttpLayer.h:18
@ OneDotZero
HTTP/1.0.
Definition: HttpLayer.h:20
@ OneDotOne
HTTP/1.1.
Definition: HttpLayer.h:22
Definition: Serializers.h:18
Fields describing one element of the HeaderFields array of HttpRequestLayer and HttpResponseLayer.
Definition: HttpLayer.h:100
static const FieldDescriptor Value
Header field value, as a string.
Definition: HttpLayer.h:113
static std::vector< FieldDescriptor > all()
Definition: HttpLayer.h:104
static const FieldDescriptor Name
Header field name, as a string.
Definition: HttpLayer.h:110
Fields shared by HttpRequestLayer and HttpResponseLayer. They're written after the first line fields,...
Definition: HttpLayer.h:96
static const FieldDescriptor HeaderFields
Field descriptor for the array of HTTP header fields, in the order they appear in the message....
Definition: HttpLayer.h:122
static const FieldDescriptor HeaderComplete
Field descriptor for whether the HTTP header is complete (i.e. ends with an empty line) or is partial...
Definition: HttpLayer.h:118
Fields written by HttpRequestLayer's serializeLayer(), in addition to HttpMessage::SerializedFields.
Definition: HttpLayer.h:242
static const FieldDescriptor Method
Field descriptor for the HTTP method, written as a string (for example "GET"), or "Unknown" if the me...
Definition: HttpLayer.h:254
static const FieldDescriptor Version
Field descriptor for the HTTP version, written as a string (for example "HTTP/1.1"),...
Definition: HttpLayer.h:261
static const FieldDescriptor Uri
Field descriptor for the request URI, written as a string.
Definition: HttpLayer.h:257
static std::vector< FieldDescriptor > all()
Definition: HttpLayer.h:244
Fields written by HttpResponseLayer's serializeLayer(), in addition to HttpMessage::SerializedFields.
Definition: HttpLayer.h:621
static const FieldDescriptor StatusCodeDescription
Field descriptor for the status code string, written as a string (see HttpResponseFirstLine::getStatu...
Definition: HttpLayer.h:642
static const FieldDescriptor Version
Field descriptor for the HTTP version, written as a string (for example "HTTP/1.1"),...
Definition: HttpLayer.h:634
static const FieldDescriptor StatusCode
Field descriptor for the status code, written as a number (for example 200).
Definition: HttpLayer.h:637
static std::vector< FieldDescriptor > all()
Definition: HttpLayer.h:623
Definition: Layer.h:212
static std::vector< FieldDescriptor > all()
Definition: Layer.h:214
Definition: Serializers.h:49
ObjectFieldDescriptor(uint16_t fieldId, std::string fieldName)
Definition: Serializers.h:53