UCommon
Namespaces | Functions
stream.h File Reference

Any ucommon streaming classes that are built from std::streamio facilities and that support ANSI C++ stream operators. More...

#include <ucommon/platform.h>
#include <ucommon/protocols.h>
#include <ucommon/thread.h>
#include <ucommon/socket.h>
#include <ucommon/fsys.h>
#include <ucommon/shell.h>
#include <iostream>
#include <fstream>
Include dependency graph for stream.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

 ucommon
 Common namespace for all ucommon objects.
 

Functions

class ucommon::__attribute__ ((visibility("default"))) ExclusiveProtocol
 An exclusive locking protocol interface base. More...
 
 std::__attribute__ ((visibility("default"))) iostream &null
 An exclusive locking protocol interface base. More...
 
std::string & ucommon::operator+ (std::string &target, String &source)
 
std::string & ucommon::operator+= (std::string &target, String &source)
 
std::ostream & ucommon::operator<< (std::ostream &out, const PrintProtocol &format)
 
std::ostream & ucommon::operator<< (std::ostream &out, const string_t &str)
 
std::ostream & ucommon::operator<< (std::ostream &out, const stringlist_t &list)
 
std::ostream & ucommon::operator<< (std::ostream &os, Socket::address &addr)
 
std::istream & ucommon::operator>> (std::istream &inp, InputProtocol &format)
 
std::istream & ucommon::operator>> (std::istream &inp, string_t &str)
 
std::istream & ucommon::operator>> (std::istream &in, stringlist_t &list)
 

Detailed Description

Any ucommon streaming classes that are built from std::streamio facilities and that support ANSI C++ stream operators.

Definition in file stream.h.

Function Documentation

§ __attribute__()

std::__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.

Author
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org

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.

Author
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org

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.

Author
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org

Separating the mutex means we can apply it either paired with a condition variable, or shared among multiple condition variables.

Author
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org

This can be used to form specialized thread synchronizing classes such as ordered sempahores, or to create thread completion lists.

Author
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org

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.

Author
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org

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.

Author
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org Automatically toggle a bool on each reference.
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org

This is then manipulated in several forms and may be exported as needed.

Author
David Sugar dyfet.nosp@m.@ost.nosp@m.el.co.nosp@m.m 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.

Author
Marcelo Dalmas mad@b.nosp@m.rasm.nosp@m.ap.co.nosp@m.m.br and David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org 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.

Author
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org

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.

Author
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org Reusable objects for forming private heaps. Reusable objects are linked objects that may be allocated in a private heap, and are returned to a free list when they are no longer needed so they can be reused without having to be re-allocated. The free list is the root of a linked object chain. This is used as a base class for those objects that will be managed through reusable heaps.
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org An index container for maintaining an ordered list of objects. This index holds a pointer to the head and tail of an ordered list of linked objects. Fundamental methods for supporting iterators are also provided.
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org

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.

Author
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org

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.

Author
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org A managed private heap for small allocations. This is used to allocate a large number of small objects from a paged heap as needed and to then release them together all at once. This pattern has significantly less overhead than using malloc and offers less locking contention since the memory pager can also have it's own mutex. Pager pool allocated memory is always aligned to the optimal data size for the cpu bus and pages are themselves created from memory aligned allocations. A page size for a memory pager should be some multiple of the OS paging size.

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.

Author
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org String pager for storing lists of NULL terminated strings. This is used for accumulating lists which can be destroyed all at once.
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org Directory pager is a paged string list for directory file names. This protocol is used to convert a directory into a list of filenames. As a protocol it offers a filtering method to select which files to include in the list.
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org Create a linked list of auto-releasable objects. LinkedObject derived objects can be created that are assigned to an autorelease object list. When the autorelease object falls out of scope, all the objects listed' with it are automatically deleted.
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org

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.

Author
David Sugar dyfet.nosp@m.@ost.nosp@m.el.co.nosp@m.m 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.

Author
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org A general purpose smart pointer helper class. This is particularly useful in conjunction with reference counted objects which can be managed and automatically removed from the heap when they are no longer being referenced by a smart pointer. The smart pointer itself would normally be constructed and initialized as an auto variable in a method call, and will dereference the object when the pointer falls out of scope. This is actually a helper class for the typed pointer template.
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org

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.

Author
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org

This is used because sometimes we choose a common memory pool to manage different objects.

Author
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org Common locking protocol. This is used for objects that may internally have sync'd functions, directly or in a derived class, that lock the current object. The default handlers do nothing but offer the virtuals as a stub.
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org

We would create a derived class who's constructor creates an internal string object, and a single method to extract that string.

Author
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org

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.

Author
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org

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.

Author
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org

This offers common routines needed for secure/ssl socket support code.

Author
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org

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.

Author
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org

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.

Author
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org

This class can support md5 digests, sha1, sha256, etc, depending on what the underlying library supports.

Author
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org

This is used both to gather entropy pools and pseudo-random values.

Author
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org

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.

Author
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org A generic socket base class. This class can be used directly or as a base class for building network protocol stacks. This common base tries to handle UDP and TCP sockets, as well as support multicast, IPV4/IPV6 addressing, and additional addressing domains (such as Unix domain sockets).
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org

This class is commonly used for TCP and DCCP listener sockets.

Author
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org A generic tcp server class. This saves the service id tag so that it can be propagated.
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org Helper class for linked_pointer template.
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org

This both binds the character protocol to iostream and offers a common base class for all other c++ stdlib based streaming classes.

Author
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org Streamable tcp connection between client and server. The tcp stream class can represent a client connection to a server or an instance of a service generated by a tcp listener. As a stream class, data can be manipulated using the << and >> operators.
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org Streamable pipe socket connection. This creates a stream between a parent and child process. As a stream class, data can be exchanged using the << and >> operators.
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org Streamable file class based on low level fsys io. This differs from the normal fstream classes as it may apply to other kinds of file streams.
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org Stream class to read from a memory buffer. May optionally be 0 byte terminated if no length is specified. Stream class to write to memory buffer. At least with gcc, linking of stream operators was broken. This provides an auxillory class to solve the issue.

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.

Author
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org Event notification to manage scheduled realtime threads. The timer is advanced to sleep threads which then wakeup either when the timer has expired or they are notified through the signal handler. This can be used to schedule and signal one-time completion handlers or for time synchronized events signaled by an asychrononous I/O or event source.
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org Portable recursive exclusive lock. This class is built from the conditional and hence does not require support for non-standard and platform specific extensions to pthread mutex to support recrusive style mutex locking. The exclusive protocol is implimented to support exclusive_lock referencing. Class for resource bound memory pools between threads. This is used to support a memory pool allocation scheme where a pool of reusable objects may be allocated, and the pool renewed by releasing objects or back. When the pool is used up, a pool consuming thread then must wait for a resource to be freed by another consumer (or timeout). This class is not meant to be used directly, but rather to build the synchronizing control between consumers which might be forced to wait for a resource.
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org Generic non-recursive exclusive lock class. This class also impliments the exclusive_lock protocol. In addition, an interface is offered to support dynamically managed mutexes which are internally pooled. These can be used to protect and serialize arbitrary access to memory and objects on demand. This offers an advantage over embedding mutexes to serialize access to individual objects since the maximum number of mutexes will never be greater than the number of actually running threads rather than the number of objects being potentially protected. The ability to hash the pointer address into an indexed table further optimizes access by reducing the chance for collisions on the primary index mutex.
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org Guard class to apply scope based mutex locking to objects. The mutex is located from the mutex pool rather than contained in the target object, and the lock is released when the guard object falls out of scope. This is essentially an automation mechanism for mutex::protect.
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org

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.

Author
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org

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.

Author
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org

This is a foundation for all utf8 string processing.

Author
David Sugar

This is derived from the classic uCommon String class by adding operations that are utf8 encoding aware.

Author
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org Pointer to utf8 encoded character data. This is a kind of "char *" for utf8 text.
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org

An exclusive locking protocol interface base.

XML streaming parser.

Splits delimited string into tokens.

Timer ports are used to provide synchronized timing events when managed under a "service thread" such as SocketService.

This class is used to access non-reentrant date and time functions in the standard C library.

The SemaphoreLock class is used to protect a section of code through a semaphore so that only x instances of the member function may execute concurrently.

The WriteLock class is used to protect a section of code through a ThreadLock for "write" access to the member function.

The ReadLock class is used to protect a section of code through a ThreadLock for "read" access to the member function.

The Mutex Counter is a counter variable which can safely be incremented or decremented by multiple threads.

The slog class is used to stream messages to the system's logging facility (syslogd).

The Serial class is used as the base for all serial I/O services under APE.

This class is used to create a "named" lock entity that can be used to control access to a resource between multiple processes.

A class for containing portable process related functions that help create portable code.

Stream serialization of persistent classes.

PersistObject.

Type manager for persistence engine.

The MapObject is a base class which can be used to make a derived class operate on a MapTable.

A map table allows for entities to be mapped (hash index) onto it.

Self managed double linked list object chain.

Self managed single linked list object chain.

Pointer to reference counted objects.

A reference countable object.

The shared mempager uses a mutex to protect key access methods.

The Multipart form is a MIME multipart document specific for the construction and delivery of form data to a web server through a post method.

A container class for multi-part MIME document objects which can be streamed to a std::ostream destination.

The purpose of this class is to define a base class for low level random file access that is portable between Win32 and Posix systems.

A low level portable directory class.

alog global log stream definition

Manipulator for info level.

Manipulator for notice level.

Manipulator for critical level.

Manipulator for alert level.

Manipulator for emerg level.

Manipulator for error level.

Manipulator for warn level.

Application logger is a class that implements a logger that can be used by applications to save log file somewhere on the system.

Produces a dump of a buffer in a hexdump way with its code Ascii translation and relative buffer address.

Classes derived from IPV6Address would require an specific validator to pass to the IPV6Address constructor.

The network name and address objects are all derived from a common IPV4Address base class.

The CIDR class is used to support routing tables and validate address policies.

Class for the function object that validates multicast addresses.

This is a base class for classes of function objects used by such derived classes.

Author
Federico Montesino p5087.nosp@m.@qui.nosp@m.ntero.nosp@m..fie.nosp@m..us.e.nosp@m.s Abstract base class for derived inet addresses validators.

Implements a specific application operator to validate multicast addresses.

Author
Federico Montesino p5087.nosp@m.@qui.nosp@m.ntero.nosp@m..fie.nosp@m..us.e.nosp@m.s Validating class specialized for multicast addresses. The CIDR class is used to support routing tables and validate address policies.
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org Classless Internet Domain Routing
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org Classless Internet Domain Routing

Specific classes, such as IPV4Host, IPV4Mask, etc, are defined from IPV4Address entirely so that the manner a network address is being used can easily be documented and understood from the code and to avoid common errors and accidental misuse of the wrong address object. For example, a "connection" to something that is declared as a "IPV4Host" can be kept type-safe from a "connection" accidently being made to something that was declared a "IPV4Broadcast".

Author
David Sugar dyfet.nosp@m.@ost.nosp@m.el.co.nosp@m.m Internet Address binary data type.

Implements a specific application operator to validate multicast addresses.

Author
Federico Montesino p5087.nosp@m.@qui.nosp@m.ntero.nosp@m..fie.nosp@m..us.e.nosp@m.s Validating class specialized for multicast addresses. The network name and address objects are all derived from a common IPV6Address base class. Specific classes, such as IPV4Host, IPV6Mask, etc, are defined from IPV6Address entirely so that the manner a network address is being used can easily be documented and understood from the code and to avoid common errors and accidental misuse of the wrong address object. For example, a "connection" to something that is declared as a "IPV6Host" can be kept type-safe from a "connection" accidently being made to something that was declared a "IPV6Broadcast".
David Sugar dyfet.nosp@m.@ost.nosp@m.el.co.nosp@m.m Internet Address binary data type.

For instance: 0000000 - 77 98 21 49 0e 00 05 00 40 1c 01 1c 2f 00 00 00 w.!I......./...

It uses ost::slog to write to syslog and std::clog to write to standard output.

It provides either a stream oriented logger or a old printf style one.

It can be used to log directly on a file or in a spooler like way. Latter uses a ost::ThreadQueue to implement a thread safe access to logger.

It provides a global stream variable called ost::alog.

It provides an AppLog::Ident class that represents a module name for instance that can be used to tag logs. Logging levels are the same defined into ost::Slog: Slog::levelEmergency Slog::levelAlert Slog::levelCritical Slog::levelError Slog::levelWarning Slog::levelNotice Slog::levelInfo Slog::levelDebugfrom.

Example of usage: alog << mod_name << debug << "Hello world!" << std::endl; Manipulator for debug level

Parameters
slapplication logger stream
Returns
application logger stream
Parameters
slapplication logger stream
Returns
application logger stream

Used to support ccstd Directory container. This provides a basic mechanism for allocating and accessing file entries.

Author
David Sugar dyfet.nosp@m.@ost.nosp@m.el.co.nosp@m.m low level directory access class. A generic class to walk a hierarchical directory structure.
David Sugar dyfet.nosp@m.@ost.nosp@m.el.co.nosp@m.m Directory tree walking.

This class is a foundation both for optimized thread shared and traditional locked file access that is commonly used to build database services, rather than the standard C++ streaming file classes.

Author
David Sugar dyfet.nosp@m.@ost.nosp@m.el.co.nosp@m.m Portable random disk file access. This class defines a database I/O file service that can be shared by multiple processes. Each thread should access a dup of the database object, and mutex locks can be used to preserve transaction integrety if multiple threads are used.

SharedFile is used when a database may be shared between multiple processes. SharedFile automatically applies low level byte-range "file locks", and provides an interface to fetch and release byte-range locked portions of a file.

Author
David Sugar dyfet.nosp@m.@ost.nosp@m.el.co.nosp@m.m This class defines a database I/O file service that can be shared by multiple processes. Create and map a disk file into memory. This portable class works under both Posix via mmap and under the win32 API. A mapped file can be referenced directly by it's memory segment. One can map and unmap portions of a file on demand, and update changed memory pages mapped from files immediately through sync().
David Sugar dyfet.nosp@m.@ost.nosp@m.el.co.nosp@m.m Map a named disk file into memory. The DSO dynamic loader class is used to load object files. On elf based systems this is typically done with dlopen. A dummy stub class is generated for non-dl capable systems.
David Sugar dyfet.nosp@m.@ost.nosp@m.el.co.nosp@m.m Dynamic class file loader.
David Sugar dyfet.nosp@m.@ost.nosp@m.el.co.nosp@m.m container for streamable multi-part MIME documents.
David Sugar dyfet.nosp@m.@ost.nosp@m.el.co.nosp@m.m deliver form results as multipart document. This is used to attach an item part to a MIME multipart document that is being streamed. The base item part class is used by all derived items.
David Sugar dyfet.nosp@m.@ost.nosp@m.el.co.nosp@m.m item or part of a multi-part object.

This class is used when a mempager will be shared by multiple threads.

Author
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org mutex protected memory pager. This class is used to associate (object) pointers with named strings. A virtual is used to allocate memory which can be overriden in the derived class.
David Sugar dyfet.nosp@m.@ost.nosp@m.el.co.nosp@m.m associate names with pointers.

This is used in association with smart pointers (RefPointer).

Author
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org Object managed by smart pointer reference count.

This is a non-template form of a reference count smart pointer, and so uses common code. This can be subclassed to return explicit object types.

Author
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org Pointer to reference count managed objects.

This is used for accumulating lists by using as a base class for a derived subclass.

Author
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org Accumulating single linked list.

This is used for accumulating lists by using as a base class for a derived subclass.

Author
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org Accumulating double linked list.

Unlike with Assoc, This form of map table also allows objects to be removed from the table. This table also includes a mutex lock for thread safety. A free list is also optionally maintained for reusable maps.

Author
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org Table to hold hash indexed objects. The MapIndex allows linear access into a MapTable, that otherwise could have its elements being retrieved only by key. It can be increased, checked and dereferenced like a pointer, by means of suitable operators.
Sergio Repetto s.rep.nosp@m.etto.nosp@m.@pent.nosp@m.aeng.nosp@m.ineer.nosp@m.ing..nosp@m.it Index object to access MapTable elements

Derived classes may override new and delete operators to use managed free list from a MapTable.

Author
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org Mappable object.

This class manages the types for generation of the persistent objects. Its data structures are managed automatically by the system. They are implicitly filled by the constructors who declare classes to the system.

Author
Daniel Silverstone

Base class for classes that will be persistent. This object is the base for all Persistent data which is not natively serialized by the persistence::engine

It registers itself with the persistence::TypeManager using a global constructor function. A matching deregister call is made in a global destructor, to allow DLL's to use the persistence::engine in a main executable.

Persistable objects must never maintain bad pointers. If a pointer doesn't point to something valid, it must be NULL. This is so the persistence engine knows whether to allocate memory for an object or whether the memory has been pre-allocated.

Author
Daniel Silverstone

This class constructs on a standard C++ STL stream and then operates in the mode specified. The stream passed into the constructor must be a binary mode to function properly.

Author
Daniel Silverstone

These are typically referenced thru Process::xxx static member functions. Many of these members are used both for win32 and posix systems although some may be platform specific.

Peocess wrapper class.

Author
David Sugar dyfet.nosp@m.@ost.nosp@m.el.co.nosp@m.m

The posix implimentation uses a pidfile and the win32 version uses a globally visible mutex.

Author
David Sugar dyfet.nosp@m.@ost.nosp@m.el.co.nosp@m.m System-wide named lock

A serial is a system serial port that is used either for line or packet based data input. Serial ports may also be "streamable" in a derived form.

Common C++ serial I/O classes are used to manage serial devices and implement serial device protocols. From the point of view of Common C++, serial devices are supported by the underlying Posix specified "termios" call interface.

The serial I/O base class is used to hold a descriptor to a serial device and to provide an exception handling interface for all serial I/O classes. The base class is also used to specify serial I/O properties such as communication speed, flow control, data size, and parity. The "Serial" base class is not itself directly used in application development, however.

Common C++ Serial I/O is itself divided into two conceptual modes; frame oriented and line oriented I/O. Both frame and line oriented I/O makes use of the ability of the underlying tty driver to buffer data and return "ready" status from when select either a specified number of bytes or newline record has been reached by manipulating termios c_cc fields appropriately. This provides some advantage in that a given thread servicing a serial port can block and wait rather than have to continually poll or read each and every byte as soon as it appears at the serial port.

Author
David Sugar dyfet.nosp@m.@ost.nosp@m.el.co.nosp@m.m base class for all serial I/O services.

A default slog object is used to avoid confusion with the native syslog facility and to imply a logical relationship to the C++ clog().

The key difference is that the slog object sends it's output to the system logging daemon (typically syslogd) rather than through stderr. slog can be streamed with the << operator just like clog; a default slog object is pre-initialized, and you stream character data to it.

The slog allows one to specify logging levels and other properties through the () operators. Hence, once can do:

slog("mydaemon", SLOG_DAEMON, SLOG_EMERGENCY) << I just died << endl; 

or things like:

slog("mydaemon", SLOG_DAEMON);
slog(SLOG_INFO) << "daemon initalized" << endl; 

The intent is to be as common-place and as convenient to use as the stderr based clog facility found in C++, and this is especially useful for C++ daemons.

The std::flush manipulator doesn't work. Either the std::endl or std::ends manipulators must be used to cause the output to be sent to the daemon.

When this class is used on a system that doesn't have the syslog headers (i.e. a non-posix win32 box), the output goes to the a file with the same name as the syslog identifier string with '.log' appended to it. If the identifier string ends in '.exe', the '.exe' is removed before the '.log' is appened. (e.g. the identifier foo.exe will generate a log file named foo.log)

Author
David Sugar dyfet.nosp@m.@ost.nosp@m.el.co.nosp@m.m
Minor docs & hacks by Jon Little littl.nosp@m.ej@a.nosp@m.rlut..nosp@m.utex.nosp@m.as.ed.nosp@m.u

system logging facility class.

A Mutex is used to protect access to the counter variable (an integer). An initial value can be specified for the counter, and it can be manipulated with the ++ and – operators.

Author
David Sugar dyfet.nosp@m.@ost.nosp@m.el.co.nosp@m.m Thread protected integer counter. The MutexLock class is used to protect a section of code so that at any given time only a single thread can perform the protected operation.

