Skip to content

API Reference Overview

sip2json C++20 Reference
Generated from intermediate Doxygen XML

The siddiqsoft namespace provides data structures, stream parsing utilities, diagnostic error definitions, and serialization functions for SIP and SDP protocols.

Namespaces

siddiqsoft
Core namespace containing the parser, message DTO, and protocol constants.

Classes & Structures

class siddiqsoft::sip2json
Static utility class for streaming, parsing, and serializing SIP and SDP messages.
class siddiqsoft::sipmessage
Primary message DTO inheriting nlohmann::json. Represents request and response packets.
class siddiqsoft::sip2json_exception
Base exception class for parse syntax, framing, and serialization failures.
class siddiqsoft::HeaderKeySet
Canonical header metadata and compact alias mapping descriptor.

Enumerations & Constants

constants Protocol & Header Constants
Complete dictionary of methods, JSON section keys, delimiters, and canonical headers.
enum class siddiqsoft::sip2jsonErrors
Diagnostic error classification passed to parseAsync error callbacks.
enum class siddiqsoft::SIPMessageType
Discriminator distinguishing request (1) from response (2) messages.

Header Files

Header File Include Path Description
sip2json.hpp #include <siddiqsoft/sip2json.hpp> Primary parser and serializer engine entry point.
sipmessage.hpp #include <siddiqsoft/sipmessage.hpp> Complete sipmessage container and field accessors.
sip2json_constants.hpp #include <siddiqsoft/private/sip2json_constants.hpp> Method names, URI schemes, and delimiters. View Constants
sip2json_header_keys.hpp #include <siddiqsoft/private/sip2json_header_keys.hpp> Hash table dispatch and canonical header representations. View Constants
sip2json_exception.hpp #include <siddiqsoft/private/sip2json_exception.hpp> sip2jsonErrors enumeration and derived exception types.
sip2json_sdp.hpp #include <siddiqsoft/private/sip2json_sdp.hpp> SDP line parser and serialization engine.

System UML Class Diagram

The following UML class diagram illustrates the primary classes, relationships, and exception hierarchy in sip2json. Each node links directly to its source header file on GitHub:

