reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
resip::SipMessage::KnownHeaders Class Reference

List of known SIP headers, searchable by header type. More...

#include <SipMessage.hxx>

Classes

class  HeaderInfo
 Publicly accessible information about a header. More...
 
class  OrderedView
 Ordered view over headers. The headers are produced in the order of Headers::Type enum values. More...
 

Public Types

using iterator = UsedIterator< TypedHeaders::iterator >
 
using const_iterator = UsedIterator< TypedHeaders::const_iterator >
 
using value_type = TypedHeaders::value_type
 
using reference = TypedHeaders::reference
 
using const_reference = TypedHeaders::const_reference
 
using pointer = TypedHeaders::pointer
 
using const_pointer = TypedHeaders::const_pointer
 
using size_type = TypedHeaders::size_type
 
using difference_type = TypedHeaders::difference_type
 
using allocator_type = TypedHeaders::allocator_type
 

Public Member Functions

 KnownHeaders () noexcept
 
 KnownHeaders (const allocator_type &alloc) noexcept(std::is_nothrow_constructible< TypedHeaders, const allocator_type & >::value)
 
 KnownHeaders (const KnownHeaders &)=delete
 
KnownHeaders & operator= (const KnownHeaders &)=delete
 
bool empty () const noexcept
 Returns true if the container is empty. Does not consider "unused" elements.
 
size_type size () const noexcept
 Returns the number of elements in the container. Does not consider "unused" elements.
 
void clear () noexcept
 Clears the container. Does not free HeaderFieldValueList objects but clears them and marks as "unused".
 
template<typename Disposer >
void clearAndDispose (Disposer &&disposer) noexcept
 Clears the container and invokes the dispose function on every element.
 
const_iterator cbegin () const noexcept
 Iterator access.
 
const_iterator cend () const noexcept
 
const_iterator begin () const noexcept
 
const_iterator end () const noexcept
 
iterator begin () noexcept
 
iterator end () noexcept
 
void reserve (size_type capacity)
 Reserves internal storage for the given number of entries.
 
size_type capacity () const noexcept
 Returns capacity of the internal storage.
 
iterator find (Headers::Type type) noexcept
 Finds header information, if present in the list. Returns end() if not found. Does not produce "unused" entries.
 
const_iterator find (Headers::Type type) const noexcept
 
void erase (iterator it) noexcept
 Erases an element. Does not free the HeaderFieldValueList object but clears it and marks as "unused".
 
template<typename ValuesFactory >
iterator insert (Headers::Type type, ValuesFactory &&valuesFactory)
 Constructs or reuses a previously erased element for a given header type.
 
OrderedView ordered () const noexcept
 Returns an ordered view over the list of headers.
 

Friends

class OrderedView::Iterator
 

Detailed Description

List of known SIP headers, searchable by header type.

This container provides access to headers of the SIP message that are known to libresiprocate. The headers can be searched by Headers::Type enum values and iterated over. The list of headers is unordered, and any modifications of the container may invalidate iterators, pointers and references into the container. The container does not own the HeaderFieldValueList objects, which must be explicitly freed on removal (which is handled by SipMessage).

Elements of the container can be in an "unused" state, which is when the element was removed but not disposed of. "Unused" elements do not participate in the publicly visible set of elements observed by users (e.g. they are not found by searching or exposed during iteration). "Unused" elements can be reused if the user attempts to insert an element with the matching header type. After that, the reused element becomes publicly accessible again.

The container can produce a read-only ordered view over its elements. When iterating over the view elements, headers are ordered by their types, i.e. Headers::Type enum values. The view does not expose "unused" elements. The view does not own or manage container elements and is invalidated on the parent container modifications.

Note
Ordering headers facilitates deterministic SIP message serialization. See the comment in HeaderTypes.hxx: "The Type enum controls the order of output of the headers in the encoded SipMessage". The leading entries of that enum follow the recommendation in RFC 3261 section 7.3.1, that headers needed for proxy processing appear towards the top of the message to facilitate rapid parsing.

Definition at line 210 of file SipMessage.hxx.

Member Typedef Documentation

◆ allocator_type

using resip::SipMessage::KnownHeaders::allocator_type = TypedHeaders::allocator_type

Definition at line 346 of file SipMessage.hxx.

◆ const_iterator

using resip::SipMessage::KnownHeaders::const_iterator = UsedIterator<TypedHeaders::const_iterator>

Definition at line 338 of file SipMessage.hxx.

◆ const_pointer

using resip::SipMessage::KnownHeaders::const_pointer = TypedHeaders::const_pointer

Definition at line 343 of file SipMessage.hxx.

◆ const_reference

using resip::SipMessage::KnownHeaders::const_reference = TypedHeaders::const_reference

Definition at line 341 of file SipMessage.hxx.

◆ difference_type

using resip::SipMessage::KnownHeaders::difference_type = TypedHeaders::difference_type

Definition at line 345 of file SipMessage.hxx.

◆ iterator

using resip::SipMessage::KnownHeaders::iterator = UsedIterator<TypedHeaders::iterator>

Definition at line 337 of file SipMessage.hxx.

◆ pointer

using resip::SipMessage::KnownHeaders::pointer = TypedHeaders::pointer

Definition at line 342 of file SipMessage.hxx.

◆ reference

using resip::SipMessage::KnownHeaders::reference = TypedHeaders::reference