It use Mutex to protect operation. Using this class is usefull and exception safe. The mutex that has been locked is automatically released when the function call stack falls out of scope, so one doesnt have to remember to unlock the mutex at each function return.

A common use is

void func_to_protect() { MutexLock lock(mutex); ... operation ... }

NOTE: do not declare variable as "MutexLock (mutex)", the mutex will be released at statement end.

Author
Frediano Ziglio fredd.nosp@m.y77@.nosp@m.angel.nosp@m.fire.nosp@m..com Mutex automatic locker for protected access.

The ThreadLock is automatically released when the object falls out of scope.

A common use is

void func_to_protect() { ReadLock lock(threadlock); ... operation ... }

NOTE: do not declare variable as "ReadLock (threadlock)", the mutex will be released at statement end.

Author
David Sugar dyfet.nosp@m.@gnu.nosp@m..org Read mode automatic locker for protected access.

The ThreadLock is automatically released when the object falls out of scope.

A common use is

void func_to_protect() { WriteLock lock(threadlock); ... operation ... }

NOTE: do not declare variable as "WriteLock (threadlock)", the mutex will be released at statement end.

Author
David Sugar dyfet.nosp@m.@gnu.nosp@m..org Read mode automatic locker for protected access.

A common use is

void func_to_protect() { SemaphoreLock lock(semaphore); ... operation ... }

NOTE: do not declare variable as "SemaohoreLock (semaphore)", the mutex will be released at statement end.

Author
David Sugar dyfet.nosp@m.@gnu.nosp@m..org Semaphore automatic locker for protected access.

The class has two purposes:

  • 1 To be used internaly in CommonCpp's date and time classes to make them thread safe.
  • 2 To be used by clients as thread safe replacements to the standard C functions, much like Thread::sleep() represents a thread safe version of the standard sleep() function.
Note
The class provides one function with the same name as its equivalent standard function and one with another, unique name. For new clients, the version with the unique name is recommended to make it easy to grep for accidental usage of the standard functions. The version with the standard name is provided for existing clients to sed replace their original version.
Also note that some functions that returned pointers have been redone to take that pointer as an argument instead, making the caller responsible for memory allocation/deallocation. This is almost how POSIX specifies *_r functions (reentrant versions of the standard time functions), except the POSIX functions also return the given pointer while we do not. We don't use the *_r functions as they aren't all generally available on all platforms yet.
Author
Idar Tollefsen idar@.nosp@m.cogn.nosp@m.ita.n.nosp@m.o Thread safe date and time functions.

This is made into a stand-alone base class since other derived libraries (such as the serial handlers) may also use the pooled "service thread" model and hence also require this code for managing timing.

Author
David Sugar dyfet.nosp@m.@ost.nosp@m.el.co.nosp@m.m synchronized millisecond timing for service threads.

The StringTokenizer takes a pointer to a string and a pointer to a string containing a number of possible delimiters. The StringTokenizer provides an input forward iterator which allows to iterate through all tokens. An iterator behaves like a logical pointer to the tokens, i.e. to shift to the next token, you've to increment the iterator, you get the token by dereferencing the iterator.

Memory consumption: This class operates on the original string and only allocates memory for the individual tokens actually requested, so this class allocates at maximum the space required for the longest token in the given string. Since for each iteration, memory is reclaimed for the last token, you MAY NOT store pointers to them; if you need them afterwards, copy them. You may not modify the original string while you operate on it with the StringTokenizer; the behaviour is undefined in that case.

The iterator has one special method 'nextDelimiter()' which returns a character containing the next delimiter following this tokenization process or '\0', if there are no following delimiters. In case of skipAllDelim, it returns the FIRST delimiter.

With the method 'setDelimiters(const char*)' you may change the set of delimiters. It affects all running iterators.

Example:

 StringTokenizer st("mary had a little lamb;its fleece was..", " ;");
 StringTokenizer::iterator i;
 for (i = st.begin() ; i != st.end() ; ++i) {
       cout << "Token: '" << *i << "'\t";
       cout << " next Delim: '" << i.nextDelimiter() << "'" << endl;
 }
 

Author
Henner Zeller H.Zel.nosp@m.ler@.nosp@m.acm.o.nosp@m.rg
License:
LGPL

This class implements a basic XML stream parser that can be used to examine an XML resource thru virtual I/O methods. This class must be derived into one that can implement the physical I/O required to parse actual data. A mixer class using XMLParser and tcpstream would be one example of this. This can also be used to parse xml content in memory buffers easily. This parser is only concerned with well-formedness, and does not perform validation.

Author
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org

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.

Author
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org

Create an instance of an exclusive object reference.

Parameters
objectcontaining Exclusive base class protocol to lock.

Destroy reference to exclusively locked object, release lock.

Test if the reference holds an active lock.

Returns
true if is not locking an object.

Test if the reference holds an active lock.

Returns
true if locking an object.

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.

Author
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org

Create an instance of an exclusive object reference.

Parameters
objectcontaining Exclusive base class protocol to lock.

Destroy reference to shared locked object, release lock.

Test if the reference holds an active lock.

Returns
true if is not locking an object.

Test if the reference holds an active lock.

Returns
true if locking an object.

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.

Parameters
objectcontaining Exclusive base class protocol to lock.

Destroy reference to shared locked object, release lock.

Test if the reference holds an active lock.

Returns
true if is not locking an object.

Test if the reference holds an active lock.

Returns
true if locking an object.

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.

Author
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org

Atomic spinlock class. Used as high-performance sync lock between threads.

Author
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org

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.

Returns
true if acquired.

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.

Parameters
timeoutin milliseconds.
Returns
true if signalled, false if timer expired.

Conditional wait for signal on timespec timeout.

Parameters
timeoutas a high resolution timespec.
Returns
true if signalled, false if timer expired.

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.

Parameters
limitbefore recycling to zero.

Get the next counter value.

Returns
next counter value.

Get the range of values before recycling.

Returns
counter limit.

Reference next counter value through pointer operation.

Returns
next counter value.

Reference next counter value by casting to integer.

Returns
next counter value.

Assign the value of the counter.

Parameters
valueto 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.

Parameters
valuefrom time()

Create a julian date from a local or gmt date and time.

Parameters
objectfrom DateTime::glt() or gmt().

Create a julian date from a ISO date string of a specified size.

Parameters
pointerto ISO date string.
sizeof date field if not null terminated.

Create a julian date from an arbitrary year, month, and day.

Parameters
yearof date.
monthof date (1-12).
dayof month (1-31).

Create a julian date object from another object.

Parameters
objectto copy.

Construct a new julian date with today's date.

Destroy julian date object.

Get the year of the date.

Returns
year of the date

Get the month of the date (1-12).

Returns
month of year

Get the day of the month of the date.

Returns
day of month

Get the day of the week (0-7).

Returns
day of week

Get a ISO string representation of the date (yyyy-mm-dd).

Parameters
bufferto store string.
Returns
string representation.

Get a time_t for the julian date if in time_t epoch.

Returns
time_t or -1 if out of range.

Get the date as a number for the object or 0 if invalid.

Returns
date as number.

Set (update) the date with current date.

Set the julian date based on an ISO date string of specified size.

Parameters
pointerto date string field.
sizeof field if not null terminated.

Check if date is valid.

Returns
true if julian date is valid.

Casting operator to return date as number.

Returns
julian number.

Access julian value.

Returns
julian number of object.

Expression operator to return an ISO date string for the current julian date.

Returns
ISO date string.

Increment date by one day.

Returns
instance of current date object.

Decrement date by one day.

Returns
instance of current date object.

Increment date by offset.

Parameters
offsetto add to julian date.
Returns
instance of current date object.

Decrement date by offset.

Parameters
offsetto subtract from julian date.
Returns
instance of current date object.

Add days to julian date in an expression.

Parameters
daysto add.
Returns
new date object with modified days.

Subtract days from a julian date in an expression.

Parameters
daysto subtract.
Returns
new date object with modified days.

Operator to compute number of days between two dates.

Parameters
dateoffset for computation.
Returns
number of days difference.

Assign date from another date object.

Parameters
dateobject to assign from.
Returns
current modified date object.

Compare julian dates if same date.

Parameters
dateto compare with.
Returns
true if same.

Compare julian dates if not same date.

Parameters
dateto compare with.
Returns
true if not same.

Compare julian date if earlier than another date.

Parameters
dateto compare with.
Returns
true if earlier.

Compare julian date if earlier than or equal to another date.

Parameters
dateto compare with.
Returns
true if earlier or same.

Compare julian date if later than another date.

Parameters
dateto compare with.
Returns
true if later.

Compare julian date if later than or equal to another date.

Parameters
dateto compare with.
Returns
true if later or same.

Check if julian date is not valid.

Returns
true if date is invalid.

Check if julian date is valid for is() expression.

Returns
true if date is valid.

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.

Parameters
valueof time_t to use.

Create a time from the time portion of a date and time object.

Parameters
objectfrom DateTime::glt() or gmt().

Create a time from a hh:mm:ss formatted time string.

Parameters
pointerto formatted time field.
sizeof field if not null terminated.

Create a time from hours (0-23), minutes (0-59), and seconds (0-59).

Parameters
hourof time.
minuteof time.
secondof time.

Create a time object from another object.

Parameters
objectto copy.

Create a time from current time.

Destroy time object.

Get current time in seconds from midnight.

Returns
seconds from midnight.

Get hours from midnight.

Returns
hours from midnight.

Get minutes from current hour.

Returns
minutes from current hour.

Get seconds from current minute.

Returns
seconds from current minute.

Get a hh:mm:ss formatted string for current time.

Parameters
bufferto store time string in.
Returns
time string buffer or NULL if invalid.

Set (update) the time with current time.

Set time from a hh:mm:ss formatted string.

Parameters
pointerto time field.
sizeof field if not null terminated.

Check if time object had valid value.

Returns
true if object is valid.

Check if time object has valid value for is() operator.

Returns
true if object is valid.

Check if time object has valid value for ! operator.

Returns
true if object is not valid.

Get difference (in seconds) between two times.

Parameters
referencetime to get difference from.
Returns
difference in seconds.

Add seconds to the current time, wrap if 24 hours.

Parameters
secondsto add.
Returns
new time object with modified value.

Subtract seconds to the current time, wrap if 24 hours.

Parameters
secondsto subtract.
Returns
new time object with modified value.

Get time in seconds.

Returns
seconds.

Get object time in seconds.

Returns
time in seconds.

Convert to standard 24 hour time string.

Returns
time string.

Incrememnt time by 1 second, wrap on 24 hour period.

Returns
modified instance of current time object.

Decrement time by 1 second, wrap on 24 hour period.

Returns
modified instance of current time object.

Assign a time as a copy of another time.

Parameters
timeto assign from.
Returns
time object that was assigned.

Increment time by specified seconds. Wraps on 24 hour period.

Parameters
secondsto add to current time.
Returns
modified instance of current time object.

Decrement time by specified seconds. Wraps on 24 hour period.

Parameters
secondsto subtract from current time.
Returns
modified instance of current time object.

Compare time with another time to see if same time.

Parameters
timeto compare with.
Returns
true if same time.

Compare time with another time to see if not same time.

Parameters
timeto compare with.
Returns
true if not same time.

Compare time if earlier than another time.

Parameters
timeobject to compare with.
Returns
true if earlier than object.

Compare time if earlier than or equal to another time.

Parameters
timeobject to compare with.
Returns
true if earlier or same as object.

Compare time if later than another time.

Parameters
timeobject to compare with.
Returns
true if later than object.

Compare time if later than or equal to another time.

Parameters
timeobject to compare with.
Returns
true if later than or same as object.

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.

Parameters
descriptorto copy from.

Create a fsys descriptor by opening an existing file or directory.

Parameters
pathof file to open for created descriptor.
accessmode of file.

Create a fsys descriptor by creating a file.

Parameters
pathof file to create for descriptor.
accessmode of file access.
permissionmode of file.

Close and release a file descriptor.

Get the descriptor from the object by pointer reference.

Returns
low level file handle.

Get the descriptor from the object by casting reference.

Returns
low level file handle.

Reset error flag.

Test if file descriptor is open.

Returns
true if open.

Test if file descriptor is closed.

Returns
true if closed.

Assign file descriptor by duplicating another descriptor.

Parameters
descriptorto 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.

Parameters
descriptorto dup from.

Get the native system descriptor handle of the file descriptor.

Returns
native os descriptor.

Set with external descriptor. Closes existing file if open.

Parameters
descriptorof open file.

Release descriptor, do not close.

Returns
handle being released.

Set the position of a file descriptor.

Parameters
offsetfrom start of file or "end" to append.
Returns
error number or 0 on success.

Drop cached data from start of file.

Parameters
sizeof region to drop or until end of file.
Returns
error number or 0 on success.

See if current file stream is a tty device.

Returns
true if device.

See if the file handle is a tty device.

Returns
true if device.

Read data from descriptor or scan directory.

Parameters
bufferto read into.
countof bytes to read.
Returns
bytes transferred, -1 if error.

Write data to descriptor.

Parameters
bufferto write from.
countof bytes to write.
Returns
bytes transferred, -1 if error.

Get status of open descriptor.

Parameters
bufferto save status info in.
Returns
error number or 0 on success.

Truncate file to specified length. The file pointer is positioned to the new end of file.

Parameters
offsetto truncate to.
Returns
true if truncate successful.

Commit changes to the filesystem.

Returns
error number or 0 on success.

Set directory prefix (chdir).

Parameters
pathto change to.
Returns
error number or 0 on success.

Get current directory prefix (pwd).

Parameters
pathto save directory into.
sizeof path we can save.
Returns
error number or 0 on success.

Stat a file.

Parameters
pathof file to stat.
bufferto save stat info.
Returns
error number or 0 on success.

Erase (remove) a file only.

Parameters
pathof file.
Returns
error number or 0 on success.

Copy a file.

Parameters
sourcefile.
targetfile.
sizeof buffer.
Returns
error number or 0 on success.

Rename a file.

Parameters
oldpathto rename from.
newpathto rename to.
Returns
error number or 0 on success.

Change file access mode.

Parameters
pathto change.
valueof mode to assign.
Returns
error number or 0 on success.

Test if path exists.

Parameters
pathto test.
Returns
if true.

Test if path readable.

Parameters
pathto test.
Returns
if true.

Test if path writable.

Parameters
pathto test.
Returns
if true.

Test if path is executable.

Parameters
pathto test.
Returns
if true.

Test if path is a file.

Parameters
pathto test.
Returns
true if exists and is file.

Test if path is a directory.

Parameters
pathto test.
Returns
true if exists and is directory.

Test if path is a symlink.

Parameters
pathto test.
Returns
true if exists and is symlink.

Test if path is a device path.

Parameters
pathto test.
Returns
true of is a device path.

Test if path is a hidden file.

Parameters
pathto test.
Returns
true if exists and is hidden.

Open a file or directory.

Parameters
pathof file to open.
accessmode of descriptor.

Assign descriptor directly.

Parameters
descriptorto assign.

Assign a descriptor directly.

Parameters
objectto assign descriptor to.
descriptorto assign.

Open a file descriptor directly.

Parameters
pathof file to create.
accessmode of descriptor.
modeof 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.

Parameters
pathto remove.
Returns
error number or 0 on success.

Create a symbolic link.

Parameters
pathto create.
targetof link.
Returns
error number or 0 on success.

Create a hard link.

Parameters
pathto create link to.
targetof link.
Returns
error number or 0 on success.

Read a symbolic link to get it's target.

Parameters
pathof link.
bufferto save target into.
sizeof buffer.

Close a fsys resource.

Returns
error code as needed.

Get last error.

Returns
error number.

Direct means to open a read-only file path and return a descriptor.

Parameters
pathto open.
Returns
descriptor on success, invalid handle on failure.

Direct means to create or access a writable path and return descriptor.

Parameters
pathto create.
Returns
descriptor on success, invalid handle on failure.

Direct means to create or append a writable path and return descriptor.

Parameters
pathto create.
Returns
descriptor on success, invalid handle on failure.

Release a file descriptor.

Parameters
descriptorto release.

Create pipe. These are created inheritable by default.

Parameters
inputdescriptor.
outputdescriptor.
sizeof buffer if supported.
Returns
0 or error code.

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.

Parameters
descriptorto modify.
enablechild process inheritence.
Returns
0 on success, error on failure.

Create inheritable /dev/null handle.

Returns
null device handle.

Load a library into memory.

Parameters
pathto plugin.
Returns
0 on success, else error.

Execute a process and get exit code.

Parameters
pathto execute.
argvlist.
optionalenv.
Returns
exit code.

Create dso object for use by load functions.

Create and map a dso object.

Parameters
pathof library to map.

Destroy dso and release library.

Map library object with library.

Parameters
nameof library to load.

Release loaded library.

Find symbol in loaded module.

Parameters
moduleto search.
symbolto search for.
Returns
address of symbol or NULL if not found.

Create and initialize an empty index.

Destroy index.

Find a specific member in the ordered list.

Parameters
offsetto member to find.

Count of objects this list manages.

Returns
number of objects in the list.

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.

Returns
LinkedIndex style object.

Get (pull) object off the list. The start of the list is advanced to the next object.

Returns
LinkedObject based object that was head of the list.

Add an object into the ordered index.

Parameters
orderedobject to add to the index.

Get an indexed member from the ordered index.

Parameters
indexof member to fetch.
Returns
LinkedObject member of index.

Return first object in list for iterators.

Returns
first object in list.

Return last object in list for iterators.

Returns
last object in list.

Return head object pointer.

Returns
head pointer.

Assign ordered index.

Parameters
objectto copy from.

Add object to our list.

Parameters
objectto add.

Supporting function to construct a new or access an existing shared memory segment. Used by primary constructors.

Parameters
nameof segment to create or access.
sizeof 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.

Parameters
nameof segment.
sizeof 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.

Parameters
nameof 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.

Parameters
nameof segment to remove.

Test if map active.

Returns
true if active map.

Test if map is inactive.

Returns
true if map 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.

Returns
start of space from map.
Parameters
sizeof space requested. Will fault if past end of segment.

Get memory from a specific offset within the mapped memory segment.

Parameters
offsetfrom start of segment. Will fault if past end.
Returns
address of offset.

Copy memory from specific offset within the mapped memory segment. This function assures the copy is not in the middle of being modified.

Parameters
offsetfrom start of segment.
bufferto copy into.
sizeof object to copy.
Returns
true on success.

Get size of mapped segment.

Returns
size of mapped segment.

Get starting address of mapped segment.

Returns
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.

Parameters
objectto add to pool.

Create an instance of a number.

Parameters
bufferor NULL if created internally.
sizeof field if not null terminated.

Set string based on a new value.

Parameters
valueto set.

Get string buffer representing the number.

Returns
string buffer.

Get value of string buffer as a long integer.

Returns
long integer value of string buffer.

Get value of string buffer as expression of object.

Returns
long integer value of string buffer.

Cast string as long integer and get value of buffer.

Returns
long integer value of string buffer.

Cast object as a string to retrieve buffer.

Returns
string buffer of value.

Assign a value to the number. This rewrites the string buffer.

Parameters
valueto assign.
Returns
new value of number object assigned.

Assign another number to this number.

Parameters
numberto assign to assign.
Returns
new value of number object assigned.

Add a value to the number. This rewrites the string buffer.

Parameters
valueto add.
Returns
new value of number object.

Subtract a value from the number. This rewrites the string buffer.

Parameters
valueto subtract.
Returns
new value of number object.

Decrement the number object. This rewrites the string buffer.

Returns
new value of number object.

Increment the number object. This rewrites the string buffer.

Returns
new value of number object.

Construct an auto-pointer referencing an existing object.

Parameters
objectwe point to.

Construct an auto-pointer as a copy of another pointer. The retention of the object being pointed to will be increased.

Parameters
pointerwe 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.

Parameters
objectto 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.

Returns
true if the pointer is not referencing anything.

Test if the pointer is referencing an object.

Returns
true if the pointer is currently referencing an object.

Object factory for creating members of the spare array when they are initially requested.

Returns
new object.

Purge the array by deleting all created objects.

Get (reference) an object at a specified offset in the array.

Parameters
offsetin array.
Returns
new or existing object.

Create a sparse array of known size. No member objects are created until they are referenced.

Parameters
sizeof array.

Destroy sparse array and delete all generated objects.

