An RTSP header map.
More...
#include <compy/priv/compiler_attrs.h>
#include <compy/types/error.h>
#include <compy/types/header.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdio.h>
#include <unistd.h>
#include <slice99.h>
Go to the source code of this file.
|
|
Compy_HeaderMap | Compy_HeaderMap_empty (void) COMPY_PRIV_MUST_USE |
| | Returns an empty header map suitable for further parsing.
|
| |
| bool | Compy_HeaderMap_find (const Compy_HeaderMap *restrict self, CharSlice99 key, CharSlice99 *restrict value) COMPY_PRIV_MUST_USE |
| | Finds a value associated with key within self.
|
| |
| bool | Compy_HeaderMap_contains_key (const Compy_HeaderMap *restrict self, CharSlice99 key) COMPY_PRIV_MUST_USE |
| | Returns whether key is present in self.
|
| |
| void | Compy_HeaderMap_append (Compy_HeaderMap *restrict self, Compy_Header h) |
| | Appends a new header to a header map.
|
| |
| ssize_t | Compy_HeaderMap_serialize (const Compy_HeaderMap *restrict self, Compy_Writer w) COMPY_PRIV_MUST_USE |
| | Serialises self into w.
|
| |
| Compy_ParseResult | Compy_HeaderMap_parse (Compy_HeaderMap *restrict self, CharSlice99 input) COMPY_PRIV_MUST_USE |
| | Parses data to self.
|
| |
| bool | Compy_HeaderMap_eq (const Compy_HeaderMap *restrict lhs, const Compy_HeaderMap *restrict rhs) COMPY_PRIV_MUST_USE |
| | Tests lhs and rhs for equality.
|
| |
| bool | Compy_HeaderMap_is_full (const Compy_HeaderMap *restrict self) COMPY_PRIV_MUST_USE |
| | Tests whether self is full (no more space left for an additional header) or not.
|
| |
| int | compy_scanf_header (const Compy_HeaderMap *restrict headers, CharSlice99 key, const char *restrict fmt,...) COMPY_PRIV_MUST_USE COMPY_PRIV_GCC_ATTR(format(scanf |
| | Attempts to parse a header.
|
| |
◆ Compy_HeaderMap_from_array
| #define Compy_HeaderMap_from_array |
( |
|
... | ) |
|
◆ Compy_HeaderMap_append()
Appends a new header to a header map.
- Parameters
-
| [out] | self | The header map to modify. |
| [in] | h | The new header to be appended. |
- Precondition
self != NULL
-
!Compy_HeaderMap_is_full(self)
◆ Compy_HeaderMap_contains_key()
| bool Compy_HeaderMap_contains_key |
( |
const Compy_HeaderMap *restrict |
self, |
|
|
CharSlice99 |
key |
|
) |
| |
Returns whether key is present in self.
- Precondition
self != NULL
◆ Compy_HeaderMap_eq()
Tests lhs and rhs for equality.
- Precondition
lhs != NULL
-
rhs != NULL
◆ Compy_HeaderMap_find()
| bool Compy_HeaderMap_find |
( |
const Compy_HeaderMap *restrict |
self, |
|
|
CharSlice99 |
key, |
|
|
CharSlice99 *restrict |
value |
|
) |
| |
Finds a value associated with key within self.
If key has been found within self, this function assigns value to this key (no copying occurs) and returns true. Otherwise, returns false and value remains unchanged.
- Parameters
-
| [in] | self | The header map to be searched for key. |
| [in] | key | The key to be searched in self. |
| [out] | value | The header value to be assigned, if found. If NULL, no assignment is performed. |
- Precondition
self != NULL
◆ Compy_HeaderMap_is_full()
Tests whether self is full (no more space left for an additional header) or not.
- Returns
true if self is full, false otherwise.
- Precondition
self != NULL
◆ Compy_HeaderMap_parse()
| Compy_ParseResult Compy_HeaderMap_parse |
( |
Compy_HeaderMap *restrict |
self, |
|
|
CharSlice99 |
input |
|
) |
| |
Parses data to self.
- Precondition
self != NULL
◆ Compy_HeaderMap_serialize()
| ssize_t Compy_HeaderMap_serialize |
( |
const Compy_HeaderMap *restrict |
self, |
|
|
Compy_Writer |
w |
|
) |
| |
Serialises self into w.
- Parameters
-
| [in] | self | The instance to be serialised. |
| [in] | w | The writer to be provided with serialised data. |
- Returns
- The number of bytes written or a negative value on error.
- Precondition
self != NULL
-
w.self && w.vptr
◆ compy_scanf_header()
| int compy_scanf_header |
( |
const Compy_HeaderMap *restrict |
headers, |
|
|
CharSlice99 |
key, |
|
|
const char *restrict |
fmt, |
|
|
|
... |
|
) |
| |
Attempts to parse a header.
- Parameters
-
| [in] | headers | The header map to search key in. |
| [in] | key | The header key to search for. |
| [in] | fmt | The scanf-like format string. |
- Returns
- The number of scanned parameters or -1 if
key is not found.
- Precondition
headers != NULL
-
fmt != NULL