Definition at line 340 of file SipMessage.hxx.

◆ size_type

using resip::SipMessage::KnownHeaders::size_type = TypedHeaders::size_type

Definition at line 344 of file SipMessage.hxx.

◆ value_type

using resip::SipMessage::KnownHeaders::value_type = TypedHeaders::value_type

Definition at line 339 of file SipMessage.hxx.

Constructor & Destructor Documentation

◆ KnownHeaders() [1/3]

resip::SipMessage::KnownHeaders::KnownHeaders ( )
inlinenoexcept

Definition at line 562 of file SipMessage.hxx.

◆ KnownHeaders() [2/3]

resip::SipMessage::KnownHeaders::KnownHeaders ( const allocator_type &  alloc)
inlineexplicitnoexcept

Definition at line 563 of file SipMessage.hxx.

◆ KnownHeaders() [3/3]

resip::SipMessage::KnownHeaders::KnownHeaders ( const KnownHeaders &  )
delete

Member Function Documentation

◆ begin() [1/2]

const_iterator resip::SipMessage::KnownHeaders::begin ( ) const
inlinenoexcept

Definition at line 594 of file SipMessage.hxx.

◆ begin() [2/2]

iterator resip::SipMessage::KnownHeaders::begin ( )
inlinenoexcept

Definition at line 597 of file SipMessage.hxx.

◆ capacity()

size_type resip::SipMessage::KnownHeaders::capacity ( ) const
inlinenoexcept

Returns capacity of the internal storage.

Definition at line 603 of file SipMessage.hxx.

◆ cbegin()

const_iterator resip::SipMessage::KnownHeaders::cbegin ( ) const
inlinenoexcept

Iterator access.

Definition at line 591 of file SipMessage.hxx.

◆ cend()

const_iterator resip::SipMessage::KnownHeaders::cend ( ) const
inlinenoexcept

Definition at line 592 of file SipMessage.hxx.

◆ clear()

void SipMessage::KnownHeaders::clear ( )
noexcept

Clears the container. Does not free HeaderFieldValueList objects but clears them and marks as "unused".

Definition at line 30 of file SipMessage.cxx.

◆ clearAndDispose()

template<typename Disposer >
void SipMessage::KnownHeaders::clearAndDispose ( Disposer &&  disposer)
inlinenoexcept

Clears the container and invokes the dispose function on every element.

The disposer function will be called on all entries, including "unused" ones. It is expected to free any resources associated with the entry and must not throw.

Definition at line 55 of file SipMessage.cxx.

◆ empty()

bool resip::SipMessage::KnownHeaders::empty ( ) const
inlinenoexcept

Returns true if the container is empty. Does not consider "unused" elements.

Definition at line 576 of file SipMessage.hxx.

◆ end() [1/2]

const_iterator resip::SipMessage::KnownHeaders::end ( ) const
inlinenoexcept

Definition at line 595 of file SipMessage.hxx.

◆ end() [2/2]

iterator resip::SipMessage::KnownHeaders::end ( )
inlinenoexcept

Definition at line 598 of file SipMessage.hxx.

◆ erase()

void SipMessage::KnownHeaders::erase ( iterator  it)
noexcept

Erases an element. Does not free the HeaderFieldValueList object but clears it and marks as "unused".

Definition at line 69 of file SipMessage.cxx.

◆ find() [1/2]

const_iterator resip::SipMessage::KnownHeaders::find ( Headers::Type  type) const
inlinenoexcept

Definition at line 607 of file SipMessage.hxx.

◆ find() [2/2]

SipMessage::KnownHeaders::iterator SipMessage::KnownHeaders::find ( Headers::Type  type)
noexcept

Finds header information, if present in the list. Returns end() if not found. Does not produce "unused" entries.

Definition at line 138 of file SipMessage.cxx.

◆ insert()

template<typename ValuesFactory >
SipMessage::KnownHeaders::iterator SipMessage::KnownHeaders::insert ( Headers::Type  type,
ValuesFactory &&  valuesFactory 
)
inline

Constructs or reuses a previously erased element for a given header type.

If the header with the given type was previously erased and is in the "unused" state, this call reuses this element. Otherwise, the call constructs a new element with the given header type and a pointer to the HeaderFieldValueList object returned by the valuesFactory() function call.

Returns
An iterator to the inserted element.

Definition at line 88 of file SipMessage.cxx.

◆ operator=()

KnownHeaders & resip::SipMessage::KnownHeaders::operator= ( const KnownHeaders &  )
delete

◆ ordered()

OrderedView resip::SipMessage::KnownHeaders::ordered ( ) const
inlinenoexcept

Returns an ordered view over the list of headers.

Definition at line 625 of file SipMessage.hxx.

◆ reserve()

void resip::SipMessage::KnownHeaders::reserve ( size_type  capacity)
inline

Reserves internal storage for the given number of entries.

Definition at line 601 of file SipMessage.hxx.

◆ size()

size_type resip::SipMessage::KnownHeaders::size ( ) const
inlinenoexcept

Returns the number of elements in the container. Does not consider "unused" elements.

Definition at line 578 of file SipMessage.hxx.

Friends And Related Symbol Documentation

◆ OrderedView::Iterator

friend class OrderedView::Iterator
friend

Definition at line 549 of file SipMessage.hxx.


The documentation for this class was generated from the following files: