1sip_is_sip_uri(3SISPe)ssion Initiation Protocol Library Functisoinps_is_sip_uri(3SIP)
2
3
4
6 sip_is_sip_uri, sip_get_uri_scheme, sip_get_uri_host, sip_get_uri_user,
7 sip_get_uri_password, sip_get_uri_port, sip_get_uri_params,
8 sip_get_uri_headers, sip_get_uri_opaque, sip_get_uri_query,
9 sip_get_uri_path, sip_get_uri_regname, sip_is_uri_teluser,
10 sip_get_uri_errflags, sip_uri_errflags_to_str - get URI related
11 attributes
12
14 cc [ flag ... ] file ... -lsip [ library ... ]
15 #include <sip.h>
16
17 boolean_t sip_is_sip_uri(const struct sip_uri *sip_uri);
18
19
20 const sip_str_t *sip_get_uri_scheme(const struct sip_uri *sip_uri,
21 int *error);
22
23
24 const sip_str_t *sip_get_uri_user(const struct sip_uri *sip_uri,
25 int *error);
26
27
28 const sip_str_t *sip_get_uri_password(const struct sip_uri *sip_uri,
29 int *error);
30
31
32 const sip_str_t *sip_get_uri_host(const struct sip_uri *sip_uri,
33 int *error);
34
35
36 int sip_get_uri_port(const struct sip_uri *sip_uri,
37 int *error);
38
39
40 const sip_param_t *sip_get_uri_params(const struct sip_uri *sip_uri,
41 int *error);
42
43
44 const sip_str_t *sip_get_uri_headers(const struct sip_uri *sip_uri,
45 int *error);
46
47
48 const sip_str_t *sip_get_uri_opaque(const struct sip_uri *sip_uri,
49 int *error);
50
51
52 const sip_str_t *sip_get_uri_query(const struct sip_uri *sip_uri,
53 int *error);
54
55
56 const sip_str_t *sip_get_uri_path(const struct sip_uri *sip_uri,
57 int *error);
58
59
60 const sip_str_t *sip_get_uri_regname(const struct sip_uri *sip_uri,
61 int *error);
62
63
64 boolean_t sip_is_uri_teluser(const struct sip_uri *sip_uri);
65
66
67 int sip_get_uri_errflags(const struct sip_uri *sip_uri,
68 int *error);
69
70
71 char *sip_uri_errflags_to_str(int uri_errflags);
72
73
75 For functions that return a pointer of type sip_str_t, sip_str_t is
76 supplied by:
77
78 typedef struct sip_str {
79 char *sip_str_ptr;
80 int sip_str_len;
81 }sip_str_t;
82
83
84
85 The sip_str_ptr parameter points to the start of the returned value and
86 sip_str_len supplies the length of the returned value.
87
88
89 For example, given the following request line in a SIP message input to
90 sip_get_request_uri_str():
91
92 INVITE sip:marconi@radio.org SIP/2.0
93
94
95
96 the return is a pointer to sip_str_t with the sip_str_ptr member point‐
97 ing to "s" of sip:marconi@radio.org and sip_str_len being set to 21,
98 the length of sip:marconi@radio.org.
99
100
101 The sip_is_sip_uri() function takes a parsed URI sip_uri and returns
102 B_TRUE if it is a SIP[S] URI and B_FALSE if it is not. A URI is a
103 SIP[S] URI if the scheme in the URI is either "sip" or "sips".
104
105
106 The sip_get_uri_user() function takes a parsed URI sip_uri and returns
107 the value of the "user" component, if present.
108
109
110 The sip_get_uri_password() function takes a parsed URI sip_uri and
111 returns the value of the "password" component, if present.
112
113
114 The sip_get_uri_host() function takes a parsed URI sip_uri and returns
115 the value of the "host" component, if present.
116
117
118 The sip_get_uri_port() function takes a parsed URI sip_uri and returns
119 the value of the "port" component, if present.
120
121
122 The sip_get_uri_params() function takes a parsed URI sip_uri and
123 returns the list of URI parameters, if present, from a SIP[S] URI.
124
125
126 The sip_get_uri_headers() function takes a parsed URI sip_uri and
127 returns 'headers' from a SIP[S] URI.
128
129
130 The sip_get_uri_query() function takes a parsed URI sip_uri and returns
131 the value of the 'query' component, if present.
132
133
134 The sip_get_uri_path() function takes a parsed URI sip_uri and returns
135 the value of the 'path' component, if present.
136
137
138 The sip_get_uri_regname() function takes a parsed URI sip_uri and
139 returns the value of the 'regname' component, if present.
140
141
142 The sip_is_uri_teluser() function returns B_TRUE if the user component
143 is a telephone-subscriber. Otherwise, B_FALSE is returned.
144
145
146 The sip_get_uri_errflags() function returns the error flags from a
147 parsed URI sip_uri. The returned value is a bitmask with the appropri‐
148 ate bit set when the parser, sip_parse_uri(), encounters an error. The
149 following are the possible error values that could be set:
150
151 Bit value Error Comments
152 _______________________________________________________________
153 0x00000001 SIP_URIERR_SCHEME invalid scheme
154 0x00000002 SIP_URIERR_USER invalid user name
155 0x00000004 SIP_URIERR_PASS invalid password
156 0x00000008 SIP_URIERR_HOST invalid host
157 0x00000010 SIP_URIERR_PORT invalid port number
158 0x00000020 SIP_URIERR_PARAM invalid URI parameters
159 0x00000040 SIP_URIERR_HEADER invalid URI headers
160 0x00000080 SIP_URIERR_OPAQUE invalid opaque
161 0x00000100 SIP_URIERR_QUERY invalid query
162 0x00000200 SIP_URIERR_PATH invalid path
163 0x00000400 SIP_URIERR_REGNAME invalid reg-name
164
165
166
167 The sip_uri_errflags_to_str() function takes the error flags from a
168 parsed URI sip_uri and forms a string with all the error bits that are
169 set. For example, if SIP_URIERR_PASS and SIP_URIERR_PORT are set in a
170 parsed URI sip_uri, the sip_uri_errflags_to_str() function returns a
171 string such as:
172
173 "Error(s) in PASSWORD, PORT part(s)"
174
175
176
177 The caller is responsible for freeing the returned string.
178
180 The sip_get_uri_scheme(), sip_get_uri_user(), sip_get_uri_password(),
181 sip_get_uri_host(), sip_get_uri_params(), sip_get_uri_headers(),
182 sip_get_uri_opaque(), sip_get_uri_query(), sip_get_uri_path(),
183 sip_get_uri_regname(), and sip_uri_errflags_to_str() functions return
184 the requested value on success and NULL on failure.
185
186
187 The sip_get_uri_port() function returns port from the URI or 0 if the
188 port is not present. The returned port is in host byte order.
189
190
191 The value of errno is not changed by these calls in the event of an
192 error.
193
195 If the error is non-null, the following value is set:
196
197 EINVAL The SIP header value of the SIP message is NULL or there is
198 no URI.
199
200 The input URI is null or the requested URI component is
201 invalid. The error flag is set for the requested component.
202
203 The URI parameters or headers are requested from a non-SIP[S]
204 URI; or the 'opaque', 'query', 'path', 'reg-name' components
205 are requested from a SIP[S] URI.
206
207
208
209 On success, the value of the location pointed to by error is set to 0.
210
212 See attributes(5) for descriptions of the following attributes:
213
214
215
216
217 ┌─────────────────────────────┬─────────────────────────────┐
218 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
219 ├─────────────────────────────┼─────────────────────────────┤
220 │Interface Stability │Committed │
221 ├─────────────────────────────┼─────────────────────────────┤
222 │MT-Level │MT-Safe │
223 └─────────────────────────────┴─────────────────────────────┘
224
226 libsip(3LIB)
227
228
229
230SunOS 5.11 10 Feb 2007 sip_is_sip_uri(3SIP)