Get count of array elements.

Returns
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.

Parameters
sizeof memory request.
Returns
allocated memory or NULL if not possible.

Convenience function.

Parameters
sizeof memory request.
Returns
alocated memory or NULL if not possible.

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.

Parameters
sizeof memory request.
Returns
allocated memory or NULL if not possible.

Duplicate NULL terminated string into allocated memory. This uses alloc.

Parameters
stringto copy into memory.
Returns
allocated memory with copy of string or NULL if cannot allocate.

Duplicate existing memory block into allocated memory. This uses alloc.

Parameters
memoryto data copy from.
sizeof memory to allocate.
Returns
allocated memory with copy or NULL if cannot allocate.

Extract formatted string for object.

Extract formatted string for object.

Parameters
charactercode we are pushing.
Returns
0 to keep processing, EOF if done, or char to unget.

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.

Returns
true if ssl support is available, false if not.

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.

Returns
true if fips support enabled and stack initialized.

Copy system certificates to a local path.

Parameters
pathto copy to.
Returns
0 or error number on failure.

Get path to system certificates.

Returns
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.

Parameters
authoritypath to use or NULL if none.
Returns
a security context that is cast from derived library.

Create an anonymous client context with an optional authority to validate.

Parameters
authoritypath to use or NULL if none.
pathsof certificates to use.
Returns
a basic client security context.

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.

Parameters
authoritypath to use.

Assign a non-default cipher to the context.

Parameters
contextto set cipher for.
ciphersto set.

Determine if the current security context is valid.

Returns
true if valid, -1 if not.

Get last error code associated with the security context.

Returns
last error code or 0/OK if none.

Create 36 character traditional version 1 uuid.

Parameters
stringto 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.

Author
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org

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.

Parameters
datato process.
sizeof data to process.
Returns
size of processed output, should be same as size or 0 if error.

This essentially encrypts a single string and pads with NULL bytes as needed.

Parameters
stringto encrypt.
Returns
total encrypted size.

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.

Parameters
addressof data to add before final pad.
sizeof data to add before final pad.
Returns
actual bytes encrypted or decrypted.

Process encrypted data in-place. This assumes no need to set the address buffer.

Parameters
addressof data to process.
sizeof data to process.
flagif to pad data.
Returns
bytes processed and written back to buffer.

Check if a specific cipher is supported.

Parameters
nameof cipher to check.
Returns
true if supported, false if not.

Finalize and recycle current digest to start a new digest.

Parameters
binarydigest used rather than text if true.

Reset and restart digest object.

Test to see if a specific digest type is supported.

Parameters
nameof digest we want to check.
Returns
true if supported, false if not.

Shortcut for short md5 digests if supported...

Parameters
textto create a digest for.
Returns
digest string.

Test to see if a specific digest type is supported.

Parameters
nameof digest we want to check.
Returns
true if supported, false if not.

Push entropic seed.

Parameters
bufferof random data to push.
sizeof buffer.
Returns
true if successful.

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.

Parameters
memorybuffer to fill.
sizeof buffer.
Returns
number of bytes filled.

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.

Parameters
memorybuffer to fill.
sizeof buffer to fill.
Returns
number of bytes set.

Get a pseudo-random integer, range 0 - 32767.

Returns
random integer.

Get a pseudo-random integer in a preset range.

Parameters
minvalue of random integer.
maxvalue of random integer.
Returns
random value from min to max.

Get a pseudo-random floating point value.

Returns
psudo-random value 0 to 1.

Get a pseudo-random floating point value in a preset range.

Parameters
minvalue of random floating point number.
maxvalue of random floating point number.
Returns
random value from min to max.

Determine if we have sufficient entropy to return random values.

Returns
true if sufficient entropy.

Create 36 character random uuid string.

Parameters
stringto 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.

Parameters
hostname in the form address or "address:port"
serviceid or port to use if not specified in host string.
typeof service to get.
protocolof service to get.

Release an address list directly. This is used internally by some derived socket types which do not use generic address lists.

Parameters
listof 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.

Author
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org

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.

Parameters
familyof socket address. Needed when host names are used.
addressor hostname.
typeof socket (stream, dgram, etc).
protocolnumber 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.

Parameters
familyof hosts to filter by or AF_UNSPEC.
hostnameor ip address. The socket family is used for hostnames.
serviceport or name we are referencing or NULL.

Construct a socket address list for a service.

Parameters
hostaddress for service.
servicename or port number.
typeof 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.

Parameters
hostnameor address to use.
serviceport 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.

Parameters
referenceto object to copy from.

Assignment operator.

Parameters
referenceto object to copy from.

Destroy address. Deallocate addrinfo structure.

Compare two address lists.

Returns
true if the two lists are the same (same addresses in the same order).

Get the first socket address in our address list.

Returns
first socket address or NULL if none.

Get the first socket address by casted reference.

Returns
first socket address we resolved or NULL if none.

Get the first socket address of specified family from our list.

Parameters
familyto seek.
Returns
first socket address of family or NULL if none.

Get the family of the first member in a list of services.

Returns
family of first socket address or 0 if none.

Get the address size of the first address.

Returns
size in bytes of first socket address or 0 if none.

Get the port of the first address .

Returns
port of first socket address or 0 if none.

Set the port of all addresses in the list.

Parameters
portthe port to set.

Returns a copy of this address list with the specified port set.

Find a specific socket address in our address list.

Returns
matching address from list or NULL if not found.

Get the full socket address list from the object.

Returns
addrinfo list we resolved or NULL if none.

Get the full socket address list by casted reference.

Returns
addrinfo list we resolved or NULL if none.

Return the full socket address list by pointer reference.

Returns
addrinfo list we resolved or NULL if none.

Print the first socket address as a human-readable string to the provided buffer and returns the printed string length.

Parameters
srcAddress to print.
dstDestination buffer to print the socket address on.
dst_szSize of the provided buffer. Strongly recommended to be at least INET6_ADDRSTRLEN (or INET_ADDRSTRLEN if compiled without IPv6).
portIf true, print port number with address. If true, ipv6_brackets will also be forced to true.
ipv6_bracketsIf true, force printing IPv6 brackets. Ignored if address is an IPv4.
Returns
length (in bytes) of the printed string, excluding trailing zero.

Test if the address list is valid.

Returns
true if we have an address list.

Test if we have no address list.

Returns
true if we have no address list.

Test if the first socket address is ADDR_ANY: 0.0.0.0 or ::0

Returns
true if the address is one of the above.

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).

Parameters
familyaddress family to set.

Test if the first socket address is ADDR_LOOPBACK: 127.0.0.1 or ::1

Returns
true if the address is one of the above.

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).

Parameters
familyaddress family to set.

Clear current object.

Set the host addresses to form a new list.

Parameters
hostnameor address to resolve.
servicename or port number, or NULL if not used.
typeof socket (stream or dgram) to filter list by.

Append additional host addresses to our list.

Parameters
hostnameor address to resolve.
servicename or port number, or NULL if not used.
typeof socket (stream or dgram).

Set an entry for host binding.

Parameters
familyof socket address. Needed when hostnames are used.
addressor hostname.
typeof socket (stream, dgram, etc).
protocolnumber of socket.

Add an individual socket address to our address list.

Parameters
addressto add.

Insert unique members from another socket address list to ours.

Parameters
addresslist to insert into list.
Returns
count of addresses added.

Remove members from another socket address list from ours.

Parameters
addresslist to remove from list.
Returns
count of addresses removed.

Remove an individual socket address from our address list.

Parameters
addressto remove.
Returns
true if found and removed, false if not found.

Insert an individual socket address to our address list only if unique.

Parameters
addressto insert into list.
Returns
true if inserted, false if duplicate.

Copy an existing addrinfo into our object. This is also used to support the copy constructor.

Parameters
addresslist to copy from.

Set an individual socket address for our address list.

Parameters
addressto add.

Set a socket address from host and service.

Parameters
hostnameor address to use.
serviceport or 0.

Returns the size of the socket address according to the family.

Returns
size in bytes of the valid part of the socket address.

Returns the port of the socket address.

Returns
port associated to the socket address.

Set the port of the socket address.

Parameters
addressto edit.
portto associate to the socket address.

Test if the socket address is ADDR_ANY: 0.0.0.0 or ::0

Returns
true if the address is one of the above.

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

Returns
true if the address is one of the above.

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.

Parameters
addressto duplicate.
Returns
duplicate address object.

Convert address object into ipv4 address.

Parameters
addressto convert.
Returns
new ipv4 address or NULL if not ipv4.

Convert address object into ipv6 address.

Parameters
addressto convert.
Returns
new ipv6 address or NULL if not ipv6.

Print socket address as a human-readable string to the provided buffer and returns the printed string length.

Parameters
srcAddress to print.
dstDestination buffer to print the socket address on.
dst_szSize of the provided buffer. Strongly recommended to be at least INET6_ADDRSTRLEN (or INET_ADDRSTRLEN if compiled without IPv6).
portIf true, print port number with address. If true, ipv6_brackets will also be forced to true.
ipv6_bracketsIf true, force printing IPv6 brackets. Ignored if address is an IPv4.
Returns
length (in bytes) of the printed string, excluding trailing zero.

Create a socket object for use.

Create socket as duped handle of existing socket.

Parameters
existingsocket to dup.

Create socket from existing socket descriptor.

Parameters
socketdescriptor 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.

Parameters
addresslist to connect with.

Create an unbound socket of a specific type.

Parameters
familyof our new socket.
type(stream, udp, etc) of our new socket.
protocolnumber of our new socket.'

Create a bound socket. If one wishes to listen for connections on a protocol, then ListenSocket should be used instead.

Parameters
addressto bind or "*" for all.
portnumber of service to bind.
familyto bind as.
typeof socket to bind (stream, udp, etc).
protocolof 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.

Parameters
socketto shutdown.

Shutdown and close the socket.

Get error code.

See the number of bytes in the receive queue.

Parameters
valueto test for.
Returns
true if at least that many bytes waiting in receive queue.

Test if socket is connected.

Returns
true if connected.

Test for pending input data. This function can wait up to a specified timeout for data to appear.

Parameters
timeoutor 0 if none.
Returns
true if input data waiting.

Set nodelay option for tcp socket.

Returns
0 if successful, -1 on error.

Test for pending input data. This function can wait up to a specified timeout for data to appear.

Parameters
socketto test.
timeoutor 0 if none.
Returns
true if input data waiting.

Test for output data sent. This function can wait up to a specified timeout for data to appear sent.

Parameters
timeoutor 0 if none.
Returns
false if cannot send more output/out of buffer space.

Get the number of bytes of data in the socket receive buffer.

Returns
bytes pending.

Set socket for unicast mode broadcasts.

Parameters
enablebroadcasting if true.
Returns
0 on success, -1 if error.

Set socket for keepalive packets.

Parameters
enablekeep-alive if true.
Returns
0 on success, -1 if error.

Set socket blocking I/O mode.

Parameters
enabletrue for blocking I/O.
Returns
0 on success, -1 if error.

Set multicast mode and multicast broadcast range.

Parameters
ttlto set for multicast socket or 0 to disable multicast.
Returns
0 on success, -1 if error.

Set loopback to read multicast packets we broadcast.

Parameters
enabletrue to loopback, false to ignore.
Returns
0 on success, -1 if error.

Get socket error code.

Returns
socket error code.

Set the time to live before packets expire.

Parameters
timeto live to set.
Returns
0 on success, -1 on error.

Set the size of the socket send buffer.

Parameters
sizeof send buffer to set.
Returns
0 on success, -1 on error.

Set the size to wait before sending.

Parameters
sizeof send wait buffer to set.
Returns
0 on success, -1 on error.

Set the size of the socket receive buffer.

Parameters
sizeof recv buffer to set.
Returns
0 on success, -1 on error.

Get the type of a socket.

Parameters
socketdescriptor.
Returns
socket type.

Set segment size and get MTU.

Parameters
socketto modify.
sizeof segment or zero to not set.
Returns
mtu size of socket.

Set congestion control id.

Parameters
socketto modify.
ccidvalue to set.
Returns
true if success, false if not dccp or not supported ccid used.

Get the type of a socket.

Returns
socket type.

Set segment size and get mtu of a socket.

Parameters
sizeof segment or 0 to leave unchanged.
Returns
mtu size.

Set ccid of dccp socket.

Parameters
ccidto set.
Returns
true if success, false if not dccp or not supported ccid used.

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.

Parameters
typeof service value.
Returns
0 on success or -1 on error.

Set packet priority, 0 to 6 unless privileged. Should be set before type-of-service.

Parameters
schedulingpriority for packet scheduling.
Returns
0 on success, -1 on error.

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.

Parameters
listof addresses to connect to.
Returns
0 on success or error.

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.

Returns
0 on success or error.

Join socket to multicast group.

Parameters
listof groups to join.
Returns
0 on success, -1 on error.

Drop socket from multicast group.

Parameters
listof groups to drop.
Returns
0 on success, -1 on error.

Socket i/o timer setting.

Parameters
timeoutto wait, inf for blocking, 0 pure non-blocking.
Returns
0 on success or error code.

Peek at data waiting in the socket receive buffer.

Parameters
datapointer to save data in.
numberof bytes to peek.
Returns
number of bytes actually read, or 0 if no data waiting.

Read data from the socket receive buffer. This will be used in abi 4.

Parameters
datapointer to save data in.
numberof bytes to read.
addressof peer data was received from.
Returns
number of bytes actually read, 0 if none, -1 if error.

Write data to the socket send buffer. This will be used in abi 4.

Parameters
datapointer to write data from.
numberof bytes to write.
addressof peer to send data to if not connected.
Returns
number of bytes actually sent, 0 if none, -1 if error.

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.

Parameters
datato save input line.
sizeof input line buffer.
Returns
number of bytes read, 0 if none, err() has error.

Print formatted string to socket.

Parameters
formatstring.
Returns
number of bytes sent.

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.

Parameters
bufferto save input line.
Returns
number of bytes read, 0 if none, err() has error.

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.

Parameters
socketto read from.
datato save input line.
sizeof input line buffer.
timeoutto wait for a complete input line.
Returns
number of bytes read, 0 if none, -1 if error.

Print formatted string to socket.

Parameters
socketto write to.
formatstring.
Returns
number of bytes sent, -1 if error.

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.

Parameters
stringto write.
Returns
number of bytes sent, 0 if none, -1 if error.

Test if socket is valid.

Returns
true if valid socket.

Test if socket is invalid.

Returns
true if socket is invalid.

Assign socket from a socket descriptor. Release existing socket if one present.

Parameters
socketdescriptor to assign to object.

Get the socket descriptor by casting.

Returns
socket descriptor of object.

Get the socket descriptor by pointer reference.

Returns
socket descriptor of object.

Get the number of bytes pending in the receive buffer of a socket descriptor.

Parameters
socketdescriptor.
Returns
number of pending bytes.

Set the send size of a socket descriptor.

Parameters
socketdescriptor.
sizeof send buffer to set.
Returns
0 on success, -1 on error.

Set the size to wait before sending.

Parameters
socketdescriptor.
sizeof send wait buffer to set.
Returns
0 on success, -1 on error.

Set the receive size of a socket descriptor.

Parameters
socketdescriptor.
sizeof receive buffer to set.
Returns
0 on success, -1 on error.

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.

Parameters
socketdescriptor.
listof addresses to connect to.
Returns
0 on success, -1 on error.

Disconnect a connected socket descriptor.

Parameters
socketdescriptor.
Returns
0 on success, -1 on error.

Drop socket descriptor from multicast group.

Parameters
socketdescriptor.
listof groups to drop.
Returns
0 on success, -1 on error.

Join socket descriptor to multicast group.

Parameters
socketdescriptor.
listof groups to join.
Returns
0 on success, -1 on error.

Get socket error code of socket descriptor.

Parameters
socketdescriptor.
Returns
socket error code.

Set multicast mode and multicast broadcast range for socket descriptor.

Parameters
socketdescriptor.
ttlto set for multicast socket or 0 to disable multicast.
Returns
0 if success, -1 if error.

Set loopback to read multicast packets socket descriptor broadcasts.

Parameters
socketdescriptor.
enabletrue to loopback, false to ignore.
Returns
0 if success, -1 if error.

Set socket blocking I/O mode of socket descriptor.

Parameters
socketdescriptor.
enabletrue for blocking I/O.
Returns
0 if success, -1 if error.

Set socket for keepalive packets for socket descriptor.

Parameters
socketdescriptor.
enablekeep-alive if true.
Returns
0 if success, -1 if error.

Set socket for unicast mode broadcasts on socket descriptor.

Parameters
socketdescriptor.
enablebroadcasting if true.
Returns
0 if success, -1 if error.

Set tcp nodelay option on socket descriptor.

Parameters
socketdescriptor.
Returns
0 if success, -1 if error.

Set packet priority of socket descriptor.

Parameters
socketdescriptor.
schedulingpriority for packet scheduling.
Returns
0 on success, -1 on error.

Set type of service of socket descriptor.

Parameters
socketdescriptor.
typeof service.
Returns
0 on success, -1 on error.

Set the time to live for the socket descriptor.

Parameters
socketdescriptor.
timeto live to set.
Returns
0 on success, -1 on error.

Get the address family of the socket descriptor.

Returns
address family.

Get the address family of a socket address object.

Parameters
addressto examine.
Returns
address family.

Get the address family of an internet socket address object.

Parameters
addressto examine.
Returns
address family.

Get data waiting in receive queue.

Parameters
socketto get from.
bufferto save.
sizeof data buffer to request.
flagsfor i/o operation (MSG_OOB, MSG_PEEK, etc).
addressof source.
Returns
number of bytes received, -1 if error.

Send data on socket.

Parameters
socketto send to.
bufferto send.
sizeof data buffer to send.
flagsfor i/o operation (MSG_OOB, MSG_PEEK, etc).
addressof destination, NULL if connected.
Returns
number of bytes sent, -1 if error.

Send reply on socket. Used to reply to a recvfrom message.

Parameters
socketto send to.
bufferto send.
sizeof data buffer to send.
flagsfor i/o operation (MSG_OOB, MSG_PEEK, etc).
addressto reply to.
Returns
number of bytes sent, -1 if error.

Bind the socket descriptor to a known interface and service port.

Parameters
socketdescriptor to bind.
addressto bind to or "*" for all.
serviceport to bind.
protocolto use or 0 if default.
Returns
0 on success, -1 if error.

Bind the socket descriptor to a known interface listen on service port.

Parameters
socketdescriptor to bind.
addressof interface to bind to.
backlogfor service.
Returns
0 on success, -1 if error.

Bind the socket descriptor to a known interface.

Parameters
socketdescriptor to bind.
addressof interface to bind to.
Returns
0 on success, -1 if error.

Accept a socket connection from a remote host.

Parameters
socketdescriptor to accept from.
addressof socket accepting.
Returns
new socket accepted.

Create a socket object unbound.

Parameters
familyof socket.
typeof socket.
protocolof socket.
Returns
socket descriptor created or INVALID_SOCKET.

Create a connected socket.

Parameters
addresslist to connect to.
typeof socket to create.
protocolof socket.
Returns
socket descriptor created or INVALID_SOCKET.

Create a bound socket for a service.

Parameters
ifaceto bind.
serviceport to bind.
familyto select or AF_UNSPEC
typeof socket to create.
protocolof socket to create.
Returns
socket descriptor created or INVALID_SOCKET.

Create a connected socket for a service.

Parameters
addressof service for connect.
Returns
socket descriptor.

Release (close) a socket.

Parameters
socketto close.

Lookup and return the host name associated with a socket address.

Parameters
addressto lookup.
bufferto save hostname into.
sizeof buffer to save hostname into.
Returns
buffer or NULL if lookup fails.

Create an address info lookup hint based on the family and type properties of a socket descriptor.

Parameters
socketdescriptor.
hintbuffer.
Returns
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.

Parameters
socketdescriptor.
addressthat is resolved.
hostnameto resolve.
serviceport.
Returns
socket address size.

Get the size of a socket address.

Parameters
addressof socket.
Returns
size to use for this socket address object.

Compare socket addresses. Test if the address and service matches or if there is no service, then just the host address values.

Parameters
address1to compare.
address2to compare.
Returns
true if same family and equal.

Copy a socket address.

Parameters
targetaddress pointer to copy into.
originaddress pointer to copy from.
Returns
number of bytes copied, 0 if invalid.

