PcapPlusPlus  23.09
pcpp::HttpResponseStatusCode Struct Reference

The enum wrapper class of HTTP response status codes. More...

#include <HttpLayer.h>

Public Types

enum  Value : int {
  Http100Continue = 100, Http101SwitchingProtocols = 101, Http102Processing = 102, Http103EarlyHints = 103,
  Http200OK = 200, Http201Created = 201, Http202Accepted = 202, Http203NonAuthoritativeInformation = 203,
  Http204NoContent = 204, Http205ResetContent = 205, Http206PartialContent = 206, Http207MultiStatus = 207,
  Http208AlreadyReported = 208, Http226IMUsed = 226, Http300MultipleChoices = 300, Http301MovedPermanently = 301,
  Http302 = 302, Http303SeeOther = 303, Http304NotModified = 304, Http305UseProxy = 305,
  Http306SwitchProxy = 306, Http307TemporaryRedirect = 307, Http308PermanentRedirect = 308, Http400BadRequest = 400,
  Http401Unauthorized = 401, Http402PaymentRequired = 402, Http403Forbidden = 403, Http404NotFound = 404,
  Http405MethodNotAllowed = 405, Http406NotAcceptable = 406, Http407ProxyAuthenticationRequired = 407, Http408RequestTimeout = 408,
  Http409Conflict = 409, Http410Gone = 410, Http411LengthRequired = 411, Http412PreconditionFailed = 412,
  Http413RequestEntityTooLarge = 413, Http414RequestURITooLong = 414, Http415UnsupportedMediaType = 415, Http416RequestedRangeNotSatisfiable = 416,
  Http417ExpectationFailed = 417, Http418ImATeapot = 418, Http419AuthenticationTimeout = 419, Http420 = 420,
  Http421MisdirectedRequest = 421, Http422UnprocessableEntity = 422, Http423Locked = 423, Http424FailedDependency = 424,
  Http425TooEarly = 425, Http426UpgradeRequired = 426, Http428PreconditionRequired = 428, Http429TooManyRequests = 429,
  Http431RequestHeaderFieldsTooLarge = 431, Http440LoginTimeout = 440, Http444NoResponse = 444, Http449RetryWith = 449,
  Http450BlockedByWindowsParentalControls = 450, Http451 = 451, Http494RequestHeaderTooLarge = 494, Http495CertError = 495,
  Http496NoCert = 496, Http497HTTPtoHTTPS = 497, Http498TokenExpiredInvalid = 498, Http499 = 499,
  Http500InternalServerError = 500, Http501NotImplemented = 501, Http502BadGateway = 502, Http503ServiceUnavailable = 503,
  Http504GatewayTimeout = 504, Http505HTTPVersionNotSupported = 505, Http506VariantAlsoNegotiates = 506, Http507InsufficientStorage = 507,
  Http508LoopDetected = 508, Http509BandwidthLimitExceeded = 509, Http510NotExtended = 510, Http511NetworkAuthenticationRequired = 511,
  Http520OriginError = 520, Http521WebServerIsDown = 521, Http522ConnectionTimedOut = 522, Http523ProxyDeclinedRequest = 523,
  Http524aTimeoutOccurred = 524, Http598NetworkReadTimeoutError = 598, Http599NetworkConnectTimeoutError = 599, HttpStatus1xxCodeUnknown = 900001
}
 Define enum types and the corresponding int values. More...
 

Public Member Functions

 HttpResponseStatusCode (Value statusCode)
 Construct HttpResponseStatusCode from Value enum. More...
 
 HttpResponseStatusCode (const int &statusCodeNumber, const std::string &statusMessage="")
 Construct HttpResponseStatusCode from the code number and the customized message. More...
 
 HttpResponseStatusCode (const Value &statusCode, const std::string &statusMessage)
 Construct HttpResponseStatusCode from Value enum and the customized message. More...
 
std::string toString () const
 get status code number as string
 
int toInt () const
 get status code number as int
 
std::string getMessage () const
 get status code message, e.g. "OK", "Not Found"
 
bool isUnsupportedCode () const
 

Detailed Description

The enum wrapper class of HTTP response status codes.

Member Enumeration Documentation

◆ Value

Define enum types and the corresponding int values.

Enumerator
Http100Continue 

100 Continue

Http101SwitchingProtocols 

101 Switching Protocols

Http102Processing 

102 Processing

Http103EarlyHints 

103 Early Hints

Http200OK 

104-199 Unassigned 200 OK

Http201Created 

201 Created

Http202Accepted 

202 Accepted

Http203NonAuthoritativeInformation 

203 Non-Authoritative Information

Http204NoContent 

204 No Content

Http205ResetContent 

205 Reset Content

Http206PartialContent 

206 Partial Content

Http207MultiStatus 

207 Multi-Status

Http208AlreadyReported 

208 Already Reported

Http226IMUsed 

209-225 Unassigned 226 IM Used

Http300MultipleChoices 

227-299 Unassigned 300 Multiple Choices

Http301MovedPermanently 

301 Moved Permanently

Http302 

302 (various messages)

Http303SeeOther 

303 See Other

Http304NotModified 

304 Not Modified

Http305UseProxy 

305 Use Proxy

