/usr/include/ncbi-vdb/klib/path-priv.h is in libncbi-vdb-dev 2.8.1+dfsg-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 | /*===========================================================================
*
* Public Domain Notice
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _h_klib_path_priv_
#define _h_klib_path_priv_
#ifndef _h_vfs_extern_
#include <klib/extern.h>
#endif
#ifndef _h_vfs_path_
#include <klib/path.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*--------------------------------------------------------------------------
* forwards
*/
struct String;
#define NCBI_FILE_SCHEME "ncbi-file"
#define NCBI_ACCESSION_SCHEME "ncbi-acc"
#define HTTP_SCHEME "http"
#define FTP_SCHEME "ftp"
#define FASP_SCHEME "fasp"
#define NCBI_LEGREFSEQ_SCHEME "x-ncbi-legrefseq"
#define NCBI_OBJECT_SCHEME "ncbi-obj"
/* options for a VPath possibly obtained from a query string on an URI */
typedef uint32_t KPOption_t;
enum eKPOption_t
{
kpopt_encrypted,
kpopt_pwpath,
kpopt_pwfd,
kpopt_readgroup,
#if 0
kpopt_temporary_pw_hack,
#endif
kpopt_vdb_ctx,
kpopt_gap_ticket,
kpopt_count
};
/* =====
* Much of what follows is expected to move into the interface klib/path.h
* once it becomes supported.
*/
/* MakeFmt
* make a path object from a format string plus arguments
*
* "new_path" [ OUT ] - a reference to the new object.
*
* "fmt" [ IN ] and "args" [ IN ] - arguments to string_printf
* ( see <klib/text.h> ) to build a NUL-terminated string
* that conforms with the rules for "posix_path"
*
* NB - SECURITY RISK IF USED DIRECTLY FROM EXTERNAL STRINGS.
* ALSO, FMT IS **NOT** PRINTF COMPATIBLE - see string_printf.
*/
#if 0
KLIB_EXTERN rc_t CC KPathMakeRelative ( KPath ** new_path, const KPath * base_path,
const char * relative_path );
KLIB_EXTERN rc_t CC KPathMakeRelativeFmt ( KPath ** new_path, const KPath * base_path,
const char * fmt, ... );
KLIB_EXTERN rc_t CC KPathVMakeRelativeFmt ( KPath ** new_path, const KPath * base_path,
const char * fmt, va_list args );
KLIB_EXTERN rc_t CC KPathMakeCurrentPath ( KPath ** new_path );
KLIB_EXTERN rc_t CC KPathMakeURI ( KPath ** new_path, const char * uri );
#endif
/* Option
* rc == 0 if the option has been specified
* for options with a parameter, the value of the parameter is copied to buffer
*/
KLIB_EXTERN rc_t CC KPathOption ( const KPath * self, KPOption_t option,
char * buffer, size_t buffer_size,
size_t * num_read);
#ifdef __cplusplus
}
#endif
#endif /* _h_vfs_path_priv_ */
/*--------------------------------------------------------------------------
*
* The ABNF form described in RFC5234 will be used to define URLS and paths
* with some handwaving instead of complete character definitions for case
* insensitivity. CORE definitions from RFC5234 will be used again handwaving
* case insensitivity.
*
* --------------------
*
* URL for a VPath
*
* as per RFC 3986, an URI consists of:
*
* URI = scheme ":" heir-part [ "?" query ] [ "#" fragment ]
*
* We will support however something intbetween an URI and an IRI in that we'll
* all UTF-8 rather than limit certain characters to ASCII.
*
* For the NCBI path URL: The hier-part is intended to be compatible with the
* "file:" scheme Authority on any of the Unix-like operating
* systems must either be empty or "localhost". For Windows
* it must be a host that can be used if the "file" url is
* translated into a UNC style Windows path. Also in a
* Windows vfs: URL a single colon ':' will be allowed only at
* the end of a single character rive letter for the first
* sub-part of the path.
*
* scheme = "ncbi-file" ; ( case insensitive )
*
* hier-part = "//" authority path-abempty
* / path-absolute
* / path-relative
* / path-empty
*
* by RFC 3986 authority is
* authority = [ userinfo "@" ] host [ ":" port]
* but at this point we only recognize
* authority = host
*
* by RFC 3986 host is
* host = IP-literal / IPv4address / reg-name
* but at this point we only recognize
* host = reg-name
*
* reg-name = *( unreserved / pct-encoded / sub-delims )
*
* path = path-abempty
* / path-absolute
* / path-noscheme
* / path-rootless
* / path-empty
*
* path-abempty = * ( "/" segment )
*
* path-absolute = "/" segment-nz *( "/" segment )
*
* path-noscheme = segment-nz-nc *( "/" segment )
*
* path-rootless = segment-nz *( "/" segment )
*
* path-empty = ""
*
* segment = *pchar ; can be empty
* segment-nz = 1*pchar ; can't be empty
* segment-nz-nc = 1*pchar-nz ; can't be empty
*
* pchar = ":" / pchar-nc
*
* pchar-nc = unreserved / pct-encoded / sub-delims ? "@"
*
* pct-encoded = "%" HEXDIG HEXDIG ; hex digits are 0-9, a-f or A-F
*
* authority = "localhost" / host-name ; the host name is an O/S specific
* ; name of a remote host
*
* query = query_entry [ * ( "&" query_entry ) ]
*
* query_entry = "encrypt" / "enc" / ( "pwfile=" hier-part ) / ( "pwfd=" fd )
*
* fd = 1* DIGIT
*
* unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~" / UTF-8
*
* reserved = gen-delims / subdelims
*
* gen-delims = ":" / "/" / "?" / "#" / "[" / "]" / "@"
*
* sub-delims = "!" / "$" / "&" / "'" / "(" / ")" / "*"
* / "+" / "," / ";" / "="
*
* Handwaving on the UTF-8. We'll accept it rather than requiring percent encoding
* in most cases.
* Examples:
* "ncbi-file://home/my-name/data-files"
* "ncbi-file://win-server/archive/secure/read12345?encrypted"
* "ncbi-file:///c:/scanned-data/0001/file.sra?enc?pwd-file=c:/Users/JamesMcCoy/ncbi.pwd"
*
* We allow an implied scheme of "vfs" if none present.
* 'host-name' is partially implemented for Windows. Not currently for any the
* of the supported Unix systems. We do not support IP addresses instead of
* host names.
*
* 'path' can be either absolute or relative and must be posix style as per
* RFC 3986 and matches the "file" scheme.
*
* 'fragment' is not yet implemented or defined.
*
* 'fd' is a system specific file handle. Not yet supported on Windows.
*
* --------------------
*
* VFS posix_path representation:
*
* The internal representation of a path for VFS resembles very closely the
* POSIX pathname crossed with the Windows UNC path. Only the Unix "/"
* separator is allowed not the "\" for paths.
*
* posix-path = full-path / relative-path
*
* full-path = ["//" host] "/" [ directory-path "/" ] resource
*
* relative-path = [ directory-path "/" ] resource
*
* directory-path = resource [ "/" directory-path ]
*
* resource = string ; (UTF-8 O/S specific name for a directory or a file)
*
* host = string ; (UTF-8 O/S specific name for the local or remote host)
*
* For a host "localhost" is a synonym for the current host.
* The "//host" is not guaranteed to work for all systems except "//localhost"
*
* The resource "." is assumed to mean the local directory and will be stripped
* when a path is made canonical.
*
* The resource ".." is assumed to mean the containing directory and when made
* canonical it will be left in at the begining for relative paths or removed along
* with the preceding resource name.
*
* For Windows the device is handled in a unique way with some potential for ambiguity.
* The UNC approach for a named drive "C:" becomes "/c". So "C:\" becomes "/c/".
*
* In the future the complex approach from the "file:" URL should be adopted
* with the ":" allowed only in the first directory name in a path. RFC 3986
* notes though that this complex approach puts some five variants into the ABNF
* to describe the path portion of an URL.
*/
|