SmolRTSP  0.1.3
A small, portable, extensible RTSP 1.0 implementation in C99
error.h File Reference

Possible parsing errors. More...

#include <smolrtsp/writer.h>
#include <stdbool.h>
#include <stddef.h>
#include <datatype99.h>
#include <slice99.h>
#include <smolrtsp/priv/compiler_attrs.h>
Include dependency graph for error.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Enumerations

enum  SmolRTSP_ParseType { SmolRTSP_ParseType_Int , SmolRTSP_ParseType_Ident , SmolRTSP_ParseType_HeaderName }
 Types of data that can be failed to parse. More...
 

Functions

const char * SmolRTSP_ParseType_str (SmolRTSP_ParseType self) SMOLRTSP_PRIV_MUST_USE
 Returns a string representation of self.
 
 datatype99 (SmolRTSP_ParseError,(SmolRTSP_ParseError_ContentLength, CharSlice99),(SmolRTSP_ParseError_StrMismatch, CharSlice99, CharSlice99),(SmolRTSP_ParseError_TypeMismatch, SmolRTSP_ParseType, CharSlice99),(SmolRTSP_ParseError_HeaderMapOverflow),(SmolRTSP_ParseError_MissingCSeq),(SmolRTSP_ParseError_InvalidCSeq, CharSlice99))
 An error that might occur during parsing. More...
 
int SmolRTSP_ParseError_print (SmolRTSP_ParseError self, SmolRTSP_Writer w) SMOLRTSP_PRIV_MUST_USE
 Prints self into w. More...
 
 datatype99 (SmolRTSP_ParseStatus,(SmolRTSP_ParseStatus_Complete, size_t),(SmolRTSP_ParseStatus_Partial))
 A status of successful parsing. More...
 
bool SmolRTSP_ParseStatus_is_complete (SmolRTSP_ParseStatus self) SMOLRTSP_PRIV_MUST_USE
 Returns whether self is complete.
 
bool SmolRTSP_ParseStatus_is_partial (SmolRTSP_ParseStatus self) SMOLRTSP_PRIV_MUST_USE
 Returns whether self is partial.
 
 datatype99 (SmolRTSP_ParseResult,(SmolRTSP_ParseResult_Success, SmolRTSP_ParseStatus),(SmolRTSP_ParseResult_Failure, SmolRTSP_ParseError))
 A result of parsing (either success or failure). More...
 
SmolRTSP_ParseResult SmolRTSP_ParseResult_partial (void) SMOLRTSP_PRIV_MUST_USE
 Creates a successful and partial parse result.
 
SmolRTSP_ParseResult SmolRTSP_ParseResult_complete (size_t offset) SMOLRTSP_PRIV_MUST_USE
 Creates a successful and complete parse result with the byte offset offset (from the beginning of input).
 
bool SmolRTSP_ParseResult_is_success (SmolRTSP_ParseResult self) SMOLRTSP_PRIV_MUST_USE
 Returns whether self is successful.
 
bool SmolRTSP_ParseResult_is_failure (SmolRTSP_ParseResult self) SMOLRTSP_PRIV_MUST_USE
 Returns whether self is a failure.
 
bool SmolRTSP_ParseResult_is_partial (SmolRTSP_ParseResult self) SMOLRTSP_PRIV_MUST_USE
 Returns whether self is both successful and partial.
 
bool SmolRTSP_ParseResult_is_complete (SmolRTSP_ParseResult self) SMOLRTSP_PRIV_MUST_USE
 The same as SmolRTSP_ParseResult_is_partial but for a complete result.
 

Detailed Description

Possible parsing errors.

Enumeration Type Documentation

◆ SmolRTSP_ParseType

Types of data that can be failed to parse.

Enumerator
SmolRTSP_ParseType_Int 

An integer (-34, 0, 123).

SmolRTSP_ParseType_Ident 

An identifier (abc).

SmolRTSP_ParseType_HeaderName 

A header name (Content-Length, Authorization).

Function Documentation

◆ datatype99() [1/3]

datatype99 ( SmolRTSP_ParseError  ,
(SmolRTSP_ParseError_ContentLength, CharSlice99)  ,
(SmolRTSP_ParseError_StrMismatch, CharSlice99, CharSlice99)  ,
(SmolRTSP_ParseError_TypeMismatch, SmolRTSP_ParseType, CharSlice99)  ,
(SmolRTSP_ParseError_HeaderMapOverflow)  ,
(SmolRTSP_ParseError_MissingCSeq)  ,
(SmolRTSP_ParseError_InvalidCSeq, CharSlice99)   
)

An error that might occur during parsing.

Variants

  • ContentLength – An invalid value of the Content-Length header was specified. Arguments:
    1. The value of this header.
  • StrMismatch – Two given strings are uneqal. Arguments:
    1. Expected string.
    2. Actual string.
  • TypeMismatch – Failed to parse an item. Arguments:
    1. A type of item failed to parse.
    2. The erroneous string.
  • HeaderMapOverflow – An attempt to add a header to a full header map.
  • MissingCSeq – Missing the CSeq header.
  • InvalidCSeq – Failed to parse the CSeq header.

See Datatype99 for the macro usage.

◆ datatype99() [2/3]

datatype99 ( SmolRTSP_ParseResult  ,
(SmolRTSP_ParseResult_Success, SmolRTSP_ParseStatus)  ,
(SmolRTSP_ParseResult_Failure, SmolRTSP_ParseError)   
)

A result of parsing (either success or failure).

See Datatype99 for the macro usage.

◆ datatype99() [3/3]

datatype99 ( SmolRTSP_ParseStatus  ,
(SmolRTSP_ParseStatus_Complete, size_t)  ,
(SmolRTSP_ParseStatus_Partial)   
)

A status of successful parsing.

Variants

  • Complete – The parsing has completed. Arguments:
    1. A number of consumed bytes from the beginning of input.
  • Partial – Need more data to continue parsing.

See Datatype99 for the macro usage.

◆ SmolRTSP_ParseError_print()

int SmolRTSP_ParseError_print ( SmolRTSP_ParseError  self,
SmolRTSP_Writer  w 
)

Prints self into w.

Parameters
[in]selfThe error to print.
[in]wThe writer to be provided with data.
Returns
The number of bytes written or a negative value on error.
Precondition
w.self && w.vptr