Http306SwitchProxy 

306 Switch Proxy

Http307TemporaryRedirect 

307 Temporary Redirect

Http308PermanentRedirect 

308 Permanent Redirect,

Http400BadRequest 

309-399 Unassigned 400 Bad Request

Http401Unauthorized 

401 Unauthorized

Http402PaymentRequired 

402 Payment Required

Http403Forbidden 

403 Forbidden

Http404NotFound 

404 Not Found

Http405MethodNotAllowed 

405 Method Not Allowed

Http406NotAcceptable 

406 Not Acceptable

Http407ProxyAuthenticationRequired 

407 Proxy Authentication Required

Http408RequestTimeout 

408 Request Timeout

Http409Conflict 

409 Conflict

Http410Gone 

410 Gone

Http411LengthRequired 

411 Length Required

Http412PreconditionFailed 

412 Precondition Failed

Http413RequestEntityTooLarge 

413 RequestEntity Too Large

Http414RequestURITooLong 

414 Request-URI Too Long

Http415UnsupportedMediaType 

415 Unsupported Media Type

Http416RequestedRangeNotSatisfiable 

416 Requested Range Not Satisfiable

Http417ExpectationFailed 

417 Expectation Failed

Http418ImATeapot 

418 I'm a teapot

Http419AuthenticationTimeout 

419 Authentication Timeout

Http420 

420 (various messages)

Http421MisdirectedRequest 

421 Misdirected Request

Http422UnprocessableEntity 

422 Unprocessable Entity

Http423Locked 

423 Locked

Http424FailedDependency 

424 Failed Dependency

Http425TooEarly 

425 Too Early

Http426UpgradeRequired 

426 Upgrade Required

Http428PreconditionRequired 

427 Unassigned 428 Precondition Required

Http429TooManyRequests 

429 Too Many Requests

Http431RequestHeaderFieldsTooLarge 

430 Unassigned 431 Request Header Fields Too Large

Http440LoginTimeout 

432-439 unassigned 440 Login Timeout

Http444NoResponse 

441-443 unassigned 444 No Response

Http449RetryWith 

445-448 unassigned 449 Retry With

Http450BlockedByWindowsParentalControls 

450 Blocked by Windows Parental Controls

Http451 

451 (various messages)

Http494RequestHeaderTooLarge 

452-493 unassigned 494 Request Header Too Large

Http495CertError 

495 Cert Error

Http496NoCert 

496 No Cert

Http497HTTPtoHTTPS 

497 HTTP to HTTPS

Http498TokenExpiredInvalid 

498 Token expired/invalid

Http499 

499 (various messages)

Http500InternalServerError 

500 Internal Server Error

Http501NotImplemented 

501 Not Implemented

Http502BadGateway 

502 Bad Gateway

Http503ServiceUnavailable 

503 Service Unavailable

Http504GatewayTimeout 

504 Gateway Timeout

Http505HTTPVersionNotSupported 

505 HTTP Version Not Supported

Http506VariantAlsoNegotiates 

506 Variant Also Negotiates

Http507InsufficientStorage 

507 Insufficient Storage

Http508LoopDetected 

508 Loop Detected

Http509BandwidthLimitExceeded 

509 Bandwidth Limit Exceeded

Http510NotExtended 

510 Not Extended

Http511NetworkAuthenticationRequired 

511 Network Authentication Required

Http520OriginError 

512-519 unassigned 520 Origin Error

Http521WebServerIsDown 

521 Web server is down

Http522ConnectionTimedOut 

522 Connection timed out

Http523ProxyDeclinedRequest 

523 Proxy Declined Request

Http524aTimeoutOccurred 

524 A timeout occurred

Http598NetworkReadTimeoutError 

525-597 unassigned 598 Network read timeout error

Http599NetworkConnectTimeoutError 

599 Network connect timeout error

HttpStatus1xxCodeUnknown 

Unknown status code

Constructor & Destructor Documentation

◆ HttpResponseStatusCode() [1/3]

pcpp::HttpResponseStatusCode::HttpResponseStatusCode ( Value  statusCode)
inline

Construct HttpResponseStatusCode from Value enum.

Parameters
[in]statusCodethe status code enum

◆ HttpResponseStatusCode() [2/3]

pcpp::HttpResponseStatusCode::HttpResponseStatusCode ( const int &  statusCodeNumber,
const std::string &  statusMessage = "" 
)
explicit

Construct HttpResponseStatusCode from the code number and the customized message.

Parameters
[in]statusCodeNumberthe status code in number, e.g. 200, 404
[in]statusMessagethe status message, optional, leave empty to use a default message

◆ HttpResponseStatusCode() [3/3]

pcpp::HttpResponseStatusCode::HttpResponseStatusCode ( const Value statusCode,
const std::string &  statusMessage 
)
explicit

Construct HttpResponseStatusCode from Value enum and the customized message.

Parameters
[in]statusCodethe status code enum
[in]statusMessagethe customized status message, optional

Member Function Documentation

◆ isUnsupportedCode()

bool pcpp::HttpResponseStatusCode::isUnsupportedCode ( ) const
inline
Returns
If this HttpResponseStatusCode a valid code
Note
Any unknown or error code has an extreme large enum value