classDiagram
    direction TB

    classDef coreClass fill:rgba(35,73,109,0.08),stroke:#23496d,stroke-width:2px;
    classDef utilityClass fill:rgba(15,118,110,0.08),stroke:#0f766e,stroke-width:2px;
    classDef exceptionClass fill:rgba(185,28,28,0.06),stroke:#b91c1c,stroke-width:1.5px;
    classDef enumClass fill:rgba(109,40,217,0.06),stroke:#6d28d9,stroke-width:1.5px;
    classDef externalClass fill:rgba(100,116,139,0.06),stroke:#64748b,stroke-width:1.5px,stroke-dasharray: 4 3;
    classDef highlightClass fill:rgba(2,132,199,0.18),stroke:#0284c7,stroke-width:3px;

    class json["nlohmann::json"] {
        <<external DOM>>
    }
    class json:::externalClass

    class runtime_error["std::runtime_error"] {
        <<external exception>>
    }
    class runtime_error:::externalClass

    class sip2json["siddiqsoft::sip2json"] {
        <<final utility>>
        +parseAsync(string_view& frameBuffer, callback parseCallback, callback errorCallback)$ size_t
        +parse(string_view& buffer)$ vector~sipmessage~
        +parseFromBuffer(string_view& buffer)$ sipmessage
        +serialize(sipmessage& sipm)$ string
    }
    class sip2json:::utilityClass

    class sipmessage["siddiqsoft::sipmessage"] {
        +sipmessage()
        +headers() auto&
        +getHeader(string& key, optional~T~ defaultValue) auto
        +hasHeader(string_view key) bool
        +setUserAgent(string& ua) auto&
        +getUserAgent() auto
        +getContentLength() uint32_t
        +getExpires() uint32_t
        +getContentTypeView() string_view
        +getContentType() string
        +getCallID() auto
        +getMethod() auto
        +getUri() auto
        +getMethodView() string_view
        +getUriView() string_view
        +getReasonView() string_view
        +getCallIDView() string_view
        +getStatusCode() auto
        +getReason() auto
        +body() auto&
        +hasBody() bool
        +getBodyElement(json_pointer& jp, T& defaultValue) T
        +isMessageRequest() bool
        +isMessageResponse() bool
        +setHeader(string& key, T& v) sipmessage&
        +setBody(json_pointer& key, T& v) sipmessage&
    }
    class sipmessage:::coreClass

    class HeaderKeySet["siddiqsoft::HeaderKeySet"] {
        +bool isCanonical
        +bool isMultiLine
        +bool isCustom
        +HeaderKeySet() constexpr
        +canonical() string&
        +lower() string&
        +alt() string&
    }
    class HeaderKeySet:::coreClass

    class SIPMessageType["siddiqsoft::SIPMessageType"] {
        <<enumeration>>
        notspecified
        request = 1
        response = 2
    }
    class SIPMessageType:::enumClass

    class sip2jsonErrors["siddiqsoft::sip2jsonErrors"] {
        <<enumeration>>
        ok = 0
        incomplete_buffer_for_parse
        incomplete_buffer_for_content
        incomplete_buffer_for_header
        invalid_startline
        unsupported_contenttype
        missing_required_element
        invalid_document
        invalid_document_unsupported_method
        invalid_document_unsupported_content
        empty_message
        unknown = 0xFFFFFFFF
    }
    class sip2jsonErrors:::enumClass

    class sip2json_exception["siddiqsoft::sip2json_exception"] {
        +sip2jsonErrors errCode
        +sip2json_exception(string& msg)
    }
    class sip2json_exception:::exceptionClass

    class empty_message_error["siddiqsoft::empty_message_error"]
    class empty_message_error:::exceptionClass
    class incomplete_buffer_for_content_error["siddiqsoft::incomplete_buffer_for_content_error"]
    class incomplete_buffer_for_content_error:::exceptionClass
    class incomplete_buffer_for_header_error["siddiqsoft::incomplete_buffer_for_header_error"]
    class incomplete_buffer_for_header_error:::exceptionClass
    class incomplete_buffer_for_parse_error["siddiqsoft::incomplete_buffer_for_parse_error"]
    class incomplete_buffer_for_parse_error:::exceptionClass
    class invalid_document_error["siddiqsoft::invalid_document_error"]
    class invalid_document_error:::exceptionClass
    class invalid_startline_error["siddiqsoft::invalid_startline_error"]
    class invalid_startline_error:::exceptionClass
    class missing_required_element["siddiqsoft::missing_required_element"]
    class missing_required_element:::exceptionClass
    class unsupported_contenttype_error["siddiqsoft::unsupported_contenttype_error"]
    class unsupported_contenttype_error:::exceptionClass

    json <|-- sipmessage : public inheritance
    runtime_error <|-- sip2json_exception : public inheritance
    sip2json_exception <|-- empty_message_error
    sip2json_exception <|-- incomplete_buffer_for_content_error
    sip2json_exception <|-- incomplete_buffer_for_header_error
    sip2json_exception <|-- incomplete_buffer_for_parse_error
    sip2json_exception <|-- invalid_document_error
    sip2json_exception <|-- invalid_startline_error
    sip2json_exception <|-- missing_required_element
    sip2json_exception <|-- unsupported_contenttype_error

    sip2json ..> sipmessage : produces / consumes
    sip2json ..> sip2json_exception : throws
    sipmessage ..> SIPMessageType : classifies
    sipmessage ..> HeaderKeySet : uses
    sip2json_exception ..> sip2jsonErrors : contains

    link sip2json "https://github.com/SiddiqSoft/sip2json/blob/master/include/siddiqsoft/sip2json.hpp" "Source: include/siddiqsoft/sip2json.hpp"
    link sipmessage "https://github.com/SiddiqSoft/sip2json/blob/master/include/siddiqsoft/sipmessage.hpp" "Source: include/siddiqsoft/sipmessage.hpp"
    link HeaderKeySet "https://github.com/SiddiqSoft/sip2json/blob/master/include/siddiqsoft/private/sip2json_header_keys.hpp" "Source: include/siddiqsoft/private/sip2json_header_keys.hpp"
    link sip2json_exception "https://github.com/SiddiqSoft/sip2json/blob/master/include/siddiqsoft/private/sip2json_exception.hpp" "Source: include/siddiqsoft/private/sip2json_exception.hpp"
    link SIPMessageType "https://github.com/SiddiqSoft/sip2json/blob/master/include/siddiqsoft/sipmessage.hpp" "Source: include/siddiqsoft/sipmessage.hpp"
    link sip2jsonErrors "https://github.com/SiddiqSoft/sip2json/blob/master/include/siddiqsoft/private/sip2json_exception.hpp" "Source: include/siddiqsoft/private/sip2json_exception.hpp"
    link empty_message_error "https://github.com/SiddiqSoft/sip2json/blob/master/include/siddiqsoft/private/sip2json_exception.hpp" "Source: include/siddiqsoft/private/sip2json_exception.hpp"
    link incomplete_buffer_for_content_error "https://github.com/SiddiqSoft/sip2json/blob/master/include/siddiqsoft/private/sip2json_exception.hpp" "Source: include/siddiqsoft/private/sip2json_exception.hpp"
    link incomplete_buffer_for_header_error "https://github.com/SiddiqSoft/sip2json/blob/master/include/siddiqsoft/private/sip2json_exception.hpp" "Source: include/siddiqsoft/private/sip2json_exception.hpp"
    link incomplete_buffer_for_parse_error "https://github.com/SiddiqSoft/sip2json/blob/master/include/siddiqsoft/private/sip2json_exception.hpp" "Source: include/siddiqsoft/private/sip2json_exception.hpp"
    link invalid_document_error "https://github.com/SiddiqSoft/sip2json/blob/master/include/siddiqsoft/private/sip2json_exception.hpp" "Source: include/siddiqsoft/private/sip2json_exception.hpp"
    link invalid_startline_error "https://github.com/SiddiqSoft/sip2json/blob/master/include/siddiqsoft/private/sip2json_exception.hpp" "Source: include/siddiqsoft/private/sip2json_exception.hpp"
    link missing_required_element "https://github.com/SiddiqSoft/sip2json/blob/master/include/siddiqsoft/private/sip2json_exception.hpp" "Source: include/siddiqsoft/private/sip2json_exception.hpp"
    link unsupported_contenttype_error "https://github.com/SiddiqSoft/sip2json/blob/master/include/siddiqsoft/private/sip2json_exception.hpp" "Source: include/siddiqsoft/private/sip2json_exception.hpp"
    link json "https://github.com/nlohmann/json" "External: nlohmann/json"
    link runtime_error "https://en.cppreference.com/w/cpp/error/runtime_error" "Standard Library: std::runtime_error"

