OpenIO SDS C API
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
oiourl.h
Go to the documentation of this file.
1 /*
2 OpenIO SDS core library
3 Copyright (C) 2014 Worldline, as part of Redcurrant
4 Copyright (C) 2015-2017 OpenIO SAS, as part of OpenIO SDS
5 
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 3.0 of the License, or (at your option) any later version.
10 
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
15 
16 You should have received a copy of the GNU Lesser General Public
17 License along with this library.
18 */
19 
20 #ifndef OIO_SDS__core__oiourl_h
21 # define OIO_SDS__core__oiourl_h 1
22 
28 #include <glib.h>
29 #include <sys/types.h>
30 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 
35 #define OIOURL_DEFAULT_TYPE ""
36 
38 {
44 
46 
47  OIOURL_WHOLE, /* read-only */
48 
49  OIOURL_HEXID, /* read-write */
50  OIOURL_CONTENTID, /* read-write */
51 
53 };
54 
55 
56 struct oio_url_s;
57 
73 struct oio_url_s * oio_url_init(const char *url);
74 
80 struct oio_url_s * oio_url_init_raw(const char *url);
81 
83 struct oio_url_s * oio_url_empty(void);
84 
86 struct oio_url_s* oio_url_dup(const struct oio_url_s *u);
87 
88 void oio_url_clean(struct oio_url_s *u);
89 
90 void oio_url_cleanv (struct oio_url_s **tab);
91 
92 void oio_url_pclean(struct oio_url_s **pu);
93 
105 struct oio_url_s* oio_url_set(struct oio_url_s *u,
106  enum oio_url_field_e f, const char *v);
107 
108 void oio_url_unset(struct oio_url_s *u, enum oio_url_field_e f);
109 
120 const char * oio_url_get(struct oio_url_s *u, enum oio_url_field_e f);
121 
122 int oio_url_has(const struct oio_url_s *u, enum oio_url_field_e f);
123 
127 void oio_url_set_id(struct oio_url_s *u, const void *id);
128 
129 /* the returned value points to an array of oio_url_get_id_size() bytes long. */
130 const void* oio_url_get_id(struct oio_url_s *u);
131 
132 /* returns the number of bytes */
133 size_t oio_url_get_id_size(struct oio_url_s *u);
134 
136 int oio_url_has_fq_path (const struct oio_url_s *u);
137 
139 int oio_url_has_fq_container (const struct oio_url_s *u);
140 
148 gboolean oio_url_check(const struct oio_url_s *u, const char *n, const gchar **e);
149 
150 #ifdef __cplusplus
151 }
152 #endif
153 
155 #endif /*OIO_SDS__core__oiourl_h*/
Definition: oiourl.h:41
size_t oio_url_get_id_size(struct oio_url_s *u)
Definition: url.c:604
int oio_url_has(const struct oio_url_s *u, enum oio_url_field_e f)
Definition: url.c:449
Definition: oiourl.h:40
const void * oio_url_get_id(struct oio_url_s *u)
Definition: url.c:581
int oio_url_has_fq_container(const struct oio_url_s *u)
Definition: url.c:489
struct oio_url_s * oio_url_init(const char *url)
Definition: url.c:233
struct oio_url_s * oio_url_set(struct oio_url_s *u, enum oio_url_field_e f, const char *v)
Definition: url.c:317
Definition: oiourl.h:42
struct oio_url_s * oio_url_empty(void)
Definition: url.c:257
oio_url_field_e
Definition: oiourl.h:37
void oio_url_pclean(struct oio_url_s **pu)
Definition: url.c:282
void oio_url_set_id(struct oio_url_s *u, const void *id)
Definition: url.c:591
struct oio_url_s * oio_url_init_raw(const char *url)
Definition: url.c:245
Definition: oiourl.h:39
Definition: oiourl.h:52
Definition: url.c:30
Definition: oiourl.h:45
const char * oio_url_get(struct oio_url_s *u, enum oio_url_field_e f)
Definition: url.c:533
void oio_url_unset(struct oio_url_s *u, enum oio_url_field_e f)
Definition: url.c:389
Definition: oiourl.h:43
void oio_url_cleanv(struct oio_url_s **tab)
Definition: url.c:272
int oio_url_has_fq_path(const struct oio_url_s *u)
Definition: url.c:483
struct oio_url_s * oio_url_dup(const struct oio_url_s *u)
Definition: url.c:296
gboolean oio_url_check(const struct oio_url_s *u, const char *n, const gchar **e)
Definition: url.c:642
Definition: oiourl.h:49
Definition: oiourl.h:47
Definition: oiourl.h:50
void oio_url_clean(struct oio_url_s *u)
Definition: url.c:263