Store an address into an address object.

Parameters
storagefor address.
addressto store.
Returns
number of bytes stored.

Store an address into an internet address object.

Parameters
storagefor address.
addressto store.
Returns
number of bytes stored.

Compare socket host addresses. Test if the host address matches or if there is no service, then just the host address values.

Parameters
address1to compare.
address2to compare.
Returns
true if same family and equal.

Compare socket addresses. Test if the stored addresses received match. or if there is no service, then just the host address values.

Parameters
address1to compare.
address2to compare.
Returns
true if same family and equal.

Compare socket addresses. Test if the internet addresses received match. or if there is no service, then just the host address values.

Parameters
address1to compare.
address2to compare.
Returns
true if same family and equal.

See if both addresses are in the same subnet. This is only relevant to IPV4 and class domain routing.

Parameters
address1to test.
address2to test.
Returns
true if in same subnet.

Get the socket address of the interface needed to reach a destination address.

Parameters
addressof interface found.
targetaddress.
sizeof interface, 0 used for older code
Returns
0 on success, -1 on error.

Get the hostname of a socket address.

Parameters
addressto lookup.
bufferto save hostname in.
sizeof hostname buffer.
Returns
buffer if found or NULL if not.

Get the service port of a socket.

Parameters
addressof socket to examine.
Returns
service port number.

Get the service port of an inet socket.

Parameters
addressof internet socket to examine.
Returns
service port number.

Convert a socket address and service into a hash map index.

Parameters
addressto convert.
sizeof map index.
Returns
key index path.

Convert a socket host address into a hash map index.

Parameters
addressto convert.
sizeof map index.
Returns
key index path.

Initialize socket subsystem.

Set default socket family preference for query options when the socket type is otherwise not specified.

Parameters
familyto 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.

Parameters
enabletrue to set mapping. This is default.

Return error code of last socket operation,

Returns
errno style error code.

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.

Parameters
stringaddress to check.
Returns
true if zero/null address.

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.

Parameters
stringaddress to check.
Returns
true if zero/null address.

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.

Parameters
socketdescriptor to examine.
addressstorage for local address.
Returns
0 on success, -1 on failure.

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.

Parameters
socketdescriptor to examine.
addressstorage for remote address.
Returns
0 on success, -1 on failure.

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.

Parameters
objectto guard.

Prematurely release a guard.

Construct a guard for a specific object.

Parameters
objectto 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.

Parameters
stacksize 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.

Parameters
timeoutto 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.

Parameters
thread1to test.
thread2to test.
Returns
true if both are the same context.

Get current thread id.

Returns
thread id.

Check if timer has been updated since last check. This also sets updated false.

Returns
true if was updated.

Check if timer active.

Returns
true if active.

Construct an untriggered timer set to the time of creation.

Construct a triggered timer that expires at specified offset.

Parameters
offsetto expire in milliseconds.

Construct a triggered timer that expires at specified offset.

Parameters
offsetto expire in seconds.

Construct a timer from a copy of another timer.

Parameters
copyof timer to construct from.

Set the timer to expire.

Parameters
expiretime in milliseconds.

Set the timer to expire.

Parameters
expiretime in seconds.

Set (update) the timer with current time.

Clear pending timer, has no value.

Get remaining time until the timer expires.

Returns
0 if expired or milliseconds still waiting.

Get remaining time until timer expires by reference.

Returns
0 if expired or milliseconds still waiting.

Check if timer has expired.

Returns
true if timer still pending.

Check if timer expired for is() expression.

Returns
true if timer expired.

Set timer expiration.

Parameters
expiretimer in specified seconds.

Set timer expiration.

Parameters
expiretimer in milliseconds.

Adjust timer expiration.

Parameters
expiretime to add in seconds.

Adjust timer expiration.

Parameters
expiretime to add in milliseconds.

Adjust timer expiration.

Parameters
expiretime to subtract in seconds.

Adjust timer expiration.

Parameters
expiretime to subtract in milliseconds.

Compute difference between two timers.

Parameters
timerto use for difference.
Returns
difference in milliseconds.

Compare timers if same timeout.

Parameters
timerto compare with.
Returns
true if same.

Compare timers if not same timeout.

Parameters
timerto compare with.
Returns
true if not same.

Compare timers if earlier timeout than another timer.

Parameters
timerto compare with.
Returns
true if earlier.

Compare timers if earlier than or equal to another timer.

Parameters
timerto compare with.
Returns
true if earlier or same.

Compare timers if later timeout than another timer.

Parameters
timerto compare with.
Returns
true if later.

Compare timers if later than or equal to another timer.

Parameters
timerto compare with.
Returns
true if later or same.

Sleep current thread until the specified timer expires.

Parameters
timerto reference for sleep.

Get timer ticks since uuid epoch.

Returns
timer ticks in 100ns resolution.

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.

Author
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org

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.

Parameters
addressof actual allocation.
sizeof object allocated.
arpool 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?

Returns
true if not empty.

Number of retains (smart pointers) referencing us.

Returns
number of copies of pointers referencing.

Override delete to de-allocate actual heap. This is used because the object is atomically aligned, but the heap may not be.

Parameters
addressof 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.

Parameters
objectto reference.

Create a smart pointer based on another pointer. Both pointers then reference the same object.

Parameters
pointerinstance 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.

Parameters
objectto reference.

Assign from a guarded typeref.

Adjust memory pointer to atomic boundry.

Parameters
addressthat was allocated.
Returns
address for actual atomic aligned object.

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.

Parameters
pointerinstance to share reference with.

Manually release the current container.

Get size of referenced heap object.

Returns
size of container or 0 if none.

Get number of references to container.

Returns
total number of pointers referencing container.

Check if pointer currently has a heap container.

Returns
true if we are referencing a container.

Check if we are currently not pointing to anything.

Returns
true if not referencing a container.

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.

Parameters
targetsmart pointer object to set.
objectto 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.

Parameters
codepointin string.
Returns
size of codepoint as utf8 encoded data, 0 if invalid.

Count ut8 encoded ucs4 codepoints in string.

Parameters
stringof utf8 data.
Returns
codepount count, 0 if empty or invalid.

Get codepoint offset in a string.

Parameters
stringof utf8 data.
positionof codepoint in string, negative offsets are from tail.
Returns
offset of codepoint or NULL if invalid.

Convert a utf8 encoded codepoint to a ucs4 character value.

Parameters
encodedutf8 codepoint.
Returns
ucs4 string or 0 if invalid.

How many chars requires to encode a given wchar string.

Parameters
stringof ucs4 data.
Returns
number of chars required to encode given string.

How many chars requires to encode a given unicode character.

Parameters
characterto encode.
Returns
number of chars required to encode given character.

Convert a unicode string into utf8.

Parameters
stringof unicode data to pack
bufferof character protocol to put data into.
Returns
number of code points converted.

Convert a utf8 string into a unicode data buffer.

Parameters
unicodedata buffer.
bufferof character protocol to pack from.
sizeof unicode data buffer in codepoints.
Returns
number of code points converted.

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.

Parameters
stringto search in.
charactercode to search for.
startoffset in string in codepoints.
Returns
pointer to first instance or NULL if not found.

Find last occurrence of character in string.

Parameters
stringto search in.
charactercode to search for.
endoffset to start from in codepoints.
Returns
pointer to last instance or NULL if not found.

Count occurrences of a unicode character in string.

Parameters
stringto search in.
charactercode to search for.
Returns
count of occurrences.

Get a unicode character from a character protocol.

Parameters
bufferof character protocol to read from.
Returns
unicode character or EOF error.

Push a unicode character to a character protocol.

Parameters
characterto push to file.
bufferof character protocol to push character to.
Returns
unicode character or EOF on error.

Create a utf8 pointer set to NULL.

Create a utf8 pointer for an existing char pointer.

Parameters
stringpointer to use.

Create a utf8 pointer as a copy of existing utf8 pointer.

Parameters
copyof object to use.

Iterative increment of a utf8 pointer to prior codepoint.

Returns
object incremented.

Iterative decrement of a utf8 pointer to next codepoint.

Returns
object decremented.

Adjust utf8 pointer by specified codepoints forward.

Parameters
offsetto increment by.
Returns
object incremented.

Adjust utf8 pointer by specified codepoints backward.

Parameters
offsetto decrement by.
Returns
object decremented.

Get new utf8 string after adding a codepoint offset.

Parameters
offsetto add.
Returns
new utf8 pointer pointing to specified offset.

Get new utf8 string after subtracting a codepoint offset.

Parameters
offsetto subtract.
Returns
new utf8 pointer pointing to specified offset.

Check if text is valid pointer.

Returns
true if not NULL.

Check if text is an invalid pointer.

Returns
false if not NULL.

Extract a unicode character from a specified codepoint.

Parameters
codepointoffset to extract character from.
Returns
unicode character or 0.

Assign a utf8 string to point to.

Parameters
stringto point to.
Returns
current object after set to string.

Iterative increment of a utf8 pointer to next codepoint.

Iterative decrement of a utf8 pointer to prior codepoint.

check if pointer equals another string.

Parameters
stringto check.
Returns
true if same memory address.

check if pointer does not equal another string.

Parameters
stringto check.
Returns
false if same memory address.

Get unicode character pointed to by pointer.

Returns
unicode character we are pointing to.

Get c string we point to.

Returns
string we point to.

Convert utf8 pointer to a generic string pointer.

Returns
generic string pointer.

Get length of null terminated utf8 string in codepoints.

Returns
codepoint length of string.

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.

Author
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org

Create an instance of an exclusive object reference.

Parameters
objectcontaining Exclusive base class protocol to lock.

Destroy reference to shared locked object, release lock.

Test if the reference holds an active lock.

Returns
true if is not locking an object.

Test if the reference holds an active lock.

Returns
true if locking an object.

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.

Parameters
objectcontaining Exclusive base class protocol to lock.

Destroy reference to shared locked object, release lock.

Test if the reference holds an active lock.

Returns
true if is not locking an object.

Test if the reference holds an active lock.

Returns
true if locking an object.

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.

Author
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org

Atomic spinlock class. Used as high-performance sync lock between threads.

Author
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org

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.

Returns
true if acquired.

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.

Parameters
timeoutin milliseconds.
Returns
true if signalled, false if timer expired.

Conditional wait for signal on timespec timeout.

Parameters
timeoutas a high resolution timespec.
Returns
true if signalled, false if timer expired.

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.

Parameters
limitbefore recycling to zero.

Get the next counter value.

Returns
next counter value.

Get the range of values before recycling.

Returns
counter limit.

Reference next counter value through pointer operation.

Returns
next counter value.

Reference next counter value by casting to integer.

Returns
next counter value.

Assign the value of the counter.

Parameters
valueto 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.

Parameters
valuefrom time()

Create a julian date from a local or gmt date and time.

Parameters
objectfrom DateTime::glt() or gmt().

Create a julian date from a ISO date string of a specified size.

Parameters
pointerto ISO date string.
sizeof date field if not null terminated.

Create a julian date from an arbitrary year, month, and day.

Parameters
yearof date.
monthof date (1-12).
dayof month (1-31).

Create a julian date object from another object.

Parameters
objectto copy.

Construct a new julian date with today's date.

Destroy julian date object.

Get the year of the date.

Returns
year of the date

Get the month of the date (1-12).

Returns
month of year

Get the day of the month of the date.

Returns
day of month

Get the day of the week (0-7).

Returns
day of week

Get a ISO string representation of the date (yyyy-mm-dd).

Parameters
bufferto store string.
Returns
string representation.

Get a time_t for the julian date if in time_t epoch.

Returns
time_t or -1 if out of range.

Get the date as a number for the object or 0 if invalid.

Returns
date as number.

Set (update) the date with current date.

Set the julian date based on an ISO date string of specified size.

Parameters
pointerto date string field.
sizeof field if not null terminated.

Check if date is valid.

Returns
true if julian date is valid.

Casting operator to return date as number.

Returns
julian number.

Access julian value.

Returns
julian number of object.

Expression operator to return an ISO date string for the current julian date.

Returns
ISO date string.

Increment date by one day.

Returns
instance of current date object.

Decrement date by one day.

Returns
instance of current date object.

Increment date by offset.

Parameters
offsetto add to julian date.
Returns
instance of current date object.

Decrement date by offset.

Parameters
offsetto subtract from julian date.
Returns
instance of current date object.

Add days to julian date in an expression.

Parameters
daysto add.
Returns
new date object with modified days.

Subtract days from a julian date in an expression.

Parameters
daysto subtract.
Returns
new date object with modified days.

Operator to compute number of days between two dates.

Parameters
dateoffset for computation.
Returns
number of days difference.

Assign date from another date object.

Parameters
dateobject to assign from.
Returns
current modified date object.

Compare julian dates if same date.

Parameters
dateto compare with.
Returns
true if same.

Compare julian dates if not same date.

Parameters
dateto compare with.
Returns
true if not same.

Compare julian date if earlier than another date.

Parameters
dateto compare with.
Returns
true if earlier.

Compare julian date if earlier than or equal to another date.

Parameters
dateto compare with.
Returns
true if earlier or same.

Compare julian date if later than another date.

Parameters
dateto compare with.
Returns
true if later.

Compare julian date if later than or equal to another date.

Parameters
dateto compare with.
Returns
true if later or same.

Check if julian date is not valid.

Returns
true if date is invalid.

Check if julian date is valid for is() expression.

Returns
true if date is valid.

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.

Parameters
valueof time_t to use.

Create a time from the time portion of a date and time object.

Parameters
objectfrom DateTime::glt() or gmt().

Create a time from a hh:mm:ss formatted time string.

Parameters
pointerto formatted time field.
sizeof field if not null terminated.

Create a time from hours (0-23), minutes (0-59), and seconds (0-59).

Parameters
hourof time.
minuteof time.
secondof time.

Create a time object from another object.

Parameters
objectto copy.

Create a time from current time.

Destroy time object.

Get current time in seconds from midnight.

Returns
seconds from midnight.

Get hours from midnight.

Returns
hours from midnight.

Get minutes from current hour.

Returns
minutes from current hour.

Get seconds from current minute.

Returns
seconds from current minute.

Get a hh:mm:ss formatted string for current time.

Parameters
bufferto store time string in.
Returns
time string buffer or NULL if invalid.

Set (update) the time with current time.

Set time from a hh:mm:ss formatted string.

Parameters
pointerto time field.
sizeof field if not null terminated.

Check if time object had valid value.

Returns
true if object is valid.

Check if time object has valid value for is() operator.

Returns
true if object is valid.

Check if time object has valid value for ! operator.

Returns
true if object is not valid.

Get difference (in seconds) between two times.

Parameters
referencetime to get difference from.
Returns
difference in seconds.

Add seconds to the current time, wrap if 24 hours.

Parameters
secondsto add.
Returns
new time object with modified value.

Subtract seconds to the current time, wrap if 24 hours.

Parameters
secondsto subtract.
Returns
new time object with modified value.

Get time in seconds.

Returns
seconds.

Get object time in seconds.

Returns
time in seconds.

Convert to standard 24 hour time string.

Returns
time string.

Incrememnt time by 1 second, wrap on 24 hour period.

Returns
modified instance of current time object.

Decrement time by 1 second, wrap on 24 hour period.

Returns
modified instance of current time object.

Assign a time as a copy of another time.

Parameters
timeto assign from.
Returns
time object that was assigned.

Increment time by specified seconds. Wraps on 24 hour period.

Parameters
secondsto add to current time.
Returns
modified instance of current time object.

Decrement time by specified seconds. Wraps on 24 hour period.

Parameters
secondsto subtract from current time.
Returns
modified instance of current time object.

Compare time with another time to see if same time.

Parameters
timeto compare with.
Returns
true if same time.

Compare time with another time to see if not same time.

Parameters
timeto compare with.
Returns
true if not same time.

Compare time if earlier than another time.

Parameters
timeobject to compare with.
Returns
true if earlier than object.

Compare time if earlier than or equal to another time.

Parameters
timeobject to compare with.
Returns
true if earlier or same as object.

Compare time if later than another time.

Parameters
timeobject to compare with.
Returns
true if later than object.

Compare time if later than or equal to another time.

Parameters
timeobject to compare with.
Returns
true if later than or same as object.

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.

Parameters
descriptorto copy from.

Create a fsys descriptor by opening an existing file or directory.

Parameters
pathof file to open for created descriptor.
accessmode of file.

Create a fsys descriptor by creating a file.

Parameters
pathof file to create for descriptor.
accessmode of file access.
permissionmode of file.

Close and release a file descriptor.

Get the descriptor from the object by pointer reference.

Returns
low level file handle.

Get the descriptor from the object by casting reference.

Returns
low level file handle.

Reset error flag.

Test if file descriptor is open.

Returns
true if open.

Test if file descriptor is closed.

Returns
true if closed.

Assign file descriptor by duplicating another descriptor.

Parameters
descriptorto 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.

Parameters
descriptorto dup from.

Get the native system descriptor handle of the file descriptor.

Returns
native os descriptor.

Set with external descriptor. Closes existing file if open.

Parameters
descriptorof open file.

Release descriptor, do not close.

Returns
handle being released.

Set the position of a file descriptor.

Parameters
offsetfrom start of file or "end" to append.
Returns
error number or 0 on success.

Drop cached data from start of file.

Parameters
sizeof region to drop or until end of file.
Returns
error number or 0 on success.

See if current file stream is a tty device.

Returns
true if device.

See if the file handle is a tty device.

Returns
true if device.

Read data from descriptor or scan directory.

Parameters
bufferto read into.
countof bytes to read.
Returns
bytes transferred, -1 if error.

Write data to descriptor.

Parameters
bufferto write from.
countof bytes to write.
Returns
bytes transferred, -1 if error.

Get status of open descriptor.

Parameters
bufferto save status info in.
Returns
error number or 0 on success.

Truncate file to specified length. The file pointer is positioned to the new end of file.

Parameters
offsetto truncate to.
Returns
true if truncate successful.

Commit changes to the filesystem.

Returns
error number or 0 on success.

Set directory prefix (chdir).

Parameters
pathto change to.
Returns
error number or 0 on success.

Get current directory prefix (pwd).

Parameters
pathto save directory into.
sizeof path we can save.
Returns
error number or 0 on success.

Stat a file.

Parameters
pathof file to stat.
bufferto save stat info.
Returns
error number or 0 on success.

Erase (remove) a file only.

Parameters
pathof file.
Returns
error number or 0 on success.

Copy a file.

Parameters
sourcefile.
targetfile.
sizeof buffer.
Returns
error number or 0 on success.

Rename a file.

Parameters
oldpathto rename from.
newpathto rename to.
Returns
error number or 0 on success.

Change file access mode.

Parameters
pathto change.
valueof mode to assign.
Returns
error number or 0 on success.

Test if path exists.

Parameters
pathto test.
Returns
if true.

Test if path readable.

Parameters
pathto test.
Returns
if true.

Test if path writable.

Parameters
pathto test.
Returns
if true.

Test if path is executable.

Parameters
pathto test.
Returns
if true.

Test if path is a file.

Parameters
pathto test.
Returns
true if exists and is file.

Test if path is a directory.

Parameters
pathto test.
Returns
true if exists and is directory.

Test if path is a symlink.

Parameters
pathto test.
Returns
true if exists and is symlink.

Test if path is a device path.

Parameters
pathto test.
Returns
true of is a device path.

Test if path is a hidden file.

Parameters
pathto test.
Returns
true if exists and is hidden.

Open a file or directory.

Parameters
pathof file to open.
accessmode of descriptor.

Assign descriptor directly.

Parameters
descriptorto assign.

Assign a descriptor directly.

Parameters
objectto assign descriptor to.
descriptorto assign.

Open a file descriptor directly.

Parameters
pathof file to create.
accessmode of descriptor.
modeof 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.

Parameters
pathto remove.
Returns
error number or 0 on success.

Create a symbolic link.

Parameters
pathto create.
targetof link.
Returns
error number or 0 on success.

Create a hard link.

Parameters
pathto create link to.
targetof link.
Returns
error number or 0 on success.

Read a symbolic link to get it's target.

Parameters
pathof link.
bufferto save target into.
sizeof buffer.

Close a fsys resource.

Returns
error code as needed.

Get last error.

Returns
error number.

Direct means to open a read-only file path and return a descriptor.

