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