Source Code Mapping

Component / Class Header File Source Link Purpose & Architectural Role
siddiqsoft::sip2json include/siddiqsoft/sip2json.hpp sip2json.hpp Top-level static parser, stream deserializer, and wire serializer utility
siddiqsoft::sipmessage include/siddiqsoft/sipmessage.hpp sipmessage.hpp Core message container inheriting from nlohmann::json with zero-copy view accessors
siddiqsoft::HeaderKeySet include/siddiqsoft/private/sip2json_header_keys.hpp sip2json_header_keys.hpp Canonical SIP header normalization, compact alias mapping, and compile-time hashing
siddiqsoft::SIPMessageType include/siddiqsoft/sipmessage.hpp sipmessage.hpp Protocol message discriminator (Request = 1, Response = 2)
siddiqsoft::sip2json_exception include/siddiqsoft/private/sip2json_exception.hpp sip2json_exception.hpp Base exception class inheriting from std::runtime_error with sip2jsonErrors payload
siddiqsoft::sip2jsonErrors include/siddiqsoft/private/sip2json_exception.hpp sip2json_exception.hpp Diagnostic error code enumeration for parser and syntax failures
Derived Exceptions include/siddiqsoft/private/sip2json_exception.hpp sip2json_exception.hpp Specialized exception hierarchy (invalid_document_error, empty_message_error, etc.)
Parser Engine (raw_view) include/siddiqsoft/private/sip2json_parser.hpp sip2json_parser.hpp High-throughput streaming parser, zero-copy buffer slicing, CRLF boundary scanning
Wire Serializer include/siddiqsoft/private/sip2json_serializer.hpp sip2json_serializer.hpp RFC 3261 compliant text wire serializer
SDP Body Parser include/siddiqsoft/private/sip2json_sdp.hpp sip2json_sdp.hpp RFC 4566 Session Description Protocol parser and structured JSON serialization
Response Codes include/siddiqsoft/private/sip2json_response_codes.hpp sip2json_response_codes.hpp SIP status codes, reason phrases, and classification ranges (1xx-6xx)
Protocol Constants include/siddiqsoft/private/sip2json_constants.hpp sip2json_constants.hpp SIP grammar tokens, method strings, whitespace matchers, CRLF constants
DateTime Parser include/siddiqsoft/private/sip2json_datetime.hpp sip2json_datetime.hpp RFC 3261 / RFC 1123 HTTP-date timestamp parser and serializer
Utility Functions include/siddiqsoft/private/sip2json_utils.hpp sip2json_utils.hpp Internal whitespace trimming, view slicing, string conversion utilities

Detailed Topics

Constants Reference

Full documentation of methods (METHOD_INVITE), JSON keys, delimiters, and canonical header names.

View Constants Reference

JSON Schema & SDP

JSON document structure, field types, header conversions, and SDP attribute mapping.

View Schema Reference

Code Examples

Practical integration snippets: asynchronous stream parsing, message creation, and error handling.

View Code Examples