Parameters
pathto open.
Returns
descriptor on success, invalid handle on failure.

Direct means to create or access a writable path and return descriptor.

Parameters
pathto create.
Returns
descriptor on success, invalid handle on failure.

Direct means to create or append a writable path and return descriptor.

Parameters
pathto create.
Returns
descriptor on success, invalid handle on failure.

Release a file descriptor.

Parameters
descriptorto release.

Create pipe. These are created inheritable by default.

Parameters
inputdescriptor.
outputdescriptor.
sizeof buffer if supported.
Returns
0 or error code.

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.

Parameters
descriptorto modify.
enablechild process inheritence.
Returns
0 on success, error on failure.

Create inheritable /dev/null handle.

Returns
null device handle.

Load a library into memory.

Parameters
pathto plugin.
Returns
0 on success, else error.

Execute a process and get exit code.

Parameters
pathto execute.
argvlist.
optionalenv.
Returns
exit code.

Create dso object for use by load functions.

Create and map a dso object.

Parameters
pathof library to map.

Destroy dso and release library.

Map library object with library.

Parameters
nameof library to load.

Release loaded library.

Find symbol in loaded module.

Parameters
moduleto search.
symbolto search for.
Returns
address of symbol or NULL if not found.

Create and initialize an empty index.

Destroy index.

Find a specific member in the ordered list.

Parameters
offsetto member to find.

Count of objects this list manages.

Returns
number of objects in the list.

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.

Returns
LinkedIndex style object.

Get (pull) object off the list. The start of the list is advanced to the next object.

Returns
LinkedObject based object that was head of the list.

Add an object into the ordered index.

Parameters
orderedobject to add to the index.

Get an indexed member from the ordered index.

Parameters
indexof member to fetch.
Returns
LinkedObject member of index.

Return first object in list for iterators.

Returns
first object in list.

Return last object in list for iterators.

Returns
last object in list.

Return head object pointer.

Returns
head pointer.

Assign ordered index.

Parameters
objectto copy from.

Add object to our list.

Parameters
objectto add.

Supporting function to construct a new or access an existing shared memory segment. Used by primary constructors.

Parameters
nameof segment to create or access.
sizeof 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.

Parameters
nameof segment.
sizeof 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.

Parameters
nameof 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.

Parameters
nameof segment to remove.

Test if map active.

Returns
true if active map.

Test if map is inactive.

Returns
true if map 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.

Returns
start of space from map.
Parameters
sizeof space requested. Will fault if past end of segment.

Get memory from a specific offset within the mapped memory segment.

Parameters
offsetfrom start of segment. Will fault if past end.
Returns
address of offset.

Copy memory from specific offset within the mapped memory segment. This function assures the copy is not in the middle of being modified.

Parameters
offsetfrom start of segment.
bufferto copy into.
sizeof object to copy.
Returns
true on success.

Get size of mapped segment.

Returns
size of mapped segment.

Get starting address of mapped segment.

Returns
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.

Parameters
objectto add to pool.

Create an instance of a number.

Parameters
bufferor NULL if created internally.
sizeof field if not null terminated.

Set string based on a new value.

Parameters
valueto set.

Get string buffer representing the number.

Returns
string buffer.

Get value of string buffer as a long integer.

Returns
long integer value of string buffer.

Get value of string buffer as expression of object.

Returns
long integer value of string buffer.

Cast string as long integer and get value of buffer.

Returns
long integer value of string buffer.

Cast object as a string to retrieve buffer.

Returns
string buffer of value.

Assign a value to the number. This rewrites the string buffer.

Parameters
valueto assign.
Returns
new value of number object assigned.

Assign another number to this number.

Parameters
numberto assign to assign.
Returns
new value of number object assigned.

Add a value to the number. This rewrites the string buffer.

Parameters
valueto add.
Returns
new value of number object.

Subtract a value from the number. This rewrites the string buffer.

Parameters
valueto subtract.
Returns
new value of number object.

Decrement the number object. This rewrites the string buffer.

Returns
new value of number object.

Increment the number object. This rewrites the string buffer.

Returns
new value of number object.

Construct an auto-pointer referencing an existing object.

Parameters
objectwe point to.

Construct an auto-pointer as a copy of another pointer. The retention of the object being pointed to will be increased.

Parameters
pointerwe 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.

Parameters
objectto 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.

Returns
true if the pointer is not referencing anything.

Test if the pointer is referencing an object.

Returns
true if the pointer is currently referencing an object.

Object factory for creating members of the spare array when they are initially requested.

Returns
new object.

Purge the array by deleting all created objects.

Get (reference) an object at a specified offset in the array.

Parameters
offsetin array.
Returns
new or existing object.

Create a sparse array of known size. No member objects are created until they are referenced.

Parameters
sizeof array.

Destroy sparse array and delete all generated objects.

Get count of array elements.

Returns
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.

Parameters
sizeof memory request.
Returns
allocated memory or NULL if not possible.

Convenience function.

Parameters
sizeof memory request.
Returns
alocated memory or NULL if not possible.

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.

Parameters
sizeof memory request.
Returns
allocated memory or NULL if not possible.

Duplicate NULL terminated string into allocated memory. This uses alloc.

Parameters
stringto copy into memory.
Returns
allocated memory with copy of string or NULL if cannot allocate.

Duplicate existing memory block into allocated memory. This uses alloc.

Parameters
memoryto data copy from.
sizeof memory to allocate.
Returns
allocated memory with copy or NULL if cannot allocate.

Extract formatted string for object.

Extract formatted string for object.

Parameters
charactercode we are pushing.
Returns
0 to keep processing, EOF if done, or char to unget.

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.

Returns
true if ssl support is available, false if not.

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.

Returns
true if fips support enabled and stack initialized.

Copy system certificates to a local path.

Parameters
pathto copy to.
Returns
0 or error number on failure.

Get path to system certificates.

Returns
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.

Parameters
authoritypath to use or NULL if none.
Returns
a security context that is cast from derived library.

Create an anonymous client context with an optional authority to validate.

Parameters
authoritypath to use or NULL if none.
pathsof certificates to use.
Returns
a basic client security context.

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.

Parameters
authoritypath to use.

Assign a non-default cipher to the context.

Parameters
contextto set cipher for.
ciphersto set.

Determine if the current security context is valid.

Returns
true if valid, -1 if not.

Get last error code associated with the security context.

Returns
last error code or 0/OK if none.

Create 36 character traditional version 1 uuid.

Parameters
stringto 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.

Author
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org

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.

Parameters
datato process.
sizeof data to process.
Returns
size of processed output, should be same as size or 0 if error.

This essentially encrypts a single string and pads with NULL bytes as needed.

Parameters
stringto encrypt.
Returns
total encrypted size.

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.

Parameters
addressof data to add before final pad.
sizeof data to add before final pad.
Returns
actual bytes encrypted or decrypted.

Process encrypted data in-place. This assumes no need to set the address buffer.

Parameters
addressof data to process.
sizeof data to process.
flagif to pad data.
Returns
bytes processed and written back to buffer.

Check if a specific cipher is supported.

Parameters
nameof cipher to check.
Returns
true if supported, false if not.

Finalize and recycle current digest to start a new digest.

Parameters
binarydigest used rather than text if true.

Reset and restart digest object.

Test to see if a specific digest type is supported.

Parameters
nameof digest we want to check.
Returns
true if supported, false if not.

Shortcut for short md5 digests if supported...

Parameters
textto create a digest for.
Returns
digest string.

Test to see if a specific digest type is supported.

Parameters
nameof digest we want to check.
Returns
true if supported, false if not.

Push entropic seed.

Parameters
bufferof random data to push.
sizeof buffer.
Returns
true if successful.

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.

Parameters
memorybuffer to fill.
sizeof buffer.
Returns
number of bytes filled.

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.

Parameters
memorybuffer to fill.
sizeof buffer to fill.
Returns
number of bytes set.

Get a pseudo-random integer, range 0 - 32767.

Returns
random integer.

Get a pseudo-random integer in a preset range.

Parameters
minvalue of random integer.
maxvalue of random integer.
Returns
random value from min to max.

Get a pseudo-random floating point value.

Returns
psudo-random value 0 to 1.

Get a pseudo-random floating point value in a preset range.

Parameters
minvalue of random floating point number.
maxvalue of random floating point number.
Returns
random value from min to max.

Determine if we have sufficient entropy to return random values.

Returns
true if sufficient entropy.

Create 36 character random uuid string.

Parameters
stringto 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.

Parameters
hostname in the form address or "address:port"
serviceid or port to use if not specified in host string.
typeof service to get.
protocolof service to get.

Release an address list directly. This is used internally by some derived socket types which do not use generic address lists.

Parameters
listof 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.

Author
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org

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.

Parameters
familyof socket address. Needed when host names are used.
addressor hostname.
typeof socket (stream, dgram, etc).
protocolnumber 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.

Parameters
familyof hosts to filter by or AF_UNSPEC.
hostnameor ip address. The socket family is used for hostnames.
serviceport or name we are referencing or NULL.

Construct a socket address list for a service.

Parameters
hostaddress for service.
servicename or port number.
typeof 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.

Parameters
hostnameor address to use.
serviceport 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.

Parameters
referenceto object to copy from.

Assignment operator.

Parameters
referenceto object to copy from.

Destroy address. Deallocate addrinfo structure.

Compare two address lists.

Returns
true if the two lists are the same (same addresses in the same order).

Get the first socket address in our address list.

Returns
first socket address or NULL if none.

Get the first socket address by casted reference.

Returns
first socket address we resolved or NULL if none.

Get the first socket address of specified family from our list.

Parameters
familyto seek.
Returns
first socket address of family or NULL if none.

Get the family of the first member in a list of services.

Returns
family of first socket address or 0 if none.

Get the address size of the first address.

Returns
size in bytes of first socket address or 0 if none.

Get the port of the first address .

Returns
port of first socket address or 0 if none.

Set the port of all addresses in the list.

Parameters
portthe port to set.

Returns a copy of this address list with the specified port set.

Find a specific socket address in our address list.

Returns
matching address from list or NULL if not found.

Get the full socket address list from the object.

Returns
addrinfo list we resolved or NULL if none.

Get the full socket address list by casted reference.

Returns
addrinfo list we resolved or NULL if none.

Return the full socket address list by pointer reference.

Returns
addrinfo list we resolved or NULL if none.

Print the first socket address as a human-readable string to the provided buffer and returns the printed string length.

Parameters
srcAddress to print.
dstDestination buffer to print the socket address on.
dst_szSize of the provided buffer. Strongly recommended to be at least INET6_ADDRSTRLEN (or INET_ADDRSTRLEN if compiled without IPv6).
portIf true, print port number with address. If true, ipv6_brackets will also be forced to true.
ipv6_bracketsIf true, force printing IPv6 brackets. Ignored if address is an IPv4.
Returns
length (in bytes) of the printed string, excluding trailing zero.

Test if the address list is valid.

Returns
true if we have an address list.

Test if we have no address list.

Returns
true if we have no address list.

Test if the first socket address is ADDR_ANY: 0.0.0.0 or ::0

Returns
true if the address is one of the above.

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).

Parameters
familyaddress family to set.

Test if the first socket address is ADDR_LOOPBACK: 127.0.0.1 or ::1

Returns
true if the address is one of the above.

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).

Parameters
familyaddress family to set.

Clear current object.

Set the host addresses to form a new list.

Parameters
hostnameor address to resolve.
servicename or port number, or NULL if not used.
typeof socket (stream or dgram) to filter list by.

Append additional host addresses to our list.

Parameters
hostnameor address to resolve.
servicename or port number, or NULL if not used.
typeof socket (stream or dgram).

Set an entry for host binding.

Parameters
familyof socket address. Needed when hostnames are used.
addressor hostname.
typeof socket (stream, dgram, etc).
protocolnumber of socket.

Add an individual socket address to our address list.

Parameters
addressto add.

Insert unique members from another socket address list to ours.

Parameters
addresslist to insert into list.
Returns
count of addresses added.

Remove members from another socket address list from ours.

Parameters
addresslist to remove from list.
Returns
count of addresses removed.

Remove an individual socket address from our address list.

Parameters
addressto remove.
Returns
true if found and removed, false if not found.

Insert an individual socket address to our address list only if unique.

Parameters
addressto insert into list.
Returns
true if inserted, false if duplicate.

Copy an existing addrinfo into our object. This is also used to support the copy constructor.

Parameters
addresslist to copy from.

Set an individual socket address for our address list.

Parameters
addressto add.

Set a socket address from host and service.

Parameters
hostnameor address to use.
serviceport or 0.

Returns the size of the socket address according to the family.

Returns
size in bytes of the valid part of the socket address.

Returns the port of the socket address.

Returns
port associated to the socket address.

Set the port of the socket address.

Parameters
addressto edit.
portto associate to the socket address.

Test if the socket address is ADDR_ANY: 0.0.0.0 or ::0

Returns
true if the address is one of the above.

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

Returns
true if the address is one of the above.

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.

Parameters
addressto duplicate.
Returns
duplicate address object.

Convert address object into ipv4 address.

Parameters
addressto convert.
Returns
new ipv4 address or NULL if not ipv4.

Convert address object into ipv6 address.

Parameters
addressto convert.
Returns
new ipv6 address or NULL if not ipv6.

Print socket address as a human-readable string to the provided buffer and returns the printed string length.

Parameters
srcAddress to print.
dstDestination buffer to print the socket address on.
dst_szSize of the provided buffer. Strongly recommended to be at least INET6_ADDRSTRLEN (or INET_ADDRSTRLEN if compiled without IPv6).
portIf true, print port number with address. If true, ipv6_brackets will also be forced to true.
ipv6_bracketsIf true, force printing IPv6 brackets. Ignored if address is an IPv4.
Returns
length (in bytes) of the printed string, excluding trailing zero.

Create a socket object for use.

Create socket as duped handle of existing socket.

Parameters
existingsocket to dup.

Create socket from existing socket descriptor.

Parameters
socketdescriptor 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.

Parameters
addresslist to connect with.

Create an unbound socket of a specific type.

Parameters
familyof our new socket.
type(stream, udp, etc) of our new socket.
protocolnumber of our new socket.'

Create a bound socket. If one wishes to listen for connections on a protocol, then ListenSocket should be used instead.

Parameters
addressto bind or "*" for all.
portnumber of service to bind.
familyto bind as.
typeof socket to bind (stream, udp, etc).
protocolof 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.

Parameters
socketto shutdown.

Shutdown and close the socket.

Get error code.

See the number of bytes in the receive queue.

Parameters
valueto test for.
Returns
true if at least that many bytes waiting in receive queue.

Test if socket is connected.

Returns
true if connected.

Test for pending input data. This function can wait up to a specified timeout for data to appear.

Parameters
timeoutor 0 if none.
Returns
true if input data waiting.

Set nodelay option for tcp socket.

Returns
0 if successful, -1 on error.

Test for pending input data. This function can wait up to a specified timeout for data to appear.

Parameters
socketto test.
timeoutor 0 if none.
Returns
true if input data waiting.

Test for output data sent. This function can wait up to a specified timeout for data to appear sent.

Parameters
timeoutor 0 if none.
Returns
false if cannot send more output/out of buffer space.

Get the number of bytes of data in the socket receive buffer.

Returns
bytes pending.

Set socket for unicast mode broadcasts.

Parameters
enablebroadcasting if true.
Returns
0 on success, -1 if error.

Set socket for keepalive packets.

Parameters
enablekeep-alive if true.
Returns
0 on success, -1 if error.

Set socket blocking I/O mode.

Parameters
enabletrue for blocking I/O.
Returns
0 on success, -1 if error.

Set multicast mode and multicast broadcast range.

Parameters
ttlto set for multicast socket or 0 to disable multicast.
Returns
0 on success, -1 if error.

Set loopback to read multicast packets we broadcast.

Parameters
enabletrue to loopback, false to ignore.
Returns
0 on success, -1 if error.

Get socket error code.

Returns
socket error code.

Set the time to live before packets expire.

Parameters
timeto live to set.
Returns
0 on success, -1 on error.

Set the size of the socket send buffer.

Parameters
sizeof send buffer to set.
Returns
0 on success, -1 on error.

Set the size to wait before sending.

Parameters
sizeof send wait buffer to set.
Returns
0 on success, -1 on error.

Set the size of the socket receive buffer.

Parameters
sizeof recv buffer to set.
Returns
0 on success, -1 on error.

Get the type of a socket.

Parameters
socketdescriptor.
Returns
socket type.

Set segment size and get MTU.

Parameters
socketto modify.
sizeof segment or zero to not set.
Returns
mtu size of socket.

Set congestion control id.

Parameters
socketto modify.
ccidvalue to set.
Returns
true if success, false if not dccp or not supported ccid used.

Get the type of a socket.

Returns
socket type.

Set segment size and get mtu of a socket.

Parameters
sizeof segment or 0 to leave unchanged.
Returns
mtu size.

Set ccid of dccp socket.

Parameters
ccidto set.
Returns
true if success, false if not dccp or not supported ccid used.

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.

Parameters
typeof service value.
Returns
0 on success or -1 on error.

Set packet priority, 0 to 6 unless privileged. Should be set before type-of-service.

Parameters
schedulingpriority for packet scheduling.
Returns
0 on success, -1 on error.

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.

Parameters
listof addresses to connect to.
Returns
0 on success or error.

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.

Returns
0 on success or error.

Join socket to multicast group.

Parameters
listof groups to join.
Returns
0 on success, -1 on error.

Drop socket from multicast group.

Parameters
listof groups to drop.
Returns
0 on success, -1 on error.

Socket i/o timer setting.

Parameters
timeoutto wait, inf for blocking, 0 pure non-blocking.
Returns
0 on success or error code.

Peek at data waiting in the socket receive buffer.

Parameters
datapointer to save data in.
numberof bytes to peek.
Returns
number of bytes actually read, or 0 if no data waiting.

Read data from the socket receive buffer. This will be used in abi 4.

Parameters
datapointer to save data in.
numberof bytes to read.
addressof peer data was received from.
Returns
number of bytes actually read, 0 if none, -1 if error.

Write data to the socket send buffer. This will be used in abi 4.

Parameters
datapointer to write data from.
numberof bytes to write.
addressof peer to send data to if not connected.
Returns
number of bytes actually sent, 0 if none, -1 if error.

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.

Parameters
datato save input line.
sizeof input line buffer.
Returns
number of bytes read, 0 if none, err() has error.

Print formatted string to socket.

Parameters
formatstring.
Returns
number of bytes sent.

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.

Parameters
bufferto save input line.
Returns
number of bytes read, 0 if none, err() has error.

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.

Parameters
socketto read from.
datato save input line.
sizeof input line buffer.
timeoutto wait for a complete input line.
Returns
number of bytes read, 0 if none, -1 if error.

Print formatted string to socket.

Parameters
socketto write to.
formatstring.
Returns
number of bytes sent, -1 if error.

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.

Parameters
stringto write.
Returns
number of bytes sent, 0 if none, -1 if error.

Test if socket is valid.

Returns
true if valid socket.

Test if socket is invalid.

Returns
true if socket is invalid.

Assign socket from a socket descriptor. Release existing socket if one present.

Parameters
socketdescriptor to assign to object.

Get the socket descriptor by casting.

Returns
socket descriptor of object.

Get the socket descriptor by pointer reference.

Returns
socket descriptor of object.

Get the number of bytes pending in the receive buffer of a socket descriptor.

Parameters
socketdescriptor.
Returns
number of pending bytes.

Set the send size of a socket descriptor.

Parameters
socketdescriptor.
sizeof send buffer to set.
Returns
0 on success, -1 on error.

Set the size to wait before sending.

Parameters
socketdescriptor.
sizeof send wait buffer to set.
Returns
0 on success, -1 on error.

Set the receive size of a socket descriptor.

Parameters
socketdescriptor.
sizeof receive buffer to set.
Returns
0 on success, -1 on error.

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.

Parameters
socketdescriptor.
listof addresses to connect to.
Returns
0 on success, -1 on error.

Disconnect a connected socket descriptor.

Parameters
socketdescriptor.
Returns
0 on success, -1 on error.

Drop socket descriptor from multicast group.

Parameters
socketdescriptor.
listof groups to drop.
Returns
0 on success, -1 on error.

Join socket descriptor to multicast group.

Parameters
socketdescriptor.
listof groups to join.
Returns
0 on success, -1 on error.

