3#if !defined(ORG_FOSSIL_SCM_FSL_CORE_H_INCLUDED)
4#define ORG_FOSSIL_SCM_FSL_CORE_H_INCLUDED
24#if defined(__cplusplus)
60#if !defined(fsl_report_oom_impl)
61#define fsl_report_oom_impl \
62 fprintf(stderr,"OOM @ %s:%d\n", __FILE__, __LINE__)
66#define FSL__WARN_OOM fsl_report_oom_impl
67#define fsl_report_oom fsl_report_oom_impl
328#define fsl_rc_e_map(E) \
330 "The quintessential not-an-error value.") \
331 E(FSL_RC_ERROR, 100, \
332 "Generic/unknown error.") \
334 "A placeholder return value for not yet implemented functions.") \
336 "Out of memory. Indicates that a resource allocation request failed.") \
337 E(FSL_RC_MISUSE, 103, \
338 "API misuse (invalid args).") \
339 E(FSL_RC_RANGE, 104, \
340 "Some range was violated (function argument, UTF character, etc.).") \
341 E(FSL_RC_ACCESS, 105, \
342 "Indicates that access to or locking of a resource was denied " \
343 "by some security mechanism or other.") \
345 "Indicates an I/O error. Whether it was reading or " \
346 "writing is context-dependent.") \
347 E(FSL_RC_NOT_FOUND, 107, \
348 "Requested resource not found") \
349 E(FSL_RC_ALREADY_EXISTS, 108, \
350 "Indicates that a to-be-created resource already exists.") \
351 E(FSL_RC_CONSISTENCY, 109, \
352 "Data consistency problem") \
353 E(FSL_RC_REPO_NEEDS_REBUILD, 110, \
354 "Indicates that the requested repo needs to be rebuilt.") \
355 E(FSL_RC_NOT_A_REPO, 111, \
356 "Indicates that the requested repo is not, in fact, a repo. " \
357 "Also used by some APIs to indicate that they require a " \
358 "repository db but none has been opened.") \
359 E(FSL_RC_REPO_VERSION, 112, \
360 "Indicates an attempt to open a too-old or too-new repository db.") \
362 "Indicates db-level error (e.g. statement prep failed). In such " \
363 "cases, the error state of the related db handle (fsl_db) or " \
364 "Fossil context (fsl_cx) will be updated to contain more " \
365 "information directly from the db driver.") \
366 E(FSL_RC_BREAK, 114, \
367 "Used by some iteration routines to indicate that " \
368 "iteration should stop prematurely without an error.") \
369 E(FSL_RC_STEP_ROW, 115, \
370 "Indicates that fsl_stmt_step() has fetched a row and " \
371 "the cursor may be used to access the current row state (e.g. using " \
372 "fsl_stmt_get_int32() and friends). It is strictly illegal to use " \
373 "the fsl_stmt_get_xxx() APIs unless fsl_stmt_step() has returned " \
375 E(FSL_RC_STEP_DONE, 116, \
376 "Indicates that fsl_stmt_step() has reached the end of " \
377 "the result set and that there is no row data to process. This is also the " \
378 "result for non-fetching queries (INSERT and friends). It is strictly " \
379 "illegal to use the fsl_stmt_get_xxx() APIs after fsl_stmt_step() has " \
380 "returned this code.") \
381 E(FSL_RC_STEP_ERROR, 117, \
382 "Indicates that a db-level error occurred " \
383 "during a fsl_stmt_step() iteration.") \
384 E(FSL_RC_TYPE, 118, \
385 "Indicates that some data type or logical type is incorrect " \
386 "(e.g. an invalid card type in conjunction with a given fsl_deck).") \
387 E(FSL_RC_NOT_A_CKOUT, 119, \
388 "Indicates that an operation which requires a checkout does not " \
389 "have a checkout to work on.") \
390 E(FSL_RC_REPO_MISMATCH, 120, \
391 "Indicates that a repo and checkout do not belong together.") \
392 E(FSL_RC_CHECKSUM_MISMATCH, 121, \
393 "Indicates that a checksum comparison failed, possibly indicating " \
394 "that corrupted or unexpected data was just read.") \
395 E(FSL_RC_LOCKED, 122, \
396 "Indicates a resource-locking error of some sort, normally a db lock.") \
397 E(FSL_RC_CONFLICT, 123, \
398 "Indicates that a merge conflict, or some other context-dependent " \
399 "type of conflict, was detected.") \
400 E(FSL_RC_UNKNOWN_RESOURCE, 124, \
401 "This is a special case of FSL_RC_NOT_FOUND, intended specifically " \
402 "to differentiate from \"file not found in filesystem\" " \
403 "(FSL_RC_NOT_FOUND) and \"fossil does not know about this file\" in " \
404 "routines for which both might be an error case. An example is a " \
405 "an operation which wants to update a repo file with contents " \
406 "from the filesystem - the file might not exist or it might not be " \
407 "in the current repo db. " \
408 "That said, this can also be used for APIs which search for other " \
409 "resources (UUIDs, tickets, etc.), but FSL_RC_NOT_FOUND is already " \
410 "fairly well entrenched in those cases and is unambiguous, so this " \
411 "code is only needed by APIs for which both cases described above " \
413 E(FSL_RC_SIZE_MISMATCH, 125, \
414 "Indicates that a size comparison check failed. " \
415 "TODO: remove this if it is not used." ) \
416 E(FSL_RC_DELTA_INVALID_SEPARATOR, 126, \
417 "Indicates that an invalid separator was encountered while " \
418 "parsing a delta." ) \
419 E(FSL_RC_DELTA_INVALID_SIZE, 127, \
420 "Indicates that an invalid size value was encountered while " \
421 "parsing a delta." ) \
422 E(FSL_RC_DELTA_INVALID_OPERATOR, 128, \
423 "Indicates that an invalid operator was encountered while parsing " \
425 E(FSL_RC_DELTA_INVALID_TERMINATOR, 129, \
426 "Indicates that an invalid terminator was encountered while " \
427 "parsing a delta.") \
428 E(FSL_RC_SYNTAX, 130, \
429 "Indicates a generic syntax error in a structural artifact. Some " \
430 "types of manifest-releated errors are reported with more specific " \
431 "error codes, e.g. FSL_RC_RANGE if a given card type appears too " \
433 E(FSL_RC_AMBIGUOUS, 131, \
434 "Indicates that some value or expression is ambiguous. Typically " \
435 "caused by trying to resolve ambiguous symbolic names or hash " \
436 "prefixes to their full hashes.") \
437 E(FSL_RC_NOOP, 132, \
438 "Used by fsl_checkin_commit(), and similar operations, to indicate " \
439 "that they're failing because they would be no-ops. That would " \
440 "normally indicate a \"non-error\", but a condition the caller " \
441 "certainly needs to know about.") \
442 E(FSL_RC_PHANTOM, 133, \
443 "A special case of FSL_RC_NOT_FOUND which indicates that the " \
444 "requested repository blob could not be loaded because it is a " \
445 "phantom. That is, the record is found but its contents are not " \
446 "available. Phantoms are blobs which fossil knows should exist, " \
447 "because it's seen references to their hashes, but for which it does " \
448 "not yet have any content.") \
449 E(FSL_RC_UNSUPPORTED, 134, \
450 "Indicates that the requested operation is unsupported.") \
451 E(FSL_RC_MISSING_INFO, 135, \
452 "Indicates that the requested operation is missing certain required " \
454 E(FSL_RC_DIFF_BINARY, 136, \
455 "Special case of FSL_RC_TYPE triggered in some diff APIs, indicating " \
456 "that the API cannot diff what appears to be binary data.") \
457 E(FSL_RC_DIFF_WS_ONLY, 137, \
458 "Triggered by some diff APIs to indicate that only whitespace " \
459 "changes we found and the diff was requested to ignore whitespace.") \
460 E(FSL_RC_INTERRUPTED, 138, \
461 "Intended to be used with fsl_cx_interrupt() by signal handlers " \
463 E(FSL_RC_WOULD_FORK, 139, \
464 "Intended to be used by operations which would cause what is " \
465 "presumably an unintended fork. Fossil does not have any issues with " \
466 "forking, but practice suggests that most forks (that is, checking " \
467 "in to a non-leaf version) are unintentional.") \
468 E(FSL_RC_CANNOT_HAPPEN, 140, \
469 "This is intended only for internal use with fsl__fatal(), to " \
470 "report conditions which \"cannot possibly happen\".") \
471 E(FSL_RC_TIMEOUT, 141, \
472 "Indicates that a context-specific timeout was triggered.") \
473 E(FSL_RC_REMOTE, 142, \
474 "Indicates that an error was received from a remote during " \
476 E(FSL_RC_SHUNNED, 143, \
477 "Indicates that a given blob is in the SHUNNED list.") \
479 "Must be the final entry in the enum. Used for creating client-side " \
480 "result codes which are guaranteed to live outside of this one's " \
497#define E(N,V,H) N = V,
676#define fsl_msg_map(E) \
677 E(INVALID, 0, "Sentinel value") \
678 E(mask_type, 0x7F000000, "Data type mask") \
679 E(mask_reserved, 0x00FFFF00, "Reserved") \
680 E(mask_purpose, 0x000000FF, "Message purpose ID") \
681 E(type_null, 0x01000000, "NULL") \
682 E(type_string, 0x02000000, "(char const *)") \
683 E(type_buffer, 0x03000000, "(fsl_buffer const *)") \
684 E(type_size, 0x04000000, "(fsl_size_t const *)") \
685 E(type_blob, 0x06000000, "(fsl_msg_blob const *)" ) \
686 E(type_rebuild_step, 0x07000000, "(fsl_rebuild_step const *)" ) \
687 E(ERROR, 0x01 | FSL_MSG_type_string, "Error string") \
688 E(INFO, 0x02 | FSL_MSG_type_string, "Info string") \
689 E(DEBUG, 0x03 | FSL_MSG_type_string, "Debugging string") \
690 E(TMPFILE, 0x04 | FSL_MSG_type_string, "value=name of temp file left over") \
691 E(CONNECT, 0x05 | FSL_MSG_type_size, "value=trip number") \
692 E(RCV_BLOB, 0x06 | FSL_MSG_type_blob, "Blob received") \
693 E(RCV_MESSAGE, 0x07 | FSL_MSG_type_string, "\"message\" card from remote") \
694 E(RCV_CONFIG, 0x08 | FSL_MSG_type_string, "Config group name") \
695 E(REBUILD_STEP, 0x09 | FSL_MSG_type_rebuild_step, "") \
696 E(REBUILD_DONE, 0x0A | FSL_MSG_type_rebuild_step, "") \
697 E(TXN_BEGIN, 0x0B | FSL_MSG_type_size, "value=transaction level") \
698 E(TXN_COMMIT, 0x0C | FSL_MSG_type_size, "value=transaction level") \
699 E(TXN_ROLLBACK, 0x0D | FSL_MSG_type_size, "value=transaction level")
706#define E(NAME,VAL,IGNORED) FSL_MSG_ ## NAME = VAL,
759#define fsl_msg_empty_m { \
760 .type = FSL_MSG_INVALID, .payload = NULL, \
810#define fsl_msg_listener_empty_m { .callback=0, .state=0 }
885#define fsl_cx_config_empty_m { \
888 .hashPolicy = FSL_HPOLICY_SHA3, \
889 .listener = fsl_msg_listener_empty_m, \
890 .output = {.out=NULL, .state=NULL}, \
891 .see = {.getSEEKey = NULL, .pState = NULL} \
1183 void * outState,
char const *zFmt,
1190 void * outState,
char const *zFmt, ... );
1197 char const *zFmt, ... );
1204 char const *zFmt, ... );
1482 char const * sql, ... );
1488 char const * sql, va_list args );
1500 char const * sql, ... );
1506 char const * sql, va_list args );
1657#define fsl_satype_e_map(E) \
1658 E(FSL_SATYPE_INVALID, -1
1663 E(FSL_SATYPE_CHECKIN, 1
1665 E(FSL_SATYPE_CLUSTER, 2
1667 E(FSL_SATYPE_CONTROL, 3
1669 E(FSL_SATYPE_WIKI, 4) \
1670 E(FSL_SATYPE_TICKET, 5) \
1671 E(FSL_SATYPE_ATTACHMENT, 6
1673 E(FSL_SATYPE_TECHNOTE, 7
1676 E(FSL_SATYPE_FORUMPOST, 8
1687#define E(N,V) N = V,
1939 bool bubbleRollback);
1943#define fsl_cx_txn_end(F, RollbackMode) \
1944 fsl_cx_txn_end_v2((F), !(RollbackMode), !!(RollbackMode))
1948#define fsl_cx_txn_end(F, RollbackMode) \
1949 fsl_cx_txn_end_v2((F), !(RollbackMode), false)
2070 const char * fmt, ...);
2194FSL_EXPORT struct tm * fsl_cx_localtime(
fsl_cx const * f,
const time_t * clock );
2199FSL_EXPORT struct tm * fsl_localtime(
const time_t * clock );
2212#if defined(__cplusplus)
int32_t fsl_id_t
fsl_id_t is a signed integer type used to store database record IDs.
uint64_t fsl_size_t
fsl_size_t is an unsigned integer type used to denote absolute ranges and lengths.
uint32_t fsl_flag32_t
A 32-bit unsigned int type.
int64_t fsl_int_t
fsl_int_t is a signed integer type used to denote "relative" ranges and lengths, or to tell a routine...
FSL_EXPORT int fsl_cx_formatv(fsl_cx *f, fsl_output_f out, void *outState, char const *zFmt, va_list args)
A proxy for fsl_appendfv() which pre-processes the format-specifier string (zFmt) to replace certain ...
fsl_hashpolicy_e
List of hash policy values.
@ FSL_HPOLICY_SHA3_ONLY
Use SHA3 hashes exclusively.
@ FSL_HPOLICY_SHA3
Use SHA3 hashes.
@ FSL_HPOLICY_SHA1
Use only SHA1 hashes.
@ FSL_HPOLICY_SHUN_SHA1
With this policy, fsl_uuid_is_shunned() will always return true for SHA1 hashes, making it "impossibl...
@ FSL_HPOLICY_AUTO
Accept SHA1 hashes but auto-promote to SHA3.
#define fsl_rc_e_map(E)
A macro which invokes its argument (a macro name) to expand to all possible values of fsl_rc_e entrie...
fsl_see_keytype_e
SQLite Encryption Extension (SEE) key types for use with fsl_see_key_f().
@ FSL_SEE_KEYTYPE_PLAIN
Corresponses to (PRAGMA key).
@ FSL_SEE_KEYTYPE_BINARY
Corresponses to (PRAGMA hexkey).
@ FSL_SEE_KEYTYPE_TEXTKEY
Corresponses to (PRAGMA textkey).
@ FSL_SEE_KEYTYPE_HEXKEY
Corresponses to (PRAGMA hexkey).
@ FSL_SEE_KEYTYPE_NONE
Sentinel value indicating "not an SEE key".
fsl_rc_e
Most functions in this library which return an int return result codes from the fsl_rc_e enum.
FSL_EXPORT int fsl_cx_format(fsl_cx *f, fsl_output_f out, void *outState, char const *zFmt,...)
The elipsis counterpart of fsl_cx_formatv().
FSL_EXPORT int fsl_cx_interruptv(fsl_cx *f, int code, char const *fmt, va_list args)
The va_list counterpart of fsl_cx_interrupt().
FSL_EXPORT int fsl_config_close(fsl_cx *f)
Closes/detaches the database connection opened by fsl_config_open().
FSL_EXPORT void fsl_cx_confirmer_get(fsl_cx const *f, fsl_confirmer *dest)
Stores a bitwise copy of f's current confirmer object into *dest.
const fsl_msg_listener fsl_msg_listener_empty
FSL_EXPORT int fsl_cx_user_set(fsl_cx *f, char const *userName)
Sets or clears (if userName is NULL or empty) the default repository user name for operations which r...
FSL_EXPORT const fsl_cx_config fsl_cx_config_empty
fsl_cx_config instance initialized with defaults, intended for non-const copy initialization.
FSL_EXPORT void fsl_cx_case_sensitive_set(fsl_cx *f, bool caseSensitive)
Sets the case-sensitivity flag for f to the given value.
FSL_EXPORT char const * fsl_cx_filename_collation(fsl_cx const *f)
If f is set to use case-sensitive filename handling, returns a pointer to an empty string,...
FSL_EXPORT char const * fsl_cx_db_file_repo(fsl_cx const *f, fsl_size_t *len)
Equivalent to fsl_ckout_db_file() except that it applies to the name of the opened repository db,...
FSL_EXPORT fsl_id_t fsl_cx_last_insert_id(fsl_cx *f)
Wrapper around fsl_db_last_insert_id() which uses f's main database.
FSL_EXPORT int fsl_cx_hash_filename(fsl_cx *f, bool useAlternate, const char *zFilename, fsl_buffer *pOut)
The file counterpart of fsl_cx_hash_buffer(), behaving exactly the same except that its data source i...
const fsl_msg fsl_msg_empty
fsl_msg instance intended for non-const copy initialization.
FSL_EXPORT int fsl_cx_err_report(fsl_cx *f, bool addNewline)
If f has error state then it outputs its error state to its output channel and returns the result of ...
FSL_EXPORT int fsl_cx_preparev_cached(fsl_cx *f, fsl_stmt **tgt, char const *sql, va_list args)
va_list counterpart of fsl_cx_prepare_cached().
#define fsl_satype_e_map(E)
Invokes macro E with 2 arguments one time for each of the core fsl_satype_e entries.
FSL_EXPORT bool fsl_cx_allows_symlinks(fsl_cx *f, bool forceRecheck)
Returns true if f has the "allow-symlinks" repo-level configuration option set to a truthy value,...
FSL_EXPORT fsl_glob_category_e fsl_glob_name_to_category(char const *str)
Converts a well-known fossil glob list configuration key to a fsl_glob_category_e value:
FSL_EXPORT int fsl_msg_emit(fsl_msg const *msg, fsl_msg_listener const *where)
If both where and where->callback are not NULL, msg is passed to where->callback and its result is re...
fsl_dbrole_e
This enum defines type ID tags with which the API tags fsl_db instances so that the library can figur...
@ FSL_DBROLE_NONE
Sentinel "no role" value.
@ FSL_DBROLE_CKOUT
The checkout db.
@ FSL_DBROLE_TEMP
Refers to the "temp" database.
@ FSL_DBROLE_CONFIG
The global (per user) config db.
@ FSL_DBROLE_MAIN
Analog to fossil's "main", which is an alias for the first db opened.
@ FSL_DBROLE_REPO
The repository db.
struct fsl_cx_init_opt fsl_cx_init_opt
FSL_EXPORT char const * fsl_cx_db_file_config(fsl_cx const *f, fsl_size_t *len)
Equivalent to fsl_ckout_db_file() except that it applies to the name of the opened config db,...
FSL_EXPORT int fsl_cx_last_sync_url(fsl_cx *f, fsl_buffer *tgt)
Extracts the "last-sync-url" entry from f's repository configuration and appends it to tgt.
FSL_EXPORT int fsl_cx_hash_buffer(const fsl_cx *f, bool useAlternate, fsl_buffer const *pIn, fsl_buffer *pOut)
Hashes all of pIn, appending the hash to pOut.
fsl_cx_flags_e
Runtime-configurable flags for a fsl_cx instance.
@ FSL_CX_F_NONE
The "no flags" value.
@ FSL_CX_F_BLOB_CACHE
If on (the default) then fsl_content_get() will use an internal cache to speed up loading of repeated...
@ FSL_CX_F_SKIP_UNKNOWN_CROSSLINKS
When encounting artifact types in the crosslinking phase which the library does not currently support...
@ FSL_CX_F_MANIFEST_CACHE
If on (the default) then an internal cache will be used for artifact loading to speed up operations w...
@ FSL_CX_F_ALLOW_WINDOWS_RESERVED_NAMES
By default, fsl_reserved_fn_check() will fail if the given filename is reserved on Windows platforms ...
@ FSL_CX_F_IS_OPENING_CKOUT
Internal use only to prevent duplicate initialization of some bits.
@ FSL_CX_F_DEFAULTS
Default flags for all fsl_cx instances.
@ FSL_CX_F_CALC_R_CARD
Tells us whether or not we want to calculate R-cards by default.
fsl_msg_e
Message type flags Indicators for use with fsl_sc::status, fsl_xfer_emit(), and friends.
char const * fsl_msg_type_cstr(fsl_msg_e e)
Returns the C-string form of the given sync message type, or NULL if e is invalid.
FSL_EXPORT int fsl_cx_format_FILE(fsl_cx *f, FILE *tgt, char const *zFmt,...)
Convenience formof fsl_cx_format() which appends the formatted output to tgt.
FSL_EXPORT char const * fsl_cx_db_file_ckout(fsl_cx const *f, fsl_size_t *len)
If f is not NULL and has a checkout db opened then this function returns its name.
FSL_EXPORT int fsl_outputfv(fsl_cx *f, char const *fmt, va_list args)
va_list counterpart to fsl_outputf().
void fsl_cx_listener_replace(fsl_cx *f, fsl_msg_listener const *pNew, fsl_msg_listener *pOld)
Replace's f's current fsl_msg listener with a bitwise copy of pNew.
FSL_EXPORT int fsl_cx_interrupted(fsl_cx const *f)
If f's is-interrupted flag is set, this function returns its value.
FSL_EXPORT int fsl_flush(fsl_cx *f)
Flushes f's output channel.
FSL_EXPORT int fsl_cx_exec(fsl_cx *f, char const *sql,...)
Convenience form of fsl_db_exec() which uses f's main db handle.
FSL_EXPORT fsl_error const * fsl_cx_err_ec(fsl_cx const *f)
Returns f's error object.
int(* fsl_see_key_f)(void *pState, const char *zDbFile, fsl_buffer *pOut, int *keyType)
EXPERIMENTAL and subject to change.
FSL_EXPORT int fsl_cx_txn_begin(fsl_cx *f)
Returns the same as passing fsl_cx_db() to fsl_db_txn_begin().
FSL_EXPORT int fsl_cx_err_set_e(fsl_cx *f, fsl_error *err)
Replaces f's error state with the contents of err, taking over any memory owned by err (but not err i...
FSL_EXPORT int fsl_cx_emit(fsl_cx *const f, fsl_msg_e type, void const *p)
If f has a fsl_msg listener, a fsl_msg composed from the given type and payload is passed to the the ...
FSL_EXPORT int fsl_cx_interrupt(fsl_cx *f, int code, const char *fmt,...)
Sets f's is-interrupted flag and, if the 3rd argument is not NULL, its error state.
FSL_EXPORT int fsl_cx_glob_list(fsl_cx *f, fsl_glob_category_e gtype, fsl_list **tgt, bool forceReload)
Fetches f's glob list of the given category.
FSL_EXPORT fsl_flag32_t fsl_cx_flag_set(fsl_cx *f, fsl_flag32_t flags, bool enable)
Sets or unsets one or more option flags on the given fossil context.
FSL_EXPORT char const * fsl_buildinfo(enum fsl_buildinfo_e what)
Fetches the piece of library-level build information specified by its argument.
FSL_EXPORT char const * fsl_cx_db_file_for_role(fsl_cx const *f, fsl_dbrole_e r, fsl_size_t *len)
Similar to fsl_cx_db_file_ckout() and friends except that it applies to db file implied by the specif...
FSL_EXPORT int fsl_cx_txn_level(fsl_cx *f)
Returns the same as passing fsl_cx_db() to fsl_db_txn_level(), or 0 if f has no db opened.
int(* fsl_msg_f)(fsl_msg const *msg, void *state)
A callback for use with the library's message-passing subsystem, to provide feedback during potential...
FSL_EXPORT int fsl_cx_confirm(fsl_cx *f, fsl_confirm_detail const *detail, fsl_confirm_response *outAnswer)
If fsl_cx_confirmer() was used to install a confirmer callback in f then this routine calls that conf...
FSL_EXPORT int fsl_cx_prepare_cached(fsl_cx *f, fsl_stmt **tgt, char const *sql,...)
Convenience form of fsl_db_prepare_cached() which uses f's main db.
FSL_EXPORT fsl_hashpolicy_e fsl_cx_hash_policy_get(fsl_cx const *f)
Returns f's current hash policy.
FSL_EXPORT void fsl_cx_finalize(fsl_cx *f)
Frees all memory associated with f, which must have been allocated/initialized using fsl_cx_malloc(),...
FSL_EXPORT char const * fsl_satype_event_cstr(fsl_satype_e t)
For a given artifact type, it returns the key string used in the event.type db table.
FSL_EXPORT char const * fsl_cx_glob_matches(fsl_cx *f, int gtype, char const *str)
Checks one or more of f's configurable glob lists to see if str matches one of them.
FSL_EXPORT int fsl_cx_uplift_db_error2(fsl_cx *f, fsl_db *db, int rc)
If rc is not 0 and f has no error state but db does, this calls fsl_cx_uplift_db_error() and returns ...
FSL_EXPORT bool fsl_cx_has_ckout(fsl_cx const *f)
Returns true if the given context has a checkout opened, else false.
FSL_EXPORT int fsl_cx_stat(fsl_cx *f, bool relativeToCwd, char const *zName, fsl_fstat *tgt)
Works similarly to fsl_stat(), except that zName must refer to a path under f's current checkout dire...
FSL_EXPORT int fsl_outputf(fsl_cx *f, char const *fmt,...)
Uses fsl_appendf() to append formatted output to the channel configured for use with fsl_output().
int fsl_cx_emitfv(fsl_cx *f, fsl_msg_e type, char const *zFmt, va_list args)
va_list counterpart of fsl_cx_emit() which emits a fsl_appendf()-formatted message as a string or a b...
FSL_EXPORT fsl_db * fsl_cx_db_config(fsl_cx *f)
If f has an opened configuration db then its handle is returned, else 0 is returned.
FSL_EXPORT char const * fsl_cx_user_guess(fsl_cx *f)
If f has a user name set (via fsl_cx_user_set()) then this function returns that value.
FSL_EXPORT bool fsl_cx_is_case_sensitive(fsl_cx *const f, bool forceRecheck)
Returns true if f is set for case-sensitive filename handling, else false.
fsl_fileperm_e
File permissions flags supported by fossil manifests.
@ FSL_FILE_PERM_LINK
Indicates a symlink.
@ FSL_FILE_PERM_EXE
Indicates a regular file with the executable bit set.
@ FSL_FILE_PERM_REGULAR
Indicates a regular, writable file.
FSL_EXPORT int fsl_close_dbs(fsl_cx *f)
Shorthand for calling both fsl_close_scm_dbs() and, if it succeeds, fsl_config_close().
FSL_EXPORT int fsl_cx_exec_multiv(fsl_cx *f, char const *sql, va_list args)
va_list counterpart of fsl_cx_exec_multi().
FSL_EXPORT fsl_db * fsl_needs_repo(fsl_cx *f)
A helper which fetches f's repository db.
FSL_EXPORT int fsl_output(fsl_cx *f, void const *src, fsl_size_t n)
Outputs the first n bytes of src to f's configured output channel.
FSL_EXPORT char const * fsl_cx_ckout_dir_name(fsl_cx const *f, fsl_size_t *len)
If f has an opened checkout db (from fsl_ckout_open_dir()) then this function returns the directory p...
FSL_EXPORT fsl_cx * fsl_cx_malloc(void)
Allocates a new fsl_cx instance, which must eventually be passed to fsl_cx_finalize() to clean it up.
FSL_EXPORT fsl_flag32_t fsl_cx_flags_get(fsl_cx const *f)
Returns f's flags.
FSL_EXPORT int fsl_cx_filename_cmp(fsl_cx *f, char const *z1, char const *z2)
Compares two strings, represumably filenames, using either fsl_strcmp() or fsl_stricmp(),...
fsl_configset_e
Bitmask values specifying "configuration sets".
@ FSL_CONFIGSET_SHUN
Shun settings.
@ FSL_CONFIGSET_ADDR
The CONCEALED table.
@ FSL_CONFIGSET_PROJ
Project name.
@ FSL_CONFIGSET_OLDFORMAT
Use the legacy format.
@ FSL_CONFIGSET_CSS
Style sheet only.
@ FSL_CONFIGSET_OVERWRITE
Causes overwrite instead of merge.
@ FSL_CONFIGSET_XFER
Transfer configuration.
@ FSL_CONFIGSET_TKT
Ticket configuration.
@ FSL_CONFIGSET_USER
The USER table.
@ FSL_CONFIGSET_ALL
Everything.
@ FSL_CONFSET_NONE
Sentinel value.
@ FSL_CONFIGSET_SKIN
WWW interface appearance.
FSL_EXPORT int fsl_cx_err_get(fsl_cx *f, char const **str, fsl_size_t *len)
Fetches the error state from f.
FSL_EXPORT int fsl_cx_exec_multi(fsl_cx *f, char const *sql,...)
The fsl_db_exec_multi() counterpart of fsl_cx_exec().
FSL_EXPORT int fsl_config_open(fsl_cx *f, char const *dbName)
Opens the given database file as f's configuration database.
FSL_EXPORT char const * fsl_library_version(void)
Returns the value of FSL_LIBRARY_VERSION used to compile the library.
FSL_EXPORT char const * fsl_rc_cstr(int rc)
Returns a "standard" string form for a fsl_rc_e code.
FSL_EXPORT void fsl_cx_confirmer(fsl_cx *f, fsl_confirmer const *newConfirmer, fsl_confirmer *prevConfirmer)
Installs or (if f is NULL) uninstalls a confirmation callback for use by operations on f which requir...
struct fsl__xfer fsl_xfer
A "transfer context" type used by many of the sync transfer APIs.
FSL_EXPORT char const * fsl_hash_policy_name(fsl_hashpolicy_e p)
Returns a human-friendly name for the given policy, or NULL for an invalid policy value.
#define fsl_msg_map(E)
Expands to a mapping of all fsl_msg types by invoking E(NAME,VALUE,PayloadDescription) for each one.
FSL_EXPORT void fsl_cx_err_reset(fsl_cx *f)
Resets's f's error state, basically equivalent to fsl_cx_err_set(f,0,NULL).
FSL_EXPORT int fsl_cx_stat2(fsl_cx *f, bool relativeToCwd, char const *zName, fsl_fstat *tgt, fsl_buffer *nameOut, bool fullPath)
This works identically to fsl_cx_stat(), but provides more information about the file being stat'd.
FSL_EXPORT int fsl_cx_init(fsl_cx **tgt, fsl_cx_config const *param)
Initializes a fsl_cx instance.
FSL_EXPORT fsl_lib_configurable_t fsl_lib_configurable
FSL_EXPORT char const * fsl_cx_user_get(fsl_cx const *f)
Returns the name set by fsl_cx_user_set(), or NULL if f has no default user name set.
FSL_EXPORT char const * fsl_satype_cstr(fsl_satype_e t)
Returns some arbitrary but distinct string for the given fsl_satype_e.
FSL_EXPORT int fsl_cx_txn_end_v2(fsl_cx *f, bool keepSavepoint, bool bubbleRollback)
Returns the same as passing fsl_cx_db() to fsl_db_txn_end().
FSL_EXPORT bool fsl_library_version_matches(char const *yourLibVersion)
Returns true (non-0) if yourLibVersion compares lexically equal to FSL_LIBRARY_VERSION,...
FSL_EXPORT int fsl_cx_execv(fsl_cx *f, char const *sql, va_list args)
va_list counterpart of fsl_cx_exec().
FSL_EXPORT int fsl_cx_uplift_db_error(fsl_cx *f, fsl_db *db)
Unconditionally Moves db->error's state into f (without requiring any allocation).
FSL_EXPORT char const * fsl_library_version_scm(void)
Returns the SCM-specific version info for libfossil (the hash and timestamp of it's own source's vers...
FSL_EXPORT int fsl_cx_err_setv(fsl_cx *f, int code, char const *fmt, va_list args)
va_list counterpart to fsl_cx_err_set().
fsl_buildinfo_e
Flags for use with fsl_buildinfo().
@ FSL_BUILDINFO_VERSION_TIMESTAMP
@ FSL_BUILDINFO_CONFIG_TIMESTAMP
@ FSL_BUILDINFO_VERSION_HASH
fsl_satype_e
An enumeration of the types of structural artifacts used by Fossil.
@ FSL_SATYPE_BRANCH_START
A pseudo-type for use with fsl_sym_to_rid() which changes the behavior of checkin lookups to return t...
FSL_EXPORT fsl_db * fsl_cx_db_repo(fsl_cx *f)
If f is not NULL and has had its repo opened via fsl_repo_open(), fsl_ckout_open_dir(),...
FSL_EXPORT int fsl_cx_getcwd(fsl_cx *f, fsl_buffer *pOut)
Works like fsl_getcwd() but updates f's error state on error and appends the current directory's name...
FSL_EXPORT int fsl_cx_preparev(fsl_cx *f, fsl_stmt *tgt, char const *sql, va_list args)
va_list counterpart of fsl_cx_prepare().
FSL_EXPORT fsl_error * fsl_cx_err_e(fsl_cx *f)
Non-const counterpart of fsl_cx_err_ec().
FSL_EXPORT int fsl_cx_prepare(fsl_cx *f, fsl_stmt *tgt, char const *sql,...)
Convenience form of fsl_db_prepare() which uses f's main db.
FSL_EXPORT int fsl_cx_err_set(fsl_cx *f, int code, char const *fmt,...)
Sets the Fossil error state to the given error code and fsl_appendf()-style format string/arguments.
FSL_EXPORT fsl_db * fsl_needs_ckout(fsl_cx *f)
The checkout-db counterpart of fsl_needs_repo().
FSL_EXPORT fsl_hashpolicy_e fsl_cx_hash_policy_set(fsl_cx *f, fsl_hashpolicy_e p)
Sets f's hash policy and returns the previous value.
fsl_glob_category_e
A collection of bitmaskable values indicating categories of fossil-standard glob sets.
@ FSL_GLOBS_ANY
A superset of all config-level glob categories.
@ FSL_GLOBS_CRNL
Corresponds to the crnl-glob config setting.
@ FSL_GLOBS_IGNORE
Corresponds to the ignore-glob config setting.
@ FSL_GLOBS_INVALID
Sentinel entry.
@ FSL_GLOBS_BINARY
Corresponds to the binary-glob config setting.
int fsl_cx_emitf(fsl_cx *f, fsl_msg_e type, char const *zFmt,...)
Elipsis counterpart of fsl_cx_emitfv().
FSL_EXPORT int fsl_cx_format_buffer(fsl_cx *f, fsl_buffer *tgt, char const *zFmt,...)
Convenience formof fsl_cx_format() which appends the formatted output to tgt.
FSL_EXPORT fsl_db * fsl_cx_db_ckout(fsl_cx *f)
If f is not NULL and has had a checkout opened via fsl_ckout_open_dir() or similar,...
FSL_EXPORT int fsl_close_scm_dbs(fsl_cx *f)
Closes any opened repository and/or checkout database(s) opened by f, freeing any associated resource...
FSL_EXPORT fsl_db * fsl_cx_db(fsl_cx *f)
Returns a handle to f's main db (which may or may not have any relationship to the repo/checkout/conf...
The fsl namespace is reserved for an eventual C++ wrapper for the API.
Holds an allocator function and its related state.
A general-purpose buffer class, analog to Fossil's Blob class, but it is not called fsl_blob to avoid...
A struct for passing on interactive questions to fsl_confirmer_callback_f implementations.
A response for use with the fsl_confirmer API.
A fsl_confirm_callback_f and its callback state, packaged into a neat little struct for easy copy/rep...
A part of the configuration used by fsl_cx_init() and friends.
struct fsl_cx_config::@251106123110033004002313117274342103023123040065 see
Config state for use with the SQLite3 Encryption Extension (SEE).
fsl_outputer output
The output channel for the Fossil instance.
fsl_hashpolicy_e hashPolicy
Specifies the default hash policy.
fsl_see_key_f getSEEKey
If this is non NULL, it is called when the library needs to fetch the encryption key to use for a db.
void * pState
Optional state for use as the first argument to getSEEKey.
fsl_msg_listener listener
Listener for fsl_msg-type events.
bool traceSql
If true, all SQL which goes through the fossil engine will be traced to stdout.
bool sqlPrint
If true, the fsl_print() SQL function will output its output to the fsl_output()-configured channel,...
The main Fossil "context" type.
A container for storing generic error state.
A simple wrapper around the stat(2) structure resp.
This type, accessible to clients via the fsl_lib_configurable global, contains configuration-related ...
fsl_allocator allocator
Library-wide allocator.
Generic list container type.
Message payload type for FSL_MSG_type_blob.
Client callback info for receiving various events during fossil sync processing.
void * state
State for the final argument to this->callback().
fsl_msg_f callback
Callback function.
A message object type for use with fsl_sc::status().
fsl_cx * f
This message's fsl_cx context, providing the callback with access to the associated SCM state.
void const * payload
An optional bit of informative text.
fsl_msg_e type
The type of status message.
An interface which encapsulates data for managing an output destination, primarily intended for use w...
Represents a prepared statement handle.
This file declares a number of utility classes and routines used by libfossil.
int(* fsl_output_f)(void *state, void const *src, fsl_size_t n)
Generic interface for streaming out data.