Apache Portable Runtime Utility Library
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
apr_uri.h
Go to the documentation of this file.
1 /* Licensed to the Apache Software Foundation (ASF) under one or more
2  * contributor license agreements. See the NOTICE file distributed with
3  * this work for additional information regarding copyright ownership.
4  * The ASF licenses this file to You under the Apache License, Version 2.0
5  * (the "License"); you may not use this file except in compliance with
6  * the License. You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 /*
18  * apr_uri.h: External Interface of apr_uri.c
19  */
20 
26 #ifndef APR_URI_H
27 #define APR_URI_H
28 
29 #include "apu.h"
30 
31 #include "apr_network_io.h"
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
43 #define APR_URI_FTP_DEFAULT_PORT 21
44 #define APR_URI_SSH_DEFAULT_PORT 22
45 #define APR_URI_TELNET_DEFAULT_PORT 23
46 #define APR_URI_GOPHER_DEFAULT_PORT 70
47 #define APR_URI_HTTP_DEFAULT_PORT 80
48 #define APR_URI_POP_DEFAULT_PORT 110
49 #define APR_URI_NNTP_DEFAULT_PORT 119
50 #define APR_URI_IMAP_DEFAULT_PORT 143
51 #define APR_URI_PROSPERO_DEFAULT_PORT 191
52 #define APR_URI_WAIS_DEFAULT_PORT 210
53 #define APR_URI_LDAP_DEFAULT_PORT 389
54 #define APR_URI_HTTPS_DEFAULT_PORT 443
55 #define APR_URI_RTSP_DEFAULT_PORT 554
56 #define APR_URI_SNEWS_DEFAULT_PORT 563
57 #define APR_URI_ACAP_DEFAULT_PORT 674
58 #define APR_URI_NFS_DEFAULT_PORT 2049
59 #define APR_URI_TIP_DEFAULT_PORT 3372
60 #define APR_URI_SIP_DEFAULT_PORT 5060
64 #define APR_URI_UNP_OMITSITEPART (1U<<0)
65 
66 #define APR_URI_UNP_OMITUSER (1U<<1)
67 
68 #define APR_URI_UNP_OMITPASSWORD (1U<<2)
69 
70 #define APR_URI_UNP_OMITUSERINFO (APR_URI_UNP_OMITUSER | \
71  APR_URI_UNP_OMITPASSWORD)
72 
73 #define APR_URI_UNP_REVEALPASSWORD (1U<<3)
74 
75 #define APR_URI_UNP_OMITPATHINFO (1U<<4)
76 
77 #define APR_URI_UNP_OMITQUERY (1U<<5)
78 
80 typedef struct apr_uri_t apr_uri_t;
81 
85 struct apr_uri_t {
87  char *scheme;
89  char *hostinfo;
91  char *user;
93  char *password;
95  char *hostname;
97  char *port_str;
99  char *path;
101  char *query;
103  char *fragment;
104 
106  struct hostent *hostent;
107 
109  apr_port_t port;
110 
112  unsigned is_initialized:1;
113 
115  unsigned dns_looked_up:1;
117  unsigned dns_resolved:1;
118 };
119 
120 /* apr_uri.c */
127 APU_DECLARE(apr_port_t) apr_uri_port_of_scheme(const char *scheme_str);
128 
146 APU_DECLARE(char *) apr_uri_unparse(apr_pool_t *p,
147  const apr_uri_t *uptr,
148  unsigned flags);
149 
159 APU_DECLARE(apr_status_t) apr_uri_parse(apr_pool_t *p, const char *uri,
160  apr_uri_t *uptr);
161 
169 APU_DECLARE(apr_status_t) apr_uri_parse_hostinfo(apr_pool_t *p,
170  const char *hostinfo,
171  apr_uri_t *uptr);
172 
174 #ifdef __cplusplus
175 }
176 #endif
177 
178 #endif /* APR_URI_H */