Get socket error code of socket descriptor.

Parameters
socketdescriptor.
Returns
socket error code.

Set multicast mode and multicast broadcast range for socket descriptor.

Parameters
socketdescriptor.
ttlto set for multicast socket or 0 to disable multicast.
Returns
0 if success, -1 if error.

Set loopback to read multicast packets socket descriptor broadcasts.

Parameters
socketdescriptor.
enabletrue to loopback, false to ignore.
Returns
0 if success, -1 if error.

Set socket blocking I/O mode of socket descriptor.

Parameters
socketdescriptor.
enabletrue for blocking I/O.
Returns
0 if success, -1 if error.

Set socket for keepalive packets for socket descriptor.

Parameters
socketdescriptor.
enablekeep-alive if true.
Returns
0 if success, -1 if error.

Set socket for unicast mode broadcasts on socket descriptor.

Parameters
socketdescriptor.
enablebroadcasting if true.
Returns
0 if success, -1 if error.

Set tcp nodelay option on socket descriptor.

Parameters
socketdescriptor.
Returns
0 if success, -1 if error.

Set packet priority of socket descriptor.

Parameters
socketdescriptor.
schedulingpriority for packet scheduling.
Returns
0 on success, -1 on error.

Set type of service of socket descriptor.

Parameters
socketdescriptor.
typeof service.
Returns
0 on success, -1 on error.

Set the time to live for the socket descriptor.

Parameters
socketdescriptor.
timeto live to set.
Returns
0 on success, -1 on error.

Get the address family of the socket descriptor.

Returns
address family.

Get the address family of a socket address object.

Parameters
addressto examine.
Returns
address family.

Get the address family of an internet socket address object.

Parameters
addressto examine.
Returns
address family.

Get data waiting in receive queue.

Parameters
socketto get from.
bufferto save.
sizeof data buffer to request.
flagsfor i/o operation (MSG_OOB, MSG_PEEK, etc).
addressof source.
Returns
number of bytes received, -1 if error.

Send data on socket.

Parameters
socketto send to.
bufferto send.
sizeof data buffer to send.
flagsfor i/o operation (MSG_OOB, MSG_PEEK, etc).
addressof destination, NULL if connected.
Returns
number of bytes sent, -1 if error.

Send reply on socket. Used to reply to a recvfrom message.

Parameters
socketto send to.
bufferto send.
sizeof data buffer to send.
flagsfor i/o operation (MSG_OOB, MSG_PEEK, etc).
addressto reply to.
Returns
number of bytes sent, -1 if error.

Bind the socket descriptor to a known interface and service port.

Parameters
socketdescriptor to bind.
addressto bind to or "*" for all.
serviceport to bind.
protocolto use or 0 if default.
Returns
0 on success, -1 if error.

Bind the socket descriptor to a known interface listen on service port.

Parameters
socketdescriptor to bind.
addressof interface to bind to.
backlogfor service.
Returns
0 on success, -1 if error.

Bind the socket descriptor to a known interface.

Parameters
socketdescriptor to bind.
addressof interface to bind to.
Returns
0 on success, -1 if error.

Accept a socket connection from a remote host.

Parameters
socketdescriptor to accept from.
addressof socket accepting.
Returns
new socket accepted.

Create a socket object unbound.

Parameters
familyof socket.
typeof socket.
protocolof socket.
Returns
socket descriptor created or INVALID_SOCKET.

Create a connected socket.

Parameters
addresslist to connect to.
typeof socket to create.
protocolof socket.
Returns
socket descriptor created or INVALID_SOCKET.

Create a bound socket for a service.

Parameters
ifaceto bind.
serviceport to bind.
familyto select or AF_UNSPEC
typeof socket to create.
protocolof socket to create.
Returns
socket descriptor created or INVALID_SOCKET.

Create a connected socket for a service.

Parameters
addressof service for connect.
Returns
socket descriptor.

Release (close) a socket.

Parameters
socketto close.

Lookup and return the host name associated with a socket address.

Parameters
addressto lookup.
bufferto save hostname into.
sizeof buffer to save hostname into.
Returns
buffer or NULL if lookup fails.

Create an address info lookup hint based on the family and type properties of a socket descriptor.

Parameters
socketdescriptor.
hintbuffer.
Returns
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.

Parameters
socketdescriptor.
addressthat is resolved.
hostnameto resolve.
serviceport.
Returns
socket address size.

Get the size of a socket address.

Parameters
addressof socket.
Returns
size to use for this socket address object.

Compare socket addresses. Test if the address and service matches or if there is no service, then just the host address values.

Parameters
address1to compare.
address2to compare.
Returns
true if same family and equal.

Copy a socket address.

Parameters
targetaddress pointer to copy into.
originaddress pointer to copy from.
Returns
number of bytes copied, 0 if invalid.

Store an address into an address object.

Parameters
storagefor address.
addressto store.
Returns
number of bytes stored.

Store an address into an internet address object.

Parameters
storagefor address.
addressto store.
Returns
number of bytes stored.

Compare socket host addresses. Test if the host address matches or if there is no service, then just the host address values.

Parameters
address1to compare.
address2to compare.
Returns
true if same family and equal.

Compare socket addresses. Test if the stored addresses received match. or if there is no service, then just the host address values.

Parameters
address1to compare.
address2to compare.
Returns
true if same family and equal.

Compare socket addresses. Test if the internet addresses received match. or if there is no service, then just the host address values.

Parameters
address1to compare.
address2to compare.
Returns
true if same family and equal.

See if both addresses are in the same subnet. This is only relevant to IPV4 and class domain routing.

Parameters
address1to test.
address2to test.
Returns
true if in same subnet.

Get the socket address of the interface needed to reach a destination address.

Parameters
addressof interface found.
targetaddress.
sizeof interface, 0 used for older code
Returns
0 on success, -1 on error.

Get the hostname of a socket address.

Parameters
addressto lookup.
bufferto save hostname in.
sizeof hostname buffer.
Returns
buffer if found or NULL if not.

Get the service port of a socket.

Parameters
addressof socket to examine.
Returns
service port number.

Get the service port of an inet socket.

Parameters
addressof internet socket to examine.
Returns
service port number.

Convert a socket address and service into a hash map index.

Parameters
addressto convert.
sizeof map index.
Returns
key index path.

Convert a socket host address into a hash map index.

Parameters
addressto convert.
sizeof map index.
Returns
key index path.

Initialize socket subsystem.

Set default socket family preference for query options when the socket type is otherwise not specified.

Parameters
familyto 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.

Parameters
enabletrue to set mapping. This is default.

Return error code of last socket operation,

Returns
errno style error code.

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.

Parameters
stringaddress to check.
Returns
true if zero/null address.

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.

Parameters
stringaddress to check.
Returns
true if zero/null address.

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.

Parameters
socketdescriptor to examine.
addressstorage for local address.
Returns
0 on success, -1 on failure.

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.

Parameters
socketdescriptor to examine.
addressstorage for remote address.
Returns
0 on success, -1 on failure.

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.

Parameters
objectto guard.

Prematurely release a guard.

Construct a guard for a specific object.

Parameters
objectto 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.

Parameters
stacksize 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.

Parameters
timeoutto 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.

Parameters
thread1to test.
thread2to test.
Returns
true if both are the same context.

Get current thread id.

Returns
thread id.

Check if timer has been updated since last check. This also sets updated false.

Returns
true if was updated.

Check if timer active.

Returns
true if active.

Construct an untriggered timer set to the time of creation.

Construct a triggered timer that expires at specified offset.

Parameters
offsetto expire in milliseconds.

Construct a triggered timer that expires at specified offset.

Parameters
offsetto expire in seconds.

Construct a timer from a copy of another timer.

Parameters
copyof timer to construct from.

Set the timer to expire.

Parameters
expiretime in milliseconds.

Set the timer to expire.

Parameters
expiretime in seconds.

Set (update) the timer with current time.

Clear pending timer, has no value.

Get remaining time until the timer expires.

Returns
0 if expired or milliseconds still waiting.

Get remaining time until timer expires by reference.

Returns
0 if expired or milliseconds still waiting.

Check if timer has expired.

Returns
true if timer still pending.

Check if timer expired for is() expression.

Returns
true if timer expired.

Set timer expiration.

Parameters
expiretimer in specified seconds.

Set timer expiration.

Parameters
expiretimer in milliseconds.

Adjust timer expiration.

Parameters
expiretime to add in seconds.

Adjust timer expiration.

Parameters
expiretime to add in milliseconds.

Adjust timer expiration.

Parameters
expiretime to subtract in seconds.

Adjust timer expiration.

Parameters
expiretime to subtract in milliseconds.

Compute difference between two timers.

Parameters
timerto use for difference.
Returns
difference in milliseconds.

Compare timers if same timeout.

Parameters
timerto compare with.
Returns
true if same.

Compare timers if not same timeout.

Parameters
timerto compare with.
Returns
true if not same.

Compare timers if earlier timeout than another timer.

Parameters
timerto compare with.
Returns
true if earlier.

Compare timers if earlier than or equal to another timer.

Parameters
timerto compare with.
Returns
true if earlier or same.

Compare timers if later timeout than another timer.

Parameters
timerto compare with.
Returns
true if later.

Compare timers if later than or equal to another timer.

Parameters
timerto compare with.
Returns
true if later or same.

Sleep current thread until the specified timer expires.

Parameters
timerto reference for sleep.

Get timer ticks since uuid epoch.

Returns
timer ticks in 100ns resolution.

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.

Author
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org

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.

Parameters
addressof actual allocation.
sizeof object allocated.
arpool 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?

Returns
true if not empty.

Number of retains (smart pointers) referencing us.

Returns
number of copies of pointers referencing.

Override delete to de-allocate actual heap. This is used because the object is atomically aligned, but the heap may not be.

Parameters
addressof 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.

Parameters
objectto reference.

Create a smart pointer based on another pointer. Both pointers then reference the same object.

Parameters
pointerinstance 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.

Parameters
objectto reference.

Assign from a guarded typeref.

Adjust memory pointer to atomic boundry.

Parameters
addressthat was allocated.
Returns
address for actual atomic aligned object.

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.

Parameters
pointerinstance to share reference with.

Manually release the current container.

Get size of referenced heap object.

Returns
size of container or 0 if none.

Get number of references to container.

Returns
total number of pointers referencing container.

Check if pointer currently has a heap container.

Returns
true if we are referencing a container.

Check if we are currently not pointing to anything.

Returns
true if not referencing a container.

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.

Parameters
targetsmart pointer object to set.
objectto 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.

Parameters
codepointin string.
Returns
size of codepoint as utf8 encoded data, 0 if invalid.

Count ut8 encoded ucs4 codepoints in string.

Parameters
stringof utf8 data.
Returns
codepount count, 0 if empty or invalid.

Get codepoint offset in a string.

Parameters
stringof utf8 data.
positionof codepoint in string, negative offsets are from tail.
Returns
offset of codepoint or NULL if invalid.

Convert a utf8 encoded codepoint to a ucs4 character value.

Parameters
encodedutf8 codepoint.
Returns
ucs4 string or 0 if invalid.

How many chars requires to encode a given wchar string.

Parameters
stringof ucs4 data.
Returns
number of chars required to encode given string.

How many chars requires to encode a given unicode character.

Parameters
characterto encode.
Returns
number of chars required to encode given character.

Convert a unicode string into utf8.

Parameters
stringof unicode data to pack
bufferof character protocol to put data into.
Returns
number of code points converted.

Convert a utf8 string into a unicode data buffer.

Parameters
unicodedata buffer.
bufferof character protocol to pack from.
sizeof unicode data buffer in codepoints.
Returns
number of code points converted.

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.

Parameters
stringto search in.
charactercode to search for.
startoffset in string in codepoints.
Returns
pointer to first instance or NULL if not found.

Find last occurrence of character in string.

Parameters
stringto search in.
charactercode to search for.
endoffset to start from in codepoints.
Returns
pointer to last instance or NULL if not found.

Count occurrences of a unicode character in string.

Parameters
stringto search in.
charactercode to search for.
Returns
count of occurrences.

Get a unicode character from a character protocol.

Parameters
bufferof character protocol to read from.
Returns
unicode character or EOF error.

Push a unicode character to a character protocol.

Parameters
characterto push to file.
bufferof character protocol to push character to.
Returns
unicode character or EOF on error.

Create a utf8 pointer set to NULL.

Create a utf8 pointer for an existing char pointer.

Parameters
stringpointer to use.

Create a utf8 pointer as a copy of existing utf8 pointer.

Parameters
copyof object to use.

Iterative increment of a utf8 pointer to prior codepoint.

Returns
object incremented.

Iterative decrement of a utf8 pointer to next codepoint.

Returns
object decremented.

Adjust utf8 pointer by specified codepoints forward.

Parameters
offsetto increment by.
Returns
object incremented.

Adjust utf8 pointer by specified codepoints backward.

Parameters
offsetto decrement by.
Returns
object decremented.

Get new utf8 string after adding a codepoint offset.

Parameters
offsetto add.
Returns
new utf8 pointer pointing to specified offset.

Get new utf8 string after subtracting a codepoint offset.

Parameters
offsetto subtract.
Returns
new utf8 pointer pointing to specified offset.

Check if text is valid pointer.

Returns
true if not NULL.

Check if text is an invalid pointer.

Returns
false if not NULL.

Extract a unicode character from a specified codepoint.

Parameters
codepointoffset to extract character from.
Returns
unicode character or 0.

Assign a utf8 string to point to.

Parameters
stringto point to.
Returns
current object after set to string.

Iterative increment of a utf8 pointer to next codepoint.

Iterative decrement of a utf8 pointer to prior codepoint.

check if pointer equals another string.

Parameters
stringto check.
Returns
true if same memory address.

check if pointer does not equal another string.

Parameters
stringto check.
Returns
false if same memory address.

Get unicode character pointed to by pointer.

Returns
unicode character we are pointing to.

Get c string we point to.

Returns
string we point to.

Convert utf8 pointer to a generic string pointer.

Returns
generic string pointer.

Get length of null terminated utf8 string in codepoints.

Returns
codepoint length of string.

Constructor. Does not deal with any state.

keeps compilers happy.

Pure virtual application operator. Apply the validation algorithm specific to derived classes.

Get network address associated with this cidr.

Returns
system binary coded address.

Get network mask associated with this cidr.

Returns
system binary coded network mask.

Compute the broadcast address associated with this cidr.

Returns
system binary coded network address.

Set the cidr from a full or partial hostname, or from an address/mask, or a host/bits specification.

Parameters
cidrstring to use.

Construct a new cidr from a string.

Parameters
cidrstring to use.

Construct an empty cidr.

Construct a copy of a cidr.

Parameters
cidrto copy from.

See if a socket address is a member of this cidr's network.

Parameters
saddrpointer to test.
Returns
true if member of cidr.

See if a low level address object is a member of this cidr's net.

Parameters
inaddrobject to test.
Returns
true if member of cidr.

Get network address associated with this cidr.

Returns
system binary coded address.

Get network mask associated with this cidr.

Returns
system binary coded network mask.

Compute the broadcast address associated with this cidr.

Returns
system binary coded network address.

Set the cidr from a full or partial hostname, or from a host/bits specification.

Parameters
cidrstring to use.

Construct a new cidr from a string.

Parameters
cidrstring to use.

Construct an empty cidr.

Construct a copy of a cidr.

Parameters
cidrto copy from.

See if a socket address is a member of this cidr's network.

Parameters
saddrpointer to test.
Returns
true if member of cidr.

See if a low level address object is a member of this cidr's net.

Parameters
inaddrobject to test.
Returns
true if member of cidr.

Sets the IP address from a string representation of the numeric address, ie "127.0.0.1"

Parameters
hostThe string representation of the IP address
Returns
true if successful

Used to specify a host name or numeric internet address.

Parameters
hostThe string representation of the IP address or a hostname, , if NULL, it will default to INADDR_ANY

Create an Internet Address object with an empty (0.0.0.0) address.

Parameters
validatoroptional validator function object, intended for derived classes.

Convert the system internet address data type (struct in_addr) into a Common C++ IPV4Address object.

Parameters
addrstruct of system used binary internet address.
validatoroptional validator function object, intended for derived classes.

Convert a null terminated ASCII host address string (example: "127.0.0.1") or host address name (example: "www.voxilla.org") directly into a Common C++ IPV4Address object.

Parameters
addressnull terminated C string.
validatoroptional validator function object, intended for derived classes.

Copy constructor

Destructor

Provide a string representation of the value (Internet Address) held in the IPV4Address object.

Returns
string representation of IPV4Address.

May be used to verify if a given IPV4Address returned by another function contains a "valid" address, or "0.0.0.0" which is often used to mark "invalid" IPV4Address values.

Returns
true if address != 0.0.0.0.

Provide a low level system usable struct in_addr object from the contents of IPV4Address. This is needed for services such as bind() and connect().

Returns
system binary coded internet address.

Provide a low level system usable struct in_addr object from the contents of IPV4Address. This is needed for services such as bind() and connect().

Parameters
ifor IPV4Addresses with multiple addresses, returns the address at this index. User should call getAddressCount() to determine the number of address the object contains.
Returns
system binary coded internet address. If parameter i is out of range, the first address is returned.

Returns the number of internet addresses that an IPV4Address object contains. This usually only happens with IPV4Host objects where multiple IP addresses are returned for a DNS lookup

Allows assignment from the return of functions like inet_addr() or htonl()

Compare two internet addresses to see if they are equal (if they specify the physical address of the same internet host).

If there is more than one IP address in either IPV4Address object, this will return true if all of the IP addresses in the smaller are in the larger in any order.

Compare two internet addresses to see if they are not equal (if they each refer to unique and different physical ip addresses).

This is implimented in terms of operator==

Constructor. Does not deal with any state.

Keeps compilers happy.

Pure virtual application operator. Apply the validation algorithm specific to derived classes.

Sets the IP address from a string representation of the numeric address, ie "127.0.0.1"

Parameters
hostThe string representation of the IP address
Returns
true if successful

Used to specify a host name or numeric internet address.

Parameters
hostThe string representation of the IP address or a hostname, , if NULL, it will default to INADDR_ANY

Create an Internet Address object with an empty (0.0.0.0) address.

Parameters
validatoroptional validator function object, intended for derived classes.

Convert the system internet address data type (struct in_addr) into a Common C++ IPV6Address object.

Parameters
addrstruct of system used binary internet address.
validatoroptional validator function object, intended for derived classes.

Convert a null terminated ASCII host address string (example: "127.0.0.1") or host address name (example: "www.voxilla.org") directly into a Common C++ IPV6Address object.

Parameters
addressnull terminated C string.
validatoroptional validator function object, intended for derived classes.

Copy constructor

Destructor

Provide a string representation of the value (Internet Address) held in the IPV6Address object.

Returns
string representation of IPV6Address.

May be used to verify if a given IPV6Address returned by another function contains a "valid" address, or "0.0.0.0" which is often used to mark "invalid" IPV6Address values.

Returns
true if address != 0.0.0.0.

Provide a low level system usable struct in_addr object from the contents of IPV6Address. This is needed for services such as bind() and connect().

Returns
system binary coded internet address.

Provide a low level system usable struct in_addr object from the contents of IPV6Address. This is needed for services such as bind() and connect().

Parameters
ifor IPV6Addresses with multiple addresses, returns the address at this index. User should call getAddressCount() to determine the number of address the object contains.
Returns
system binary coded internet address. If parameter i is out of range, the first address is returned.

Returns the number of internet addresses that an IPV6Address object contains. This usually only happens with IPV6Host objects where multiple IP addresses are returned for a DNS lookup

Compare two internet addresses to see if they are equal (if they specify the physical address of the same internet host).

If there is more than one IP address in either IPV6Address object, this will return true if all of the IP addresses in the smaller are in the larger in any order.

Compare two internet addresses to see if they are not equal (if they each refer to unique and different physical ip addresses).

This is implimented in terms of operator==

output string

HEXdump constructor.

Parameters
bufferbuffer to be "hexdumped"
buff_lenbuffer length
max_lenmax number of bytes to be "hexdumped". Usefull to truncate output. mas_len=0 does prints all.

HEXdump destructor.

const char* cast provided for conveneince.

string cast provided for conveneince.

operator <<

Parameters
hdhexdump.
Returns
application logger stream

