Module url_param

This module handles parameters supplied in sip urls.

Introduced in: 25 Oct 2004 by Håkan Stenholm <hsten@it.su.se>

Authors: Håkan Stenholm (hsten@it.su.se).

Description

This module handles parameters supplied in sip urls. They must be unique - i.e. the same key can only occur once.

Note: keys and values are currently stored as strings but pattern matching and list:keysearch will be faster if standard values are represented as atoms (but don't turn them all into atoms - as atoms aren't GCed)

Function Index

add/2 add new entry or replace old entry in url_param.
add/3 add new entry or replace old entry in url_param.
find/2 retrive the value of Key if it is contained in Param.
remove/2 find the Key-Val pair to remove from Param.
to_list/1 returns a normalized form of the parameters Note : Val will be 'none' if this was a "name" parameter rather than "name=val" - for example 'lr'.
to_norm/1 convert a uri-parameter list to a normalized (a non case sensitive form) form Note : URL parameters may not contain quotes, and the = is literal in the RFC3261 BNF, not EQUAL (which may be surrounded with linear whitespace).
to_string/1 return a raw uri-parameter string.
to_string_list/1 return parameter data in the same format as input to to_norm/1 Note : The strings returned are either "name=val" or "name".

Function Details

add/2

add(UrlParam, Key) -> #url_param{}

add new entry or replace old entry in url_param. Key is stored in a case insensitive manner, and Value is set to 'none' - needed for parameters such as "lr" that have no value.

add/3

add(UrlParam, Key, Value) -> #url_param{}

add new entry or replace old entry in url_param. Key and Value are stored in a case insensitive manner

find/2

find(Param, Key) -> [string()] | []

retrive the value of Key if it is contained in Param

remove/2

remove(Param, Key) -> #url_param{}

find the Key-Val pair to remove from Param

to_list/1

to_list(Norm) -> [{Key, Val}]

returns a normalized form of the parameters Note : Val will be 'none' if this was a "name" parameter rather than "name=val" - for example 'lr'.

to_norm/1

to_norm(Params) -> #url_param{}

throws {error, duplicate_key}

convert a uri-parameter list to a normalized (a non case sensitive form) form Note : URL parameters may not contain quotes, and the = is literal in the RFC3261 BNF, not EQUAL (which may be surrounded with linear whitespace)

to_string/1

to_string(Norm) -> string()

returns: in the ";name=val;..." format

return a raw uri-parameter string

to_string_list/1

to_string_list(Norm) -> [string()]

return parameter data in the same format as input to to_norm/1 Note : The strings returned are either "name=val" or "name".


Generated by EDoc, Oct 17 2007, 16:48:27.