SHGEO_PREC_REGION
0
Location precision of a 'regional area'.
Roughly 3000 square miles.
SHGEO_PREC_ZONE
1
Location precision of a 'zone'.
Roughly 30 square miles.
SHGEO_PREC_DISTRICT
2
Location precision of a 'district of land'.
Roughly 0.3 square miles.
SHGEO_PREC_SITE
3
Location precision of a 'land site'.
Roughly 85,000 square feet.
SHGEO_PREC_SECTION
4
Location precision of a 'section of area'.
Roughly 800 square feet.
SHGEO_PREC_SPOT
5
Location precision of a 'spot of land'.
Roughly 8 square feet.
SHGEO_PREC_POINT
6
Location precision of a single point.
Roughly 10 square inches.
SHGEO_MAX_PRECISION
6
The number of precision specifications available.
SHGEO_SYSTEM_DATABASE_NAME
"geo"
The system-level geodetic database.
SHGEO_USER_DATABASE_NAME
"geo.usr"
The user-level geodetic database.
SHGEO_ZIPCODE
"sys_zipcode_NA"
A database table containing common north-america zipcodes.
SHGEO_COMMON
"sys_common_NA"
A database table containing common north-america places.
SHGEO_NETWORK
"sys_network_NA"
A database table containing common north-america IP address locations.
SHGEO_CITY
"sys_city_NA"
A database table containing common north-america city names.
SHAUTH_SECONDARY
(1 << 1)
SHAUTH_SECRET
(1 << 2)
public key is derived from local seed secret
SHAUTH_EXTERNAL
(1 << 3)
authorization method provided via external (not local user) means
SHAUTH_TIME
(1 << 4)
the algorithm uses a relative time as the payload message to sign (2fa).
SHPERM_ADMIN
(SHPERM_READ | SHPERM_WRITE | SHPERM_CREATE | \
SHPERM_VERIFY | SHPERM_DELETE)
SHAPP_LOCAL
(1 << 0)
An application that is not intended to be publically accessible.
SHAPP_RLIMIT
(1 << 1)
Indicates that the "soft" resource limitations set by OS should be utilized.
MESSAGE_QUEUE_SIZE
4096000
The maximum size of an individual libshare message queue.
MAX_MESSAGES_PER_QUEUE
2048
The maximum number of messages a message queue can contain.
SHMSGF_RMID
(1 << 0)
remove a message queue's resources.
SHMSGF_OVERFLOW
(1 << 1)
discard stale messages when queue is full.
SHMSGF_ANONYMOUS
(1 << 2)
allow for receiving messages sent by one self.
SHMSGF_AUTH
(1 << 4)
unused
SHPROC_MAX
100
A control option which manages the maximum number of processes spawned.
SHPROC_POOL_DEFAULT_SIZE
16
The default maximum number of processes spawned.
SHESIG_VERSION
htonl(3UL)
SHESIG_ALG_DEFAULT
SHALG_ECDSA384R
TXREF_SYMBOL
0
A symbolic reference of with no systematic use.
TXREF_TEST
1
A symbolic reference for testing-use only.
shesig_sub_pub
((_cert)->pub)
The subject's public key from a share certificate.
shesig_sub_sig
((_cert)->data_sig)
A signature of the parent certicate's public key.
shesig_sub_stamp
((_cert)->stamp)
The share time-stamp of when the certificate subject's signature becomes valid.
shesig_sub_expire
((_cert)->expire)
The share time-stamp of when the certificate subject's signature validicity expires.
shesig_sub_alg
(ntohl((_cert)->alg))
Obtain the subject's signature algorithm from a share certificate.
shesig_sub_alg_set
((_cert)->alg = htonl(_alg))
shesig_sub_ser
((_cert)->ser)
Obtain the serial number of the certificate.
shesig_sub_len
(shalg_size((_cert)->data_sig)/2)
Obtain the length of the context used to create the signature.
SHPKGOP_EXTRACT
&shpkg_extract_op
SHPKGOP_SIGN
&shpkg_sign_op
SHPKGOP_UNSIGN
&shpkg_unsign_op
SHPKGOP_REMOVE
&shpkg_remove_op
SHPKGOP_LIST
&shpkg_list_op
SHCTX_DEFAULT_EXPIRE_TIME
63072000
SHCTX_MAX_VALUE_SIZE
4096
SHCTX_TABLE_COMMON
"common"
SHCTX_DATABASE_NAME
"ctx"
typedef struct shgeo_t shgeo_t
typedef struct shloc_t shloc_t
typedef struct shseed_t shseed_t
typedef struct shadow_t shadow_t
typedef struct shmsg_t shmsg_t
typedef int(* shproc_op_t)(int, shbuf_t *buff)
typedef struct shproc_req_t shproc_req_t
typedef struct shproc_t shproc_t
typedef struct shproc_pool_t shproc_pool_t
typedef int(* shpkg_op_t)(shpkg_t *, char *, shfs_ino_t *)
void shgeo_set
(shgeo_t *geo, shnum_t lat, shnum_t lon, int alt)
Establish a geodetic location based off a latitude, longitude, and optional altitude.
void shgeo_loc
(shgeo_t *geo, shnum_t *lat_p, shnum_t *lon_p, int *alt_p)
Obtain the latitude, longitude, and altitude for a geodetic location.
time_t shgeo_lifespan
(shgeo_t *geo)
The duration since the geodetic location was established in seconds.
shkey_t* shgeo_tag
(shgeo_t *geo, int prec)
A 'key tag' representing the geodetic location in reference to a particular precision.
int shgeo_cmp
(shgeo_t *geo, shgeo_t *cmp_geo, int prec)
Compare two geodetic locations for overlap based on precision specified.
int shgeo_cmpf
(shgeo_t *geo, double lat, double lon)
double shgeo_radius
(shgeo_t *f_geo, shgeo_t *t_geo)
The combined latitude and longitude distances between two geodetic locations.
void shgeo_dim
(shgeo_t *geo, int prec)
Reduce the precision of a geodetic location.
void shgeo_local
(shgeo_t *geo, int prec)
Obtain the device's current location.
void shgeo_local_set
(shgeo_t *geo)
Manually set the device's current location.
int shgeodb_scan
(shnum_t lat, shnum_t lon, shnum_t radius, shgeo_t *geo)
Search an area for a known geodetic location.
int shgeodb_place
(const char *name, shgeo_t *geo)
Search for a known geoetic location based on a location name.
int shgeodb_host
(const char *name, shgeo_t *geo)
Search for a known geodetic location given an IP or Host network address.
int shgeodb_loc
(shgeo_t *geo, shloc_t *loc)
Search for a known geodetic location given an IP or Host network address.
int shgeodb_loc_set
(shgeo_t *geo, shloc_t *loc)
Set custom location information for a particular geodetic location.
int shgeodb_loc_unset
(shgeo_t *geo)
const char* shgeo_place_desc
(char *code)
A formal description of a particular place code.
int shgeo_place_prec
(char *code)
The geometric precision for a particular place type.
const char** shgeo_place_codes
(void)
An array of codes signifying difference types of places.
int shgeodb_rowid
(shdb_t *db, const char *table, shgeo_t *geo, shdb_idx_t *rowid_p)
Obtain a rowid for a particular geodetic location in a given database.
int shgeodb_name
(shdb_t *db, char *table, const char *name, shgeo_t *geo)
Obtain a geodetic location from a location name in a given database.
uint64_t shpam_uid
(char *username)
A unique reference to a share account.
shkey_t* shpam_ident_gen
(uint64_t uid, shpeer_t *peer)
An identity key referencing an account for an application.
shkey_t* shpam_ident_root
(shpeer_t *peer)
The 'root' identity for an application.
int shpam_ident_verify
(shkey_t *id_key, uint64_t uid, shpeer_t *peer)
Verify that an identity key references an application account.
uint64_t shpam_salt
(void)
Generate a random salt to be used to perterb a password key.
const char* shpam_username_sys
(void)
The current user's system account name.
const char* shuser_self
(void)
uint64_t shuser_id
(char *acc_name)
uint64_t shuser_self_id
(void)
int shuser_create
(char *acc_name, shpriv_t **priv_p)
Create a new user account.
Param
username
The account name.
ret_sess
A session key which can be used to perform priveleged operations on the user account created.
Return Value
A libshare error code.
Note
The effective current user must have SHPERM_CREATE permission to peform this action.
int shuser_create_priv
(char *acc_name, shpriv_t *priv, shpriv_t **priv_p)
int shuser_login_2fa
(char *acc_name, char *passphrase, uint32_t code_2fa, shpriv_t **priv_p)
int shuser_login
(char *acc_name, char *passphrase, shpriv_t **priv_p)
int shuser_pass_set
(char *acc_name, shpriv_t *priv, char *passphrase)
int shuser_info_set
(char *acc_name, shpriv_t *priv, int cmd, unsigned char *data, size_t data_len)
int shuser_remove
(char *acc_name, shpriv_t *priv)
int shuser_info
(char *acc_name, int cmd, unsigned char *ret_data, size_t *ret_len_p)
shjson_t* shuser_json
(char *acc_name)
int shuser_verify
(char *acc_name)
int shuser_inform
(uint64_t uid)
Notify the shared daemon of an account.
int shuser_admin_default
(shpriv_t **priv_p)
int shpam_shadow_login
(shfs_ino_t *file, char *acc_name, uint32_t code_2fa, unsigned char *pass_data, size_t pass_len, shpriv_t **priv_p)
int shpam_shadow_pass_set
(shfs_ino_t *file, char *acc_name, shpriv_t *priv, unsigned char *pass_data, size_t pass_len)
int shpam_shadow_remove
(shfs_ino_t *file, uint64_t uid, shpriv_t *priv)
int shpam_shadow_get
(shfs_ino_t *file, uint64_t uid, int cmd, unsigned char *raw, size_t *raw_len_p)
int shpam_shadow_set
(shfs_ino_t *file, uint64_t uid, shpriv_t *priv, int cmd, unsigned char *raw, size_t raw_len)
int shpam_shadow_uid_verify
(shfs_ino_t *file, uint64_t uid)
shjson_t* shpam_shadow_json
(shfs_ino_t *file, uint64_t uid)
shfs_ino_t* shpam_shadow_file
(shfs_t **fs_p)
int shpam_shadow_remote_set
(shfs_ino_t *file, uint64_t uid, shauth_t *auth)
int shpam_shadow_priv_verify
(shfs_ino_t *file, shpriv_t *priv)
int shpam_shadow_admin_login
(shfs_ino_t *file, unsigned char *pass_data, size_t pass_len, shpriv_t **priv_p)
shpriv_t* shpam_shadow_admin_default
(shfs_ino_t *file)
shtime_t shpam_shadow_ctime
(shfs_ino_t *file, uint64_t uid)
int shpam_shadow_auth_load
(shfs_ino_t *file, uint64_t uid, int scope, shauth_t *ret_auth)
int shpam_auth_set
(shseed_t *seed, char *username, unsigned char *pass_data, size_t pass_len)
Generate a pass key from the username and pass code provided.
int shpam_auth_verify
(shseed_t *seed, char *username, unsigned char *pass_data, size_t pass_len)
Verify a password seed references a username and password.
uint64_t shpam_salt_crypt
(void)
Obtain the linux PAM salt used to "crypt" the passphrase.
int shpam_auth_alg_default
(int scope)
int shpam_auth_init
(uint64_t uid, shseed_t *seed)
int shpam_auth_2fa_verify
(shseed_t *seed, char *username, uint32_t code_2fa)
uint64_t shpam_master_seed
(shseed_t *seed)
A checksum which is representative of the "secret data" associated with an account.
uint64_t shpam_euid
(void)
char* shapp_name
(char *app_name)
Strips the absolute parent from .
app_name
Note
"/test/one/two" becomes "two"
Return Value
Relative filename of executable.
Param
app_name
The running application's executable path
shpeer_t* shapp_init
(char *exec_path, char *host, int flags)
Initialize the share library runtime for an application.
Param
exec_path
The process's executable path.
host
The host that the app runs on or NULL for localhost.
flags
application flags
int shapp_register
(shpeer_t *peer)
int shapp_listen
(int tx, shpeer_t *peer)
int shapp_account
(const char *username, char *passphrase, shseed_t **seed_p)
int shapp_ident
(uint64_t uid, shkey_t **id_key_p)
shkey_t* shapp_kpriv
(shpeer_t *peer)
shkey_t* shapp_kpub
(shpeer_t *peer)
int shlog
(int level, int err_code, char *log_str)
Perform a generic logging operation.
void sherr
(int err_code, char *log_str)
Log a libshare error code (SHERR_XXX) and an error message.
void shwarn
(char *log_str)
Log a warning message.
void shinfo
(char *log_str)
Log a informational message.
int shmsgget
(shpeer_t *peer)
Obtain the message queue id from a share library peer.
Param
peer
The destination peer message queue.
int shmsgsnd
(int msqid, const void *msgp, size_t msgsz)
Send a message to a share library peer.
Param
msg_qid
The share library message queue id.
msg_type
A non-zero user-defined categorical number.
See
shmsgget()
group__libshare__sysmsg_1ga3c42c2559874defb448a3b0436c919f1
member
int shmsg_write
(int msg_qid, shbuf_t *msg_buff, shkey_t *dest_key)
Send a message to a share library peer.
Param
dest_key
Peer key of message destination. Specifying NULL indicates to use the peer used to open the message queue.
See
shmsgget()
group__libshare__sysmsg_1ga3c42c2559874defb448a3b0436c919f1
member
int shmsgrcv
(int msqid, void *msgp, size_t msgsz)
Receive a message from a share library peer.
int shmsg_read
(int msg_qid, shkey_t *src_key, shbuf_t *msg_buff)
Receive a message from a share library peer.
int shmsgctl
(int msg_qid, int cmd, int value)
Set or retrieve message queue control attributes.
shproc_pool_t* shproc_init
(shproc_op_t req_f, shproc_op_t resp_f)
Create a new pool to manage process workers.
int shproc_conf
(shproc_pool_t *pool, int type, int val)
Configure a process pool's attributes.
-
SHPROC_MAX The maximum number of processes that can be spawned in the pool.
-
SHPROC_PRIO A value in the range -20 to 19. A lower priority indicates a more favorable scheduling.
Param
type
The configuration option value to set or get.
val
Zero to indicate a 'Get Value' request; otherwise the parameter specifies the value to the option to.
shproc_pool_t* shproc_pool
(void)
Obtain currrent pool, if any, that has been initialized.
shproc_t* shproc_start
(shproc_pool_t *pool)
Start a new process to handle worker requests.
int shproc_stop
(shproc_t *proc)
Terminate a running worker process.
shproc_t* shproc_get
(shproc_pool_t *pool, int state)
Obtain a process slot from the pool based on process state.
int shproc_schedule
(shproc_t *proc, unsigned char *data, size_t data_len)
shproc_t* shproc_pull
(shproc_pool_t *pool)
Obtain a process from the pool that is ready for work.
int shproc_push
(shproc_pool_t *pool, int fd, unsigned char *data, size_t data_len)
Perform a request against a process ready for work.
void shproc_free
(shproc_pool_t **pool_p)
deallocate resources for a process pool
void shproc_signal
(void *sig_f)
Set a custom signal handler for worker process.
void shproc_poll
(shproc_pool_t *pool)
Process pending communications with worker process(es).
void shproc_rlim_set
(void)
uint64_t shproc_rlim
(int mode)
int shesig_init
(shesig_t *cert, char *entity, int alg, int flags)
int shesig_ca_init
(shesig_t *cert, char *entity, int alg, int flags)
int shesig_sign
(shesig_t *cert, shesig_t *parent, unsigned char *key_data, size_t key_len)
int shesig_import
(shesig_t *cert, char *iss, shalg_t iss_pub)
Insert a certificate from an external origin.
void shesig_free
(shesig_t **cert_p)
char* shesig_id_hex
(shesig_t *cert)
char* shesig_flag_str
(int flags)
int shesig_id_verify
(shesig_t *cert)
void shesig_id_gen
(shesig_t *cert)
void shesig_print
(shesig_t *cert, shbuf_t *pr_buff)
const char* shesig_serialno
(shesig_t *cert)
int shesig_verify
(shesig_t *cert, shesig_t *parent)
void shesig_serial
(shesig_t *cert, unsigned char *ret_data, size_t *ret_len_p)
void shesig_serial_set
(shesig_t *cert, unsigned char *serial, size_t serial_len)
unsigned int shesig_version
(shesig_t *cert)
void shesig_version_set
(shesig_t *cert, unsigned int ver)
uint64_t shesig_uid
(shesig_t *cert)
shkey_t* shesig_ctx
(shesig_t *cert)
void shesig_ctx_name_set
(shesig_t *cert, char *label)
void shesig_ctx_set
(shesig_t *cert, shkey_t *ctx_name)
shtime_t shesig_expire
(shesig_t *cert)
void shesig_expire_set
(shesig_t *cert, shtime_t stamp)
shtime_t shesig_stamp
(shesig_t *cert)
void shesig_stamp_set
(shesig_t *cert, shtime_t stamp)
char* shesig_iss
(shesig_t *cert)
void shesig_iss_set
(shesig_t *cert, char *name)
char* shesig_ent
(shesig_t *cert)
void shesig_ent_set
(shesig_t *cert, char *name)
int shesig_load_alias
(char *label, shesig_t **cert_p)
int shesig_load
(shkey_t *id, shesig_t **cert_p)
int shesig_load_path
(char *fname, shesig_t **cert_p)
int shesig_save
(shesig_t *cert, shbuf_t *buff)
int shesig_remove_alias
(char *label)
int shesig_remove_label
(char *ref_path)
int shlic_apply
(SHFL *file, shesig_t *cert, unsigned char *key_data, size_t key_len)
Apply a licensing certificate to a shfs file.
int shlic_validate
(SHFL *file)
Validates authorized licensing of a file.
int shlic_sign
(shlic_t *lic, shesig_t *parent, unsigned char *key_data, size_t key_len)
int shlic_set
(SHFL *file, shlic_t *lic)
int shlic_get
(SHFL *file, shlic_t *ret_lic)
char* shcache_path
(const char *tag)
int shcache_write
(const char *tag, shbuf_t *buff)
int shcache_read
(const char *tag, shbuf_t *buff)
int shcache_fresh
(const char *tag)
void shcache_purge
(char *path)
time_t shcache_ttl
(void)
int shpkg_extract_op
(shpkg_t *pkg, char *path, SHFL *file)
int shpkg_sign_op
(shpkg_t *pkg, char *path, SHFL *file)
int shpkg_unsign_op
(shpkg_t *pkg, char *path, SHFL *file)
int shpkg_remove_op
(shpkg_t *pkg, char *path, SHFL *file)
int shpkg_list_op
(shpkg_t *pkg, char *path, SHFL *file)
int shpkg_op_dir
(shpkg_t *pkg, char *dir_name, char *fspec, shpkg_op_t op)
int shpkg_init
(char *pkg_name, shpkg_t **pkg_p)
shkey_t* shpkg_sig
(shpkg_t *pkg)
void shpkg_free
(shpkg_t **pkg_p)
char* shpkg_version
(shpkg_t *pkg)
void shpkg_version_set
(shpkg_t *pkg, char *ver_text)
char* shpkg_name_filter
(char *in_name)
char* shpkg_name
(shpkg_t *pkg)
shpkg_t* shpkg_load
(char *pkg_name, shkey_t *cert_sig)
int shpkg_sign_remove
(shpkg_t *pkg)
int shpkg_extract
(shpkg_t *pkg)
int shpkg_owner
(shpkg_t *pkg)
int shpkg_cert_clear
(shpkg_t *pkg)
int shpkg_remove
(shpkg_t *pkg)
SHFL* shpkg_spec_file
(shpkg_t *pkg)
int shpkg_sign
(shpkg_t *pkg, shesig_t *parent, int flags, unsigned char *key_data, size_t key_len)
int shpkg_sign_name
(shpkg_t *pkg, char *parent_alias, int flags, unsigned char *key_data, size_t key_len)
int shpkg_extract_files
(shpkg_t *pkg, char *fspec)
int shpkg_file_license
(shpkg_t *pkg, SHFL *file)
int shpkg_add
(shpkg_t *pkg, SHFL *file)
int shctx_set
(char *name, unsigned char *data, size_t data_len)
Set an auxillary context.
int shctx_setstr
(char *name, char *data)
Set an auxillary string context.
int shctx_get
(char *name, shctx_t *ctx)
Get an auxillary context.
int shctx_set_key
(shkey_t *name_key, unsigned char *data, size_t data_len)
Store auxillary context via a share-key.
int shctx_get_key
(shkey_t *name_key, shctx_t *ctx)
Retrieve auxillary context via a share-key.
int shctx_notify
(shkey_t *name_key)
inform the shared daemon to relay a local context.
shkey_t* shctx_key
(char *name)
A (shr160 / ripemd32) share key referencing the textual name.
Param
name
An unlimited length literal string.
Return Value
An un-allocated share-key.
Note
The returned share-key does not need to be freed.