Virtual method to filter results. Virtual override methods should call baseclass method to assure . and .. names are stripped out.

Returns
true if current filename is accepted.
Parameters
filepath to examine
inoinfo of type, date, etc.

Construct a directory tree walk starting at the specified prefix. A maximum subdirectory depth is also specified.

Parameters
prefixto start walk.
maxdepthsubdirectory depth to examine.

Construct an un-opened directory tree of a known maximum depth

Parameters
maxdepthsubdirectory subdirectory depth.

Open a directory tree path.

Parameters
prefixdirectory path to open.

Close the directory path.

Extract the next full pathname from the directory walk. When returning directories, a '/' is appended. The returned string is a buffer of MAX_PATH size.

Returns
path of next subdirectory entry or NULL.

This is used to step through the filter virtual for an entire subtree, and is used for cases where a derived DirTree class performs it's primary operations through filter rather than externally by calling getPath().

Returns
number of files and directories examined.
Parameters
prefixdirectory path to examine.

Construct and load a DSO object file.

Parameters
filenamepathname of object file to load.

Retrieve error indicator associated with DSO failure. This is often used in catch handlers.

Detach a DSO object from running memory.

Lookup a symbol in the loaded file.

Find a specific DSO object by filename.

Parameters
nameof DSO object file (partial).

See if DSO object is valid.

Returns
true if valid.

Install debug handler...

Contruct a multi-part document, and describe it's type.

Parameters
document(content) type.

Stream the headers of the multi-part document. The headers of individual entities are streamed as part of the body.

Parameters
outputto stream document header into.

Stream the "body" of the multi-part document. This involves streaming the headers and body of each document part.

Parameters
outputto stream document body into.

Get a string array of the headers to use. This is used to assist URLStream::post.

Returns
array of headers.

Stream the header(s) for the current document part.

Parameters
outputto stream header into.

Stream the content of this document part.

Parameters
outputto stream document body into.

Construct and attach a document part to a multipart document.

Parameters
topmultipart document to attach to.
ctContent-Type to use.

The constructor simply initializes the count.

The destructor is called when the reference count returns to zero. This is done through a virtual destructor.

The actual object being managed can be returned by this method as a void and then recast to the actual type. This removes the need to dynamic cast from RefObject and the dependence on rtti this implies.

Returns
underlying object being referenced.

Detach current object, for example, when changing pointer.

Patch point for mutex in derived class. This may often be a single static mutex shared by a managed type.

Patch point for a mutex in derived class. This may often be a single static mutex shared by a managed type.

Create an unattached pointer.

Create a pointer attached to a reference counted object.

Object being referenced.

A copy constructor.

Pointer being copied.

Get first linked object in list. This may be dynamically recast, and may refer to a master static bookmark pointer in a derived class. Otherwise it simply returns the current object. In a "free" list, this may not only return the first object, but also set the first to next.

Returns
pointer to first object in list.

Gets the last object in the list. This normally follows the links to the end. This is a virtual because derived class may include a static member bookmark for the current end.

Returns
pointer to last object in list.

Get next object, for convenience. Derived class may use this with a dynamic cast.

Returns
next object in list.

Insert object into chain. This is a virtual because derived class may choose instead to perform an insert at head or tail, may manage bookmarks, and may add mutex lock.

Parameters
objectbeing inserted.

Requested in overloaded insert() method to indicate how to insert data into list

< insert at first position in list pointed by current object

< insert at last position in list pointed by current object

< insert in list before current object

< insert in list after current object

Get first linked object in list. This may be dynamically recast, and may refer to a master static bookmark pointer in a derived class. Otherwise it follows list to front.

Returns
pointer to first object in list.

Gets the last object in the list. This normally follows the links to the end. This is a virtual because derived class may include a static member bookmark for the current end.

Returns
pointer to last object in list.

Virtual to get the insert point to use when adding new members. This may be current, or always head or always tail. As a virtual, this allows derived class to establish "policy".

Returns
pointer to insertion point in list.

Get next object, for convenience. Derived class may use this with a dynamic cast.

Returns
next object in list.

Get prev object in the list.

Returns
pointer to previous object.

Insert object into chain at given pos, as indicated by InsertMode; If no pos is given, it defaults to modeAtLast, inserting element at list's end.

Parameters
objectbeing inserted.
positionwhere object is inserted.

Remove object from chain.

Creates an empty map index (pointing to nothing).

Creates a map index pointing to a specific map object

Parameters
theindexed object

Creates a copy of a given map index

Parameters
thesource index object

Dereference operator: the pointed object it is returned as void * for easy re-cast.

Returns
pointer to indexed object.

Assignment operator to avoid implicit cast.

Returns
the object itself, as changed.

Prefix increment operator, to be used in loops and such.

Returns
the object itself, as changed.

Postfix increment operator, to be used in loops and such.

Returns
the object itself, as changed.

Comparison operator, between two MapIndex's.

Returns
the object itself, as changed.

Comparison operator, between the MapIndex and a MapObject, useful to avoid casts for sake of clearness.

Returns
the object itself, as changed.

Remove the object from it's current table.

Save id, mark as not using any table.

Parameters
idstring for this object.

This manages a registration to the typemanager - attempting to remove problems with the optimizers

This adds a new construction function to the type manager

And this one removes a type from the managers lists

This function creates a new object of the required type and returns a pointer to it. NULL is returned if we couldn't find the type

This constructor is used in serialization processes. It is called in CreateNewInstance in order to create an instance of the class to have Read() called on it.

Default destructor

This returns the ID of the persistent object (Its type)

This method is used to write to the Persistence::Engine It is not equivalent to the << operator as it writes only the data and not the object type etc.

This method is used to read from a Persistence::Engine It is not equivalent to the >> operator as it does no typesafety or anything.

These are the modes the Persistence::Engine can work in

Constructs a Persistence::Engine with the specified stream in the given mode. The stream must be initialized properly prior to this call or problems will ensue.

writes a PersistObject from a reference.

writes a PersistObject from a pointer.

reads a PersistObject into a reference overwriting the object.

reads a PersistObject into a pointer allocating memory for the object if necessary.

reads the actual object data into a pre-instantiated object pointer by calling the read function of the derived class.

reads in a class name, and caches it into the ClassMap.

The underlying stream

The mode of the engine. read or write

Typedefs for the Persistence::PersistObject support

Detach current process into a daemon, posix only. Perhaps a similar method can be used for creating win32 "services"?

Attach the current process to another device or i/o session. It is deamonified and dissasociated with the prior parent process and controlling terminal.

Parameters
devnamepath to attach to.

Set a posix compliant signal handler.

Returns
previous handler.
Parameters
signosignal no.
handlertrap handler.

Set system call interuptable signal handler.

#return previous handler.

Parameters
signosignal no.
handlertrap handler.

Lock a process in memory. Ideally you should be deep enough where additional memallocs for functions will not kill you, or use false for future.

Returns
true if successful.
Parameters
futurepages as well...

Unlock process pages.

Spawn a process and wait for it's exit code. In win32 this is done with the spawn system call. In posix, this is done with a fork, an execvp, and a waitpid.

Warning
The implementation differences between posix and win32 systems may cause side effects. For instance, if you use atexit() and this spawn method, on posix systems the function set up with atexit() will be called when the parent process of the fork exits, which will not happen on Win32 systems.
Returns
error code from process.
Parameters
execname of executable.
argvlist of command arguments.
waitfor process to exit before return.

Get the exit status of another process, waiting for it to exit.

Returns
exit code from process.
Parameters
pidprocess id.

Cancel a running child process.

Returns
0 on success.
Parameters
pidprocess id.
sigcancel signal to apply.

Get system environment.

Returns
system environ symbol.
Parameters
nameof symbol.

Set system environment in a standard manner.

Parameters
nameof environment symbol to set.
valueof environment symbol.
overwritetrue if replace existing symbol.

Get etc prefix path.

Returns
etc prefix.

Get home directory.

Returns
user home directory.

Get user name.

Returns
user login id.

Set user id by name.

Returns
true if successful.

Set the effective group id by name.

Returns
true if successful.

Return the effective operating system page size.

Returns
system page size.

Used to set process priority and optionally enable realtime.

Used to set process scheduling policy.

Portable shortcut for setting realtime...

Return true if scheduler settable.

Return true if realtime scheduling.

Create a lock under a known name.

Parameters
nameof system-wide lock to create.

Create a new lock object that can be used to make locks.

Destroy the current lock and release it.

Lock a system-wide name for this process. If the lock is successful, return true. If an existing lock was already acquired, release it first.

Returns
true if lock successful.
Parameters
namesystem-wide lock to use.

Release an acquired lock.

Flag if the current process has aqcuired a lock.

Returns
true if we have the lock.

Used to properly initialize serial object.

Opens the serial device.

Parameters
fnamePathname of device to open

Closes the serial device.

Reads from serial device.

Parameters
DataPoint to character buffer to receive data. Buffers MUST be at least Length + 1 bytes in size.
LengthNumber of bytes to read.

Writes to serial device.

Parameters
DataPoint to character buffer containing data to write. Buffers MUST
LengthNumber of bytes to write.

This service is used to throw all serial errors which usually occur during the serial constructor.

Parameters
errordefined serial error id.
errstrstring or message to optionally pass.

This service is used to thow application defined serial errors where the application specific error code is a string.

Parameters
errstring or message to pass.

This method is used to turn the error handler on or off for "throwing" execptions by manipulating the thrown flag.

Parameters
enabletrue to enable handler.

Set packet read mode and "size" of packet read buffer. This sets VMIN to x. VTIM is normally set to "0" so that "isPending()" can wait for an entire packet rather than just the first byte.

Returns
actual buffer size set.
Parameters
sizeof packet read request.
btimeroptional inter-byte data packet timeout.

Set "line buffering" read mode and specifies the newline character to be used in seperating line records. isPending can then be used to wait for an entire line of input.

Parameters
newlinenewline character.
nl1EOL2 control character.
Returns
size of conical input buffer.

Restore serial device to the original settings at time of open.

Used to flush the input waiting queue.

Used to flush any pending output data.

Used to wait until all output has been sent.

Used as the default destructor for ending serial I/O services. It will restore the port to it's original state.

Used to initialize a newly opened serial file handle. You should set serial properties and DTR manually before first use.

This allows later ttystream class to open and close a serial device.

A serial object may be constructed from a named file on the file system. This named device must be "isatty()".

Parameters
nameof file.

The serial base class may be "thrown" as a result on an error, and the "catcher" may then choose to destory the object. By assuring the socket base class is a virtual destructor, we can assure the full object is properly terminated.

Serial ports may also be duplecated by the assignment operator.

Set serial port speed for both input and output.

Returns
0 on success.
Parameters
speedto select. 0 signifies modem "hang up".

Set character size.

Returns
0 on success.
Parameters
bitscharacter size to use (usually 7 or 8).

Set parity mode.

Returns
0 on success.
Parameters
paritymode.

Set number of stop bits.

Returns
0 on success.
Parameters
bitsstop bits.

Set flow control.

Returns
0 on success.
Parameters
flowcontrol mode.

Set the DTR mode off momentarily.

Parameters
millisecnumber of milliseconds.

Send the "break" signal.

Often used by a "catch" to fetch the last error of a thrown serial.

Returns
error numbr of last Error.

Often used by a "catch" to fetch the user set error string of a thrown serial.

Returns
string for error message.

Get the "buffer" size for buffered operations. This can be used when setting packet or line read modes to determine how many bytes to wait for in a given read call.

Returns
number of bytes used for buffering.

Get the status of pending operations. This can be used to examine if input or output is waiting, or if an error has occured on the serial device.

Returns
true if ready, false if timeout.
Parameters
pendready check to perform.
timeoutin milliseconds.

Acquire the mutex

Parameters
_mutexreference to mutex to aquire.

Release the mutex automatically

Wait for read access

Parameters
_tlreference to lock to aquire.

Post the semaphore automatically

Wait for write access

Parameters
_tlreference to threadlock to aquire.

Post the semaphore automatically

Wait for the semaphore

Post the semaphore automatically

Create a timer, mark it as inactive, and set the initial "start" time to the creation time of the timer object. This allows "incTimer" to initially refer to time delays relative to the original start time of the object.

Set a new start time for the object based on when this call is made and optionally activate the timer for a specified number of milliseconds. This can be used to set the starting time of a realtime session.

Parameters
timeoutdelay in milliseconds from "now"

Set a timeout based on the current time reference value either from object creation or the last setTimer(). This reference can be used to time synchronize realtime data over specified intervals and force expiration when a new frame should be released in a synchronized manner.

Parameters
timeoutdelay in milliseconds from reference.

Adjust a timeout based on the current time reference value either from object creation or the last setTimer(). This reference can be used to time synchronize realtime data over specified intervals and force expiration when a new frame should be released in a synchronized manner.

Parameters
timeoutdelay in milliseconds from reference.

Sleep until the current timer expires. This is useful in time syncing realtime periodic tasks.

This is used to "disable" the service thread from expiring the timer object. It does not effect the reference time from either creation or a setTimer().

This is used by service threads to determine how much time remains before the timer expires based on a timeout specified in setTimer() or incTimer(). It can also be called after setting a timeout with incTimer() to see if the current timeout has already expired and hence that the application is already delayed and should skip frame(s).

return time remaining in milliseconds, or TIMEOUT_INF if inactive.

This is used to determine how much time has elapsed since a timer port setTimer benchmark time was initially set. This allows one to use setTimer() to set the timer to the current time and then measure elapsed time from that point forward.

return time elapsed in milliseconds, or TIMEOUT_INF if inactive.

a delimiter string containing all usual whitespace delimiters. These are space, tab, newline, carriage return, formfeed and vertical tab. (see isspace() manpage).

Exception thrown, if someone tried to read beyond the end of the tokens. Will not happen if you use it the 'clean' way with comparison against end(), but if you skip some tokens, because you 'know' they are there. Simplifies error handling a lot, since you can just read your tokens the way you expect it, and if there is some error in the input this Exception will be thrown.

The input forward iterator for tokens.

Author
Henner Zeller

copy constructor.

assignment operator.

shifts this iterator to the next token in the string.

returns the immutable string this iterator points to or '0' if no token is available (i.e. i == end()). Do not store pointers to this token, since it is invalidated for each iteration. If you need the token, copy it (e.g. with strdup());

returns the next delimiter after the current token or '\0', if there are no following delimiters. It returns the very next delimiter (even if skipAllDelim=true).

compares to other iterator. Usually used to compare against the end() iterator.

compares to other iterator. Usually used to compare against the end() iterator.

creates a new StringTokenizer for a string and a given set of delimiters.

Parameters
strString to be split up. This string will not be modified by this StringTokenizer, but you may as well not modfiy this string while tokenizing is in process, which may lead to undefined behaviour.
delimString containing the characters which should be regarded as delimiters.
skipAllDelimOPTIONAL. true, if subsequent delimiters should be skipped at once or false, if empty tokens should be returned for two delimiters with no other text inbetween. The first behaviour may be desirable for whitespace skipping, the second for input with delimited entry e.g. /etc/passwd like files or CSV input. NOTE, that 'true' here resembles the ANSI-C strtok(char *s,char *d) behaviour. DEFAULT = false
trimOPTIONAL. true, if the tokens returned should be trimmed, so that they don't have any whitespaces at the beginning or end. Whitespaces are any of the characters defined in StringTokenizer::SPACE. If delim itself is StringTokenizer::SPACE, this will result in a behaviour with skipAllDelim = true. DEFAULT = false

create a new StringTokenizer which splits the input string at whitespaces. The tokens are stripped from whitespaces. This means, if you change the set of delimiters in either the 'begin(const char *delim)' method or in 'setDelimiters()', you then get whitespace trimmed tokens, delimited by the new set. Behaves like StringTokenizer(s, StringTokenizer::SPACE,false,true);

returns the begin iterator

changes the set of delimiters used in subsequent iterations.

returns a begin iterator with an alternate set of delimiters.

the iterator marking the end.

Create xml parser.

Parameters
sizeof XML data buffer.

Destroy xml parser.

Virtual to receive embedded comments in XML document being parsed.

Parameters
textreceived.
sizeof text received.

Virtual to receive character text extracted from the document.

Parameters
textreceived.
sizeof text received.

Notify start of document event.

Notify end of document event.

Notify start of an element in the document.

Parameters
nameof element found.
attrlist of attributes extracted.

Notify end of an element in the document.

Parameters
nameof element ending.

Parse a chunk of data and return parser completion flag. This is used to externally drive data into the XML parser. The return status can be used to determine when a document has been fully parsed. This can be called multiple times to push stream data into the parser.

Parameters
addressof data to parse.
sizeof data to parse.

Parse a stream buffer and return parser document completion flag. This is used to scan a stream buffer for a complete XML document. The stream is scanned until the document is complete or EOF. Multiple XML document instances can be scanned from a continues XML streaming source.

Parameters
streambuffer to parse.
Returns
true if parse complete, false if invalid or EOF.

Parse a file buffer and return parser document completion flag. This is used to scan a file buffer for a complete XML document. The file is scanned until the document is complete or EOF. Multiple XML document instances can be scanned from a continues XML streaming source.

Parameters
filebuffer to parse.
Returns
true if parse complete, false if invalid or EOF.

End of document check.

Returns
true if end of document.

Get network address associated with this cidr.

Returns
system binary coded address.

Get network mask associated with this cidr.

Returns
system binary coded network mask.

Compute the broadcast address associated with this cidr.

Returns
system binary coded network address.

Set the cidr from a full or partial hostname, or from an address/mask, or a host/bits specification.

Parameters
cidrstring to use.

Construct a new cidr from a string.

Parameters
cidrstring to use.

Construct an empty cidr.

Construct a copy of a cidr.

Parameters
cidrto copy from.

See if a socket address is a member of this cidr's network.

Parameters
saddrpointer to test.
Returns
true if member of cidr.

See if a low level address object is a member of this cidr's net.

Parameters
inaddrobject to test.
Returns
true if member of cidr.

Get network address associated with this cidr.

Returns
system binary coded address.

Get network mask associated with this cidr.

Returns
system binary coded network mask.

Compute the broadcast address associated with this cidr.

Returns
system binary coded network address.

Set the cidr from a full or partial hostname, or from a host/bits specification.

Parameters
cidrstring to use.

Construct a new cidr from a string.

Parameters
cidrstring to use.

Construct an empty cidr.

Construct a copy of a cidr.

Parameters
cidrto copy from.

See if a socket address is a member of this cidr's network.

Parameters
saddrpointer to test.
Returns
true if member of cidr.

See if a low level address object is a member of this cidr's net.

Parameters
inaddrobject to test.
Returns
true if member of cidr.

Sets the IP address from a string representation of the numeric address, ie "127.0.0.1"

Parameters
hostThe string representation of the IP address
Returns
true if successful

Used to specify a host name or numeric internet address.

Parameters
hostThe string representation of the IP address or a hostname, , if NULL, it will default to INADDR_ANY

Create an Internet Address object with an empty (0.0.0.0) address.

Parameters
validatoroptional validator function object, intended for derived classes.

Convert the system internet address data type (struct in_addr) into a Common C++ IPV4Address object.

Parameters
addrstruct of system used binary internet address.
validatoroptional validator function object, intended for derived classes.

Convert a null terminated ASCII host address string (example: "127.0.0.1") or host address name (example: "www.voxilla.org") directly into a Common C++ IPV4Address object.

Parameters
addressnull terminated C string.
validatoroptional validator function object, intended for derived classes.

Copy constructor

Destructor

Provide a string representation of the value (Internet Address) held in the IPV4Address object.

Returns
string representation of IPV4Address.

May be used to verify if a given IPV4Address returned by another function contains a "valid" address, or "0.0.0.0" which is often used to mark "invalid" IPV4Address values.

Returns
true if address != 0.0.0.0.

Provide a low level system usable struct in_addr object from the contents of IPV4Address. This is needed for services such as bind() and connect().

Returns
system binary coded internet address.

Provide a low level system usable struct in_addr object from the contents of IPV4Address. This is needed for services such as bind() and connect().

Parameters
ifor IPV4Addresses with multiple addresses, returns the address at this index. User should call getAddressCount() to determine the number of address the object contains.
Returns
system binary coded internet address. If parameter i is out of range, the first address is returned.

