UCommon
|
Common namespace for all ucommon objects. More...
Data Structures | |
class | array_pointer |
Generic smart array class. More... | |
class | array_reuse |
An array of reusable objects. More... | |
class | charbuf |
A copy-on-write string class that operates by reference count. More... | |
class | linked_pointer |
A smart pointer template for iterating linked lists. More... | |
class | linked_pointer< sockaddr_struct > |
Linked pointer for address lists. More... | |
class | linked_value |
A linked object base class for ordered objects. More... | |
class | mapped_array |
Map a reusable allocator over a named shared memory segment. More... | |
class | mapped_reuse |
Template class to map typed reusable objects into shared memory heap. More... | |
class | mapped_view |
Class to access a named mapped segment published from another process. More... | |
class | object_pointer |
Typed smart pointer class. More... | |
class | paged_reuse |
A reusable private pool of reusable types. More... | |
class | pager |
This is a base class for objects that may be created in pager pools. More... | |
class | pointer |
Generic smart pointer class. More... | |
class | sarray |
Generate a typed sparse managed object array. More... | |
class | save_restore |
Save and restore global objects in function call stack frames. More... | |
class | sequence |
A template to return a sequence of objects of a specified type. More... | |
class | stringbuf |
A string class that has a predefined string buffer. More... | |
class | temporary |
Manage temporary object stored on the heap. More... | |
class | treemap |
Embed data objects into a tree structured memory database. More... | |
Typedefs | |
typedef ConditionalAccess | accesslock_t |
Convenience type for scheduling access. | |
typedef Barrier | barrier_t |
Convenience type for using thread barriers. | |
typedef typeref< Type::Bools > | boolref_t |
typedef arrayref< Type::Bytes > | bytearray_t |
typedef typeref< Type::Bytes > | byteref_t |
typedef typeref< Type::Bytes >::value * | bytevalues_t |
typedef typeref< Type::Chars >::value * | charvalues_t |
typedef Cipher | cipher_t |
Convenience type for generic ciphers. | |
typedef counter | counter_t |
A convenience typecast for integer counters. | |
typedef Date | date_t |
Convenience type for using Date object. | |
typedef DateTimeString | datetimestring_t |
Convenience type for using DateTimeString object. | |
typedef Digest | digest_t |
Convenience type for generic digests. | |
typedef dir | dir_t |
typedef DirPager | dirlist_t |
A convenience type for using DirPager directly. | |
typedef dso | dso_t |
typedef HMAC | hmac_t |
Convenience type for generic digests. | |
typedef secure::string | keystring_t |
typedef LinkedObject * | LinkedIndex |
Convenience typedef for root pointers of single linked lists. | |
typedef DLinkedObject | LinkedList |
typedef void * | mem_t |
Convenience type for loader operations. | |
typedef Mutex | mutex_t |
Convenience type for using exclusive mutex locks. | |
typedef RecursiveMutex | rexlock_t |
Convenience type for using recursive exclusive locks. | |
typedef RWLock | rwlock_t |
Convenience type for using read/write locks. | |
typedef Semaphore | semaphore_t |
Convenience type for using counting semaphores. | |
typedef Cipher::Key | skey_t |
Convenience type for generic cipher key. | |
typedef String | string_t |
A convenience type for string. | |
typedef arrayref< Type::Chars > | stringarray_t |
typedef String::regex | stringex_t |
typedef StringPager | stringlist_t |
A convenience type for paged string lists. | |
typedef StringPager::member | stringlistitem_t |
A convenience type for paged string list items. | |
typedef typeref< Type::Chars > | stringref_t |
typedef TCPServer | tcpserv_t |
typedef Timer | timer_t |
A convenience type for timers. | |
typedef Time | tod_t |
Convenience type for using Time object. | |
typedef toggle | toggle_t |
A convenience typecast for auto-toggled bools. | |
typedef int16_t | ucs2_t |
16 bit unicode character code. More... | |
typedef int32_t | ucs4_t |
32 bit unicode character code. More... | |
typedef void * | unicode_t |
Resolves issues where wchar_t is not defined. | |
typedef UString | ustring_t |
Convenience type for utf8 encoded strings. | |
typedef utf8_pointer | utf8_t |
Convenience type for utf8_pointer strings. | |
typedef unsigned short | vectorsize_t |
typedef ZNumber | znumber_t |
A convenience type for znumber. | |
Functions | |
class | __attribute__ ((visibility("default"))) ExclusiveProtocol |
An exclusive locking protocol interface base. More... | |
const char * | __TEXT (const char *s) |
Invoke translation lookup if available. More... | |
const char * | _TEXT (const char *s) |
template<typename T > | |
const T | abs (const T &value) |
Template for absolute value of a type. More... | |
const struct sockaddr * | addr (Socket::address &address) |
A convenience function to convert a socket address list into a socket address. More... | |
struct addrinfo * | addrinfo (Socket::address &address) |
A convenience function to convert a socket address list into an addrinfo. More... | |
template<typename T > | |
bool | bound (const T *pointer, const T *base, size_t count) |
Convenience function to check memory arrays. More... | |
template<typename T > | |
T & | clear (T &o) |
template<typename T > | |
class __attribute__((visibility("default"))) sstream void | clearmem (T &var) |
Secure socket using std::iostream. More... | |
template<typename T > | |
T | copy (const T &src) |
Convenience function to copy objects. | |
template<typename T > | |
T & | copy (const T &src, T &to) |
template<typename T > | |
void | copy_unsafe (T *target, const T *source) |
Convenience function to copy class. More... | |
template<typename T > | |
T & | deref_pointer (T *pointer) |
Convert a pointer to a reference with type checking. More... | |
template<typename T > | |
T * | dup (const T &object) |
Convenience function to duplicate object pointer to heap. More... | |
template<> | |
char * | dup< char > (const char &object) |
template<typename T > | |
void | dupfree (T object) |
template<> | |
void | dupfree< char * > (char *object) |
template<> | |
void | dupfree< ucs2_t * > (ucs2_t *string) |
template<> | |
void | dupfree< ucs4_t * > (ucs4_t *string) |
template<> | |
void | dupfree< unicode_t > (unicode_t string) |
bool | eq (char const *s1, char const *s2) |
Compare two null terminated strings if equal. More... | |
bool | eq (char const *s1, char const *s2, size_t size) |
Compare two null terminated strings if equal up to specified size. More... | |
bool | eq (const struct sockaddr *s1, const struct sockaddr *s2) |
Compare two socket addresses to see if equal. More... | |
bool | eq (const struct sockaddr_storage *s1, const struct sockaddr_storage *s2) |
Compare two stored socket addresses to see if equal. More... | |
bool | eq (String &s1, const char *s2) |
Compare two string objects if equal. More... | |
bool | eq_case (char const *s1, char const *s2) |
Compare two null terminated strings if equal ignoring case. More... | |
bool | eq_case (char const *s1, char const *s2, size_t size) |
Compare two null terminated strings if equal for a specified size ignoring case. More... | |
bool | eq_host (const struct sockaddr *s1, const struct sockaddr *s2) |
Compare two host addresses to see if equal. More... | |
bool | eq_subnet (const struct sockaddr *s1, const struct sockaddr *s2) |
bool | ge (String &s1, const char *s2) |
bool | gt (String &s1, const char *s2) |
template<typename T > | |
bool | is (T &object) |
Convenience function to validate object assuming it is castable to bool. More... | |
bool | is_device (const char *path) |
bool | is_dir (const char *path) |
bool | is_executable (const char *path) |
bool | is_exists (const char *path) |
bool | is_file (const char *path) |
bool | is_link (const char *path) |
bool | is_readable (const char *path) |
bool | is_writable (const char *path) |
template<typename T > | |
bool | isnull (T &object) |
Convenience function to test pointer object. More... | |
template<typename T > | |
bool | isnullp (T *object) |
Convenience function to test pointer-pointer object. More... | |
bool | le (String &s1, const char *s2) |
template<typename T > | |
T &() | limit (T &value, T &low, T &high) |
Convenience macro to range restrict values. More... | |
bool | lt (String &s1, const char *s2) |
template<typename T > | |
class __attribute__((visibility("default"))) MapRef size_t | mapkeypath (typeref< T > &object) |
template<> | |
size_t | mapkeypath< const char * > (typeref< const char * > &object) |
template<> | |
size_t | mapkeypath< const uint8_t * > (typeref< const uint8_t * > &object) |
template<typename T > | |
bool | mapped_keyequal (const T *key1, const T *key2) |
template<> | |
bool | mapped_keyequal< char > (const char *k1, const char *k2) |
template<> | |
bool | mapped_keyequal< struct sockaddr > (const struct sockaddr *s1, const struct sockaddr *s2) |
template<typename T > | |
size_t | mapped_keypath (const T *addr) |
template<> | |
size_t | mapped_keypath< char > (const char *addr) |
template<> | |
size_t | mapped_keypath< struct sockaddr > (const struct sockaddr *addr) |
template<typename T > | |
const T() | max (const T &v1, const T &v2) |
Template for max value of a type. More... | |
template<typename T > | |
T &() | max (T &o1, T &o2) |
Convenience function to return max of two objects. More... | |
template<typename T > | |
const T() | min (const T &v1, const T &v2) |
Template for min value of a type. More... | |
template<typename T > | |
T &() | min (T &o1, T &o2) |
Convenience function to return min of two objects. More... | |
template<typename T > | |
T & | move (T &src, T &to) |
Convenience function to move objects. | |
bool | ne (char const *s1, char const *s2) |
bool | ne (char const *s1, char const *s2, size_t size) |
bool | ne (String &s1, String &s2) |
bool | ne_case (char const *s1, char const *s2) |
std::string & | operator+ (std::string &target, String &source) |
std::string & | operator+= (std::string &target, String &source) |
std::ostream & | operator<< (std::ostream &os, Socket::address &addr) |
std::ostream & | operator<< (std::ostream &out, const PrintProtocol &format) |
std::ostream & | operator<< (std::ostream &out, const string_t &str) |
std::ostream & | operator<< (std::ostream &out, const stringlist_t &list) |
std::istream & | operator>> (std::istream &in, stringlist_t &list) |
std::istream & | operator>> (std::istream &inp, InputProtocol &format) |
std::istream & | operator>> (std::istream &inp, string_t &str) |
template<typename T > | |
void | reset_unsafe (T &object) |
Convenience function to reset an existing object. More... | |
template<typename T > | |
void | store_unsafe (T &target, const T *source) |
Convenience function to store object pointer into object. More... | |
String | str (const char *string) |
String | str (double value) |
String | str (long value) |
String | str (short value) |
String | str (Socket &so, size_t size) |
String | str (String &string) |
String | str (StringPager &list, const char *prefix=NULL, const char *middle=NULL, const char *suffix=NULL) |
String | str (unsigned long value) |
String | str (unsigned short value) |
ucs4_t * | strudup (const char *string) |
ucs2_t * | strwdup (const char *string) |
template<typename T > | |
void | swap (T &o1, T &o2) |
Convenience function to swap objects. More... | |
template<> | |
void | swap< string_t > (string_t &s1, string_t &s2) |
template<typename T > | |
typeref< T > | typeref_cast (T x) |
template<typename T > | |
void | zero_unsafe (T &object) |
Convenience function to zero an object and restore type info. More... | |
void | zerofill (void *addr, size_t size) |
Variables | |
class __attribute__((visibility("default"))) Conditional class __attribute__((visibility("default"))) ConditionalAccess class __attribute__((visibility("default"))) ConditionalLock class __attribute__((visibility("default"))) Barrier class __attribute__((visibility("default"))) Semaphore typedef ConditionalLock | condlock_t |
The conditional is a common base for other thread synchronizing classes. More... | |
class __attribute__((visibility("default"))) DateTime class __attribute__((visibility("default"))) DateTimeString class __attribute__((visibility("default"))) DateNumber class __attribute__((visibility("default"))) isotime typedef DateTime | datetime_t |
The Datetime class uses a julian date representation of the current year, month, and day and a integer representation of the current time. More... | |
class __attribute__((visibility("default"))) dir typedef fsys | fsys_t |
Convenience class for directories. More... | |
class __attribute__((visibility("default"))) ZNumber typedef Number | number_t |
A number manipulation class that maintains a zero lead filled string. More... | |
class __attribute__((visibility("default"))) shell typedef shell | shell_t |
A utility class for generic shell operations. More... | |
class __attribute__((visibility("default"))) JoinableThread class __attribute__((visibility("default"))) DetachedThread typedef TimedEvent | timedevent_t |
A child thread object that may be joined by parent. More... | |
class __attribute__((visibility("default"))) TimerQueue typedef TimerQueue::event | TQEvent |
A timer queue for timer events. More... | |
Common namespace for all ucommon objects.
We are using a common namespace to easily separate ucommon from other libraries. This namespace usage is set to the package name and controlled by macros so future changes will be hidden from user applications so long as the namespace macros (UCOMMON_NAMESPACE, NAMESPACE_UCOMMON, END_NAMESPACE) are used in place of direct namespace declarations.
typedef int16_t ucommon::ucs2_t |
typedef int32_t ucommon::ucs4_t |
ucommon::__attribute__ | ( | (visibility("default")) | ) |
An exclusive locking protocol interface base.
A copy-on-write utf8 string class that operates by reference count.
A core class of ut8 encoded string functions.
Smart pointer base class for auto-retained objects.
Timer class to use when scheduling realtime events.
An abstract class for defining classes that operate as a thread.
A generic and portable implementation of Read/Write locking.
Common stream buffer for std C++ i/o classes.
A bound socket used to listen for inbound socket connections.
A class to hold internet segment routing rules.
Cryptographically relevant random numbers.
A cryptographic message authentication code class.
A cryptographic digest class.
A generic data ciphering class.
Common secure socket support.
Key data protocol used for things like maps and ordered lists.
A common base class for all managed objects.
Used for processing input.
Used for forming stream output.
A redirection base class for the memory protocol.
A sparse array of managed objects.
A base class for reference counted objects.
A number manipulation class.
A memory protocol pager for private heap manager.
Construct or access a named section of memory.
Common base class for all objects that can be formed into a linked list.
Convenience class for library plugins.
A container for generic and o/s portable threadsafe file system functions.
The Time class uses a integer representation of the current time.
The Date class uses a julian date representation of the current year, month, and day.
Automatically return a sequence of untyped objects.
Automatic integer counting class.
The condition Var allows multiple conditions to share a mutex.
Condition Mutex to pair with conditionals.
Generic atomic class for referencing atomic objects and static functions.
A kind of smart pointer object to support shared locking protocol.
An exclusive locking access interface base.
This is an abstract class to form objects that will operate under an exclusive lock while being actively referenced by a smart pointer.
This object initiates a shared lock for the object being referenced when it is instantiated, and releases the shared lock when it is destroyed. You would pass the pointer an object that has the Shared as a base class.
We have an atomic counter and spinlock, and in the future we may add other atomic classes and atomic manipulations needed to create lockfree data structures. The atomic classes use mutexes if no suitable atomic code is available.
Separating the mutex means we can apply it either paired with a condition variable, or shared among multiple condition variables.
This can be used to form specialized thread synchronizing classes such as ordered sempahores, or to create thread completion lists.
This is an automatic counting object that is used to retrieve a new integer value between 0 and n each time the object is referenced. When reaching the last n value, the object restarts at 0, and so is used to retrieve a sequence of values in order.
This is an automatic counter based class which returns the next pointer in an array of pointers and restarts the list when reaching the end. This is used to support the sequence template.
This is then manipulated in several forms and may be exported as needed.
julian number based date class.
This is then manipulated in several forms and may be exported as needed. The time object can represent an instance in time (hours, minutes, and seconds) in a 24 hour period or can represent a duration. Millisecond accuracy can be offered.
Integer based time class.
These are based roughly on their posix equivilents. For libpth, the system calls are wrapped. The native file descriptor or handle may be used, but it is best to use "class fsys" instead because it can capture the errno of a file operation in a threadsafe and platform independent manner, including for mswindows targets.
This base class is used directly for objects that can be formed into a single linked list. It is also used directly as a type for a pointer to the start of list of objects that are linked together as a list.
A logical name is used which might map to something that is invoked from a call like shm_open or a named w32 mapped swap segment. This is meant to support mapping a vector onto shared memory and is often used as a supporting class for our shared memory access templates.
This is used to allocate in an optimized manner, as it assumes no mutex locks are held or used as part of it's own internal processing. It also is designed for optimized performance.
The mempager uses a strategy of allocating fixed size pages as needed from the real heap and allocating objects from these pages as needed. A new page is allocated from the real heap when there is insufficient space in the existing page to complete a request. The largest single memory allocation one can make is restricted by the page size used, and it is best to allocate objects a significant fraction smaller than the page size, as fragmentation occurs at the end of pages when there is insufficient space in the current page to complete a request.
This is used to extract, convert, and manage simple numbers that are represented in C ascii strings in a very quick and optimal way. This class modifies the string representation each time the value is changed. No math expressions or explicit comparison operators are supported for the Numbers class because these are best done by casting to long first.
number manipulation.
Reference counted objects keep track of how many objects refer to them and fall out of scope when they are no longer being referred to. This can be used to achieve automatic heap management when used in conjunction with smart pointers.
This might be used as a simple array class for reference counted objects. This class assumes that objects in the array exist when assigned, and that gaps in the array are positions that do not reference any object. Objects are automatically created (create on access/modify when an array position is referenced for the first time. This is an abstract class because it is a type factory for objects who's derived class form constructor is not known in advance and is a helper class for the sarray template.
This is used because sometimes we choose a common memory pool to manage different objects.
We would create a derived class who's constructor creates an internal string object, and a single method to extract that string.
We create a derived class that processes a single character of input, and returns a status value. EOF means it accepts no more input and any value other than 0 is a character to also unget. Otherwise 0 is good to accept more input. The constructor is used to reference a final destination object in the derived class.
This is used to manage objects that might be linked or reference counted. The base class defines only core virtuals some common public methods that should be used by all inherited object types.
This offers common routines needed for secure/ssl socket support code.
This is used to construct cryptographic ciphers to encode and decode data as needed. The cipher type is specified by the key object. This class can be used to send output streaming to memory or in a fixed size buffer. If the latter is used, a push() method is called through a virtual when the buffer is full. Since block ciphers are used, buffers should be aligned to the block size.
This class can support md5 digests, sha1, sha256, etc, depending on what the underlying library supports. The hash class accumulates the hash in the object.
This class can support md5 digests, sha1, sha256, etc, depending on what the underlying library supports.
This is used both to gather entropy pools and pseudo-random values.
This class can be used to provide a stand-alone representation of a cidr block of internet addresses or chained together into some form of access control list. The cidr class can hold segments for both IPV4 and IPV6 addresses. The class accepts cidr's defined as C strings, typically in the form of address/bits or address/submask. These routines auto-detect ipv4 and ipv6 addresses.
This class is commonly used for TCP and DCCP listener sockets.
This both binds the character protocol to iostream and offers a common base class for all other c++ stdlib based streaming classes.
This class implements classical read/write locking, including "timed" locks. Support for scheduling threads to avoid writer starvation is also provided for. By building read/write locks from a conditional, we make them available on pthread implemetations and other platforms which do not normally include optional pthread rwlock's. We also do not restrict the number of threads that may use the lock. Finally, both the exclusive and shared protocols are implemented to support exclusive_lock and shared_lock referencing. Because of the thread locking semantics this is part of thread rather than condition, and was originally called ThreadLock in older ucommon/commoncpp releases. Our autolock semantics are also different as we protect a target object, not a rwlock instance.
A derived thread class has a run method that is invoked with the newly created thread context, and can use the derived object to store all member data that needs to be associated with that context. This means the derived object can safely hold thread-specific data that is managed with the life of the object, rather than having to use the clumsy thread-specific data management and access functions found in thread support libraries.
The timer generally uses millisecond values but has a microsecond accuracy. On platforms that support it, the timer uses posix realtime monotonic clock extensions, otherwise lower accuracy timer systems might be used.
The underlying container is heap allocated and page aligned. A heap object is automatically de-referenced by release during destruction. The smart pointer is a protected base class used to derive strongly typed templates.
This is a foundation for all utf8 string processing.
This is derived from the classic uCommon String class by adding operations that are utf8 encoding aware.
A kind of smart pointer object to support exclusive locking protocol. This object initiates an exclusive lock for the object being referenced when it is instantiated, and releases the exclusive lock when it is destroyed. You would pass the pointer an object that has the Exclusive as a base class.
Create an instance of an exclusive object reference.
object | containing Exclusive base class protocol to lock. |
Destroy reference to exclusively locked object, release lock.
Test if the reference holds an active lock.
Test if the reference holds an active lock.
Release a held lock programmatically. This can be used to de-reference the object being exclusively locked without having to wait for the destructor to be called when the exclusive_lock falls out of scope.
Access interface to share lock the object.
A kind of smart pointer object to support shared locking protocol. This object initiates a shared lock for the object being referenced when it is instantiated, and releases the shared lock when it is destroyed. You would pass the pointer an object that has the Shared as a base class.
Create an instance of an exclusive object reference.
object | containing Exclusive base class protocol to lock. |
Destroy reference to shared locked object, release lock.
Test if the reference holds an active lock.
Test if the reference holds an active lock.
Release a held lock programmatically. This can be used to de-reference the object being share locked without having to wait for the destructor to be called when the shared_lock falls out of scope.
Call exclusive access on referenced objects protocol.
Restore shared access on referenced objects protocol.
Share the lock with other referencers. Many of our shared locking objects support the ability to switch between shared and exclusive mode. This derived protocol member allows one to restore the lock to shared mode after it has been made exclusive.
Convert object to an exclusive lock. Many of our shared locking objects such as the "conditional lock" support the ability to switch between shared and exclusive locking modes. This derived protocol member allows one to temporarily assert exclusive locking when tied to such methods.
Create an instance of an exclusive object reference.
object | containing Exclusive base class protocol to lock. |
Destroy reference to shared locked object, release lock.
Test if the reference holds an active lock.
Test if the reference holds an active lock.
Release a held lock programmatically. This can be used to de-reference the object being share locked without having to wait for the destructor to be called when the shared_lock falls out of scope.
Call exclusive access on referenced objects protocol.
Restore shared access on referenced objects protocol.
Atomic counter class. Can be used to manipulate value of an atomic counter without requiring explicit thread locking.
Atomic spinlock class. Used as high-performance sync lock between threads.
Construct and initialize spinlock.
NAMESPACE_UCOMMON Acquire the lock. If the lock is not acquired, one "spins" by doing something else. One suggestion is using thread::yield.
Wait for and aquire spinlock.
Release an acquired spinlock.
Initialize and construct conditional.
Destroy conditional, release any blocked threads.
Lock the conditional's supporting mutex.
Unlock the conditional's supporting mutex.
Initialize and construct conditional.
Destroy conditional, release any blocked threads.
Conditional wait for signal on millisecond timeout.
timeout | in milliseconds. |
Conditional wait for signal on timespec timeout.
timeout | as a high resolution timespec. |
Wait (block) until signalled.
Signal the conditional to release one waiting thread.
Signal the conditional to release all waiting threads.
Initialize integer counter of unknown size.
Initialize integer counter for a range of values.
limit | before recycling to zero. |
Get the next counter value.
Get the range of values before recycling.
Reference next counter value through pointer operation.
Reference next counter value by casting to integer.
Assign the value of the counter.
value | to assign. |
A method to use to "post" any changed values when shadowing a mixed object class. This is used by DateNumber and string classes.
Size of date string field.
Create a julian date from a time_t type.
value | from time() |
Create a julian date from a local or gmt date and time.
object | from DateTime::glt() or gmt(). |
Create a julian date from a ISO date string of a specified size.
pointer | to ISO date string. |
size | of date field if not null terminated. |
Create a julian date from an arbitrary year, month, and day.
year | of date. |
month | of date (1-12). |
day | of month (1-31). |
Create a julian date object from another object.
object | to copy. |
Construct a new julian date with today's date.
Destroy julian date object.
Get the year of the date.
Get the month of the date (1-12).
Get the day of the month of the date.
Get the day of the week (0-7).
Get a ISO string representation of the date (yyyy-mm-dd).
buffer | to store string. |
Get a time_t for the julian date if in time_t epoch.
Get the date as a number for the object or 0 if invalid.
Set (update) the date with current date.
Set the julian date based on an ISO date string of specified size.
pointer | to date string field. |
size | of field if not null terminated. |
Check if date is valid.
Casting operator to return date as number.
Access julian value.
Expression operator to return an ISO date string for the current julian date.
Increment date by one day.
Decrement date by one day.
Increment date by offset.
offset | to add to julian date. |
Decrement date by offset.
offset | to subtract from julian date. |
Add days to julian date in an expression.
days | to add. |
Subtract days from a julian date in an expression.
days | to subtract. |
Operator to compute number of days between two dates.
date | offset for computation. |
Assign date from another date object.
date | object to assign from. |
Compare julian dates if same date.
date | to compare with. |
Compare julian dates if not same date.
date | to compare with. |
Compare julian date if earlier than another date.
date | to compare with. |
Compare julian date if earlier than or equal to another date.
date | to compare with. |
Compare julian date if later than another date.
date | to compare with. |
Compare julian date if later than or equal to another date.
date | to compare with. |
Check if julian date is not valid.
Check if julian date is valid for is() expression.
Constant for number of seconds in a day.
Constant for number of seconds in a hour.
Constant for number of seconds in a week.
Size of time string field.
Create a time from the time portion of a time_t.
value | of time_t to use. |
Create a time from the time portion of a date and time object.
object | from DateTime::glt() or gmt(). |
Create a time from a hh:mm:ss formatted time string.
pointer | to formatted time field. |
size | of field if not null terminated. |
Create a time from hours (0-23), minutes (0-59), and seconds (0-59).
hour | of time. |
minute | of time. |
second | of time. |
Create a time object from another object.
object | to copy. |
Create a time from current time.
Destroy time object.
Get current time in seconds from midnight.
Get hours from midnight.
Get minutes from current hour.
Get seconds from current minute.
Get a hh:mm:ss formatted string for current time.
buffer | to store time string in. |
Set (update) the time with current time.
Set time from a hh:mm:ss formatted string.
pointer | to time field. |
size | of field if not null terminated. |
Check if time object had valid value.
Check if time object has valid value for is() operator.
Check if time object has valid value for ! operator.
Get difference (in seconds) between two times.
reference | time to get difference from. |
Add seconds to the current time, wrap if 24 hours.
seconds | to add. |
Subtract seconds to the current time, wrap if 24 hours.
seconds | to subtract. |
Get time in seconds.
Get object time in seconds.
Convert to standard 24 hour time string.
Incrememnt time by 1 second, wrap on 24 hour period.
Decrement time by 1 second, wrap on 24 hour period.
Assign a time as a copy of another time.
time | to assign from. |
Increment time by specified seconds. Wraps on 24 hour period.
seconds | to add to current time. |
Decrement time by specified seconds. Wraps on 24 hour period.
seconds | to subtract from current time. |
Compare time with another time to see if same time.
time | to compare with. |
Compare time with another time to see if not same time.
time | to compare with. |
Compare time if earlier than another time.
time | object to compare with. |
Compare time if earlier than or equal to another time.
time | object to compare with. |
Compare time if later than another time.
time | object to compare with. |
Compare time if later than or equal to another time.
time | object to compare with. |
Most of the common chmod values are predefined.
Enumerated file access modes.
File offset type.
Used to mark "append" in set position operations.
Construct an unattached fsys descriptor.
Contruct fsys from raw file handle.
Copy (dup) an existing fsys descriptor.
descriptor | to copy from. |
Create a fsys descriptor by opening an existing file or directory.
path | of file to open for created descriptor. |
access | mode of file. |
Create a fsys descriptor by creating a file.
path | of file to create for descriptor. |
access | mode of file access. |
permission | mode of file. |
Close and release a file descriptor.
Get the descriptor from the object by pointer reference.
Get the descriptor from the object by casting reference.
Reset error flag.
Test if file descriptor is open.
Test if file descriptor is closed.
Assign file descriptor by duplicating another descriptor.
descriptor | to dup from. |
Replace current file descriptor with an external descriptor. This does not create a duplicate. The external descriptor object is marked as invalid.
Assing file descriptor from system descriptor.
descriptor | to dup from. |
Get the native system descriptor handle of the file descriptor.
Set with external descriptor. Closes existing file if open.
descriptor | of open file. |
Release descriptor, do not close.
Set the position of a file descriptor.
offset | from start of file or "end" to append. |
Drop cached data from start of file.
size | of region to drop or until end of file. |
See if current file stream is a tty device.
See if the file handle is a tty device.
Read data from descriptor or scan directory.
buffer | to read into. |
count | of bytes to read. |
Write data to descriptor.
buffer | to write from. |
count | of bytes to write. |
Get status of open descriptor.
buffer | to save status info in. |
Truncate file to specified length. The file pointer is positioned to the new end of file.
offset | to truncate to. |
Commit changes to the filesystem.
Set directory prefix (chdir).
path | to change to. |
Get current directory prefix (pwd).
path | to save directory into. |
size | of path we can save. |
Stat a file.
path | of file to stat. |
buffer | to save stat info. |
Erase (remove) a file only.
path | of file. |
Copy a file.
source | file. |
target | file. |
size | of buffer. |
Rename a file.
oldpath | to rename from. |
newpath | to rename to. |
Change file access mode.
path | to change. |
value | of mode to assign. |
Test if path exists.
path | to test. |
Test if path readable.
path | to test. |
Test if path writable.
path | to test. |
Test if path is executable.
path | to test. |
Test if path is a file.
path | to test. |
Test if path is a directory.
path | to test. |
Test if path is a symlink.
path | to test. |
Test if path is a device path.
path | to test. |
Test if path is a hidden file.
path | to test. |
Open a file or directory.
path | of file to open. |
access | mode of descriptor. |
Assign descriptor directly.
descriptor | to assign. |
Assign a descriptor directly.
object | to assign descriptor to. |
descriptor | to assign. |
Open a file descriptor directly.
path | of file to create. |
access | mode of descriptor. |
mode | of file if created. |
Remove a symbolic link explicitly. Other kinds of files are also deleted. This should be used when uncertain about symlinks requiring special support.
path | to remove. |
Create a symbolic link.
path | to create. |
target | of link. |
Create a hard link.
path | to create link to. |
target | of link. |
Read a symbolic link to get it's target.
path | of link. |
buffer | to save target into. |
size | of buffer. |
Close a fsys resource.
Get last error.
Direct means to open a read-only file path and return a descriptor.
path | to open. |
Direct means to create or access a writable path and return descriptor.
path | to create. |
Direct means to create or append a writable path and return descriptor.
path | to create. |
Release a file descriptor.
descriptor | to release. |
Create pipe. These are created inheritable by default.
input | descriptor. |
output | descriptor. |
size | of buffer if supported. |
Changle inheritable handle. On windows this is done by creating a duplicate handle and then closing the original. Elsewhere this is done simply by setting flags.
descriptor | to modify. |
enable | child process inheritence. |
Create inheritable /dev/null handle.
Load a library into memory.
path | to plugin. |
Execute a process and get exit code.
path | to execute. |
argv | list. |
optional | env. |
Create dso object for use by load functions.
Create and map a dso object.
path | of library to map. |
Destroy dso and release library.
Map library object with library.
name | of library to load. |
Release loaded library.
Find symbol in loaded module.
module | to search. |
symbol | to search for. |
Create and initialize an empty index.
Destroy index.
Find a specific member in the ordered list.
offset | to member to find. |
Count of objects this list manages.
Purge the linked list and then set the index to empty.
Reset linked list to empty without purging.
Used to synchronize lists managed by multiple threads. A derived locking method would be invoked.
Used to synchronize lists managed by multiple threads. A derived unlocking method would be invoked.
Return a pointer to the head of the list. This allows the head pointer to be used like a simple root list pointer for pure LinkedObject based objects.
Get (pull) object off the list. The start of the list is advanced to the next object.
Add an object into the ordered index.
ordered | object to add to the index. |
Get an indexed member from the ordered index.
index | of member to fetch. |
Return first object in list for iterators.
Return last object in list for iterators.
Return head object pointer.
Assign ordered index.
object | to copy from. |
Add object to our list.
object | to add. |
Supporting function to construct a new or access an existing shared memory segment. Used by primary constructors.
name | of segment to create or access. |
size | of segment if creating new. Use 0 for read-only access. |
Construct a read/write access mapped shared segment of memory of a known size. This constructs a new memory segment.
name | of segment. |
size | of segment. |
Provide read-only mapped access to an existing named shared memory segment. The size of the map is found by the size of the already existing segment.
name | of existing segment. |
Unmap memory segment.
Unmap memory segment.
Destroy a previously existing memory segment under the specified name. This is used both before creating a new one, and after a publishing process unmaps the segment it created.
name | of segment to remove. |
Test if map active.
Test if map is inactive.
Extend size of managed heap on shared memory segment. This does not change the size of the mapped segment in any way, only that of any heap space that is being allocated and used from the mapped segment.
size | of space requested. Will fault if past end of segment. |
Get memory from a specific offset within the mapped memory segment.
offset | from start of segment. Will fault if past end. |
Copy memory from specific offset within the mapped memory segment. This function assures the copy is not in the middle of being modified.
offset | from start of segment. |
buffer | to copy into. |
size | of object to copy. |
Get size of mapped segment.
Get starting address of mapped segment.
An API that allows "disabling" of publishing shared memory maps. This may be useful when an app doesn't want to use shared memory as a runtime or build option, but does not want to have to be "recoded" explicitly for non-shared memory either. Basically it substitutes a dummy map running on the local heap.
Create an initially empty autorelease pool.
Destroy an autorelease pool and delete member objects.
Destroy an autorelease pool and delete member objects. This may be used to release an existing pool programmatically when desired rather than requiring the object to fall out of scope.
Add a linked object to the autorelease pool.
object | to add to pool. |
Create an instance of a number.
buffer | or NULL if created internally. |
size | of field if not null terminated. |
Set string based on a new value.
value | to set. |
Get string buffer representing the number.
Get value of string buffer as a long integer.
Get value of string buffer as expression of object.
Cast string as long integer and get value of buffer.
Cast object as a string to retrieve buffer.
Assign a value to the number. This rewrites the string buffer.
value | to assign. |
Assign another number to this number.
number | to assign to assign. |
Add a value to the number. This rewrites the string buffer.
value | to add. |
Subtract a value from the number. This rewrites the string buffer.
value | to subtract. |
Decrement the number object. This rewrites the string buffer.
Increment the number object. This rewrites the string buffer.
Construct an auto-pointer referencing an existing object.
object | we point to. |
Construct an auto-pointer as a copy of another pointer. The retention of the object being pointed to will be increased.
pointer | we are a copy of. |
Delete auto pointer. When it falls out of scope, the retention of the object it references is reduced. If it falls to zero in a reference counted object, then the object is auto-deleted.
Set our pointer to a specific object. If the pointer currently references another object, that object is released. The pointer references our new object and that new object is retained.
object | to assign to. |
Manually release the pointer. This reduces the retention level of the object and resets the pointer to point to nobody.
Test if the pointer is not set.
Test if the pointer is referencing an object.
Object factory for creating members of the spare array when they are initially requested.
Purge the array by deleting all created objects.
Get (reference) an object at a specified offset in the array.
offset | in array. |
Create a sparse array of known size. No member objects are created until they are referenced.
size | of array. |
Destroy sparse array and delete all generated objects.
Get count of array elements.
Protocol to allocate memory from the pager heap. The size of the request must be less than the size of the memory page used. The actual method is in a derived or stacked object.
size | of memory request. |
Convenience function.
size | of memory request. |
Allocate memory from the pager heap. The size of the request must be less than the size of the memory page used. The memory is initialized to zero. This uses alloc.
size | of memory request. |
Duplicate NULL terminated string into allocated memory. This uses alloc.
string | to copy into memory. |
Duplicate existing memory block into allocated memory. This uses alloc.
memory | to data copy from. |
size | of memory to allocate. |
Extract formatted string for object.
Extract formatted string for object.
character | code we are pushing. |
Method to retain (or increase retention) of an object.
Method to release (or decrease retention) of an object.
Required virtual destructor.
Retain (increase retention of) object when copying.
Increase retention operator.
Decrease retention operator.
Size of key data.
Buffer of key value.
Different error states of the security context.
Last error flagged for this context.
This is derived in different back-end libraries, and will be used to clear certificate credentials.
Convenience type to represent a security context.
Convenience type to represent a secure socket session.
Convenience type to represent a ssl certificate object.
Convenience type to represent a secure socket buf i/o stream.
Initialize secure stack for first use, and report if SSL support is compiled in.
Initialize secure stack with fips support. If fips support is not successfully enabled, the secure stack is also not initialized. Hence init() can be used for non-fips certified operation if fips fails.
Copy system certificates to a local path.
path | to copy to. |
Get path to system certificates.
Create a sever context. The certificate file used will be based on the init() method name. This may often be /etc/ssl/certs/initname.pem. Similarly, a matching private key certificate will also be loaded. An optional certificate authority document can be used when we are establishing a service which ssl clients have their own certificates.
authority | path to use or NULL if none. |
Create an anonymous client context with an optional authority to validate.
authority | path to use or NULL if none. |
paths | of certificates to use. |
Create a peer user client context. This assumes a user certificate in ~/.ssl/certs and the user private key in ~/.ssl/private. The path to an authority is also sent.
authority | path to use. |
Assign a non-default cipher to the context.
context | to set cipher for. |
ciphers | to set. |
Determine if the current security context is valid.
Get last error code associated with the security context.
Create 36 character traditional version 1 uuid.
string | to write uuid into, must be 37 bytes or more. |
Cipher key formed by hash algorithm. This can generate both a key and iv table based on the algorithms used and required. Normally it is used from a pass-phrase, though any block of data may be supplied.
Push a final cipher block. This is used to push the final buffer into the push method for any remaining data.
Process cipher data. This requires the size to be a multiple of the cipher block size. If an unaligned sized block of data is used, it will be ignored and the size returned will be 0.
data | to process. |
size | of data to process. |
This essentially encrypts a single string and pads with NULL bytes as needed.
string | to encrypt. |
This is used to process any data unaligned to the blocksize at the end of a cipher session. On an encryption, it will add padding or an entire padding block with the number of bytes to strip. On decryption it will remove padding at the end. The pkcs5 method of padding with removal count is used. This also sets the address buffer to NULL to prevent further puts until reset.
address | of data to add before final pad. |
size | of data to add before final pad. |
Process encrypted data in-place. This assumes no need to set the address buffer.
address | of data to process. |
size | of data to process. |
flag | if to pad data. |
Check if a specific cipher is supported.
name | of cipher to check. |
Finalize and recycle current digest to start a new digest.
binary | digest used rather than text if true. |
Reset and restart digest object.
Test to see if a specific digest type is supported.
name | of digest we want to check. |
Shortcut for short md5 digests if supported...
text | to create a digest for. |
Test to see if a specific digest type is supported.
name | of digest we want to check. |
Push entropic seed.
buffer | of random data to push. |
size | of buffer. |
Re-seed pseudo-random generation and entropy pools.
Get high-entropy random data. This is often used to initialize keys. This operation may block if there is insufficient entropy immediately available.
memory | buffer to fill. |
size | of buffer. |
Fill memory with pseudo-random values. This is used as the basis for all get and real operations and does not depend on seed entropy.
memory | buffer to fill. |
size | of buffer to fill. |
Get a pseudo-random integer, range 0 - 32767.
Get a pseudo-random integer in a preset range.
min | value of random integer. |
max | value of random integer. |
Get a pseudo-random floating point value.
Get a pseudo-random floating point value in a preset range.
min | value of random floating point number. |
max | value of random floating point number. |
Determine if we have sufficient entropy to return random values.
Create 36 character random uuid string.
string | to write uuid into, must be 37 bytes or more. |
Get an address list directly. This is used internally by some derived socket types when generic address lists would be invalid.
host | name in the form address or "address:port" |
service | id or port to use if not specified in host string. |
type | of service to get. |
protocol | of service to get. |
Release an address list directly. This is used internally by some derived socket types which do not use generic address lists.
list | of addresses. |
A generic socket address class. This class uses the addrinfo list to store socket multiple addresses in a protocol and family independent manner. Hence, this address class can be used for ipv4 and ipv6 sockets, for assigning connections to multiple hosts, etc. The address class will call the resolver when passed host names.
Construct a socket address. This is used to get an address to bind a socket interface to. The address can be specified as the ip address of the interface or as a "hostname". If a hostname is used, then family should be specified for clarity.
family | of socket address. Needed when host names are used. |
address | or hostname. |
type | of socket (stream, dgram, etc). |
protocol | number of socket. |
Construct a socket address for an existing socket. This can be the name of a host or to perform a lookup in a domain for a service. Family can be used to restrict the set of results returned, however since things like connecto() already filter by family and create will use family from the addrinfo, in most cases AF_UNSPEC can be used. This may be depreciated in favor of the constructor that matches a set() method.
family | of hosts to filter by or AF_UNSPEC. |
hostname | or ip address. The socket family is used for hostnames. |
service | port or name we are referencing or NULL. |
Construct a socket address list for a service.
host | address for service. |
service | name or port number. |
type | of service, stream, dgram, etc. |
Construct a socket address from host and service. This is primarily used to construct a list of potential service connections by pure port numbers or for host lookup only.
hostname | or address to use. |
service | port or 0. |
Construct a socket address from an IPv4 address and a port number.
Construct a socket address from an IPv6 address and a port number.
Construct a socket address from a sockaddr object.
Construct a socket address from an addrinfo structure.
Construct an empty address.
Copy constructor.
reference | to object to copy from. |
Assignment operator.
reference | to object to copy from. |
Destroy address. Deallocate addrinfo structure.
Compare two address lists.
Get the first socket address in our address list.
Get the first socket address by casted reference.
Get the first socket address of specified family from our list.
family | to seek. |
Get the family of the first member in a list of services.
Get the address size of the first address.
Get the port of the first address .
Set the port of all addresses in the list.
port | the port to set. |
Returns a copy of this address list with the specified port set.
Find a specific socket address in our address list.
Get the full socket address list from the object.
Get the full socket address list by casted reference.
Return the full socket address list by pointer reference.
Print the first socket address as a human-readable string to the provided buffer and returns the printed string length.
src | Address to print. |
dst | Destination buffer to print the socket address on. |
dst_sz | Size of the provided buffer. Strongly recommended to be at least INET6_ADDRSTRLEN (or INET_ADDRSTRLEN if compiled without IPv6). |
port | If true, print port number with address. If true, ipv6_brackets will also be forced to true. |
ipv6_brackets | If true, force printing IPv6 brackets. Ignored if address is an IPv4. |
Test if the address list is valid.
Test if we have no address list.
Test if the first socket address is ADDR_ANY: 0.0.0.0 or ::0
Clear the address list and set the first address to be the ADDR_ANY of the current family, or of the specified family (if set).
family | address family to set. |
Test if the first socket address is ADDR_LOOPBACK: 127.0.0.1 or ::1
Clear the address list and set the first address to be the ADDR_LOOPBACK of the current family, or of the specified family (if set).
family | address family to set. |
Clear current object.
Set the host addresses to form a new list.
hostname | or address to resolve. |
service | name or port number, or NULL if not used. |
type | of socket (stream or dgram) to filter list by. |
Append additional host addresses to our list.
hostname | or address to resolve. |
service | name or port number, or NULL if not used. |
type | of socket (stream or dgram). |
Set an entry for host binding.
family | of socket address. Needed when hostnames are used. |
address | or hostname. |
type | of socket (stream, dgram, etc). |
protocol | number of socket. |
Add an individual socket address to our address list.
address | to add. |
Insert unique members from another socket address list to ours.
address | list to insert into list. |
Remove members from another socket address list from ours.
address | list to remove from list. |
Remove an individual socket address from our address list.
address | to remove. |
Insert an individual socket address to our address list only if unique.
address | to insert into list. |
Copy an existing addrinfo into our object. This is also used to support the copy constructor.
address | list to copy from. |
Set an individual socket address for our address list.
address | to add. |
Set a socket address from host and service.
hostname | or address to use. |
service | port or 0. |
Returns the size of the socket address according to the family.
Returns the port of the socket address.
Set the port of the socket address.
address | to edit. |
port | to associate to the socket address. |
Test if the socket address is ADDR_ANY: 0.0.0.0 or ::0
Set the socket address to ADDR_ANY: 0.0.0.0 or ::0
Get a ADDR_ANY socket address of the given family.
Test if the socket address is ADDR_LOOPBACK: 127.0.0.1 or ::1
Set the socket address to ADDR_LOOPBACK: 127.0.0.1 or ::1 depending on the family of the pointed address.
Get a ADDR_LOOPBACK socket address of the given family.
Duplicate a socket address.
address | to duplicate. |
Convert address object into ipv4 address.
address | to convert. |
Convert address object into ipv6 address.
address | to convert. |
Print socket address as a human-readable string to the provided buffer and returns the printed string length.
src | Address to print. |
dst | Destination buffer to print the socket address on. |
dst_sz | Size of the provided buffer. Strongly recommended to be at least INET6_ADDRSTRLEN (or INET_ADDRSTRLEN if compiled without IPv6). |
port | If true, print port number with address. If true, ipv6_brackets will also be forced to true. |
ipv6_brackets | If true, force printing IPv6 brackets. Ignored if address is an IPv4. |
Create a socket object for use.
Create socket as duped handle of existing socket.
existing | socket to dup. |
Create socket from existing socket descriptor.
socket | descriptor to use. |
Create and connect a socket to an address from an address list. The type of socket created is based on the type we are connecting to.
address | list to connect with. |
Create an unbound socket of a specific type.
family | of our new socket. |
type | (stream, udp, etc) of our new socket. |
protocol | number of our new socket.' |
Create a bound socket. If one wishes to listen for connections on a protocol, then ListenSocket should be used instead.
address | to bind or "*" for all. |
port | number of service to bind. |
family | to bind as. |
type | of socket to bind (stream, udp, etc). |
protocol | of socket to bind. |
Shutdown, close, and destroy socket.
Cancel pending i/o by shutting down the socket.
Cancel pending i/o by shutting down the socket.
socket | to shutdown. |
Shutdown and close the socket.
Get error code.
See the number of bytes in the receive queue.
value | to test for. |
Test if socket is connected.
Test for pending input data. This function can wait up to a specified timeout for data to appear.
timeout | or 0 if none. |
Set nodelay option for tcp socket.
Test for pending input data. This function can wait up to a specified timeout for data to appear.
socket | to test. |
timeout | or 0 if none. |
Test for output data sent. This function can wait up to a specified timeout for data to appear sent.
timeout | or 0 if none. |
Get the number of bytes of data in the socket receive buffer.
Set socket for unicast mode broadcasts.
enable | broadcasting if true. |
Set socket for keepalive packets.
enable | keep-alive if true. |
Set socket blocking I/O mode.
enable | true for blocking I/O. |
Set multicast mode and multicast broadcast range.
ttl | to set for multicast socket or 0 to disable multicast. |
Set loopback to read multicast packets we broadcast.
enable | true to loopback, false to ignore. |
Get socket error code.
Set the time to live before packets expire.
time | to live to set. |
Set the size of the socket send buffer.
size | of send buffer to set. |
Set the size to wait before sending.
size | of send wait buffer to set. |
Set the size of the socket receive buffer.
size | of recv buffer to set. |
Get the type of a socket.
socket | descriptor. |
Set segment size and get MTU.
socket | to modify. |
size | of segment or zero to not set. |
Set congestion control id.
socket | to modify. |
ccid | value to set. |
Get the type of a socket.
Set segment size and get mtu of a socket.
size | of segment or 0 to leave unchanged. |
Set ccid of dccp socket.
ccid | to set. |
Set the type of service field of outgoing packets. Some useful values include IPTOS_LOWDELAY to minimize delay for interactive traffic, IPTOS_THROUGHPUT to optimize throughput, OPTOS_RELIABILITY to optimize for reliability, and IPTOS_MINCOST for low speed use.
type | of service value. |
Set packet priority, 0 to 6 unless privileged. Should be set before type-of-service.
scheduling | priority for packet scheduling. |
Shutdown the socket communication channel.
Connect our socket to a remote host from an address list. For TCP (and DCCP) sockets, the entire list may be tried. For UDP, connect is only a state and the first valid entry in the list is used.
list | of addresses to connect to. |
Disconnect a connected socket. Depending on the implementation, this might be done by connecting to AF_UNSPEC, connecting to a 0 address, or connecting to self.
Join socket to multicast group.
list | of groups to join. |
Drop socket from multicast group.
list | of groups to drop. |
Socket i/o timer setting.
timeout | to wait, inf for blocking, 0 pure non-blocking. |
Peek at data waiting in the socket receive buffer.
data | pointer to save data in. |
number | of bytes to peek. |
Read data from the socket receive buffer. This will be used in abi 4.
data | pointer to save data in. |
number | of bytes to read. |
address | of peer data was received from. |
Write data to the socket send buffer. This will be used in abi 4.
data | pointer to write data from. |
number | of bytes to write. |
address | of peer to send data to if not connected. |
Read a newline of text data from the socket and save in NULL terminated string. This uses an optimized I/O method that takes advantage of socket peeking. This presumes a connected socket on a streamble protocol. Because the trailing newline is dropped, the return size may be greater than the string length. If there was no data read because of eof of data, an error has occured, or timeout without input, then 0 will be returned.
data | to save input line. |
size | of input line buffer. |
Print formatted string to socket.
format | string. |
Read a string of input from the socket and strip trailing newline. This uses an optimized I/O method that takes advantage of socket peeking. This presumes a connected socket on a streamble protocol. Because the trailing newline is dropped, the return size may be greater than the string length. If there was no data read because of eof of data, an error has occured, or timeout without input, then 0 will be returned.
buffer | to save input line. |
Read a newline of text data from the socket and save in NULL terminated string. This uses an optimized I/O method that takes advantage of socket peeking. As such, it has to be rewritten to be used in a ssl layer socket.
socket | to read from. |
data | to save input line. |
size | of input line buffer. |
timeout | to wait for a complete input line. |
Print formatted string to socket.
socket | to write to. |
format | string. |
Write a null terminated string to the socket. This exists because we messed up consistency with the original puts() method. In the future there will be a single puts() that has a NULL default.
string | to write. |
Test if socket is valid.
Test if socket is invalid.
Assign socket from a socket descriptor. Release existing socket if one present.
socket | descriptor to assign to object. |
Get the socket descriptor by casting.
Get the socket descriptor by pointer reference.
Get the number of bytes pending in the receive buffer of a socket descriptor.
socket | descriptor. |
Set the send size of a socket descriptor.
socket | descriptor. |
size | of send buffer to set. |
Set the size to wait before sending.
socket | descriptor. |
size | of send wait buffer to set. |
Set the receive size of a socket descriptor.
socket | descriptor. |
size | of receive buffer to set. |
Connect socket descriptor to a remote host from an address list. For TCP (and DCCP) sockets, the entire list may be tried. For UDP, connect is only a state and the first valid entry in the list is used.
socket | descriptor. |
list | of addresses to connect to. |
Disconnect a connected socket descriptor.
socket | descriptor. |
Drop socket descriptor from multicast group.
socket | descriptor. |
list | of groups to drop. |
Join socket descriptor to multicast group.
socket | descriptor. |
list | of groups to join. |
Get socket error code of socket descriptor.
socket | descriptor. |
Set multicast mode and multicast broadcast range for socket descriptor.
socket | descriptor. |
ttl | to set for multicast socket or 0 to disable multicast. |
Set loopback to read multicast packets socket descriptor broadcasts.
socket | descriptor. |
enable | true to loopback, false to ignore. |
Set socket blocking I/O mode of socket descriptor.
socket | descriptor. |
enable | true for blocking I/O. |
Set socket for keepalive packets for socket descriptor.
socket | descriptor. |
enable | keep-alive if true. |
Set socket for unicast mode broadcasts on socket descriptor.
socket | descriptor. |
enable | broadcasting if true. |
Set tcp nodelay option on socket descriptor.
socket | descriptor. |
Set packet priority of socket descriptor.
socket | descriptor. |
scheduling | priority for packet scheduling. |
Set type of service of socket descriptor.
socket | descriptor. |
type | of service. |
Set the time to live for the socket descriptor.
socket | descriptor. |
time | to live to set. |
Get the address family of the socket descriptor.
Get the address family of a socket address object.
address | to examine. |
Get the address family of an internet socket address object.
address | to examine. |
Get data waiting in receive queue.
socket | to get from. |
buffer | to save. |
size | of data buffer to request. |
flags | for i/o operation (MSG_OOB, MSG_PEEK, etc). |
address | of source. |
Send data on socket.
socket | to send to. |
buffer | to send. |
size | of data buffer to send. |
flags | for i/o operation (MSG_OOB, MSG_PEEK, etc). |
address | of destination, NULL if connected. |
Send reply on socket. Used to reply to a recvfrom message.
socket | to send to. |
buffer | to send. |
size | of data buffer to send. |
flags | for i/o operation (MSG_OOB, MSG_PEEK, etc). |
address | to reply to. |
Bind the socket descriptor to a known interface and service port.
socket | descriptor to bind. |
address | to bind to or "*" for all. |
service | port to bind. |
protocol | to use or 0 if default. |
Bind the socket descriptor to a known interface listen on service port.
socket | descriptor to bind. |
address | of interface to bind to. |
backlog | for service. |
Bind the socket descriptor to a known interface.
socket | descriptor to bind. |
address | of interface to bind to. |
Accept a socket connection from a remote host.
socket | descriptor to accept from. |
address | of socket accepting. |
Create a socket object unbound.
family | of socket. |
type | of socket. |
protocol | of socket. |
Create a connected socket.
address | list to connect to. |
type | of socket to create. |
protocol | of socket. |
Create a bound socket for a service.
iface | to bind. |
service | port to bind. |
family | to select or AF_UNSPEC |
type | of socket to create. |
protocol | of socket to create. |
Create a connected socket for a service.
address | of service for connect. |
Release (close) a socket.
socket | to close. |
Lookup and return the host name associated with a socket address.
address | to lookup. |
buffer | to save hostname into. |
size | of buffer to save hostname into. |
Create an address info lookup hint based on the family and type properties of a socket descriptor.
socket | descriptor. |
hint | buffer. |
Lookup a host name and service address based on the addressing family and socket type of a socket descriptor. Store the result in a socket address structure.
socket | descriptor. |
address | that is resolved. |
hostname | to resolve. |
service | port. |
Get the size of a socket address.
address | of socket. |
Compare socket addresses. Test if the address and service matches or if there is no service, then just the host address values.
address1 | to compare. |
address2 | to compare. |
Copy a socket address.
target | address pointer to copy into. |
origin | address pointer to copy from. |
Store an address into an address object.
storage | for address. |
address | to store. |
Store an address into an internet address object.
storage | for address. |
address | to store. |
Compare socket host addresses. Test if the host address matches or if there is no service, then just the host address values.
address1 | to compare. |
address2 | to compare. |
Compare socket addresses. Test if the stored addresses received match. or if there is no service, then just the host address values.
address1 | to compare. |
address2 | to compare. |
Compare socket addresses. Test if the internet addresses received match. or if there is no service, then just the host address values.
address1 | to compare. |
address2 | to compare. |
See if both addresses are in the same subnet. This is only relevant to IPV4 and class domain routing.
address1 | to test. |
address2 | to test. |
Get the socket address of the interface needed to reach a destination address.
address | of interface found. |
target | address. |
size | of interface, 0 used for older code |
Get the hostname of a socket address.
address | to lookup. |
buffer | to save hostname in. |
size | of hostname buffer. |
Get the service port of a socket.
address | of socket to examine. |
Get the service port of an inet socket.
address | of internet socket to examine. |
Convert a socket address and service into a hash map index.
address | to convert. |
size | of map index. |
Convert a socket host address into a hash map index.
address | to convert. |
size | of map index. |
Initialize socket subsystem.
Set default socket family preference for query options when the socket type is otherwise not specified.
family | to select. |
Set the default socket behavior for v6-v4 mapping. This also effects v6 address lookup as to whether v4 remapped addresses can be used if no v6 address is found.
enable | true to set mapping. This is default. |
Return error code of last socket operation,
Simple function to validate that a given IP address string is a "zero" address. Such address strings are used for example in SIP to indicate "hold" by re-inviting peers to a null address. Supports IPV4 and IPV6 addresses.
string | address to check. |
Simple function to validate that a given IP address string is a numeric address. This can be used to verify an address is not a "host" name. Supports IPV4 and IPV6 address strings.
string | address to check. |
Get local address to which the socket is bound. This is defined here because we may re-define the backend linkage for the socks proxy in the future.
socket | descriptor to examine. |
address | storage for local address. |
Get remote address to which the socket is connected. This is defined here because we may re-define the backend linkage for the socks proxy in the future.
socket | descriptor to examine. |
address | storage for remote address. |
Helper function for linked_pointer<struct sockaddr>.
Helper function for linked_pointer<struct sockaddr>.
Helper function for linked_pointer<struct sockaddr>.
Create an unitialized instance of guard. Usually used with a guard = operator.
Set guard to mutex lock a new object. If a lock is currently held, it is released.
object | to guard. |
Prematurely release a guard.
Construct a guard for a specific object.
object | to guard. |
Release mutex when guard falls out of scope.
Create a thread object that will have a preset stack size. If 0 is used, then the stack size is os defined/default.
stack | size to use or 0 for default. |
Map thread for get method. This should be called from start of the run() method of a derived class.
Check if running.
Set thread priority without disrupting scheduling if possible. Based on scheduling policy. It is recommended that the process is set for realtime scheduling, and this method is actually for internal use.
Yield execution context of the current thread. This is a static and may be used anywhere.
Sleep current thread for a specified time period.
timeout | to sleep for in milliseconds. |
Get mapped thread object. This returns the mapped base class of the thread object of the current executing context. You will need to cast to the correct derived class to access derived thread-specific storage. If the current thread context is not mapped NULL is returned.
Abstract interface for thread context run method.
Destroy thread object, thread-specific data, and execution context.
Exit the thread context. This function should NO LONGER be called directly to exit a running thread. Instead this method will only be used to modify the behavior of the thread context at thread exit, including detached threads which by default delete themselves. This documented usage was changed to support Mozilla NSPR exit behavior in case we support NSPR as an alternate thread runtime in the future.
Used to initialize threading library. May be needed for some platforms.
Get cache line size.
Used to specify scheduling policy for threads above priority "0". Normally we apply static realtime policy SCHED_FIFO (default) or SCHED_RR. However, we could apply SCHED_OTHER, etc.
Set concurrency level of process. This is essentially a portable wrapper for pthread_setconcurrency.
Determine if two thread identifiers refer to the same thread.
thread1 | to test. |
thread2 | to test. |
Get current thread id.
Check if timer has been updated since last check. This also sets updated false.
Check if timer active.
Construct an untriggered timer set to the time of creation.
Construct a triggered timer that expires at specified offset.
offset | to expire in milliseconds. |
Construct a triggered timer that expires at specified offset.
offset | to expire in seconds. |
Construct a timer from a copy of another timer.
copy | of timer to construct from. |
Set the timer to expire.
expire | time in milliseconds. |
Set the timer to expire.
expire | time in seconds. |
Set (update) the timer with current time.
Clear pending timer, has no value.
Get remaining time until the timer expires.
Get remaining time until timer expires by reference.
Check if timer has expired.
Check if timer expired for is() expression.
Set timer expiration.
expire | timer in specified seconds. |
Set timer expiration.
expire | timer in milliseconds. |
Adjust timer expiration.
expire | time to add in seconds. |
Adjust timer expiration.
expire | time to add in milliseconds. |
Adjust timer expiration.
expire | time to subtract in seconds. |
Adjust timer expiration.
expire | time to subtract in milliseconds. |
Compute difference between two timers.
timer | to use for difference. |
Compare timers if same timeout.
timer | to compare with. |
Compare timers if not same timeout.
timer | to compare with. |
Compare timers if earlier timeout than another timer.
timer | to compare with. |
Compare timers if earlier than or equal to another timer.
timer | to compare with. |
Compare timers if later timeout than another timer.
timer | to compare with. |
Compare timers if later than or equal to another timer.
timer | to compare with. |
Sleep current thread until the specified timer expires.
timer | to reference for sleep. |
Get timer ticks since uuid epoch.
Heap base-class container for typeref objects. This uses atomic reference counters for thread safety with maximal performance. This is used as a protected base class used for strongly typed heap containers through templates.
Construction of aligned container. This is used to inform the object of the underlying real address it exists on the heap since malloc is not assured to be atomically aligned by default.
address | of actual allocation. |
size | of object allocated. |
ar | pool to use |
Release memory and delete object when no longer referenced. This gets called with the atomic reference counter < 1, such as when the last smart pointer de-references.
Is this object not empty?
Number of retains (smart pointers) referencing us.
Override delete to de-allocate actual heap. This is used because the object is atomically aligned, but the heap may not be.
address | of our object. |
Retain a copy of this object. Usually a smart pointer referencing.
Release a copy of this object. Only when the reference count reaches 0 is it destroyed.
Create a smart pointer referencing an existing heap object.
object | to reference. |
Create a smart pointer based on another pointer. Both pointers then reference the same object.
pointer | instance to share reference with. |
Create a smart pointer referencing nothing.
Set our smart pointer to a specific heap container. If we were pointing to something already we release that.
object | to reference. |
Assign from a guarded typeref.
Adjust memory pointer to atomic boundry.
address | that was allocated. |
Destroy pointer when falling out of scope. This de-references the heap container.
Set our smart pointer based on another pointer instance. If we are already referencing, we release the current container.
pointer | instance to share reference with. |
Manually release the current container.
Get size of referenced heap object.
Get number of references to container.
Check if pointer currently has a heap container.
Check if we are currently not pointing to anything.
Special weak-public means to copy a container reference. This uses the base class container which is not public, so only derived type specific smart pointers can actually use this method. It is made public because making it protected actually makes it inaccessible to template derived classes.
target | smart pointer object to set. |
object | to have it reference. |
Size of "unicode_t" character codes, may not be ucs4_t size.
A convenient NULL pointer value.
Compute character size of utf8 string codepoint.
codepoint | in string. |
Count ut8 encoded ucs4 codepoints in string.
string | of utf8 data. |
Get codepoint offset in a string.
string | of utf8 data. |
position | of codepoint in string, negative offsets are from tail. |
Convert a utf8 encoded codepoint to a ucs4 character value.
encoded | utf8 codepoint. |
How many chars requires to encode a given wchar string.
string | of ucs4 data. |
How many chars requires to encode a given unicode character.
character | to encode. |
Convert a unicode string into utf8.
string | of unicode data to pack |
buffer | of character protocol to put data into. |
Convert a utf8 string into a unicode data buffer.
unicode | data buffer. |
buffer | of character protocol to pack from. |
size | of unicode data buffer in codepoints. |
Dup a utf8 string into a ucs4_t string.
Dup a utf8 string into a ucs2_t representation.
Find first occurance of character in string.
string | to search in. |
character | code to search for. |
start | offset in string in codepoints. |
Find last occurrence of character in string.
string | to search in. |
character | code to search for. |
end | offset to start from in codepoints. |
Count occurrences of a unicode character in string.
string | to search in. |
character | code to search for. |
Get a unicode character from a character protocol.
buffer | of character protocol to read from. |
Push a unicode character to a character protocol.
character | to push to file. |
buffer | of character protocol to push character to. |
Create a utf8 pointer set to NULL.
Create a utf8 pointer for an existing char pointer.
string | pointer to use. |
Create a utf8 pointer as a copy of existing utf8 pointer.
copy | of object to use. |
Iterative increment of a utf8 pointer to prior codepoint.
Iterative decrement of a utf8 pointer to next codepoint.
Adjust utf8 pointer by specified codepoints forward.
offset | to increment by. |
Adjust utf8 pointer by specified codepoints backward.
offset | to decrement by. |
Get new utf8 string after adding a codepoint offset.
offset | to add. |
Get new utf8 string after subtracting a codepoint offset.
offset | to subtract. |
Check if text is valid pointer.
Check if text is an invalid pointer.
Extract a unicode character from a specified codepoint.
codepoint | offset to extract character from. |
Assign a utf8 string to point to.
string | to point to. |
Iterative increment of a utf8 pointer to next codepoint.
Iterative decrement of a utf8 pointer to prior codepoint.
check if pointer equals another string.
string | to check. |
check if pointer does not equal another string.
string | to check. |
Get unicode character pointed to by pointer.
Get c string we point to.
Convert utf8 pointer to a generic string pointer.
Get length of null terminated utf8 string in codepoints.
Access interface to share lock the object.
A kind of smart pointer object to support shared locking protocol. This object initiates a shared lock for the object being referenced when it is instantiated, and releases the shared lock when it is destroyed. You would pass the pointer an object that has the Shared as a base class.
Create an instance of an exclusive object reference.
object | containing Exclusive base class protocol to lock. |
Destroy reference to shared locked object, release lock.
Test if the reference holds an active lock.
Test if the reference holds an active lock.
Release a held lock programmatically. This can be used to de-reference the object being share locked without having to wait for the destructor to be called when the shared_lock falls out of scope.
Call exclusive access on referenced objects protocol.
Restore shared access on referenced objects protocol.
Share the lock with other referencers. Many of our shared locking objects support the ability to switch between shared and exclusive mode. This derived protocol member allows one to restore the lock to shared mode after it has been made exclusive.
Convert object to an exclusive lock. Many of our shared locking objects such as the "conditional lock" support the ability to switch between shared and exclusive locking modes. This derived protocol member allows one to temporarily assert exclusive locking when tied to such methods.
Create an instance of an exclusive object reference.
object | containing Exclusive base class protocol to lock. |
Destroy reference to shared locked object, release lock.
Test if the reference holds an active lock.
Test if the reference holds an active lock.
Release a held lock programmatically. This can be used to de-reference the object being share locked without having to wait for the destructor to be called when the shared_lock falls out of scope.
Call exclusive access on referenced objects protocol.
Restore shared access on referenced objects protocol.
Atomic counter class. Can be used to manipulate value of an atomic counter without requiring explicit thread locking.
Atomic spinlock class. Used as high-performance sync lock between threads.
Construct and initialize spinlock.
NAMESPACE_UCOMMON Acquire the lock. If the lock is not acquired, one "spins" by doing something else. One suggestion is using thread::yield.
Wait for and aquire spinlock.
Release an acquired spinlock.
Initialize and construct conditional.
Destroy conditional, release any blocked threads.
Lock the conditional's supporting mutex.
Unlock the conditional's supporting mutex.
Initialize and construct conditional.
Destroy conditional, release any blocked threads.
Conditional wait for signal on millisecond timeout.
timeout | in milliseconds. |
Conditional wait for signal on timespec timeout.
timeout | as a high resolution timespec. |
Wait (block) until signalled.
Signal the conditional to release one waiting thread.
Signal the conditional to release all waiting threads.
Initialize integer counter of unknown size.
Initialize integer counter for a range of values.
limit | before recycling to zero. |
Get the next counter value.
Get the range of values before recycling.
Reference next counter value through pointer operation.
Reference next counter value by casting to integer.
Assign the value of the counter.
value | to assign. |
A method to use to "post" any changed values when shadowing a mixed object class. This is used by DateNumber and string classes.
Size of date string field.
Create a julian date from a time_t type.
value | from time() |
Create a julian date from a local or gmt date and time.
object | from DateTime::glt() or gmt(). |
Create a julian date from a ISO date string of a specified size.
pointer | to ISO date string. |
size | of date field if not null terminated. |
Create a julian date from an arbitrary year, month, and day.
year | of date. |
month | of date (1-12). |
day | of month (1-31). |
Create a julian date object from another object.
object | to copy. |
Construct a new julian date with today's date.
Destroy julian date object.
Get the year of the date.
Get the month of the date (1-12).
Get the day of the month of the date.
Get the day of the week (0-7).
Get a ISO string representation of the date (yyyy-mm-dd).
buffer | to store string. |
Get a time_t for the julian date if in time_t epoch.
Get the date as a number for the object or 0 if invalid.
Set (update) the date with current date.
Set the julian date based on an ISO date string of specified size.
pointer | to date string field. |
size | of field if not null terminated. |
Check if date is valid.
Casting operator to return date as number.
Access julian value.
Expression operator to return an ISO date string for the current julian date.
Increment date by one day.
Decrement date by one day.
Increment date by offset.
offset | to add to julian date. |
Decrement date by offset.
offset | to subtract from julian date. |
Add days to julian date in an expression.
days | to add. |
Subtract days from a julian date in an expression.
days | to subtract. |
Operator to compute number of days between two dates.
date | offset for computation. |
Assign date from another date object.
date | object to assign from. |
Compare julian dates if same date.
date | to compare with. |
Compare julian dates if not same date.
date | to compare with. |
Compare julian date if earlier than another date.
date | to compare with. |
Compare julian date if earlier than or equal to another date.
date | to compare with. |
Compare julian date if later than another date.
date | to compare with. |
Compare julian date if later than or equal to another date.
date | to compare with. |
Check if julian date is not valid.
Check if julian date is valid for is() expression.
Constant for number of seconds in a day.
Constant for number of seconds in a hour.
Constant for number of seconds in a week.
Size of time string field.
Create a time from the time portion of a time_t.
value | of time_t to use. |
Create a time from the time portion of a date and time object.
object | from DateTime::glt() or gmt(). |
Create a time from a hh:mm:ss formatted time string.
pointer | to formatted time field. |
size | of field if not null terminated. |
Create a time from hours (0-23), minutes (0-59), and seconds (0-59).
hour | of time. |
minute | of time. |
second | of time. |
Create a time object from another object.
object | to copy. |
Create a time from current time.
Destroy time object.
Get current time in seconds from midnight.
Get hours from midnight.
Get minutes from current hour.
Get seconds from current minute.
Get a hh:mm:ss formatted string for current time.
buffer | to store time string in. |
Set (update) the time with current time.
Set time from a hh:mm:ss formatted string.
pointer | to time field. |
size | of field if not null terminated. |
Check if time object had valid value.
Check if time object has valid value for is() operator.
Check if time object has valid value for ! operator.
Get difference (in seconds) between two times.
reference | time to get difference from. |
Add seconds to the current time, wrap if 24 hours.
seconds | to add. |
Subtract seconds to the current time, wrap if 24 hours.
seconds | to subtract. |
Get time in seconds.
Get object time in seconds.
Convert to standard 24 hour time string.
Incrememnt time by 1 second, wrap on 24 hour period.
Decrement time by 1 second, wrap on 24 hour period.
Assign a time as a copy of another time.
time | to assign from. |
Increment time by specified seconds. Wraps on 24 hour period.
seconds | to add to current time. |
Decrement time by specified seconds. Wraps on 24 hour period.
seconds | to subtract from current time. |
Compare time with another time to see if same time.
time | to compare with. |
Compare time with another time to see if not same time.
time | to compare with. |
Compare time if earlier than another time.
time | object to compare with. |
Compare time if earlier than or equal to another time.
time | object to compare with. |
Compare time if later than another time.
time | object to compare with. |
Compare time if later than or equal to another time.
time | object to compare with. |
Most of the common chmod values are predefined.
Enumerated file access modes.
File offset type.
Used to mark "append" in set position operations.
Construct an unattached fsys descriptor.
Contruct fsys from raw file handle.
Copy (dup) an existing fsys descriptor.
descriptor | to copy from. |
Create a fsys descriptor by opening an existing file or directory.
path | of file to open for created descriptor. |
access | mode of file. |
Create a fsys descriptor by creating a file.
path | of file to create for descriptor. |
access | mode of file access. |
permission | mode of file. |
Close and release a file descriptor.
Get the descriptor from the object by pointer reference.
Get the descriptor from the object by casting reference.
Reset error flag.
Test if file descriptor is open.
Test if file descriptor is closed.
Assign file descriptor by duplicating another descriptor.
descriptor | to dup from. |
Replace current file descriptor with an external descriptor. This does not create a duplicate. The external descriptor object is marked as invalid.
Assing file descriptor from system descriptor.
descriptor | to dup from. |
Get the native system descriptor handle of the file descriptor.
Set with external descriptor. Closes existing file if open.
descriptor | of open file. |
Release descriptor, do not close.
Set the position of a file descriptor.
offset | from start of file or "end" to append. |
Drop cached data from start of file.
size | of region to drop or until end of file. |
See if current file stream is a tty device.
See if the file handle is a tty device.
Read data from descriptor or scan directory.
buffer | to read into. |
count | of bytes to read. |
Write data to descriptor.
buffer | to write from. |
count | of bytes to write. |
Get status of open descriptor.
buffer | to save status info in. |
Truncate file to specified length. The file pointer is positioned to the new end of file.
offset | to truncate to. |
Commit changes to the filesystem.
Set directory prefix (chdir).
path | to change to. |
Get current directory prefix (pwd).
path | to save directory into. |
size | of path we can save. |
Stat a file.
path | of file to stat. |
buffer | to save stat info. |
Erase (remove) a file only.
path | of file. |
Copy a file.
source | file. |
target | file. |
size | of buffer. |
Rename a file.
oldpath | to rename from. |
newpath | to rename to. |
Change file access mode.
path | to change. |
value | of mode to assign. |
Test if path exists.
path | to test. |
Test if path readable.
path | to test. |
Test if path writable.
path | to test. |
Test if path is executable.
path | to test. |
Test if path is a file.
path | to test. |
Test if path is a directory.
path | to test. |
Test if path is a symlink.
path | to test. |
Test if path is a device path.
path | to test. |
Test if path is a hidden file.
path | to test. |
Open a file or directory.
path | of file to open. |
access | mode of descriptor. |
Assign descriptor directly.
descriptor | to assign. |
Assign a descriptor directly.
object | to assign descriptor to. |
descriptor | to assign. |
Open a file descriptor directly.
path | of file to create. |
access | mode of descriptor. |
mode | of file if created. |
Remove a symbolic link explicitly. Other kinds of files are also deleted. This should be used when uncertain about symlinks requiring special support.
path | to remove. |
Create a symbolic link.
path | to create. |
target | of link. |
Create a hard link.
path | to create link to. |
target | of link. |
Read a symbolic link to get it's target.
path | of link. |
buffer | to save target into. |
size | of buffer. |
Close a fsys resource.
Get last error.
Direct means to open a read-only file path and return a descriptor.
path | to open. |
Direct means to create or access a writable path and return descriptor.
path | to create. |
Direct means to create or append a writable path and return descriptor.
path | to create. |
Release a file descriptor.
descriptor | to release. |
Create pipe. These are created inheritable by default.
input | descriptor. |
output | descriptor. |
size | of buffer if supported. |
Changle inheritable handle. On windows this is done by creating a duplicate handle and then closing the original. Elsewhere this is done simply by setting flags.
descriptor | to modify. |
enable | child process inheritence. |
Create inheritable /dev/null handle.
Load a library into memory.
path | to plugin. |
Execute a process and get exit code.
path | to execute. |
argv | list. |
optional | env. |
Create dso object for use by load functions.
Create and map a dso object.
path | of library to map. |
Destroy dso and release library.
Map library object with library.
name | of library to load. |
Release loaded library.
Find symbol in loaded module.
module | to search. |
symbol | to search for. |
Create and initialize an empty index.
Destroy index.
Find a specific member in the ordered list.
offset | to member to find. |
Count of objects this list manages.
Purge the linked list and then set the index to empty.
Reset linked list to empty without purging.
Used to synchronize lists managed by multiple threads. A derived locking method would be invoked.
Used to synchronize lists managed by multiple threads. A derived unlocking method would be invoked.
Return a pointer to the head of the list. This allows the head pointer to be used like a simple root list pointer for pure LinkedObject based objects.
Get (pull) object off the list. The start of the list is advanced to the next object.
Add an object into the ordered index.
ordered | object to add to the index. |
Get an indexed member from the ordered index.
index | of member to fetch. |
Return first object in list for iterators.
Return last object in list for iterators.
Return head object pointer.
Assign ordered index.
object | to copy from. |
Add object to our list.
object | to add. |
Supporting function to construct a new or access an existing shared memory segment. Used by primary constructors.
name | of segment to create or access. |
size | of segment if creating new. Use 0 for read-only access. |
Construct a read/write access mapped shared segment of memory of a known size. This constructs a new memory segment.
name | of segment. |
size | of segment. |
Provide read-only mapped access to an existing named shared memory segment. The size of the map is found by the size of the already existing segment.
name | of existing segment. |
Unmap memory segment.
Unmap memory segment.
Destroy a previously existing memory segment under the specified name. This is used both before creating a new one, and after a publishing process unmaps the segment it created.
name | of segment to remove. |
Test if map active.
Test if map is inactive.
Extend size of managed heap on shared memory segment. This does not change the size of the mapped segment in any way, only that of any heap space that is being allocated and used from the mapped segment.
size | of space requested. Will fault if past end of segment. |
Get memory from a specific offset within the mapped memory segment.
offset | from start of segment. Will fault if past end. |
Copy memory from specific offset within the mapped memory segment. This function assures the copy is not in the middle of being modified.
offset | from start of segment. |
buffer | to copy into. |
size | of object to copy. |
Get size of mapped segment.
Get starting address of mapped segment.
An API that allows "disabling" of publishing shared memory maps. This may be useful when an app doesn't want to use shared memory as a runtime or build option, but does not want to have to be "recoded" explicitly for non-shared memory either. Basically it substitutes a dummy map running on the local heap.
Create an initially empty autorelease pool.
Destroy an autorelease pool and delete member objects.
Destroy an autorelease pool and delete member objects. This may be used to release an existing pool programmatically when desired rather than requiring the object to fall out of scope.
Add a linked object to the autorelease pool.
object | to add to pool. |
Create an instance of a number.
buffer | or NULL if created internally. |
size | of field if not null terminated. |
Set string based on a new value.
value | to set. |
Get string buffer representing the number.
Get value of string buffer as a long integer.
Get value of string buffer as expression of object.
Cast string as long integer and get value of buffer.
Cast object as a string to retrieve buffer.
Assign a value to the number. This rewrites the string buffer.
value | to assign. |
Assign another number to this number.
number | to assign to assign. |
Add a value to the number. This rewrites the string buffer.
value | to add. |
Subtract a value from the number. This rewrites the string buffer.
value | to subtract. |
Decrement the number object. This rewrites the string buffer.
Increment the number object. This rewrites the string buffer.
Construct an auto-pointer referencing an existing object.
object | we point to. |
Construct an auto-pointer as a copy of another pointer. The retention of the object being pointed to will be increased.
pointer | we are a copy of. |
Delete auto pointer. When it falls out of scope, the retention of the object it references is reduced. If it falls to zero in a reference counted object, then the object is auto-deleted.
Set our pointer to a specific object. If the pointer currently references another object, that object is released. The pointer references our new object and that new object is retained.
object | to assign to. |
Manually release the pointer. This reduces the retention level of the object and resets the pointer to point to nobody.
Test if the pointer is not set.
Test if the pointer is referencing an object.
Object factory for creating members of the spare array when they are initially requested.
Purge the array by deleting all created objects.
Get (reference) an object at a specified offset in the array.
offset | in array. |
Create a sparse array of known size. No member objects are created until they are referenced.
size | of array. |
Destroy sparse array and delete all generated objects.
Get count of array elements.
Protocol to allocate memory from the pager heap. The size of the request must be less than the size of the memory page used. The actual method is in a derived or stacked object.
size | of memory request. |
Convenience function.
size | of memory request. |
Allocate memory from the pager heap. The size of the request must be less than the size of the memory page used. The memory is initialized to zero. This uses alloc.
size | of memory request. |
Duplicate NULL terminated string into allocated memory. This uses alloc.
string | to copy into memory. |
Duplicate existing memory block into allocated memory. This uses alloc.
memory | to data copy from. |
size | of memory to allocate. |
Extract formatted string for object.
Extract formatted string for object.
character | code we are pushing. |
Method to retain (or increase retention) of an object.
Method to release (or decrease retention) of an object.
Required virtual destructor.
Retain (increase retention of) object when copying.
Increase retention operator.
Decrease retention operator.
Size of key data.
Buffer of key value.
Different error states of the security context.
Last error flagged for this context.
This is derived in different back-end libraries, and will be used to clear certificate credentials.
Convenience type to represent a security context.
Convenience type to represent a secure socket session.
Convenience type to represent a ssl certificate object.
Convenience type to represent a secure socket buf i/o stream.
Initialize secure stack for first use, and report if SSL support is compiled in.
Initialize secure stack with fips support. If fips support is not successfully enabled, the secure stack is also not initialized. Hence init() can be used for non-fips certified operation if fips fails.
Copy system certificates to a local path.
path | to copy to. |
Get path to system certificates.
Create a sever context. The certificate file used will be based on the init() method name. This may often be /etc/ssl/certs/initname.pem. Similarly, a matching private key certificate will also be loaded. An optional certificate authority document can be used when we are establishing a service which ssl clients have their own certificates.
authority | path to use or NULL if none. |
Create an anonymous client context with an optional authority to validate.
authority | path to use or NULL if none. |
paths | of certificates to use. |
Create a peer user client context. This assumes a user certificate in ~/.ssl/certs and the user private key in ~/.ssl/private. The path to an authority is also sent.
authority | path to use. |
Assign a non-default cipher to the context.
context | to set cipher for. |
ciphers | to set. |
Determine if the current security context is valid.
Get last error code associated with the security context.
Create 36 character traditional version 1 uuid.
string | to write uuid into, must be 37 bytes or more. |
Cipher key formed by hash algorithm. This can generate both a key and iv table based on the algorithms used and required. Normally it is used from a pass-phrase, though any block of data may be supplied.
Push a final cipher block. This is used to push the final buffer into the push method for any remaining data.
Process cipher data. This requires the size to be a multiple of the cipher block size. If an unaligned sized block of data is used, it will be ignored and the size returned will be 0.
data | to process. |
size | of data to process. |
This essentially encrypts a single string and pads with NULL bytes as needed.
string | to encrypt. |
This is used to process any data unaligned to the blocksize at the end of a cipher session. On an encryption, it will add padding or an entire padding block with the number of bytes to strip. On decryption it will remove padding at the end. The pkcs5 method of padding with removal count is used. This also sets the address buffer to NULL to prevent further puts until reset.
address | of data to add before final pad. |
size | of data to add before final pad. |
Process encrypted data in-place. This assumes no need to set the address buffer.
address | of data to process. |
size | of data to process. |
flag | if to pad data. |
Check if a specific cipher is supported.
name | of cipher to check. |
Finalize and recycle current digest to start a new digest.
binary | digest used rather than text if true. |
Reset and restart digest object.
Test to see if a specific digest type is supported.
name | of digest we want to check. |
Shortcut for short md5 digests if supported...
text | to create a digest for. |
Test to see if a specific digest type is supported.
name | of digest we want to check. |
Push entropic seed.
buffer | of random data to push. |
size | of buffer. |
Re-seed pseudo-random generation and entropy pools.
Get high-entropy random data. This is often used to initialize keys. This operation may block if there is insufficient entropy immediately available.
memory | buffer to fill. |
size | of buffer. |
Fill memory with pseudo-random values. This is used as the basis for all get and real operations and does not depend on seed entropy.
memory | buffer to fill. |
size | of buffer to fill. |
Get a pseudo-random integer, range 0 - 32767.
Get a pseudo-random integer in a preset range.
min | value of random integer. |
max | value of random integer. |
Get a pseudo-random floating point value.
Get a pseudo-random floating point value in a preset range.
min | value of random floating point number. |
max | value of random floating point number. |
Determine if we have sufficient entropy to return random values.
Create 36 character random uuid string.
string | to write uuid into, must be 37 bytes or more. |
Get an address list directly. This is used internally by some derived socket types when generic address lists would be invalid.
host | name in the form address or "address:port" |
service | id or port to use if not specified in host string. |
type | of service to get. |
protocol | of service to get. |
Release an address list directly. This is used internally by some derived socket types which do not use generic address lists.
list | of addresses. |
A generic socket address class. This class uses the addrinfo list to store socket multiple addresses in a protocol and family independent manner. Hence, this address class can be used for ipv4 and ipv6 sockets, for assigning connections to multiple hosts, etc. The address class will call the resolver when passed host names.
Construct a socket address. This is used to get an address to bind a socket interface to. The address can be specified as the ip address of the interface or as a "hostname". If a hostname is used, then family should be specified for clarity.
family | of socket address. Needed when host names are used. |
address | or hostname. |
type | of socket (stream, dgram, etc). |
protocol | number of socket. |
Construct a socket address for an existing socket. This can be the name of a host or to perform a lookup in a domain for a service. Family can be used to restrict the set of results returned, however since things like connecto() already filter by family and create will use family from the addrinfo, in most cases AF_UNSPEC can be used. This may be depreciated in favor of the constructor that matches a set() method.
family | of hosts to filter by or AF_UNSPEC. |
hostname | or ip address. The socket family is used for hostnames. |
service | port or name we are referencing or NULL. |
Construct a socket address list for a service.
host | address for service. |
service | name or port number. |
type | of service, stream, dgram, etc. |
Construct a socket address from host and service. This is primarily used to construct a list of potential service connections by pure port numbers or for host lookup only.
hostname | or address to use. |
service | port or 0. |
Construct a socket address from an IPv4 address and a port number.
Construct a socket address from an IPv6 address and a port number.
Construct a socket address from a sockaddr object.
Construct a socket address from an addrinfo structure.
Construct an empty address.
Copy constructor.
reference | to object to copy from. |
Assignment operator.
reference | to object to copy from. |
Destroy address. Deallocate addrinfo structure.
Compare two address lists.
Get the first socket address in our address list.
Get the first socket address by casted reference.
Get the first socket address of specified family from our list.
family | to seek. |
Get the family of the first member in a list of services.
Get the address size of the first address.
Get the port of the first address .
Set the port of all addresses in the list.
port | the port to set. |
Returns a copy of this address list with the specified port set.
Find a specific socket address in our address list.
Get the full socket address list from the object.
Get the full socket address list by casted reference.
Return the full socket address list by pointer reference.
Print the first socket address as a human-readable string to the provided buffer and returns the printed string length.
src | Address to print. |
dst | Destination buffer to print the socket address on. |
dst_sz | Size of the provided buffer. Strongly recommended to be at least INET6_ADDRSTRLEN (or INET_ADDRSTRLEN if compiled without IPv6). |
port | If true, print port number with address. If true, ipv6_brackets will also be forced to true. |
ipv6_brackets | If true, force printing IPv6 brackets. Ignored if address is an IPv4. |
Test if the address list is valid.
Test if we have no address list.
Test if the first socket address is ADDR_ANY: 0.0.0.0 or ::0
Clear the address list and set the first address to be the ADDR_ANY of the current family, or of the specified family (if set).
family | address family to set. |
Test if the first socket address is ADDR_LOOPBACK: 127.0.0.1 or ::1
Clear the address list and set the first address to be the ADDR_LOOPBACK of the current family, or of the specified family (if set).
family | address family to set. |
Clear current object.
Set the host addresses to form a new list.
hostname | or address to resolve. |
service | name or port number, or NULL if not used. |
type | of socket (stream or dgram) to filter list by. |
Append additional host addresses to our list.
hostname | or address to resolve. |
service | name or port number, or NULL if not used. |
type | of socket (stream or dgram). |
Set an entry for host binding.
family | of socket address. Needed when hostnames are used. |
address | or hostname. |
type | of socket (stream, dgram, etc). |
protocol | number of socket. |
Add an individual socket address to our address list.
address | to add. |
Insert unique members from another socket address list to ours.
address | list to insert into list. |
Remove members from another socket address list from ours.
address | list to remove from list. |
Remove an individual socket address from our address list.
address | to remove. |
Insert an individual socket address to our address list only if unique.
address | to insert into list. |
Copy an existing addrinfo into our object. This is also used to support the copy constructor.
address | list to copy from. |
Set an individual socket address for our address list.
address | to add. |
Set a socket address from host and service.
hostname | or address to use. |
service | port or 0. |
Returns the size of the socket address according to the family.
Returns the port of the socket address.
Set the port of the socket address.
address | to edit. |
port | to associate to the socket address. |
Test if the socket address is ADDR_ANY: 0.0.0.0 or ::0
Set the socket address to ADDR_ANY: 0.0.0.0 or ::0
Get a ADDR_ANY socket address of the given family.
Test if the socket address is ADDR_LOOPBACK: 127.0.0.1 or ::1
Set the socket address to ADDR_LOOPBACK: 127.0.0.1 or ::1 depending on the family of the pointed address.
Get a ADDR_LOOPBACK socket address of the given family.
Duplicate a socket address.
address | to duplicate. |
Convert address object into ipv4 address.
address | to convert. |
Convert address object into ipv6 address.
address | to convert. |
Print socket address as a human-readable string to the provided buffer and returns the printed string length.
src | Address to print. |
dst | Destination buffer to print the socket address on. |
dst_sz | Size of the provided buffer. Strongly recommended to be at least INET6_ADDRSTRLEN (or INET_ADDRSTRLEN if compiled without IPv6). |
port | If true, print port number with address. If true, ipv6_brackets will also be forced to true. |
ipv6_brackets | If true, force printing IPv6 brackets. Ignored if address is an IPv4. |
Create a socket object for use.
Create socket as duped handle of existing socket.
existing | socket to dup. |
Create socket from existing socket descriptor.
socket | descriptor to use. |
Create and connect a socket to an address from an address list. The type of socket created is based on the type we are connecting to.
address | list to connect with. |
Create an unbound socket of a specific type.
family | of our new socket. |
type | (stream, udp, etc) of our new socket. |
protocol | number of our new socket.' |
Create a bound socket. If one wishes to listen for connections on a protocol, then ListenSocket should be used instead.
address | to bind or "*" for all. |
port | number of service to bind. |
family | to bind as. |
type | of socket to bind (stream, udp, etc). |
protocol | of socket to bind. |
Shutdown, close, and destroy socket.
Cancel pending i/o by shutting down the socket.
Cancel pending i/o by shutting down the socket.
socket | to shutdown. |
Shutdown and close the socket.
Get error code.
See the number of bytes in the receive queue.
value | to test for. |
Test if socket is connected.
Test for pending input data. This function can wait up to a specified timeout for data to appear.
timeout | or 0 if none. |
Set nodelay option for tcp socket.
Test for pending input data. This function can wait up to a specified timeout for data to appear.
socket | to test. |
timeout | or 0 if none. |
Test for output data sent. This function can wait up to a specified timeout for data to appear sent.
timeout | or 0 if none. |
Get the number of bytes of data in the socket receive buffer.
Set socket for unicast mode broadcasts.
enable | broadcasting if true. |
Set socket for keepalive packets.
enable | keep-alive if true. |
Set socket blocking I/O mode.
enable | true for blocking I/O. |
Set multicast mode and multicast broadcast range.
ttl | to set for multicast socket or 0 to disable multicast. |
Set loopback to read multicast packets we broadcast.
enable | true to loopback, false to ignore. |
Get socket error code.
Set the time to live before packets expire.
time | to live to set. |
Set the size of the socket send buffer.
size | of send buffer to set. |
Set the size to wait before sending.
size | of send wait buffer to set. |
Set the size of the socket receive buffer.
size | of recv buffer to set. |
Get the type of a socket.
socket | descriptor. |
Set segment size and get MTU.
socket | to modify. |
size | of segment or zero to not set. |
Set congestion control id.
socket | to modify. |
ccid | value to set. |
Get the type of a socket.
Set segment size and get mtu of a socket.
size | of segment or 0 to leave unchanged. |
Set ccid of dccp socket.
ccid | to set. |
Set the type of service field of outgoing packets. Some useful values include IPTOS_LOWDELAY to minimize delay for interactive traffic, IPTOS_THROUGHPUT to optimize throughput, OPTOS_RELIABILITY to optimize for reliability, and IPTOS_MINCOST for low speed use.
type | of service value. |
Set packet priority, 0 to 6 unless privileged. Should be set before type-of-service.
scheduling | priority for packet scheduling. |
Shutdown the socket communication channel.
Connect our socket to a remote host from an address list. For TCP (and DCCP) sockets, the entire list may be tried. For UDP, connect is only a state and the first valid entry in the list is used.
list | of addresses to connect to. |
Disconnect a connected socket. Depending on the implementation, this might be done by connecting to AF_UNSPEC, connecting to a 0 address, or connecting to self.
Join socket to multicast group.
list | of groups to join. |
Drop socket from multicast group.
list | of groups to drop. |
Socket i/o timer setting.
timeout | to wait, inf for blocking, 0 pure non-blocking. |
Peek at data waiting in the socket receive buffer.
data | pointer to save data in. |
number | of bytes to peek. |
Read data from the socket receive buffer. This will be used in abi 4.
data | pointer to save data in. |
number | of bytes to read. |
address | of peer data was received from. |
Write data to the socket send buffer. This will be used in abi 4.
data | pointer to write data from. |
number | of bytes to write. |
address | of peer to send data to if not connected. |
Read a newline of text data from the socket and save in NULL terminated string. This uses an optimized I/O method that takes advantage of socket peeking. This presumes a connected socket on a streamble protocol. Because the trailing newline is dropped, the return size may be greater than the string length. If there was no data read because of eof of data, an error has occured, or timeout without input, then 0 will be returned.
data | to save input line. |
size | of input line buffer. |
Print formatted string to socket.
format | string. |
Read a string of input from the socket and strip trailing newline. This uses an optimized I/O method that takes advantage of socket peeking. This presumes a connected socket on a streamble protocol. Because the trailing newline is dropped, the return size may be greater than the string length. If there was no data read because of eof of data, an error has occured, or timeout without input, then 0 will be returned.
buffer | to save input line. |
Read a newline of text data from the socket and save in NULL terminated string. This uses an optimized I/O method that takes advantage of socket peeking. As such, it has to be rewritten to be used in a ssl layer socket.
socket | to read from. |
data | to save input line. |
size | of input line buffer. |
timeout | to wait for a complete input line. |
Print formatted string to socket.
socket | to write to. |
format | string. |
Write a null terminated string to the socket. This exists because we messed up consistency with the original puts() method. In the future there will be a single puts() that has a NULL default.
string | to write. |
Test if socket is valid.
Test if socket is invalid.
Assign socket from a socket descriptor. Release existing socket if one present.
socket | descriptor to assign to object. |
Get the socket descriptor by casting.
Get the socket descriptor by pointer reference.
Get the number of bytes pending in the receive buffer of a socket descriptor.
socket | descriptor. |
Set the send size of a socket descriptor.
socket | descriptor. |
size | of send buffer to set. |
Set the size to wait before sending.
socket | descriptor. |
size | of send wait buffer to set. |
Set the receive size of a socket descriptor.
socket | descriptor. |
size | of receive buffer to set. |
Connect socket descriptor to a remote host from an address list. For TCP (and DCCP) sockets, the entire list may be tried. For UDP, connect is only a state and the first valid entry in the list is used.
socket | descriptor. |
list | of addresses to connect to. |
Disconnect a connected socket descriptor.
socket | descriptor. |
Drop socket descriptor from multicast group.
socket | descriptor. |
list | of groups to drop. |
Join socket descriptor to multicast group.
socket | descriptor. |
list | of groups to join. |
Get socket error code of socket descriptor.
socket | descriptor. |
Set multicast mode and multicast broadcast range for socket descriptor.
socket | descriptor. |
ttl | to set for multicast socket or 0 to disable multicast. |
Set loopback to read multicast packets socket descriptor broadcasts.
socket | descriptor. |
enable | true to loopback, false to ignore. |
Set socket blocking I/O mode of socket descriptor.
socket | descriptor. |
enable | true for blocking I/O. |
Set socket for keepalive packets for socket descriptor.
socket | descriptor. |
enable | keep-alive if true. |
Set socket for unicast mode broadcasts on socket descriptor.
socket | descriptor. |
enable | broadcasting if true. |
Set tcp nodelay option on socket descriptor.
socket | descriptor. |
Set packet priority of socket descriptor.
socket | descriptor. |
scheduling | priority for packet scheduling. |
Set type of service of socket descriptor.
socket | descriptor. |
type | of service. |
Set the time to live for the socket descriptor.
socket | descriptor. |
time | to live to set. |
Get the address family of the socket descriptor.
Get the address family of a socket address object.
address | to examine. |
Get the address family of an internet socket address object.
address | to examine. |
Get data waiting in receive queue.
socket | to get from. |
buffer | to save. |
size | of data buffer to request. |
flags | for i/o operation (MSG_OOB, MSG_PEEK, etc). |
address | of source. |
Send data on socket.
socket | to send to. |
buffer | to send. |
size | of data buffer to send. |
flags | for i/o operation (MSG_OOB, MSG_PEEK, etc). |
address | of destination, NULL if connected. |
Send reply on socket. Used to reply to a recvfrom message.
socket | to send to. |
buffer | to send. |
size | of data buffer to send. |
flags | for i/o operation (MSG_OOB, MSG_PEEK, etc). |
address | to reply to. |
Bind the socket descriptor to a known interface and service port.
socket | descriptor to bind. |
address | to bind to or "*" for all. |
service | port to bind. |
protocol | to use or 0 if default. |
Bind the socket descriptor to a known interface listen on service port.
socket | descriptor to bind. |
address | of interface to bind to. |
backlog | for service. |
Bind the socket descriptor to a known interface.
socket | descriptor to bind. |
address | of interface to bind to. |
Accept a socket connection from a remote host.
socket | descriptor to accept from. |
address | of socket accepting. |
Create a socket object unbound.
family | of socket. |
type | of socket. |
protocol | of socket. |
Create a connected socket.
address | list to connect to. |
type | of socket to create. |
protocol | of socket. |
Create a bound socket for a service.
iface | to bind. |
service | port to bind. |
family | to select or AF_UNSPEC |
type | of socket to create. |
protocol | of socket to create. |
Create a connected socket for a service.
address | of service for connect. |
Release (close) a socket.
socket | to close. |
Lookup and return the host name associated with a socket address.
address | to lookup. |
buffer | to save hostname into. |
size | of buffer to save hostname into. |
Create an address info lookup hint based on the family and type properties of a socket descriptor.
socket | descriptor. |
hint | buffer. |
Lookup a host name and service address based on the addressing family and socket type of a socket descriptor. Store the result in a socket address structure.
socket | descriptor. |
address | that is resolved. |
hostname | to resolve. |
service | port. |
Get the size of a socket address.
address | of socket. |
Compare socket addresses. Test if the address and service matches or if there is no service, then just the host address values.
address1 | to compare. |
address2 | to compare. |
Copy a socket address.
target | address pointer to copy into. |
origin | address pointer to copy from. |
Store an address into an address object.
storage | for address. |
address | to store. |
Store an address into an internet address object.
storage | for address. |
address | to store. |
Compare socket host addresses. Test if the host address matches or if there is no service, then just the host address values.
address1 | to compare. |
address2 | to compare. |
Compare socket addresses. Test if the stored addresses received match. or if there is no service, then just the host address values.
address1 | to compare. |
address2 | to compare. |
Compare socket addresses. Test if the internet addresses received match. or if there is no service, then just the host address values.
address1 | to compare. |
address2 | to compare. |
See if both addresses are in the same subnet. This is only relevant to IPV4 and class domain routing.
address1 | to test. |
address2 | to test. |
Get the socket address of the interface needed to reach a destination address.
address | of interface found. |
target | address. |
size | of interface, 0 used for older code |
Get the hostname of a socket address.
address | to lookup. |
buffer | to save hostname in. |
size | of hostname buffer. |
Get the service port of a socket.
address | of socket to examine. |
Get the service port of an inet socket.
address | of internet socket to examine. |
Convert a socket address and service into a hash map index.
address | to convert. |
size | of map index. |
Convert a socket host address into a hash map index.
address | to convert. |
size | of map index. |
Initialize socket subsystem.
Set default socket family preference for query options when the socket type is otherwise not specified.
family | to select. |
Set the default socket behavior for v6-v4 mapping. This also effects v6 address lookup as to whether v4 remapped addresses can be used if no v6 address is found.
enable | true to set mapping. This is default. |
Return error code of last socket operation,
Simple function to validate that a given IP address string is a "zero" address. Such address strings are used for example in SIP to indicate "hold" by re-inviting peers to a null address. Supports IPV4 and IPV6 addresses.
string | address to check. |
Simple function to validate that a given IP address string is a numeric address. This can be used to verify an address is not a "host" name. Supports IPV4 and IPV6 address strings.
string | address to check. |
Get local address to which the socket is bound. This is defined here because we may re-define the backend linkage for the socks proxy in the future.
socket | descriptor to examine. |
address | storage for local address. |
Get remote address to which the socket is connected. This is defined here because we may re-define the backend linkage for the socks proxy in the future.
socket | descriptor to examine. |
address | storage for remote address. |
Helper function for linked_pointer<struct sockaddr>.
Helper function for linked_pointer<struct sockaddr>.
Helper function for linked_pointer<struct sockaddr>.
Create an unitialized instance of guard. Usually used with a guard = operator.
Set guard to mutex lock a new object. If a lock is currently held, it is released.
object | to guard. |
Prematurely release a guard.
Construct a guard for a specific object.
object | to guard. |
Release mutex when guard falls out of scope.
Create a thread object that will have a preset stack size. If 0 is used, then the stack size is os defined/default.
stack | size to use or 0 for default. |
Map thread for get method. This should be called from start of the run() method of a derived class.
Check if running.
Set thread priority without disrupting scheduling if possible. Based on scheduling policy. It is recommended that the process is set for realtime scheduling, and this method is actually for internal use.
Yield execution context of the current thread. This is a static and may be used anywhere.
Sleep current thread for a specified time period.
timeout | to sleep for in milliseconds. |
Get mapped thread object. This returns the mapped base class of the thread object of the current executing context. You will need to cast to the correct derived class to access derived thread-specific storage. If the current thread context is not mapped NULL is returned.
Abstract interface for thread context run method.
Destroy thread object, thread-specific data, and execution context.
Exit the thread context. This function should NO LONGER be called directly to exit a running thread. Instead this method will only be used to modify the behavior of the thread context at thread exit, including detached threads which by default delete themselves. This documented usage was changed to support Mozilla NSPR exit behavior in case we support NSPR as an alternate thread runtime in the future.
Used to initialize threading library. May be needed for some platforms.
Get cache line size.
Used to specify scheduling policy for threads above priority "0". Normally we apply static realtime policy SCHED_FIFO (default) or SCHED_RR. However, we could apply SCHED_OTHER, etc.
Set concurrency level of process. This is essentially a portable wrapper for pthread_setconcurrency.
Determine if two thread identifiers refer to the same thread.
thread1 | to test. |
thread2 | to test. |
Get current thread id.
Check if timer has been updated since last check. This also sets updated false.
Check if timer active.
Construct an untriggered timer set to the time of creation.
Construct a triggered timer that expires at specified offset.
offset | to expire in milliseconds. |
Construct a triggered timer that expires at specified offset.
offset | to expire in seconds. |
Construct a timer from a copy of another timer.
copy | of timer to construct from. |
Set the timer to expire.
expire | time in milliseconds. |
Set the timer to expire.
expire | time in seconds. |
Set (update) the timer with current time.
Clear pending timer, has no value.
Get remaining time until the timer expires.
Get remaining time until timer expires by reference.
Check if timer has expired.
Check if timer expired for is() expression.
Set timer expiration.
expire | timer in specified seconds. |
Set timer expiration.
expire | timer in milliseconds. |
Adjust timer expiration.
expire | time to add in seconds. |
Adjust timer expiration.
expire | time to add in milliseconds. |
Adjust timer expiration.
expire | time to subtract in seconds. |
Adjust timer expiration.
expire | time to subtract in milliseconds. |
Compute difference between two timers.
timer | to use for difference. |
Compare timers if same timeout.
timer | to compare with. |
Compare timers if not same timeout.
timer | to compare with. |
Compare timers if earlier timeout than another timer.
timer | to compare with. |
Compare timers if earlier than or equal to another timer.
timer | to compare with. |
Compare timers if later timeout than another timer.
timer | to compare with. |
Compare timers if later than or equal to another timer.
timer | to compare with. |
Sleep current thread until the specified timer expires.
timer | to reference for sleep. |
Get timer ticks since uuid epoch.
Heap base-class container for typeref objects. This uses atomic reference counters for thread safety with maximal performance. This is used as a protected base class used for strongly typed heap containers through templates.
Construction of aligned container. This is used to inform the object of the underlying real address it exists on the heap since malloc is not assured to be atomically aligned by default.
address | of actual allocation. |
size | of object allocated. |
ar | pool to use |
Release memory and delete object when no longer referenced. This gets called with the atomic reference counter < 1, such as when the last smart pointer de-references.
Is this object not empty?
Number of retains (smart pointers) referencing us.
Override delete to de-allocate actual heap. This is used because the object is atomically aligned, but the heap may not be.
address | of our object. |
Retain a copy of this object. Usually a smart pointer referencing.
Release a copy of this object. Only when the reference count reaches 0 is it destroyed.
Create a smart pointer referencing an existing heap object.
object | to reference. |
Create a smart pointer based on another pointer. Both pointers then reference the same object.
pointer | instance to share reference with. |
Create a smart pointer referencing nothing.
Set our smart pointer to a specific heap container. If we were pointing to something already we release that.
object | to reference. |
Assign from a guarded typeref.
Adjust memory pointer to atomic boundry.
address | that was allocated. |
Destroy pointer when falling out of scope. This de-references the heap container.
Set our smart pointer based on another pointer instance. If we are already referencing, we release the current container.
pointer | instance to share reference with. |
Manually release the current container.
Get size of referenced heap object.
Get number of references to container.
Check if pointer currently has a heap container.
Check if we are currently not pointing to anything.
Special weak-public means to copy a container reference. This uses the base class container which is not public, so only derived type specific smart pointers can actually use this method. It is made public because making it protected actually makes it inaccessible to template derived classes.
target | smart pointer object to set. |
object | to have it reference. |
Size of "unicode_t" character codes, may not be ucs4_t size.
A convenient NULL pointer value.
Compute character size of utf8 string codepoint.
codepoint | in string. |
Count ut8 encoded ucs4 codepoints in string.
string | of utf8 data. |
Get codepoint offset in a string.
string | of utf8 data. |
position | of codepoint in string, negative offsets are from tail. |
Convert a utf8 encoded codepoint to a ucs4 character value.
encoded | utf8 codepoint. |
How many chars requires to encode a given wchar string.
string | of ucs4 data. |
How many chars requires to encode a given unicode character.
character | to encode. |
Convert a unicode string into utf8.
string | of unicode data to pack |
buffer | of character protocol to put data into. |
Convert a utf8 string into a unicode data buffer.
unicode | data buffer. |
buffer | of character protocol to pack from. |
size | of unicode data buffer in codepoints. |
Dup a utf8 string into a ucs4_t string.
Dup a utf8 string into a ucs2_t representation.
Find first occurance of character in string.
string | to search in. |
character | code to search for. |
start | offset in string in codepoints. |
Find last occurrence of character in string.
string | to search in. |
character | code to search for. |
end | offset to start from in codepoints. |
Count occurrences of a unicode character in string.
string | to search in. |
character | code to search for. |
Get a unicode character from a character protocol.
buffer | of character protocol to read from. |
Push a unicode character to a character protocol.
character | to push to file. |
buffer | of character protocol to push character to. |
Create a utf8 pointer set to NULL.
Create a utf8 pointer for an existing char pointer.
string | pointer to use. |
Create a utf8 pointer as a copy of existing utf8 pointer.
copy | of object to use. |
Iterative increment of a utf8 pointer to prior codepoint.
Iterative decrement of a utf8 pointer to next codepoint.
Adjust utf8 pointer by specified codepoints forward.
offset | to increment by. |
Adjust utf8 pointer by specified codepoints backward.
offset | to decrement by. |
Get new utf8 string after adding a codepoint offset.
offset | to add. |
Get new utf8 string after subtracting a codepoint offset.
offset | to subtract. |
Check if text is valid pointer.
Check if text is an invalid pointer.
Extract a unicode character from a specified codepoint.
codepoint | offset to extract character from. |
Assign a utf8 string to point to.
string | to point to. |
Iterative increment of a utf8 pointer to next codepoint.
Iterative decrement of a utf8 pointer to prior codepoint.
check if pointer equals another string.
string | to check. |
check if pointer does not equal another string.
string | to check. |
Get unicode character pointed to by pointer.
Get c string we point to.
Convert utf8 pointer to a generic string pointer.
Get length of null terminated utf8 string in codepoints.
|
inline |
Invoke translation lookup if available.
This can also be used to mark text constants that need to be translated. It should not be used with pointer variables, which should instead call shell::text directly. The primary purpose is to allow extraction of text to be internationalized with xgettext "--keyword=_TEXT:1".
|
inline |
|
inline |
|
inline |
|
inline |
Convenience function to check memory arrays.
pointer | to validate. |
base | address of array. |
count | of objects. |
Definition at line 430 of file generics.h.
class __attribute__ ((visibility("default"))) sstream void ucommon::clearmem | ( | T & | var | ) |
|
inline |
Convenience function to copy class.
target | to copy into. |
source | to copy from. |
Definition at line 367 of file generics.h.
|
inline |
Convert a pointer to a reference with type checking.
This is mostly convenience for documenting behavior.
pointer | to convert. |
Definition at line 479 of file generics.h.
|
inline |
Convenience function to duplicate object pointer to heap.
object | we are duping. |
Definition at line 324 of file generics.h.
|
inline |
|
inline |
|
inline |
Compare two socket addresses to see if equal.
If the port is zero then this is the same as comparing host address alone.
s1 | socket address to compare. |
s2 | socket address to compare. |
|
inline |
|
inline |
Compare two string objects if equal.
The left string is an object, the right may be an object or converted to a const string. The compare virtual method of the left object is used, so we can do things like collation order or derived class specific sorting.
s1 | string to compare. |
s2 | string to compare. |
|
inline |
Compare two null terminated strings if equal ignoring case.
This is related to stricmp or gcc strcasecmp.
s1 | string to compare. |
s2 | string to compare. |
|
inline |
|
inline |
|
inline |
Convenience function to validate object assuming it is castable to bool.
object | we are testing. |
Definition at line 292 of file generics.h.
|
inline |
Convenience function to test pointer object.
This solves issues where some compilers get confused between bool and pointer operators.
object | we are testing. |
Definition at line 303 of file generics.h.
|
inline |
Convenience function to test pointer-pointer object.
This solves issues where some compilers get confused between bool and pointer operators.
object | we are testing. |
Definition at line 314 of file generics.h.
|
inline |
Convenience macro to range restrict values.
value | to check. |
low | value. |
high | value. |
Definition at line 468 of file generics.h.
|
inline |
|
inline |
Convenience function to return max of two objects.
o1 | to check. |
o2 | to check. |
Definition at line 445 of file generics.h.
|
inline |
|
inline |
Convenience function to return min of two objects.
o1 | to check. |
o2 | to check. |
Definition at line 456 of file generics.h.
|
inline |
Convenience function to reset an existing object.
object | type to reset. |
Definition at line 348 of file generics.h.
|
inline |
Convenience function to store object pointer into object.
target | to copy into. |
source | to copy from. |
Definition at line 377 of file generics.h.
|
inline |
Convenience function to swap objects.
Can be specialized.
o1 | to swap. |
o2 | to swap. |
Definition at line 387 of file generics.h.
|
inline |
Convenience function to zero an object and restore type info.
object | to zero in memory. |
Definition at line 357 of file generics.h.
class __attribute__ ((visibility("default"))) Conditional class __attribute__ ((visibility("default"))) ConditionalAccess class __attribute__ ((visibility("default"))) ConditionalLock class __attribute__ ((visibility("default"))) Barrier class __attribute__ ((visibility("default"))) Semaphore typedef ConditionalLock ucommon::condlock_t |
The conditional is a common base for other thread synchronizing classes.
Many of the complex sychronization objects, including barriers, semaphores, and various forms of read/write locks are all built from the conditional. This assures that the minimum functionality to build higher order thread synchronizing objects is a pure conditional, and removes dependencies on what may be optional features or functions that may have different behaviors on different pthread implimentations and platforms.
Definition at line 655 of file condition.h.
class __attribute__ ((visibility("default"))) DateTime class __attribute__ ((visibility("default"))) DateTimeString class __attribute__ ((visibility("default"))) DateNumber class __attribute__ ((visibility("default"))) isotime typedef DateTime ucommon::datetime_t |
The Datetime class uses a julian date representation of the current year, month, and day and a integer representation of the current time.
This is then manipulated in several forms and may be exported as needed.
Integer based time class. A DateTime string class. This can be used to access the date and time as a standard string without requiring an external buffer.
a datetime class that returns strings. A number class that manipulates a string buffer that is also a date.
a number that is also a date string. Convenience type for using DateTime object.
Definition at line 994 of file datetime.h.
class __attribute__ ((visibility("default"))) dir typedef fsys ucommon::fsys_t |
class __attribute__ ((visibility("default"))) ZNumber typedef Number ucommon::number_t |
class __attribute__ ((visibility("default"))) shell typedef shell ucommon::shell_t |
class __attribute__ ((visibility("default"))) JoinableThread class __attribute__ ((visibility("default"))) DetachedThread typedef TimedEvent ucommon::timedevent_t |
A child thread object that may be joined by parent.
A child thread is a type of thread in which the parent thread (or process main thread) can then wait for the child thread to complete and then delete the child object. The parent thread can wait for the child thread to complete either by calling join, or performing a "delete" of the derived child object. In either case the parent thread will suspend execution until the child thread exits.
class __attribute__ ((visibility("default"))) TimerQueue typedef TimerQueue::event ucommon::TQEvent |
A timer queue for timer events.
The timer queue is used to hold a linked list of timers that must be processed together. The timer queue processes the timer event list and calls an expired function on events that have expired. The timer queue also determines the wait time until the next timer will expire. When timer events are modified, they can retrigger the queue to re-examine the list to find when the next timer will now expire.