Module sipparse_util

Function Index

is_IPv4address/1 parse host string, throw an exception if it doesn't conform to the format specified in RFC3261 chapter 25.1 page 218.
is_IPv6reference/1 parse host string, throw an exception if it doesn't conform to the format specified in RFC3261 chapter 25.1 page 218.
is_alpha/1 Check if Char is alphanumeric.
is_alphanum/1 Check if Char is alphanumeric or a digit.
is_digit/1 Check if Char is a digit.
is_hostname/1 parse host string, throw an exception if it doesn't conform to the format specified in RFC3261 chapter 25.1 p218.
is_qval/1 parse a qvalue string qvalue = ( "0" [ "." 0*3DIGIT ] ) / ( "1" [ "." 0*3("0") ] ) - RFC 3261.
is_token/1 Check if Str is a 'token'.
parse_host/1 return Host if it is wellformed, a exception is thrown if the Host is malformed the host rule alows for a varity of formats: hostname ipv4address ipv6reference.
parse_hostport/1 splits the string into it's two parts, a exception is thrown if the Host or Port is malformed the host:port section of the sip url can be formated in a varity of ways: hostname:port hostname ipv4address:port ipv4address [ipv6reference]:port ipv6reference.
split_fields/2 split FieldStr into two parts where Sep is encountered Example, if Sep = @ then: "foo@bar" = {"foo", "bar"} "foo" = {"foo"} "foo@" = throw() "@bar" = throw() "foo@bar" = throw() "@" = throw() "" = {""} XXX is this ok ? nothing currently depends on this behaviour..
split_non_quoted/2 Split In using Delim as delimeter, but don't split on delimeters inside quotes.
split_quoted_string/1 Parse out a quoted string from In and return the quoted part as First and the rest as Second.
str_to_float/1 convert Str containing float() or integer() value, to a float().
str_to_qval/1 parse a qvalue string qvalue = ( "0" [ "." 0*3DIGIT ] ) / ( "1" [ "." 0*3("0") ] ) - RFC 3261.
strip/3 works like string:strip/3 but can strip several types of char() at once.

Function Details

is_IPv4address/1

is_IPv4address(Host::Str) -> Str

parse host string, throw an exception if it doesn't conform to the format specified in RFC3261 chapter 25.1 page 218. Note : this function only matches IPv4 hostnames

is_IPv6reference/1

is_IPv6reference(IPv6Str) -> true | false

parse host string, throw an exception if it doesn't conform to the format specified in RFC3261 chapter 25.1 page 218. Note : this function only matches IPv6 hostnames

is_alpha/1

is_alpha(Char) -> true | false

Check if Char is alphanumeric. Based on RFC3261 BNF, chapter 25.

is_alphanum/1

is_alphanum(Char) -> true | false

Check if Char is alphanumeric or a digit. Based on RFC3261 BNF, chapter 25.

is_digit/1

is_digit(Char) -> true | false

Check if Char is a digit. Based on RFC3261 BNF, chapter 25.

is_hostname/1

is_hostname(Host::Str) -> true

parse host string, throw an exception if it doesn't conform to the format specified in RFC3261 chapter 25.1 p218. Fails hard (with a badmatch or error 'invalid_hostname' on errors). Note : this function only matches symbolic hostnames These rules are the same: is_digit = [0-9] is_alpha = [A-Za-z] is_alphanum = [A-Za-z0-9]

is_qval/1

is_qval(Str) -> true | false

parse a qvalue string qvalue = ( "0" [ "." 0*3DIGIT ] ) / ( "1" [ "." 0*3("0") ] ) - RFC 3261

is_token/1

is_token(Str) -> true | false

Check if Str is a 'token'. Based on RFC3261 BNF, chapter 25.

parse_host/1

parse_host(Host) -> Host

throws {error, Reason} | {'EXIT', Reason}

return Host if it is wellformed, a exception is thrown if the Host is malformed the host rule alows for a varity of formats: hostname ipv4address ipv6reference

parse_hostport/1

parse_hostport(HostPort) -> {Host, Port}

throws {error, Reason} | {'EXIT', Reason}

splits the string into it's two parts, a exception is thrown if the Host or Port is malformed the host:port section of the sip url can be formated in a varity of ways: hostname:port hostname ipv4address:port ipv4address [ipv6reference]:port ipv6reference

split_fields/2

split_fields(FieldStr, Sep) -> {First, Second} | {First}

throws {error, Reason}

split FieldStr into two parts where Sep is encountered Example, if Sep = @ then: "foo@bar" = {"foo", "bar"} "foo" = {"foo"} "foo@" = throw() "@bar" = throw() "foo@bar" = throw() "@" = throw() "" = {""} XXX is this ok ? nothing currently depends on this behaviour.

split_non_quoted/2

split_non_quoted(Delim, In) -> {ok, Result} | {error, Reason}

Split In using Delim as delimeter, but don't split on delimeters inside quotes.

split_quoted_string/1

split_quoted_string(Rest::In) -> {ok, First, Second}

Parse out a quoted string from In and return the quoted part as First and the rest as Second.

str_to_float/1

str_to_float(Str) -> float()

throws {error, string_not_float_or_integer}

convert Str containing float() or integer() value, to a float(). Note : user need to strip any preceding or trailing spaces (or other chars themselves) XXX q_value(...) in contact.erl uses similar code XXX this should be in a utility module

str_to_qval/1

str_to_qval(R::Str) -> float()

throws {error, malformed_beging_of_qvalue} | {error, wrong_number_of_chars_in_q_value} | {error, q_value_out_of_range}

parse a qvalue string qvalue = ( "0" [ "." 0*3DIGIT ] ) / ( "1" [ "." 0*3("0") ] ) - RFC 3261

strip/3

strip(Str, X2::Direction, StripChars) -> NewString

works like string:strip/3 but can strip several types of char() at once


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