Returns the number of internet addresses that an IPV4Address object contains. This usually only happens with IPV4Host objects where multiple IP addresses are returned for a DNS lookup

Allows assignment from the return of functions like inet_addr() or htonl()

Compare two internet addresses to see if they are equal (if they specify the physical address of the same internet host).

If there is more than one IP address in either IPV4Address object, this will return true if all of the IP addresses in the smaller are in the larger in any order.

Compare two internet addresses to see if they are not equal (if they each refer to unique and different physical ip addresses).

This is implimented in terms of operator==

Constructor. Does not deal with any state.

Keeps compilers happy.

Pure virtual application operator. Apply the validation algorithm specific to derived classes.

Sets the IP address from a string representation of the numeric address, ie "127.0.0.1"

Parameters
hostThe string representation of the IP address
Returns
true if successful

Used to specify a host name or numeric internet address.

Parameters
hostThe string representation of the IP address or a hostname, , if NULL, it will default to INADDR_ANY

Create an Internet Address object with an empty (0.0.0.0) address.

Parameters
validatoroptional validator function object, intended for derived classes.

Convert the system internet address data type (struct in_addr) into a Common C++ IPV6Address object.

Parameters
addrstruct of system used binary internet address.
validatoroptional validator function object, intended for derived classes.

Convert a null terminated ASCII host address string (example: "127.0.0.1") or host address name (example: "www.voxilla.org") directly into a Common C++ IPV6Address object.

Parameters
addressnull terminated C string.
validatoroptional validator function object, intended for derived classes.

Copy constructor

Destructor

Provide a string representation of the value (Internet Address) held in the IPV6Address object.

Returns
string representation of IPV6Address.

May be used to verify if a given IPV6Address returned by another function contains a "valid" address, or "0.0.0.0" which is often used to mark "invalid" IPV6Address values.

Returns
true if address != 0.0.0.0.

Provide a low level system usable struct in_addr object from the contents of IPV6Address. This is needed for services such as bind() and connect().

Returns
system binary coded internet address.

Provide a low level system usable struct in_addr object from the contents of IPV6Address. This is needed for services such as bind() and connect().

Parameters
ifor IPV6Addresses with multiple addresses, returns the address at this index. User should call getAddressCount() to determine the number of address the object contains.
Returns
system binary coded internet address. If parameter i is out of range, the first address is returned.

Returns the number of internet addresses that an IPV6Address object contains. This usually only happens with IPV6Host objects where multiple IP addresses are returned for a DNS lookup

Compare two internet addresses to see if they are equal (if they specify the physical address of the same internet host).

If there is more than one IP address in either IPV6Address object, this will return true if all of the IP addresses in the smaller are in the larger in any order.

Compare two internet addresses to see if they are not equal (if they each refer to unique and different physical ip addresses).

This is implimented in terms of operator==

output string

HEXdump constructor.

Parameters
bufferbuffer to be "hexdumped"
buff_lenbuffer length
max_lenmax number of bytes to be "hexdumped". Usefull to truncate output. mas_len=0 does prints all.

HEXdump destructor.

const char* cast provided for conveneince.

string cast provided for conveneince.

operator <<

Parameters
hdhexdump.
Returns
application logger stream

Virtual method to filter results. Virtual override methods should call baseclass method to assure . and .. names are stripped out.

Returns
true if current filename is accepted.
Parameters
filepath to examine
inoinfo of type, date, etc.

Construct a directory tree walk starting at the specified prefix. A maximum subdirectory depth is also specified.

Parameters
prefixto start walk.
maxdepthsubdirectory depth to examine.

Construct an un-opened directory tree of a known maximum depth

Parameters
maxdepthsubdirectory subdirectory depth.

Open a directory tree path.

Parameters
prefixdirectory path to open.

Close the directory path.

Extract the next full pathname from the directory walk. When returning directories, a '/' is appended. The returned string is a buffer of MAX_PATH size.

Returns
path of next subdirectory entry or NULL.

This is used to step through the filter virtual for an entire subtree, and is used for cases where a derived DirTree class performs it's primary operations through filter rather than externally by calling getPath().

Returns
number of files and directories examined.
Parameters
prefixdirectory path to examine.

Construct and load a DSO object file.

Parameters
filenamepathname of object file to load.

Retrieve error indicator associated with DSO failure. This is often used in catch handlers.

Detach a DSO object from running memory.

Lookup a symbol in the loaded file.

Find a specific DSO object by filename.

Parameters
nameof DSO object file (partial).

See if DSO object is valid.

Returns
true if valid.

Install debug handler...

Contruct a multi-part document, and describe it's type.

Parameters
document(content) type.

Stream the headers of the multi-part document. The headers of individual entities are streamed as part of the body.

Parameters
outputto stream document header into.

Stream the "body" of the multi-part document. This involves streaming the headers and body of each document part.

Parameters
outputto stream document body into.

Get a string array of the headers to use. This is used to assist URLStream::post.

Returns
array of headers.

Stream the header(s) for the current document part.

Parameters
outputto stream header into.

Stream the content of this document part.

Parameters
outputto stream document body into.

Construct and attach a document part to a multipart document.

Parameters
topmultipart document to attach to.
ctContent-Type to use.

The constructor simply initializes the count.

The destructor is called when the reference count returns to zero. This is done through a virtual destructor.

The actual object being managed can be returned by this method as a void and then recast to the actual type. This removes the need to dynamic cast from RefObject and the dependence on rtti this implies.

Returns
underlying object being referenced.

Detach current object, for example, when changing pointer.

Patch point for mutex in derived class. This may often be a single static mutex shared by a managed type.

Patch point for a mutex in derived class. This may often be a single static mutex shared by a managed type.

Create an unattached pointer.

Create a pointer attached to a reference counted object.

Object being referenced.

A copy constructor.

Pointer being copied.

Get first linked object in list. This may be dynamically recast, and may refer to a master static bookmark pointer in a derived class. Otherwise it simply returns the current object. In a "free" list, this may not only return the first object, but also set the first to next.

Returns
pointer to first object in list.

Gets the last object in the list. This normally follows the links to the end. This is a virtual because derived class may include a static member bookmark for the current end.

Returns
pointer to last object in list.

Get next object, for convenience. Derived class may use this with a dynamic cast.

Returns
next object in list.

Insert object into chain. This is a virtual because derived class may choose instead to perform an insert at head or tail, may manage bookmarks, and may add mutex lock.

Parameters
objectbeing inserted.

Requested in overloaded insert() method to indicate how to insert data into list

< insert at first position in list pointed by current object

< insert at last position in list pointed by current object

< insert in list before current object

< insert in list after current object

Get first linked object in list. This may be dynamically recast, and may refer to a master static bookmark pointer in a derived class. Otherwise it follows list to front.

Returns
pointer to first object in list.

Gets the last object in the list. This normally follows the links to the end. This is a virtual because derived class may include a static member bookmark for the current end.

Returns
pointer to last object in list.

Virtual to get the insert point to use when adding new members. This may be current, or always head or always tail. As a virtual, this allows derived class to establish "policy".

Returns
pointer to insertion point in list.

Get next object, for convenience. Derived class may use this with a dynamic cast.

Returns
next object in list.

Get prev object in the list.

Returns
pointer to previous object.

Insert object into chain at given pos, as indicated by InsertMode; If no pos is given, it defaults to modeAtLast, inserting element at list's end.

Parameters
objectbeing inserted.
positionwhere object is inserted.

Remove object from chain.

Creates an empty map index (pointing to nothing).

Creates a map index pointing to a specific map object

Parameters
theindexed object

Creates a copy of a given map index

Parameters
thesource index object

Dereference operator: the pointed object it is returned as void * for easy re-cast.

Returns
pointer to indexed object.

Assignment operator to avoid implicit cast.

Returns
the object itself, as changed.

Prefix increment operator, to be used in loops and such.

Returns
the object itself, as changed.

Postfix increment operator, to be used in loops and such.

Returns
the object itself, as changed.

Comparison operator, between two MapIndex's.

Returns
the object itself, as changed.

Comparison operator, between the MapIndex and a MapObject, useful to avoid casts for sake of clearness.

Returns
the object itself, as changed.

Remove the object from it's current table.

Save id, mark as not using any table.

Parameters
idstring for this object.

This manages a registration to the typemanager - attempting to remove problems with the optimizers

This adds a new construction function to the type manager

And this one removes a type from the managers lists

This function creates a new object of the required type and returns a pointer to it. NULL is returned if we couldn't find the type

This constructor is used in serialization processes. It is called in CreateNewInstance in order to create an instance of the class to have Read() called on it.

Default destructor

This returns the ID of the persistent object (Its type)

This method is used to write to the Persistence::Engine It is not equivalent to the << operator as it writes only the data and not the object type etc.

This method is used to read from a Persistence::Engine It is not equivalent to the >> operator as it does no typesafety or anything.

These are the modes the Persistence::Engine can work in

Constructs a Persistence::Engine with the specified stream in the given mode. The stream must be initialized properly prior to this call or problems will ensue.

writes a PersistObject from a reference.

writes a PersistObject from a pointer.

reads a PersistObject into a reference overwriting the object.

reads a PersistObject into a pointer allocating memory for the object if necessary.

reads the actual object data into a pre-instantiated object pointer by calling the read function of the derived class.

reads in a class name, and caches it into the ClassMap.

The underlying stream

The mode of the engine. read or write

Typedefs for the Persistence::PersistObject support

Detach current process into a daemon, posix only. Perhaps a similar method can be used for creating win32 "services"?

Attach the current process to another device or i/o session. It is deamonified and dissasociated with the prior parent process and controlling terminal.

Parameters
devnamepath to attach to.

Set a posix compliant signal handler.

Returns
previous handler.
Parameters
signosignal no.
handlertrap handler.

Set system call interuptable signal handler.

#return previous handler.

Parameters
signosignal no.
handlertrap handler.

Lock a process in memory. Ideally you should be deep enough where additional memallocs for functions will not kill you, or use false for future.

Returns
true if successful.
Parameters
futurepages as well...

Unlock process pages.

Spawn a process and wait for it's exit code. In win32 this is done with the spawn system call. In posix, this is done with a fork, an execvp, and a waitpid.

Warning
The implementation differences between posix and win32 systems may cause side effects. For instance, if you use atexit() and this spawn method, on posix systems the function set up with atexit() will be called when the parent process of the fork exits, which will not happen on Win32 systems.
Returns
error code from process.
Parameters
execname of executable.
argvlist of command arguments.
waitfor process to exit before return.

Get the exit status of another process, waiting for it to exit.

Returns
exit code from process.
Parameters
pidprocess id.

Cancel a running child process.

Returns
0 on success.
Parameters
pidprocess id.
sigcancel signal to apply.

Get system environment.

Returns
system environ symbol.
Parameters
nameof symbol.

Set system environment in a standard manner.

Parameters
nameof environment symbol to set.
valueof environment symbol.
overwritetrue if replace existing symbol.

Get etc prefix path.

Returns
etc prefix.

Get home directory.

Returns
user home directory.

Get user name.

Returns
user login id.

Set user id by name.

Returns
true if successful.

Set the effective group id by name.

Returns
true if successful.

Return the effective operating system page size.

Returns
system page size.

Used to set process priority and optionally enable realtime.

Used to set process scheduling policy.

Portable shortcut for setting realtime...

Return true if scheduler settable.

Return true if realtime scheduling.

Create a lock under a known name.

Parameters
nameof system-wide lock to create.

Create a new lock object that can be used to make locks.

Destroy the current lock and release it.

Lock a system-wide name for this process. If the lock is successful, return true. If an existing lock was already acquired, release it first.

Returns
true if lock successful.
Parameters
namesystem-wide lock to use.

Release an acquired lock.

Flag if the current process has aqcuired a lock.

Returns
true if we have the lock.

Used to properly initialize serial object.

Opens the serial device.

Parameters
fnamePathname of device to open

Closes the serial device.

Reads from serial device.

Parameters
DataPoint to character buffer to receive data. Buffers MUST be at least Length + 1 bytes in size.
LengthNumber of bytes to read.

Writes to serial device.

Parameters
DataPoint to character buffer containing data to write. Buffers MUST
LengthNumber of bytes to write.

This service is used to throw all serial errors which usually occur during the serial constructor.

Parameters
errordefined serial error id.
errstrstring or message to optionally pass.

This service is used to thow application defined serial errors where the application specific error code is a string.

Parameters
errstring or message to pass.

This method is used to turn the error handler on or off for "throwing" execptions by manipulating the thrown flag.

Parameters
enabletrue to enable handler.

Set packet read mode and "size" of packet read buffer. This sets VMIN to x. VTIM is normally set to "0" so that "isPending()" can wait for an entire packet rather than just the first byte.

Returns
actual buffer size set.
Parameters
sizeof packet read request.
btimeroptional inter-byte data packet timeout.

Set "line buffering" read mode and specifies the newline character to be used in seperating line records. isPending can then be used to wait for an entire line of input.

Parameters
newlinenewline character.
nl1EOL2 control character.
Returns
size of conical input buffer.

Restore serial device to the original settings at time of open.

Used to flush the input waiting queue.

Used to flush any pending output data.

Used to wait until all output has been sent.

Used as the default destructor for ending serial I/O services. It will restore the port to it's original state.

Used to initialize a newly opened serial file handle. You should set serial properties and DTR manually before first use.

This allows later ttystream class to open and close a serial device.

A serial object may be constructed from a named file on the file system. This named device must be "isatty()".

Parameters
nameof file.

The serial base class may be "thrown" as a result on an error, and the "catcher" may then choose to destory the object. By assuring the socket base class is a virtual destructor, we can assure the full object is properly terminated.

Serial ports may also be duplecated by the assignment operator.

Set serial port speed for both input and output.

Returns
0 on success.
Parameters
speedto select. 0 signifies modem "hang up".

Set character size.

Returns
0 on success.
Parameters
bitscharacter size to use (usually 7 or 8).

Set parity mode.

Returns
0 on success.
Parameters
paritymode.

Set number of stop bits.

Returns
0 on success.
Parameters
bitsstop bits.

Set flow control.

Returns
0 on success.
Parameters
flowcontrol mode.

Set the DTR mode off momentarily.

Parameters
millisecnumber of milliseconds.

Send the "break" signal.

Often used by a "catch" to fetch the last error of a thrown serial.

Returns
error numbr of last Error.

Often used by a "catch" to fetch the user set error string of a thrown serial.

Returns
string for error message.

Get the "buffer" size for buffered operations. This can be used when setting packet or line read modes to determine how many bytes to wait for in a given read call.

Returns
number of bytes used for buffering.

Get the status of pending operations. This can be used to examine if input or output is waiting, or if an error has occured on the serial device.

Returns
true if ready, false if timeout.
Parameters
pendready check to perform.
timeoutin milliseconds.

Acquire the mutex

Parameters
_mutexreference to mutex to aquire.

Release the mutex automatically

Wait for read access

Parameters
_tlreference to lock to aquire.

Post the semaphore automatically

Wait for write access

Parameters
_tlreference to threadlock to aquire.

Post the semaphore automatically

Wait for the semaphore

Post the semaphore automatically

Create a timer, mark it as inactive, and set the initial "start" time to the creation time of the timer object. This allows "incTimer" to initially refer to time delays relative to the original start time of the object.

Set a new start time for the object based on when this call is made and optionally activate the timer for a specified number of milliseconds. This can be used to set the starting time of a realtime session.

Parameters
timeoutdelay in milliseconds from "now"

Set a timeout based on the current time reference value either from object creation or the last setTimer(). This reference can be used to time synchronize realtime data over specified intervals and force expiration when a new frame should be released in a synchronized manner.

Parameters
timeoutdelay in milliseconds from reference.

Adjust a timeout based on the current time reference value either from object creation or the last setTimer(). This reference can be used to time synchronize realtime data over specified intervals and force expiration when a new frame should be released in a synchronized manner.

Parameters
timeoutdelay in milliseconds from reference.

Sleep until the current timer expires. This is useful in time syncing realtime periodic tasks.

This is used to "disable" the service thread from expiring the timer object. It does not effect the reference time from either creation or a setTimer().

This is used by service threads to determine how much time remains before the timer expires based on a timeout specified in setTimer() or incTimer(). It can also be called after setting a timeout with incTimer() to see if the current timeout has already expired and hence that the application is already delayed and should skip frame(s).

return time remaining in milliseconds, or TIMEOUT_INF if inactive.

This is used to determine how much time has elapsed since a timer port setTimer benchmark time was initially set. This allows one to use setTimer() to set the timer to the current time and then measure elapsed time from that point forward.

return time elapsed in milliseconds, or TIMEOUT_INF if inactive.

a delimiter string containing all usual whitespace delimiters. These are space, tab, newline, carriage return, formfeed and vertical tab. (see isspace() manpage).

Exception thrown, if someone tried to read beyond the end of the tokens. Will not happen if you use it the 'clean' way with comparison against end(), but if you skip some tokens, because you 'know' they are there. Simplifies error handling a lot, since you can just read your tokens the way you expect it, and if there is some error in the input this Exception will be thrown.

The input forward iterator for tokens.

Author
Henner Zeller

copy constructor.

assignment operator.

shifts this iterator to the next token in the string.

returns the immutable string this iterator points to or '0' if no token is available (i.e. i == end()). Do not store pointers to this token, since it is invalidated for each iteration. If you need the token, copy it (e.g. with strdup());

returns the next delimiter after the current token or '\0', if there are no following delimiters. It returns the very next delimiter (even if skipAllDelim=true).

compares to other iterator. Usually used to compare against the end() iterator.

compares to other iterator. Usually used to compare against the end() iterator.

creates a new StringTokenizer for a string and a given set of delimiters.

Parameters
strString to be split up. This string will not be modified by this StringTokenizer, but you may as well not modfiy this string while tokenizing is in process, which may lead to undefined behaviour.
delimString containing the characters which should be regarded as delimiters.
skipAllDelimOPTIONAL. true, if subsequent delimiters should be skipped at once or false, if empty tokens should be returned for two delimiters with no other text inbetween. The first behaviour may be desirable for whitespace skipping, the second for input with delimited entry e.g. /etc/passwd like files or CSV input. NOTE, that 'true' here resembles the ANSI-C strtok(char *s,char *d) behaviour. DEFAULT = false
trimOPTIONAL. true, if the tokens returned should be trimmed, so that they don't have any whitespaces at the beginning or end. Whitespaces are any of the characters defined in StringTokenizer::SPACE. If delim itself is StringTokenizer::SPACE, this will result in a behaviour with skipAllDelim = true. DEFAULT = false

create a new StringTokenizer which splits the input string at whitespaces. The tokens are stripped from whitespaces. This means, if you change the set of delimiters in either the 'begin(const char *delim)' method or in 'setDelimiters()', you then get whitespace trimmed tokens, delimited by the new set. Behaves like StringTokenizer(s, StringTokenizer::SPACE,false,true);

returns the begin iterator

changes the set of delimiters used in subsequent iterations.

returns a begin iterator with an alternate set of delimiters.

the iterator marking the end.

Create xml parser.

Parameters
sizeof XML data buffer.

Destroy xml parser.

Virtual to receive embedded comments in XML document being parsed.

Parameters
textreceived.
sizeof text received.

Virtual to receive character text extracted from the document.

Parameters
textreceived.
sizeof text received.

Notify start of document event.

Notify end of document event.

Notify start of an element in the document.

Parameters
nameof element found.
attrlist of attributes extracted.

Notify end of an element in the document.

Parameters
nameof element ending.

Parse a chunk of data and return parser completion flag. This is used to externally drive data into the XML parser. The return status can be used to determine when a document has been fully parsed. This can be called multiple times to push stream data into the parser.

Parameters
addressof data to parse.
sizeof data to parse.

Parse a stream buffer and return parser document completion flag. This is used to scan a stream buffer for a complete XML document. The stream is scanned until the document is complete or EOF. Multiple XML document instances can be scanned from a continues XML streaming source.

Parameters
streambuffer to parse.
Returns
true if parse complete, false if invalid or EOF.

Parse a file buffer and return parser document completion flag. This is used to scan a file buffer for a complete XML document. The file is scanned until the document is complete or EOF. Multiple XML document instances can be scanned from a continues XML streaming source.

Parameters
filebuffer to parse.
Returns
true if parse complete, false if invalid or EOF.

End of document check.

Returns
true if end of document.

Definition at line 55 of file access.h.