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 
36 {
40  /* DO NOT REUSE the value <4>, previously used as OIOURL_TYPE */
42 
44 
45  OIOURL_WHOLE = 7, /* read-only */
46 
47  OIOURL_HEXID = 8, /* read-write */
48  OIOURL_CONTENTID = 9, /* read-write */
49 
51 };
52 
55 #define LIMIT_LENGTH_NSNAME 64
56 
59 #define LIMIT_LENGTH_ACCOUNTNAME 64
60 
63 #define LIMIT_LENGTH_CONTENTPATH 1024
64 
67 #define LIMIT_LENGTH_VERSION 24
68 
71 #define LIMIT_LENGTH_USER 1024
72 
73 
74 struct oio_url_s;
75 
91 struct oio_url_s * oio_url_init(const char *url);
92 
98 struct oio_url_s * oio_url_init_raw(const char *url);
99 
101 struct oio_url_s * oio_url_empty(void);
102 
104 struct oio_url_s* oio_url_dup(const struct oio_url_s *u);
105 
106 void oio_url_clean(struct oio_url_s *u);
107 
108 void oio_url_cleanv (struct oio_url_s **tab);
109 
110 void oio_url_pclean(struct oio_url_s **pu);
111 
123 struct oio_url_s* oio_url_set(struct oio_url_s *u,
124  enum oio_url_field_e f, const char *v);
125 
126 void oio_url_unset(struct oio_url_s *u, enum oio_url_field_e f);
127 
138 const char * oio_url_get(struct oio_url_s *u, enum oio_url_field_e f);
139 
140 int oio_url_has(const struct oio_url_s *u, enum oio_url_field_e f);
141 
145 void oio_url_set_id(struct oio_url_s *u, const void *id);
146 
147 /* the returned value points to an array of oio_url_get_id_size() bytes long. */
148 const void* oio_url_get_id(struct oio_url_s *u);
149 
150 /* returns the number of bytes */
151 size_t oio_url_get_id_size(struct oio_url_s *u);
152 
154 int oio_url_has_fq_path (const struct oio_url_s *u);
155 
157 int oio_url_has_fq_container (const struct oio_url_s *u);
158 
166 gboolean oio_url_check(const struct oio_url_s *u, const char *n, const gchar **e);
167 
168 #ifdef __cplusplus
169 }
170 #endif
171 
173 #endif /*OIO_SDS__core__oiourl_h*/
Definition: oiourl.h:39
size_t oio_url_get_id_size(struct oio_url_s *u)
Definition: url.c:594
int oio_url_has(const struct oio_url_s *u, enum oio_url_field_e f)
Definition: url.c:443
Definition: oiourl.h:38
const void * oio_url_get_id(struct oio_url_s *u)
Definition: url.c:571
int oio_url_has_fq_container(const struct oio_url_s *u)
Definition: url.c:480
struct oio_url_s * oio_url_init(const char *url)
Definition: url.c:248
struct oio_url_s * oio_url_set(struct oio_url_s *u, enum oio_url_field_e f, const char *v)
Definition: url.c:327
struct oio_url_s * oio_url_empty(void)
Definition: url.c:272
oio_url_field_e
Definition: oiourl.h:35
void oio_url_pclean(struct oio_url_s **pu)
Definition: url.c:297
void oio_url_set_id(struct oio_url_s *u, const void *id)
Definition: url.c:581
struct oio_url_s * oio_url_init_raw(const char *url)
Definition: url.c:260
Definition: oiourl.h:37
Definition: oiourl.h:50
Definition: url.c:30
Definition: oiourl.h:43
const char * oio_url_get(struct oio_url_s *u, enum oio_url_field_e f)
Definition: url.c:525
void oio_url_unset(struct oio_url_s *u, enum oio_url_field_e f)
Definition: url.c:391
Definition: oiourl.h:41
void oio_url_cleanv(struct oio_url_s **tab)
Definition: url.c:287
int oio_url_has_fq_path(const struct oio_url_s *u)
Definition: url.c:474
struct oio_url_s * oio_url_dup(const struct oio_url_s *u)
Definition: url.c:311
gboolean oio_url_check(const struct oio_url_s *u, const char *n, const gchar **e)
Definition: url.c:633
Definition: oiourl.h:47
Definition: oiourl.h:45
Definition: oiourl.h:48
void oio_url_clean(struct oio_url_s *u)
Definition: url.c:278