tinyows 1.2.2
ows_get_capabilities.c
Go to the documentation of this file.
1/*
2 Copyright (c) <2007-2012> <Barbara Philippot - Olivier Courtin>
3
4 Permission is hereby granted, free of charge, to any person obtaining a copy
5 of this software and associated documentation files (the "Software"), to deal
6 in the Software without restriction, including without limitation the rights
7 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 copies of the Software, and to permit persons to whom the Software is
9 furnished to do so, subject to the following conditions:
10
11 The above copyright notice and this permission notice shall be included in
12 all copies or substantial portions of the Software.
13
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 IN THE SOFTWARE.
21*/
22
23
24#include <stdlib.h>
25#include <stdio.h>
26#include <assert.h>
27
28#include "ows.h"
29
30
31/*
32 * Display what distributed computing platform is supported
33 * And what entry point is for all operations
34 * Assume that online_ressource figure in the metadata
35 * Used for version 1.1.0 WFS
36 */
37void ows_get_capabilities_dcpt(const ows * o, const char * req)
38{
39 assert(o);
40 assert(o->online_resource);
41
42 fprintf(o->output, " <ows:DCP>\n");
43 fprintf(o->output, " <ows:HTTP>\n");
44 fprintf(o->output, " <ows:Get xlink:href=\"");
45 fprintf(o->output, "%s?%s\"/>\n", o->online_resource->buf, req);
46 fprintf(o->output, " </ows:HTTP>\n");
47 fprintf(o->output, " </ows:DCP>\n");
48 fprintf(o->output, " <ows:DCP>\n");
49 fprintf(o->output, " <ows:HTTP>\n");
50 fprintf(o->output, " <ows:Post xlink:href=\"");
51 fprintf(o->output, "%s\"/>\n", o->online_resource->buf);
52 fprintf(o->output, " </ows:HTTP>\n");
53 fprintf(o->output, " </ows:DCP>\n");
54}
55
56
57/*
58 * Provides information about the service itself
59 * Assume that online_ressource, name and title figure in the metadata
60 * Used for version 1.0.0 de WFS GetCapabilities
61 */
63{
64 list_node *ln;
65
66 assert(o);
67 assert(o->online_resource);
68 assert(o->metadata->name);
69 assert(o->metadata->title);
70
71 ln = NULL;
72
73 fprintf(o->output, " <Service>\n");
74 fprintf(o->output, " <Name>%s</Name>\n", o->metadata->name->buf);
75 fprintf(o->output, " <Title>%s</Title>\n", o->metadata->title->buf);
76
77 if (o->metadata->abstract)
78 fprintf(o->output, " <Abstract>%s</Abstract>\n", o->metadata->abstract->buf);
79
80 if (o->metadata->keywords) {
81 fprintf(o->output, " <Keywords>");
82
83 for (ln = o->metadata->keywords->first ; ln->next; ln = ln->next)
84 fprintf(o->output, "%s,", ln->value->buf);
85
86 fprintf(o->output, "%s</Keywords>\n", ln->value->buf);
87 }
88
89 fprintf(o->output, " <OnlineResource>%s</OnlineResource>\n", o->online_resource->buf);
90
91 if (o->metadata->fees)
92 fprintf(o->output, " <Fees>%s</Fees>\n", o->metadata->fees->buf);
93
95 fprintf(o->output,
96 " <AccessConstraints>%s</AccessConstraints>\n",
98
99 fprintf(o->output, " </Service>\n");
100}
101
102
103/*
104 * Provides metadata about the service itself
105 * Assume that type and versions figure in the metadata
106 * Used for version 1.1.0 de WFS GetCapabilities
107 */
109{
110 list_node *ln;
111
112 assert(o);
113 assert(o->metadata->type);
114 assert(o->metadata->versions);
115
116 ln = NULL;
117
118 fprintf(o->output, " <ows:ServiceIdentification>\n");
119
120 if (o->metadata->title)
121 fprintf(o->output, " <ows:Title>%s</ows:Title>\n", o->metadata->title->buf);
122
123 if (o->metadata->abstract)
124 fprintf(o->output, " <ows:Abstract>%s</ows:Abstract>\n", o->metadata->abstract->buf);
125
126 if (o->metadata->keywords) {
127 fprintf(o->output, " <ows:Keywords>\n");
128 for (ln = o->metadata->keywords->first ; ln ; ln = ln->next)
129 fprintf(o->output, " <ows:Keyword>%s</ows:Keyword>\n", ln->value->buf);
130 fprintf(o->output, " </ows:Keywords>\n");
131 }
132
133 fprintf(o->output, " <ows:ServiceType>%s</ows:ServiceType>\n", o->metadata->type->buf);
134 for (ln = o->metadata->versions->first ; ln ; ln = ln->next)
135 fprintf(o->output, " <ows:ServiceTypeVersion>%s</ows:ServiceTypeVersion>\n", ln->value->buf);
136
137
138 if (o->metadata->fees)
139 fprintf(o->output, " <ows:Fees>%s</ows:Fees>\n", o->metadata->fees->buf);
140
142 fprintf(o->output,
143 " <ows:AccessConstraints>%s</ows:AccessConstraints>\n",
145
146 fprintf(o->output, " </ows:ServiceIdentification>\n");
147}
148
149
150/*
151 * Provides metadata about the organisation operating the server
152 * Assume that provider name figures in the metadata
153 * Used for version 1.1.0 of WFS GetCapabilities
154 */
156{
157 assert(o);
158
159 if (!o->contact) return;
160
161 fprintf(o->output, " <ows:ServiceProvider>\n");
162
163 if (o->contact->name)
164 fprintf(o->output, " <ows:ProviderName>%s</ows:ProviderName>\n", o->contact->name->buf);
165 if (o->contact->site)
166 fprintf(o->output, " <ows:ProviderSite xlink:href=\"%s\" />\n", o->contact->site->buf);
167
168 fprintf(o->output, " <ows:ServiceContact>\n");
169
170 if (o->contact->indiv_name)
171 fprintf(o->output, " <ows:IndividualName>%s</ows:IndividualName>\n",
172 o->contact->indiv_name->buf);
173
174 if (o->contact->position)
175 fprintf(o->output, " <ows:PositionName>%s</ows:PositionName>\n",
176 o->contact->position->buf);
177
178 if ( o->contact->phone
179 || o->contact->fax
180 || o->contact->address
181 || o->contact->postcode
182 || o->contact->city
183 || o->contact->state
184 || o->contact->country
185 || o->contact->email
187 || o->contact->hours
188 || o->contact->instructions) {
189 fprintf(o->output, " <ows:ContactInfo>\n");
190
191 if (o->contact->phone || o->contact->fax) {
192 fprintf(o->output, " <ows:Phone>\n");
193
194 if (o->contact->phone)
195 fprintf(o->output, " <ows:Voice>%s</ows:Voice>\n", o->contact->phone->buf);
196
197 if (o->contact->fax)
198 fprintf(o->output, " <ows:Facsimile>%s</ows:Facsimile>\n",
199 o->contact->fax->buf);
200
201 fprintf(o->output, " </ows:Phone>\n");
202 }
203
204 if ( o->contact->address
205 || o->contact->postcode
206 || o->contact->city
207 || o->contact->state
208 || o->contact->country
209 || o->contact->email) {
210 fprintf(o->output, " <ows:Address>\n");
211
212 if (o->contact->address)
213 fprintf(o->output, " <ows:DeliveryPoint>%s</ows:DeliveryPoint>\n",
214 o->contact->address->buf);
215
216 if (o->contact->city)
217 fprintf(o->output, " <ows:City>%s</ows:City>\n", o->contact->city->buf);
218
219 if (o->contact->state)
220 fprintf(o->output, " <ows:AdministrativeArea>%s</ows:AdministrativeArea>\n",
221 o->contact->state->buf);
222
223 if (o->contact->postcode)
224 fprintf(o->output, " <ows:PostalCode>%s</ows:PostalCode>\n",
225 o->contact->postcode->buf);
226
227 if (o->contact->country)
228 fprintf(o->output, " <ows:Country>%s</ows:Country>\n",
229 o->contact->country->buf);
230
231 if (o->contact->email)
232 fprintf(o->output,
233 " <ows:ElectronicMailAddress>%s</ows:ElectronicMailAddress>\n",
234 o->contact->email->buf);
235
236 fprintf(o->output, " </ows:Address>\n");
237 }
238
239 if (o->contact->online_resource)
240 fprintf(o->output, " <ows:OnlineResource xlink:href=\"%s\" />\n",
242
243 if (o->contact->hours)
244 fprintf(o->output, " <ows:HoursOfService>%s</ows:HoursOfService>\n",
245 o->contact->hours->buf);
246
247 if (o->contact->instructions)
248 fprintf(o->output, " <ows:ContactInstructions>%s</ows:ContactInstructions>\n",
250
251 fprintf(o->output, " </ows:ContactInfo>\n");
252 }
253
254 fprintf(o->output, " </ows:ServiceContact>\n");
255 fprintf(o->output, " </ows:ServiceProvider>\n");
256}
257
258
259/*
260 * vim: expandtab sw=4 ts=4
261 */
void ows_service_metadata(const ows *o)
void ows_service_identification(const ows *o)
void ows_get_capabilities_dcpt(const ows *o, const char *req)
void ows_service_provider(const ows *o)
struct List_node list_node
struct Ows ows
char * buf
size to next realloc
Definition ows_struct.h:39
struct List_node * next
Definition ows_struct.h:45
buffer * value
Definition ows_struct.h:44
list_node * first
Definition ows_struct.h:50
buffer * instructions
Definition ows_struct.h:237
buffer * phone
Definition ows_struct.h:227
buffer * address
Definition ows_struct.h:230
buffer * state
Definition ows_struct.h:233
buffer * postcode
Definition ows_struct.h:231
buffer * position
Definition ows_struct.h:226
buffer * name
Definition ows_struct.h:223
buffer * indiv_name
Definition ows_struct.h:225
buffer * hours
Definition ows_struct.h:236
buffer * online_resource
Definition ows_struct.h:229
buffer * fax
Definition ows_struct.h:228
buffer * city
Definition ows_struct.h:232
buffer * email
Definition ows_struct.h:235
buffer * country
Definition ows_struct.h:234
buffer * site
Definition ows_struct.h:224
list * keywords
Definition ows_struct.h:217
buffer * abstract
Definition ows_struct.h:216
buffer * type
Definition ows_struct.h:212
buffer * access_constraints
Definition ows_struct.h:219
buffer * name
Definition ows_struct.h:214
buffer * title
Definition ows_struct.h:215
list * versions
Definition ows_struct.h:213
buffer * fees
Definition ows_struct.h:218
ows_contact * contact
Definition ows_struct.h:385
ows_meta * metadata
Definition ows_struct.h:384
buffer * online_resource
Definition ows_struct.h:373
FILE * output
Definition ows_struct.h:382

Generated for tinyows by doxygen 1.13.2