Group PJSIP_URI_GENERIC

group PJSIP_URI_GENERIC

Generic representation for all types of URI.

Defines

PJSIP_URI_SCHEME_IS_SIP(url)

This macro checks that the URL is a “sip:” URL.

Parameters
  • url – The URL (pointer to)

Returns

non-zero if TRUE.

PJSIP_URI_SCHEME_IS_SIPS(url)

This macro checks that the URL is a “sips:” URL (not SIP).

Parameters
  • url – The URL (pointer to)

Returns

non-zero if TRUE.

PJSIP_URI_SCHEME_IS_TEL(url)

This macro checks that the URL is a “tel:” URL.

Parameters
  • url – The URL (pointer to)

Returns

non-zero if TRUE.

Enums

enum pjsip_uri_context_e

URI context.

Values:

enumerator PJSIP_URI_IN_REQ_URI

The URI is in Request URI.

enumerator PJSIP_URI_IN_FROMTO_HDR

The URI is in From/To header.

enumerator PJSIP_URI_IN_CONTACT_HDR

The URI is in Contact header.

enumerator PJSIP_URI_IN_ROUTING_HDR

The URI is in Route/Record-Route header.

enumerator PJSIP_URI_IN_OTHER

Other context (web page, business card, etc.)

Functions

const pj_str_t *pjsip_uri_get_scheme(const void *uri)

Generic function to get the URI scheme.

Parameters

uri – the URI object.

Returns

the URI scheme.

void *pjsip_uri_get_uri(const void *uri)

Generic function to get the URI object contained by this URI, or the URI itself if it doesn’t contain another URI.

Parameters

uri – the URI.

Returns

the URI.

pj_status_t pjsip_uri_cmp(pjsip_uri_context_e context, const void *uri1, const void *uri2)

Generic function to compare two URIs.

Parameters
  • context – Comparison context.

  • uri1 – The first URI.

  • uri2 – The second URI.

Returns

PJ_SUCCESS if equal, or otherwise the error status which should point to the mismatch part.

int pjsip_uri_print(pjsip_uri_context_e context, const void *uri, char *buf, pj_size_t size)

Generic function to print an URI object.

Parameters
  • context – Print context.

  • uri – The URI to print.

  • buf – The buffer.

  • size – Size of the buffer.

Returns

Length printed if successful, negative value if failed.

void *pjsip_uri_clone(pj_pool_t *pool, const void *uri)

Generic function to clone an URI object.

Parameters
  • pool – Pool.

  • uri – URI to clone.

Returns

New URI.

struct pjsip_uri_vptr
#include <sip_uri.h>

URI ‘virtual’ function table. All types of URI in this library (such as sip:, sips:, tel:, and name-addr) will have pointer to this table as their first struct member. This table provides polimorphic behaviour to the URI.

Public Members

const pj_str_t *(*p_get_scheme)(const void *uri)

Get URI scheme.

Param uri

the URI (self).

Return

the URI scheme.

void *(*p_get_uri)(void *uri)

Get the URI object contained by this URI, or the URI itself if it doesn’t contain another URI.

Param uri

the URI (self).

pj_ssize_t (*p_print)(pjsip_uri_context_e context, const void *uri, char *buf, pj_size_t size)

Print URI components to the buffer, following the rule of which components are allowed for the context.

Param context

the context where the URI will be placed.

Param uri

the URI (self).

Param buf

the buffer.

Param size

the size of the buffer.

Return

the length printed.

pj_status_t (*p_compare)(pjsip_uri_context_e context, const void *uri1, const void *uri2)

Compare two URIs according to the context.

Param context

the context.

Param uri1

the first URI (self).

Param uri2

the second URI.

Return

PJ_SUCCESS if equal, or otherwise the error status which should point to the mismatch part.

void *(*p_clone)(pj_pool_t *pool, const void *uri)

Clone URI.

Param pool

the pool.

Param the

URI to clone (self).

Return

new URI.

struct pjsip_uri
#include <sip_uri.h>

The declaration of ‘base class’ for all URI scheme.

Forward declaration for URI (sip_uri.h).

Public Members

pjsip_uri_vptr *vptr

All URIs must have URI virtual function table as their first member.