MPR - MPR API Native API

The Multithreaded Portable Runtime (MPR) is a portable runtime library for embedded applications.



The MPR provides management for logging, error handling, events, files, http, memory, ssl, sockets, strings, xml parsing, and date/time functions. It also provides a foundation of safe routines for secure programming, that help to prevent buffer overflows and other security threats. The MPR is a library and a C API that can be used in both C and C++ programs.

The MPR uses a set extended typedefs for common types. These include: bool, cchar, cvoid, uchar, short, ushort, int, uint, long, ulong, int32, uint32, int64, uint64, float, and double. The cchar type is a const char, cvoid is const void. Several types have "u" prefixes to denote unsigned qualifiers.

The MPR includes a memory allocator and generational garbage collector. The allocator is a fast, immediate coalescing allocator that will return memory back to the O/S if not required. It is optimized for frequent allocations of small blocks (< 4K) and uses a scheme of free queues for fast allocation.

Not all of these APIs are thread-safe.

Components

Mpr Primary MPR application control structure.
MprBuf Dynamic Buffer Module.
MprCache In-memory caching.
MprCmd Command execution Service.
MprDispatcher Event Dispatcher.
MprEvent Event object.
MprFile File I/O Module.
MprFileSystem File system service.
MprFloat Floating Point Services.
MprHash Hash table entry structure.
MprJson JSON parser.
MprList List data structure.
MprLog Logging Services.
MprMem Memory Allocation Service.
MprMime Mime Type hash table entry (the URL extension is the key).
MprModule Loadable Module Service.
MprModuleSerivce Loadable module service.
MprPath Path (filename) Information.
MprSignal Signal control structure.
MprSocket Socket Service.
MprSsl SSL control structure.
MprString Safe String Module.
MprSynch Multithreaded Synchronization Services.
MprTestService Test service facility.
MprThread Thread Service.
MprTime Date and Time Service.
MprWaitHandler Wait Handler Service.
MprWorker Worker thread structure.
MprXml Per XML session structure.

Functions

voidassert(bool cond)
 Assert that a condition is true.
boolassertTrue(MprTestGroup *gp, cchar *loc, bool success, cchar *msg)
 Test assert.
char*fmt(char *buf, ssize maxSize, cchar *fmt, ...)
 Format a string into a static buffer.
char*fmtv(char *buf, ssize maxSize, cchar *fmt, va_list args)
 Format a string into a statically allocated buffer.
char*itos(int64 value)
 Convert an integer to a string.
char*itosbuf(char *buf, ssize size, int64 value, int radix)
 Convert an integer to a string buffer.
char*itosradix(int64 value, int radix)
 Convert an integer to a string.
MprSocket*mprAcceptSocket(MprSocket *listen)
 Accept an incoming connection.
MprKey*mprAddDuplicateKey(MprHash *table, cvoid *key, cvoid *ptr)
 Add a duplicate symbol value into the hash table.
voidmprAddFileSystem(MprFileSystem *fs)
 Create and initialize the disk FileSystem.
intmprAddItem(MprList *list, cvoid *item)
 Add an item to a list.
MprKey*mprAddKey(MprHash *table, cvoid *key, cvoid *ptr)
 Add a symbol value into the hash table.
MprKey*mprAddKeyFmt(MprHash *table, cvoid *key, cchar *fmt, ...)
 Add a key with a formatting value into the hash table.
MprMime*mprAddMime(MprHash *table, cchar *ext, cchar *mimeType)
 Add a mime type to the mime type table.
intmprAddNullItem(MprList *list)
 Add a null item to the list.
voidmprAddNullToBuf(MprBuf *buf)
 Add a null character to the buffer contents.
voidmprAddRoot(void *ptr)
 Add a memory block as a root for garbage collection.
MprSignal*mprAddSignalHandler(int signo, void *handler, void *arg, MprDispatcher *dispatcher, int flags)
 Add a signal handler.
MprWaitHandler*mprAddSocketHandler(MprSocket *sp, int mask, MprDispatcher *dispatcher, void *proc, void *data, int flags)
 Add a wait handler to a socket.
voidmprAddSocketProvider(cchar *name, MprSocketProvider *provider)
 Add a secure socket provider for SSL communications.
voidmprAddSslCiphers(struct MprSsl *ssl, cchar *ciphers)
 Add the ciphers to use for SSL.
voidmprAddStandardSignals()
 Add standard trapping of system signals.
voidmprAddTerminator(MprTerminator terminator)
 Add a terminator callback.
MprTestGroup*mprAddTestGroup(MprTestService *ts, MprTestDef *def)
 Add a test group to the test service.
voidmprAdjustBufEnd(MprBuf *buf, ssize count)
 Adjust the buffer end position.
voidmprAdjustBufStart(MprBuf *buf, ssize count)
 Adjust the buffer start position.
void*mprAlloc(ssize size)
 Allocate a block of memory.
void*mprAllocMem(ssize size, int flags)
 Allocate a block of memory.
void*mprAllocObj(Type type, MprManager manager)
 Allocate an object of a given type.
void*mprAllocZeroed(ssize size)
 Allocate a zeroed block of memory.
MprList*mprAppendList(MprList *list, MprList *add)
 Append a list.
boolmprAreCmdEventsEnabled(MprCmd *cmd, int channel)
 Return true if command events are enabled.
voidmprAssert(cchar *loc, cchar *msg)
 Output an assure assertion failed message.
voidmprAtomicAdd(volatile int *target, int value)
 Atomic Add.
voidmprAtomicAdd64(volatile int64 *target, int value)
 Atomic 64 bit Add.
voidmprAtomicBarrier()
 Apply a full (read+write) memory barrier.
intmprAtomicCas(void *volatile *target, void *expected, cvoid *value)
 Atomic Compare and Swap.
void*mprAtomicExchange(void *volatile *target, cvoid *value)
 Exchange the target and a value.
voidmprAtomicListInsert(void *volatile *head, volatile void **link, void *item)
 Atomic list insertion.
MprFile*mprAttachFileFd(int fd, cchar *name, int omode)
 Attach to an existing file descriptor.
intmprAvailableWorkers()
 Get the count of available worker threads Return the count of free threads in the worker thread pool.
intmprBackupLog(cchar *path, int count)
 Backup a log.
MprHash*mprBlendHash(MprHash *target, MprHash *other)
 Blend two hash tables.
voidmprBreakpoint()
 Trigger a breakpoint.
char*mprBufToString(MprBuf *buf)
 Convert the buffer contents to a string.
voidmprClearList(MprList *list)
 Clears the list of all items.
MprBuf*mprCloneBuf(MprBuf *orig)
 Clone a buffer.
MprHash*mprCloneHash(MprHash *table)
 Copy a hash table.
MprList*mprCloneList(MprList *src)
 Clone a list and all elements.
struct MprSsl*mprCloneSsl(MprSsl *src)
 Create the a new SSL control structure based on an existing structure.
voidmprCloseCmdFd(MprCmd *cmd, int channel)
 Close the command channel.
intmprCloseFile(MprFile *file)
 Close a file.
voidmprCloseSocket(MprSocket *sp, bool graceful)
 Close a socket.
voidmprCompactBuf(MprBuf *buf)
 Compact the buffer contents.
intmprCompareTime(MprTime t1, MprTime t2)
 Compare two times.
intmprConnectSocket(MprSocket *sp, cchar *ip, int port, int flags)
 Connect a client socket.
intmprCopyListContents(MprList *dest, MprList *src)
 Copy list contents.
intmprCopyPath(cchar *from, cchar *to, int omode)
 Copy a file.
Mpr*mprCreate(int argc, char **argv, int flags)
 Create an instance of the MPR.
MprBuf*mprCreateBuf(ssize initialSize, ssize maxSize)
 Create a new buffer.
MprCache*mprCreateCache(int options)
 Create a new cache object.
MprCmd*mprCreateCmd(MprDispatcher *dispatcher)
 Create a new Command object.
MprCond*mprCreateCond()
 Create a condition lock variable.
MprDispatcher*mprCreateDispatcher(cchar *name, int flags)
 Create a new event dispatcher.
MprEvent*mprCreateEvent(MprDispatcher *dispatcher, cchar *name, MprTicks period, void *proc, void *data, int flags)
 Create a new event.
intmprCreateEventOutside(MprDispatcher *dispatcher, void *proc, void *data)
 Create an event outside the MPR.
MprFileSystem*mprCreateFileSystem(cchar *path)
 Create and initialize the FileSystem subsystem.
MprHash*mprCreateHash(int hashSize, int flags)
 Create a hash table.
MprHash*mprCreateHashFromWords(cchar *str)
 Create a hash of words.
MprKeyValue*mprCreateKeyPair(cchar *key, cchar *value)
 Create a key / value pair.
MprList*mprCreateList(int size, int flags)
 Create a list.
MprMutex*mprCreateLock()
 Create a Mutex lock object.
voidmprCreateLogService()
 Initialize the log service.
struct Mpr*mprCreateMemService(MprManager manager, int flags)
 Create and initialize the Memory service.
MprHash*mprCreateMimeTypes(cchar *path)
 Create the mime types.
MprModule*mprCreateModule(cchar *name, cchar *path, cchar *entry, void *data)
 Create a module.
MprModuleService*mprCreateModuleService()
 Create and initialize the module service.
intmprCreateNotifierService(MprWaitService *ws)
 Internal.
intmprCreateOsService()
 Create and initialze the O/S dependent subsystem.
MprRomFileSystem*mprCreateRomFileSystem(cchar *path)
 Create and initialize the ROM FileSystem.
MprSocket*mprCreateSocket()
 Create a socket.
MprSpin*mprCreateSpinLock()
 Create a spin lock lock object.
struct MprSsl*mprCreateSsl(int server)
 Create the SSL control structure.
MprTestService*mprCreateTestService()
 Create the test service.
MprThread*mprCreateThread(cchar *name, void *proc, void *data, ssize stackSize)
 Create a new thread.
intmprCreateTimeService()
 Mpr time structure.
MprEvent*mprCreateTimerEvent(MprDispatcher *dispatcher, cchar *name, MprTicks period, void *proc, void *data, int flags)
 Create a timer event.
MprWaitHandler*mprCreateWaitHandler(int fd, int mask, MprDispatcher *dispatcher, void *proc, void *data, int flags)
 Create a wait handler.
char*mprDecode64(cchar *str)
 Decode a null terminated string using base-46 encoding.
char*mprDecode64Block(cchar *buf, ssize *len, int flags)
 Decode a null terminated string using base-46 encoding.
voidmprDecodeLocalTime(struct tm *timep, MprTime time)
 Decode a time value into a tokenized local time value.
voidmprDecodeUniversalTime(struct tm *timep, MprTime time)
 Decode a time value into a tokenized UTC time structure.
voidmprDedicateWorker(MprWorker *worker)
 Dedicate a worker thread to a current real thread.
intmprDeletePath(cchar *path)
 Delete a file.
MprObj*mprDeserialize(cchar *str)
 Deserialize a JSON string into an object tree.
MprObj*mprDeserializeCustom(cchar *str, MprJsonCallback callback, void *data)
 Custom deserialization from a JSON string into an object tree.
voidmprDestroy(int how)
 Destroy the MPR.
void*mprDestroyCache(MprCache *cache)
 Destroy a new cache object.
voidmprDestroyCmd(MprCmd *cmd)
 Destroy the command.
voidmprDestroyMemService()
 Destroy the memory service.
voidmprDisableCmdEvents(MprCmd *cmd, int channel)
 Disable command I/O events.
voidmprDisableDispatcher(MprDispatcher *dispatcher)
 Disable a dispatcher from service events.
voidmprDisableFileBuffering(MprFile *file)
 Disable file buffering.
voidmprDisconnectCmd(MprCmd *cmd)
 Disconnect a command its underlying I/O channels.
voidmprDisconnectSocket(MprSocket *sp)
 Disconnect a socket by closing its underlying file descriptor.
char*mprEmptyString()
 Reference to a permanent preallocated empty string.
voidmprEnableCmdEvents(MprCmd *cmd, int channel)
 Enable command I/O events.
voidmprEnableCmdOutputEvents(MprCmd *cmd, bool on)
 Enable command I/O events for the command's STDOUT and STDERR channels.
voidmprEnableContinuousEvent(MprEvent *event, int enable)
 Enable or disable an event being continous.
voidmprEnableDispatcher(MprDispatcher *dispatcher)
 Enable a dispatcher to service events.
intmprEnableFileBuffering(MprFile *file, ssize size, ssize maxSize)
 Enable file buffering.
boolmprEnableGC(bool on)
 Enable or disable the garbage collector.
voidmprEnableSocketEvents(MprSocket *sp, int mask)
 Enable socket events for a socket callback.
char*mprEncode64(cchar *str)
 Encode a string using base-46 encoding.
char*mprEncode64Block(cchar *buf, ssize len)
 Encode buffer using base-46 encoding.
ssizemprEprintf(cchar *fmt, ...)
 Print a formatted message to the standard error channel.
voidmprError(cchar *fmt, ...)
 Log an error message.
char*mprEscapeCmd(cchar *cmd, int escChar)
 Encode a string escaping typical command (shell) characters.
char*mprEscapeHtml(cchar *html)
 Encode a string by escaping typical HTML characters.
intmprExpireCache(MprCache *cache, cchar *key, MprTicks expires)
 Set the expiry date for a cache item.
voidmprFinalizeCmd(MprCmd *cmd)
 Finalize the writing of data to the command process.
voidmprFlushBuf(MprBuf *buf)
 Flush the buffer contents.
intmprFlushFile(MprFile *file)
 Flush any buffered write data.
ssizemprFlushSocket(MprSocket *sp)
 Flush a socket.
char*mprFormatLocalTime(cchar *fmt, MprTime time)
 Convert a time value to local time and format as a string.
char*mprFormatTm(cchar *fmt, struct tm *timep)
 Format a time value as a local time.
char*mprFormatUniversalTime(cchar *fmt, MprTime time)
 Convert a time value to universal time and format as a string.
ssizemprFprintf(struct MprFile *file, cchar *fmt, ...)
 Print a formatted message to a file descriptor.
char*mprGetAbsPath(cchar *path)
 Convert a path to an absolute path.
char*mprGetAppDir()
 Get the application directory.
cchar*mprGetAppName()
 Get the application name defined via mprSetAppName.
char*mprGetAppPath()
 Get the application executable path.
cchar*mprGetAppTitle()
 Get the application title string.
cchar*mprGetAppVersion()
 Get the application version string.
ssizemprGetBlockFromBuf(MprBuf *buf, char *blk, ssize count)
 Get a block of data from the buffer.
ssizemprGetBlockSize(cvoid *ptr)
 Get the allocated size of a memory block.
char*mprGetBuf(MprBuf *buf)
 Get the origin of the buffer content storage.
char*mprGetBufEnd(MprBuf *buf)
 Get a reference to the end of the buffer contents.
ssizemprGetBufLength(MprBuf *buf)
 Get the buffer content length.
MprBufProcmprGetBufRefillProc(MprBuf *buf)
 Get the buffer refill procedure.
ssizemprGetBufSize(MprBuf *buf)
 Get the current size of the buffer content storage.
ssizemprGetBufSpace(MprBuf *buf)
 Get the space available to store content.
char*mprGetBufStart(MprBuf *buf)
 Get the start of the buffer contents.
intmprGetCharFromBuf(MprBuf *buf)
 Get a character from the buffer.
MprBuf*mprGetCmdBuf(MprCmd *cmd, int channel)
 Get the underlying buffer for a channel.
intmprGetCmdExitStatus(MprCmd *cmd)
 Get the command exit status.
intmprGetCmdFd(MprCmd *cmd, int channel)
 Get the underlying file descriptor for an I/O channel.
boolmprGetCmdlineLogging()
 Get if command line logging is being used.
MprOsThreadmprGetCurrentOsThread()
 Get the O/S thread.
char*mprGetCurrentPath()
 Return the current working directory.
MprThread*mprGetCurrentThread()
 Get the currently executing thread.
cchar*mprGetCurrentThreadName()
 Return the name of the current thread.
char*mprGetDate(char *fmt)
 Get a string representation of the current date/time.
boolmprGetDebugMode()
 Get the debug mode.
MprDispatcher*mprGetDispatcher()
 Get the MPR primary dispatcher.
cchar*mprGetDomainName()
 Get the application domain name string.
MprTicksmprGetElapsedTicks(MprTicks mark)
 Get the elapsed time since a ticks mark.
MprTimemprGetElapsedTime(MprTime mark)
 Get the elapsed time since a starting time mark.
intmprGetEndian()
 Return the endian byte ordering for the application.
intmprGetError()
 Return the error code for the most recent system or library operation.
intmprGetExitStatus()
 Get the exit status.
intmprGetFileChar(MprFile *file)
 Read a character from the file.
intmprGetFileFd(MprFile *file)
 Get the file descriptor for a file.
MprOffmprGetFilePosition(MprFile *file)
 Return the current file position.
MprOffmprGetFileSize(MprFile *file)
 Get the size of the file.
void*mprGetFirstItem(MprList *list)
 Get the first item in the list.
MprKey*mprGetFirstKey(MprHash *table)
 Return the first symbol in a symbol entry.
cchar*mprGetFirstPathSeparator(cchar *path)
 Get the first path separator in a path.
intmprGetHashLength(MprHash *table)
 Return the count of symbols in a symbol entry.
uint64mprGetHiResTicks()
 Get the CPU tick count.
cchar*mprGetHostName()
 Get the application host name string.
cchar*mprGetIpAddr()
 Get the application IP address string.
void*mprGetItem(MprList *list, int index)
 Get an list item.
void*mprGetLastItem(MprList *list)
 Get the last item in the list.
intmprGetListCapacity(MprList *list)
 Get the current capacity of the list.
intmprGetListLength(MprList *list)
 Get the number of items in the list.
struct MprFile*mprGetLogFile()
 Get the log file object.
MprLogHandlermprGetLogHandler()
 Get the current MPR debug log handler.
intmprGetLogLevel()
 Get the current logging level.
char*mprGetMD5(cchar *str)
 Get an MD5 checksum.
char*mprGetMD5WithPrefix(cchar *buf, ssize len, cchar *prefix)
 Get an MD5 checksum with optional prefix string and buffer length.
intmprGetMaxWorkers()
 Get the maximum count of worker pool threads Get the maximum limit of worker pool threads.
ssizemprGetMem()
 Return the amount of memory currently used by the application.
MprMemStats*mprGetMemStats()
 Return the current allocation memory statistics block.
cchar*mprGetMimeProgram(MprHash *table, cchar *mimeType)
 Get the mime type program for a given mimeType.
cchar*mprGetModuleSearchPath()
 Get the module search path.
Mpr*mprGetMpr()
 Return the MPR control instance.
char*mprGetNativePath(cchar *path)
 Get a path formatted according to the native O/S conventions.
void*mprGetNextItem(MprList *list, int *lastIndex)
 Get the next item in the list.
MprKey*mprGetNextKey(MprHash *table, MprKey *last)
 Return the next symbol in a symbol entry.
void*mprGetNextStableItem(MprList *list, int *lastIndex)
 Get the next item in a stable list.
intmprGetOsError()
 Return the O/S error code.
intmprGetPageSize()
 Get the current O/S virtual page size.
char*mprGetPathBase(cchar *path)
 Get the base portion of a path.
cchar*mprGetPathBaseRef(cchar *path)
 Get a reference to the base portion of a path.
char*mprGetPathDir(cchar *path)
 Get the directory portion of a path.
char*mprGetPathExt(cchar *path)
 Get the file extension portion of a path.
MprList*mprGetPathFiles(cchar *dir, int flags)
 Create a list of files in a directory or subdirectories.
char*mprGetPathFirstDir(cchar *path)
 Get the first directory portion of a path.
intmprGetPathInfo(cchar *path, MprPath *info)
 Return information about a file represented by a path.
char*mprGetPathLink(cchar *path)
 Get the target of a symbolic link.
cchar*mprGetPathNewline(cchar *path)
 Get the file newline character string for a given path.
char*mprGetPathParent(cchar *path)
 Get the parent directory of a path.
cchar*mprGetPathSeparators(cchar *path)
 Get the path directory separator.
char*mprGetPortablePath(cchar *path)
 Get a portable path.
void*mprGetPrevItem(MprList *list, int *lastIndex)
 Get the previous item in the list.
intmprGetRandomBytes(char *buf, ssize size, bool block)
 Get some random data.
char*mprGetRelPath(cchar *dest, cchar *origin)
 Get a relative path.
MprTicksmprGetRemainingTicks(MprTicks mark, MprTicks timeout)
 Return the time remaining until a timeout has elapsed.
char*mprGetSHA(cchar *str)
 Get an SHA1 checksum.
char*mprGetSHABase64(cchar *str)
 Get an SHA1 checksum of a null terminated string.
char*mprGetSHAWithPrefix(cchar *buf, ssize len, cchar *prefix)
 Get an SHA1 checksum with optional prefix string and buffer length.
cchar*mprGetServerName()
 Get the application server name string.
boolmprGetSocketBlockingMode(MprSocket *sp)
 Get the socket blocking mode.
intmprGetSocketError(MprSocket *sp)
 Get a socket error code.
SocketmprGetSocketFd(MprSocket *sp)
 Get the socket file descriptor.
intmprGetSocketInfo(cchar *ip, int port, int *family, int *protocol, struct sockaddr **addr, Socklen *addrlen)
 Get the socket for an IP:Port address.
intmprGetSocketPort(MprSocket *sp)
 Get the port used by a socket.
char*mprGetSocketState(MprSocket *sp)
 Get the socket state.
intmprGetSslCipherCode(cchar *cipher)
 Lookup an SSL cipher by its IANA name and return the cipher IANA code.
cchar*mprGetSslCipherName(int cipher)
 Lookup an SSL cipher by its IANA code and return the string name.
MprFile*mprGetStderr()
 Return a file object for the Stderr I/O channel.
MprFile*mprGetStdin()
 Return a file object for the Stdin I/O channel.
MprFile*mprGetStdout()
 Return a file object for the Stdout I/O channel.
char*mprGetTempPath(cchar *tmpDir)
 Make a temporary file.
cchar*mprGetThreadName(MprThread *thread)
 Get the thread name.
intmprGetThreadPriority(MprThread *thread)
 Get the thread priroity.
MprTicksmprGetTicks()
 Get the system time.
MprTimemprGetTime()
 Get the time.
intmprGetTimeZoneOffset(MprTime when)
 Get the current timezone offset for a given time.
char*mprGetWinPath(cchar *path)
 Convert a path to an absolute windows path.
voidmprGetWorkerStats(MprWorkerStats *stats)
 Get the Worker service statistics.
voidmprGlobalLock()
 Globally lock the application.
voidmprGlobalUnlock()
 Unlock the global mutex.
intmprGrowBuf(MprBuf *buf, ssize count)
 Grow the buffer.
boolmprHasDualNetworkStack()
 has the system got a dual IPv4 + IPv6 network stack.
boolmprHasIPv6()
 Determine if the system support IPv6.
boolmprHasMemError()
 Determine if the MPR has encountered memory allocation errors.
boolmprHasSecureSockets()
 Determine if SSL is available.
voidmprHiddenSocketData(MprSocket *sp, ssize len, int dir)
 Indicate that the application layer has buffered data for the socket.
voidmprHold(void *ptr)
 Hold a memory block.
int64mprIncCache(MprCache *cache, cchar *key, int64 amount)
 Increment a numeric cache item.
voidmprInfo(cchar *fmt, ...)
 Log an informational message.
voidmprInitList(MprList *list, int flags)
 Initialize a list structure.
MprMutex*mprInitLock(MprMutex *mutex)
 Initialize a statically allocated Mutex lock object.
MprSpin*mprInitSpinLock(MprSpin *lock)
 Initialize a statically allocated spinlock object.
intmprInsertCharToBuf(MprBuf *buf, int c)
 Insert a character into the buffer.
intmprInsertItemAtPos(MprList *list, int index, cvoid *item)
 Insert an item into a list at a specific position.
intmprIsCmdComplete(MprCmd *cmd)
 Test if a command is complete.
boolmprIsCmdRunning(MprCmd *cmd)
 Test if the command is still running.
boolmprIsExiting()
 Determine if the MPR is exiting.
boolmprIsFinished()
 Determine if the MPR has finished.
boolmprIsIPv6(cchar *ip)
 Determine if the IP address is an IPv6 address.
boolmprIsIdle()
 Determine if the App is idle.
intmprIsInfinite(double value)
 Test if a double value is infinte.
intmprIsNan(double value)
 Test if a double value is not-a-number.
boolmprIsPathAbs(cchar *path)
 Determine if a path is absolute.
boolmprIsPathDir(cchar *path)
 Determine if a path is a directory.
boolmprIsPathRel(cchar *path)
 Determine if a path is relative.
boolmprIsPathSeparator(cchar *path, cchar c)
 Test if a character is a path separarator.
boolmprIsSocketEof(MprSocket *sp)
 Test if the other end of the socket has been closed.
boolmprIsSocketSecure(MprSocket *sp)
 Determine if the socket is secure.
boolmprIsSocketV6(MprSocket *sp)
 Determine if the socket is using IPv6 Currently only works for server side addresses.
boolmprIsStopping()
 Test if the application is stopping.
boolmprIsStoppingCore()
 Test if the application is stopping and core services are being terminated.
intmprIsValid(cvoid *ptr)
 Test is a pointer is a valid memory context.
intmprIsZero(double value)
 Test if a double value is zero.
char*mprJoinPath(cchar *base, cchar *path)
 Join paths.
char*mprJoinPathExt(cchar *path, cchar *ext)
 Join an extension to a path.
voidmprJsonParseError(MprJson *jp, cchar *fmt, ...)
 Signal a parse error in the JSON input stream.
SocketmprListenOnSocket(MprSocket *sp, cchar *ip, int port, int flags)
 Listen on a server socket for incoming connections.
intmprLoadModule(MprModule *mp)
 Load a module.
intmprLoadNativeModule(MprModule *mp)
 Load a native module.
intmprLoadSsl()
 Load the SSL module.
voidmprLock(MprMutex *lock)
 Lock access.
voidmprLog(int level, cchar *fmt, ...)
 Write a message to the log file.
voidmprLogHeader()
 Emit a descriptive log header.
intmprLookAtLastCharInBuf(MprBuf *buf)
 Peek at the last character in the buffer.
intmprLookAtNextCharInBuf(MprBuf *buf)
 Peek at the next character in the buffer.
MprFileSystem*mprLookupFileSystem(cchar *path)
 Lookup a file system.
intmprLookupItem(MprList *list, cvoid *item)
 Find an item and return its index.
void*mprLookupKey(MprHash *table, cvoid *key)
 Lookup a symbol in the hash table.
MprKey*mprLookupKeyEntry(MprHash *table, cvoid *key)
 Lookup a symbol in the hash table and return the hash entry.
cchar*mprLookupMime(MprHash *table, cchar *ext)
 Get the mime type for an extension.
MprModule*mprLookupModule(cchar *name)
 Lookup a module.
void*mprLookupModuleData(cchar *name)
 Lookup a module and return the module data.
intmprLookupStringItem(MprList *list, cchar *str)
 Find a string item and return its index.
intmprMakeArgv(cchar *command, cchar ***argv, int flags)
 Make a argv style array of command arguments.
intmprMakeDir(cchar *path, int perms, int owner, int group, bool makeMissing)
 Make a directory.
intmprMakeLink(cchar *path, cchar *target, bool hard)
 Make a link.
voidmprMapSeparators(char *path, int separator)
 Map the separators in a path.
voidmprMark(void *ptr)
 Mark a memory block as in-use.
voidmprMarkBlock(cvoid *ptr)
 Mark a block as "in-use" for the Garbage Collector.
intmprMemcmp(cvoid *b1, ssize b1Len, cvoid *b2, ssize b2Len)
 Compare two byte strings.
ssizemprMemcpy(void *dest, ssize destMax, cvoid *src, ssize nbytes)
 Safe copy for a block of data.
void*mprMemdup(cvoid *ptr, ssize size)
 Duplicate a block of memory.
voidmprNap(MprTicks msec)
 Nap for a while.
char*mprNormalizePath(cchar *path)
 Normalize a path.
intmprNotifyOn(MprWaitService *ws, MprWaitHandler *wp, int mask)
 Begin I/O notification services on a wait handler.
MprFile*mprOpenFile(cchar *filename, int omode, int perms)
 Open a file.
intmprParseArgs(char *command, char **argv, int maxArgs)
 Make a argv style array of command arguments.
intmprParseSocketAddress(cchar *address, char **ip, int *port, int *secure, int defaultPort)
 Parse an socket address IP address.
intmprParseTestArgs(MprTestService *ts, int argc, char **argv, MprTestParser extraParser)
 Parse test command arguments.
boolmprPathExists(cchar *path, int omode)
 Determine if a file exists for a path name and can be accessed.
intmprPeekFileChar(MprFile *file)
 Non-destructively read a character from the file.
voidmprPollWinCmd(MprCmd *cmd, MprTicks timeout)
 Poll for I/O on the command pipes.
void*mprPopItem(MprList *list)
 Pop an item.
voidmprPrintMem(cchar *msg, int detail)
 Print a memory usage report to stdout.
ssizemprPrintf(cchar *fmt, ...)
 Formatted print.
char*mprPrintfCore(char *buf, ssize maxsize, cchar *fmt, va_list args)
 Format a string into a buffer.
voidmprPruneCache(MprCache *cache)
 Prune the cache.
intmprPushItem(MprList *list, cvoid *item)
 Push an item onto the list.
ssizemprPutBlockToBuf(MprBuf *buf, cchar *ptr, ssize size)
 Put a block to the buffer.
intmprPutCharToBuf(MprBuf *buf, int c)
 Put a character to the buffer.
ssizemprPutFileChar(MprFile *file, int c)
 Write a character to the file.
ssizemprPutFileString(MprFile *file, cchar *str)
 Write a string to the file.
ssizemprPutIntToBuf(MprBuf *buf, int64 i)
 Put an integer to the buffer.
ssizemprPutPadToBuf(MprBuf *buf, int c, ssize count)
 Put padding characters to the buffer.
ssizemprPutStringToBuf(MprBuf *buf, cchar *str)
 Put a string to the buffer.
ssizemprPutSubStringToBuf(MprBuf *buf, cchar *str, ssize count)
 Put a substring to the buffer.
ssizemprPutToBuf(MprBuf *buf, cchar *fmt, ...)
 Put a formatted string to the buffer.
voidmprQueueIOEvent(MprWaitHandler *wp)
 Queue an IO event for dispatch on the wait handler dispatcher.
intmprRandom()
 Return a random number.
voidmprRawLog(int level, cchar *fmt, ...)
 Write a raw log message to the diagnostic log file.
char*mprReadCache(MprCache *cache, cchar *key, MprTime *modified, int64 *version)
 Read an item from the cache.
ssizemprReadCmd(MprCmd *cmd, int channel, char *buf, ssize bufsize)
 Make the I/O channels to send and receive data to and from the command.
ssizemprReadFile(MprFile *file, void *buf, ssize size)
 Read data from a file.
char*mprReadLine(MprFile *file, ssize size, ssize *len)
 Read a line from the file.
ssizemprReadSocket(MprSocket *sp, void *buf, ssize size)
 Read from a socket.
void*mprRealloc(void *ptr, ssize size)
 Reallocate a block.
intmprReapCmd(MprCmd *cmd, MprTicks timeout)
 Reap the command.
voidmprRecallWaitHandler(MprWaitHandler *wp)
 Recall a wait handler.
voidmprRecallWaitHandlerByFd(int fd)
 Recall a wait handler by fd.
intmprRefillBuf(MprBuf *buf)
 Refill the buffer with data.
voidmprRelayEvent(MprDispatcher *dispatcher, void *proc, void *data, MprEvent *event)
 Relay an event to a dispatcher.
voidmprRelease(void *ptr)
 Release a memory block.
voidmprReleaseWorker(MprWorker *worker)
 Release a worker thread.
boolmprRemoveCache(MprCache *cache, cchar *key)
 Remove items from the cache.
voidmprRemoveEvent(MprEvent *event)
 Remove an event.
intmprRemoveItem(MprList *list, cvoid *item)
 Remove an item from the list.
intmprRemoveItemAtPos(MprList *list, int index)
 Remove an item from the list.
intmprRemoveKey(MprHash *table, cvoid *key)
 Remove a symbol entry from the hash table.
intmprRemoveLastItem(MprList *list)
 Remove the last item from the list.
intmprRemoveRangeOfItems(MprList *list, int start, int end)
 Remove a range of items from the list.
voidmprRemoveRoot(void *ptr)
 remove a memory block as a root for garbage collection.
voidmprRemoveSocketHandler(MprSocket *sp)
 Remove a socket wait handler.
intmprRemoveStringItem(MprList *list, cchar *str)
 Remove a string item from the list.
voidmprRemoveWaitHandler(MprWaitHandler *wp)
 Disconnect a wait handler from its underlying file descriptor.
char*mprReplacePathExt(cchar *dir, cchar *ext)
 Replace an extension to a path.
voidmprReportTestResults(MprTestService *ts)
 Report the test results.
voidmprRequestGC(int flags)
 Collect garbage.
voidmprRescheduleEvent(MprEvent *event, MprTicks period)
 Reschedule an event.
voidmprResetBufIfEmpty(MprBuf *buf)
 Reset the buffer.
voidmprResetCond(MprCond *cond)
 Reset a condition variable.
voidmprResetMemError()
 Reset the memory allocation error flag.
voidmprResetTestGroup(MprTestGroup *gp)
 Reset a test group.
voidmprResetYield()
 Reset a sticky yield.
char*mprResolvePath(cchar *base, cchar *path)
 Resolve paths.
voidmprRestart()
 Restart the application.
voidmprRestartContinuousEvent(MprEvent *event)
 Restart an event.
intmprRunCmd(MprCmd *cmd, cchar *command, cchar **envp, char **out, char **err, MprTicks timeout, int flags)
 Run a command using a string command line.
intmprRunCmdV(MprCmd *cmd, int argc, cchar **argv, cchar **envp, char **out, char **err, MprTicks timeout, int flags)
 Run a command using an argv[] array of arguments.
intmprRunTests(MprTestService *ts)
 Run the define unit tests.
intmprSamePath(cchar *path1, cchar *path2)
 Compare two paths if they are the same.
intmprSamePathCount(cchar *path1, cchar *path2, ssize len)
 Compare two paths if they are the same for a given length.
char*mprSearchForModule(cchar *module)
 Search for a module on the current module path.
char*mprSearchPath(cchar *path, int flags, cchar *search, ...)
 Search for a path.
MprOffmprSeekFile(MprFile *file, int seekType, MprOff distance)
 Seek the I/O pointer to a new location in the file.
cchar*mprSerialize(MprObj *obj, int flags)
 Serialize a JSON object tree into a string.
intmprServiceEvents(MprTicks delay, int flags)
 Service events.
boolmprServicesAreIdle()
 Determine if the MPR services.
intmprSetAppName(cchar *name, cchar *title, cchar *version)
 Set the application name, title and version.
voidmprSetAppPath(cchar *path)
 Set the application executable path.
voidmprSetBufMax(MprBuf *buf, ssize maxSize)
 Set the maximum buffer size.
voidmprSetBufRefillProc(MprBuf *buf, MprBufProc fn, void *arg)
 Set the buffer refill procedure.
intmprSetBufSize(MprBuf *buf, ssize size, ssize maxSize)
 Set the buffer size.
voidmprSetCacheLimits(MprCache *cache, int64 keys, MprTicks lifespan, int64 memory, int resolution)
 Set the cache resource limits.
voidmprSetCmdCallback(MprCmd *cmd, MprCmdProc callback, void *data)
 Define a callback to be invoked to receive response data from the command.
voidmprSetCmdDefaultEnv(MprCmd *cmd, cchar **env)
 Set the default environment to use for commands.
voidmprSetCmdDir(MprCmd *cmd, cchar *dir)
 Set the home directory for the command.
voidmprSetCmdEnv(MprCmd *cmd, cchar **env)
 Set the command environment.
voidmprSetCmdSearchPath(MprCmd *cmd, cchar *search)
 Set the default command search path.
boolmprSetCmdlineLogging(bool on)
 Set if command line logging was requested.
voidmprSetCurrentThreadPriority(int priority)
 Set the thread priroity for the current thread.
voidmprSetDebugMode(bool on)
 Turn on debug mode.
voidmprSetDomainName(cchar *s)
 Set the application domain name string.
voidmprSetEnv(cchar *key, cchar *value)
 Set an environment variable value.
voidmprSetExitStrategy(int strategy)
 Set the exit strategy for when the application terminates.
voidmprSetExitTimeout(MprTicks timeout)
 Set the exit timeout for a graceful shutdown or restart.
voidmprSetFilesLimit(int limit)
 Set the maximum number of open file/socket descriptors.
voidmprSetHostName(cchar *s)
 Set the application host name string.
MprIdleCallbackmprSetIdleCallback(MprIdleCallback idleCallback)
 Define a new idle callback to be invoked by mprIsIdle()
voidmprSetIpAddr(cchar *ip)
 Sete the application IP address string.
void*mprSetItem(MprList *list, int index, cvoid *item)
 Set a list item.
intmprSetListLimits(MprList *list, int initialSize, int maxSize)
 Define the list size limits.
voidmprSetLogBackup(ssize logSize, int backupCount, int flags)
 Set the log rotation parameters.
voidmprSetLogFile(struct MprFile *file)
 Set a file to be used for logging.
voidmprSetLogHandler(MprLogHandler handler)
 Set an MPR debug log handler.
voidmprSetLogLevel(int level)
 Set the current logging level.
void*mprSetManager(void *ptr, MprManager manager)
 Update the manager for a block of memory.
intmprSetMaxSocketAccept(int max)
 Set the maximum number of accepted client connections that are permissable.
voidmprSetMaxWorkers(int count)
 Set the maximum count of worker threads Set the maximum number of worker pool threads for the MPR.
voidmprSetMemError()
 Set an memory allocation error condition on a memory context.
voidmprSetMemLimits(ssize redline, ssize maxMemory)
 Configure the application memory limits.
voidmprSetMemNotifier(MprMemNotifier cback)
 Define a memory notifier.
voidmprSetMemPolicy(int policy)
 Set the memory allocation policy for when allocations fail.
intmprSetMimeProgram(MprHash *table, cchar *mimeType, cchar *program)
 Set the mime type program.
voidmprSetMinWorkers(int count)
 Set the minimum count of worker threads Set the count of threads the worker pool will have.
voidmprSetModuleFinalizer(MprModule *module, MprModuleProc stop)
 Define a module finalizer that will be called before a module is stopped.
voidmprSetModuleSearchPath(char *searchPath)
 Set the module search path.
voidmprSetModuleTimeout(MprModule *module, MprTicks timeout)
 Set a module timeout.
voidmprSetOsError(int error)
 Set the O/S error code.
voidmprSetPathNewline(cchar *path, cchar *newline)
 Set the file system new line character string.
voidmprSetPathSeparators(cchar *path, cchar *separators)
 Set the file system path separators.
intmprSetRomFileSystem(MprRomInode *inodeList)
 Set the ROM file system data.
voidmprSetServerName(cchar *s)
 Set the application server name string.
intmprSetSocketBlockingMode(MprSocket *sp, bool on)
 Set the socket blocking mode.
voidmprSetSocketEof(MprSocket *sp, bool eof)
 Set an EOF condition on the socket.
intmprSetSocketNoDelay(MprSocket *sp, bool on)
 Set the socket delay mode.
voidmprSetSslCaFile(struct MprSsl *ssl, cchar *caFile)
 Set the client certificate file to use for SSL.
voidmprSetSslCaPath(struct MprSsl *ssl, cchar *caPath)
 Set the path for the client certificate directory.
voidmprSetSslCertFile(struct MprSsl *ssl, cchar *certFile)
 Set certificate to use for SSL.
voidmprSetSslCiphers(MprSsl *ssl, cchar *ciphers)
 Set the ciphers to use.
voidmprSetSslKeyFile(struct MprSsl *ssl, cchar *keyFile)
 Set the key file to use for SSL.
voidmprSetSslProtocols(struct MprSsl *ssl, int protocols)
 Set the SSL protocol to use.
voidmprSetSslProvider(MprSsl *ssl, cchar *provider)
 Set the SSL provider to use.
voidmprSetThreadPriority(MprThread *thread, int priority)
 Set the thread priroity.
voidmprSetWorkerStackSize(int size)
 Set the default worker stack size.
boolmprShouldAbortRequests()
 Test if requests should be aborted.
boolmprShouldDenyNewRequests()
 Test if new requests should be denied.
voidmprSignalCond(MprCond *cond)
 Signal a condition lock variable.
voidmprSignalDispatcher(MprDispatcher *dispatcher)
 Signal the dispatcher to wakeup and re-examine its queues.
voidmprSignalMultiCond(MprCond *cond)
 Signal a condition lock variable for use with multiple waiters.
voidmprSignalTest2Complete(MprTestGroup *gp)
 Signal a test is complete.
voidmprSignalTestComplete(MprTestGroup *gp)
 Signal a test is complete.
voidmprSleep(MprTicks msec)
 Sleep for a while.
boolmprSocketHandshaking(MprSocket *sp)
 Test if the socket is doing an SSL handshake.
boolmprSocketHasBufferedRead(MprSocket *sp)
 Test if the socket has buffered read data.
boolmprSocketHasBufferedWrite(MprSocket *sp)
 Test if the socket has buffered write data.
voidmprSort(void *base, ssize num, ssize width, MprSortProc compare, void *ctx)
 Quicksort.
MprList*mprSortList(MprList *list, MprSortProc compare, void *ctx)
 Sort a list.
voidmprSpinLock(MprSpin *lock)
 Lock a spinlock.
voidmprSpinUnlock(MprSpin *lock)
 Unlock a spinlock.
intmprStart()
 Start the Mpr services.
intmprStartCmd(MprCmd *cmd, int argc, cchar **argv, cchar **envp, int flags)
 Start the command.
intmprStartEventsThread()
 Start an thread dedicated to servicing events.
intmprStartLogging(cchar *logSpec, int showConfig)
 Start logging.
intmprStartModule(MprModule *mp)
 Start a module.
intmprStartModuleService()
 Start the module service.
intmprStartOsService()
 Start the O/S dependent subsystem.
intmprStartThread(MprThread *thread)
 Start a thread.
intmprStartWorker(MprWorkerProc proc, void *data)
 Start a worker thread.
intmprStopCmd(MprCmd *cmd, int signal)
 Stop the command.
voidmprStopContinuousEvent(MprEvent *event)
 Stop an event.
intmprStopModule(MprModule *mp)
 Stop a module.
voidmprStopModuleService()
 Stop the module service.
voidmprStopOsService()
 Stop the O/S dependent subsystem.
voidmprTerminate(int flags, int status)
 Terminate the application.
voidmprTrace(int level, cchar *fmt, ...)
 Write a trace message to the diagnostic log file.
char*mprTransformPath(cchar *path, int flags)
 Transform a path.
char*mprTrimPathDrive(cchar *path)
 Trim the drive from a path.
char*mprTrimPathExt(cchar *path)
 Trim an extension from a path.
intmprTruncateFile(cchar *path, MprOff size)
 Truncate a file.
boolmprTryLock(MprMutex *lock)
 Attempt to lock access.
boolmprTrySpinLock(MprSpin *lock)
 Attempt to lock access on a spin lock.
intmprUnloadModule(MprModule *mp)
 Unload a module.
intmprUnloadNativeModule(MprModule *mp)
 Unload a native module.
voidmprUnlock(MprMutex *lock)
 Unlock a mutex.
intmprUpgradeSocket(MprSocket *sp, struct MprSsl *ssl, cchar *peerName)
 Upgrade a socket to use SSL/TLS.
char*mprUriDecode(cchar *uri)
 Decode a URI string by de-scaping URI characters.
char*mprUriDecodeInSitu(char *uri)
 Decode a URI string by de-scaping URI characters.
char*mprUriEncode(cchar *uri, int map)
 Encode a string by escaping URI characters.
intmprUsingDefaultLogHandler()
 Determine if the app is using the default MPR log handler.
voidmprValidateBlock(void *ptr)
 Validate a memory block and issue asserts if the memory block is not valid.
voidmprVerifyMem()
 Verify all memory.
voidmprVerifySslDepth(struct MprSsl *ssl, int depth)
 Control the depth of SSL SSL certificate verification.
voidmprVerifySslIssuer(struct MprSsl *ssl, bool on)
 Control the verification of SSL certificate issuers.
voidmprVerifySslPeer(struct MprSsl *ssl, bool on)
 Require verification of peer certificates.
void*mprVirtAlloc(ssize size, int mode)
 Memory virtual memory into the applications address space.
voidmprVirtFree(void *ptr, ssize size)
 Free (unpin) a mapped section of virtual memory.
intmprWaitForCmd(MprCmd *cmd, MprTicks timeout)
 Wait for the command to complete.
intmprWaitForCond(MprCond *cond, MprTicks timeout)
 Wait for a condition lock variable.
intmprWaitForEvent(MprDispatcher *dispatcher, MprTicks timeout)
 Wait for an event to occur on the given dispatcher.
voidmprWaitForIO(MprWaitService *ws, MprTicks timeout)
 Wait for I/O.
intmprWaitForMultiCond(MprCond *cond, MprTicks timeout)
 Wait for a condition lock variable for use with multiple waiters.
intmprWaitForSingleIO(int fd, int mask, MprTicks timeout)
 Wait for I/O on a file descriptor.
boolmprWaitForTest2ToComplete(MprTestGroup *gp, MprTicks timeout)
 Wait for a test to complete.
boolmprWaitForTestToComplete(MprTestGroup *gp, MprTicks timeout)
 Wait for a test to complete.
voidmprWaitOn(MprWaitHandler *wp, int desiredMask)
 Subscribe for desired wait events.
intmprWaitTillIdle(MprTicks timeout)
 Wait until the application is idle.
voidmprWarn(cchar *fmt, ...)
 Log a warning message.
ssizemprWriteCache(MprCache *cache, cchar *key, cchar *value, MprTime modified, MprTicks lifespan, int64 version, int options)
 Write a cache item.
ssizemprWriteCmd(MprCmd *cmd, int channel, char *buf, ssize bufsize)
 Write data to an I/O channel.
ssizemprWriteCmdBlock(MprCmd *cmd, int channel, char *buf, ssize bufsize)
 Write data to an I/O channel.
ssizemprWriteFile(MprFile *file, cvoid *buf, ssize count)
 Write data to a file.
ssizemprWriteFileFmt(MprFile *file, cchar *fmt, ...)
 Write formatted data to a file.
ssizemprWriteFileString(MprFile *file, cchar *str)
 Write a string to a file.
ssizemprWritePathContents(cchar *path, cchar *buf, ssize len, int mode)
 Create a file and write contents.
ssizemprWriteSocket(MprSocket *sp, cvoid *buf, ssize len)
 Write to a socket.
ssizemprWriteSocketString(MprSocket *sp, cchar *str)
 Write to a string to a socket.
ssizemprWriteSocketVector(MprSocket *sp, MprIOVec *iovec, int count)
 Write a vector to a socket.
cchar*mprXmlGetErrorMsg(MprXml *xp)
 Get the XML error message if mprXmlParse fails.
intmprXmlGetLineNumber(MprXml *xp)
 Get the source XML line number.
void*mprXmlGetParseArg(MprXml *xp)
 Get the XML callback argument.
MprXml*mprXmlOpen(ssize initialSize, ssize maxSize)
 Open an XML parser instance.
intmprXmlParse(MprXml *xp)
 Run the XML parser.
voidmprXmlSetInputStream(MprXml *xp, MprXmlInputStream fn, void *arg)
 Define the XML parser input stream.
voidmprXmlSetParseArg(MprXml *xp, void *parseArg)
 Set the XML callback argument.
voidmprXmlSetParserHandler(MprXml *xp, MprXmlHandler h)
 Set the XML parser data handle.
voidmprYield(int flags)
 Yield a thread to allow garbage collection.
void*palloc(ssize size)
 Allocate a "permanent" block of memory that is not subject GC.
voidpfree(void *ptr)
 Free a "permanent" block of memory allocated via "palloc".
void*prealloc(void *ptr, ssize size)
 Reallocate a "permanent" block of memory allocated via "palloc".
char*scamel(cchar *str)
 Create a camel case version of the string.
intscaselesscmp(cchar *s1, cchar *s2)
 Compare strings ignoring case.
boolscaselessmatch(cchar *s1, cchar *s2)
 Compare strings ignoring case.
char*schr(cchar *str, int c)
 Find a character in a string.
char*sclone(cchar *str)
 Clone a string.
intscmp(cchar *s1, cchar *s2)
 Compare strings.
char*scontains(cchar *str, cchar *pattern)
 Find a pattern in a string.
ssizescopy(char *dest, ssize destMax, cchar *src)
 Copy a string.
boolsends(cchar *str, cchar *suffix)
 Test if the string ends with a given pattern.
char*sfmt(cchar *fmt, ...)
 Format a string.
char*sfmtv(cchar *fmt, va_list args)
 Format a string.
uintshash(cchar *str, ssize len)
 Compute a hash code for a string.
uintshashlower(cchar *str, ssize len)
 Compute a caseless hash code for a string.
char*sjoin(cchar *str, ...)
 Catenate strings.
char*sjoinv(cchar *str, va_list args)
 Catenate strings.
ssizeslen(cchar *str)
 Return the length of a string.
char*slower(cchar *str)
 Convert a string to lower case.
boolsmatch(cchar *s1, cchar *s2)
 Compare strings.
intsncaselesscmp(cchar *s1, cchar *s2, ssize len)
 Compare strings ignoring case.
char*snclone(cchar *str, ssize len)
 Clone a substring.
intsncmp(cchar *s1, cchar *s2, ssize len)
 Compare strings.
char*sncontains(cchar *str, cchar *pattern, ssize limit)
 Find a pattern in a string with a limit.
ssizesncopy(char *dest, ssize destMax, cchar *src, ssize len)
 Copy characters from a string.
char*spascal(cchar *str)
 Create a Pascal case version of the string.
char*spbrk(cchar *str, cchar *set)
 Locate the a character in a string.
char*srchr(cchar *str, int c)
 Find a character in a string by searching backwards.
char*srejoin(char *buf, ...)
 Append strings to an existing string and reallocate as required.
char*srejoinv(char *buf, va_list args)
 Append strings to an existing string and reallocate as required.
ssizesspn(cchar *str, cchar *set)
 Find the end of a spanning prefix.
boolsstarts(cchar *str, cchar *prefix)
 Test if the string starts with a given pattern.
char*ssub(cchar *str, ssize offset, ssize length)
 Create a substring.
char*stemplate(cchar *str, struct MprHash *tokens)
 Replace template tokens in a string with values from a lookup table.
int64stoi(cchar *str)
 Convert a string to an integer.
int64stoiradix(cchar *str, int radix, int *err)
 Convert a string to an integer.
char*stok(char *str, cchar *delim, char **last)
 Tokenize a string.
char*strim(cchar *str, cchar *set, int where)
 Trim a string.
char*supper(cchar *str)
 Convert a string to upper case.

Typedefs

MprBufProcBuffer refill callback function.
MprCmdChildChild status structure.
MprCmdServiceCommand execution service.
MprCondCondition variable for single and multi-thread synchronization.
MprDirEntryDirectory entry description.
MprEventProcEvent callback function.
MprForkCallbackCallback function before doing a fork().
MprFreeMemBlock structure when on a free list.
MprHashHash table control structure.
MprHashProcHashing function to use for the table.
MprHeapMemory allocator heap.
MprIOVecVectored write array.
MprJsonCallbackJSON callbacks.
MprKeyValueKey value pairs for use with MprList or MprKey.
MprListCompareProcList comparison procedure for sorting.
MprLogHandlerLog handler callback type.
MprManagerMpr memory block manager prototype.
MprMemNotifierMemory allocation error callback.
MprMemStatsMemory allocator statistics.
MprModuleEntryLoadable module entry point signature.
MprModuleProcModule start/stop point function signature.
MprMutexMultithreading lock control structure.
MprObjObject container for JSON parse trees.
MprOffSigned file offset data type.
MprRegionMemmory regions allocated from the O/S.
MprRomInodeA RomInode is created for each file in the Rom file system.
MprSignalInfoPer signal structure.
MprSignalProcSignal callback procedure.
MprSignalServiceSignal service control.
MprSocketPrebindCallback before binding a socket.
MprSocketProcSocket I/O callback procedure.
MprSocketProviderSocket service provider interface.
MprSocketServiceMpr socket service class.
MprSortProcQuicksort callback function.
MprSpinMultithreading spin lock control structure.
MprTestCaseTest case structure.
MprTestDefTest case definition.
MprTestFailureTest failure record.
MprTestGroupA test group is a group of tests to cover a unit of functionality.
MprTestParserCallback parser for non-standard command line arguments.
MprTestProcUnit test callback procedure.
MprThreadLocalThread local data storage.
MprThreadProcThread main procedure.
MprThreadServiceThread service.
MprTicksElapsed time data type.
MprWaitServiceWait Service.
MprWorkerProcWorker thread callback signature.
MprWorkerServiceWorker Thread Service.
MprWorkerStatsStatistics for Workers.
MprXmlHandlerXML callback handler.
MprXmlInputStreamXML input stream function.

Defines

#defineBIT_MPR_LOGGING   1
 Default for logging is "on".
#defineMPR_ALLOC_MANAGER   0x1
 Reserve room for a manager.
#defineMPR_ALLOC_PAD_MASK   0x1
 Flags that impact padding.
#defineMPR_ALLOC_POLICY_EXIT   3
 Exit the app if max exceeded with a MPR_EXIT_NORMAL exit.
#defineMPR_ALLOC_POLICY_NOTHING   0
 Do nothing.
#defineMPR_ALLOC_POLICY_PRUNE   1
 Prune all non-essential memory and continue.
#defineMPR_ALLOC_POLICY_RESTART   2
 Gracefully restart the app if redline is exceeded.
#defineMPR_ALLOC_ZERO   0x2
 Zero memory.
#defineMPR_ARGV_ARGS_ONLY   0x1
 Command is missing program name.
#defineMPR_ASSERT_MSG   0x10
 Originated from assert.
#defineMPR_BACKGROUND_PRIORITY   15
 May only get CPU if idle.
#defineMPR_CACHE_ADD   0x2
 Add key if not already existing.
#defineMPR_CACHE_APPEND   0x8
 Set and append if already existing.
#defineMPR_CACHE_PREPEND   0x10
 Set and prepend if already existing.
#defineMPR_CACHE_SET   0x4
 Update key value, create if required.
#defineMPR_CACHE_SHARED   0x1
 Use shared cache.
#defineMPR_CMD_DETACH   0x4
 mprRunCmd flag to detach the child process and don't wait.
#defineMPR_CMD_ERR   0x4000
 mprRunCmd flag to capture stdout.
#defineMPR_CMD_EXACT_ENV   0x8
 mprRunCmd flag to use the exact environment (no inherit from parent).
#defineMPR_CMD_IN   0x1000
 mprRunCmd flag to connect to stdin.
#defineMPR_CMD_NEW_SESSION   0x1
 mprRunCmd flag to create a new session on unix.
#defineMPR_CMD_OUT   0x2000
 mprRunCmd flag to capture stdout.
#defineMPR_CMD_SHOW   0x2
 mprRunCmd flag to show the window of the created process on windows.
#defineMPR_CMD_STDERR   2
 Stderr for the client side.
#defineMPR_CMD_STDIN   0
 Stdout for the client side.
#defineMPR_CMD_STDOUT   1
 Stdin for the client side.
#defineMPR_CMD_VXWORKS_EOF   "_ _EOF_ _"
 Special string for VxWorks CGI to emit to signal EOF.
#defineMPR_CMD_VXWORKS_EOF_LEN   9
 Length of MPR_CMD_VXWORKS_EOF.
#defineMPR_CONFIG   2
 Configuration settings trace level.
#defineMPR_CRITICAL_PRIORITY   99
 May not yield.
#defineMPR_DECODE_TOKEQ   1
 Decode base 64 blocks up to a NULL or equals.
#defineMPR_DEFAULT_DATE   "%a %b %d %T %Y %Z"
 Default date format used in mprFormatLocalTime/mprFormatUniversalTime when no format supplied.
#defineMPR_DEFAULT_MAX_THREADS   20
 Default max threads.
#defineMPR_DEFAULT_MIN_THREADS   0
 Default min threads.
#defineMPR_DISABLE_GC   0x1
 Disable GC.
#defineMPR_DISPATCHER_AUTO_CREATE   0x8
 Dispatcher is auto-created for incoming events.
#defineMPR_DISPATCHER_DESTROYED   0x4
 Dispatcher is destroyed.
#defineMPR_DISPATCHER_ENABLED   0x1
 Dispacher is enabled.
#defineMPR_DISPATCHER_WAITING   0x2
 Dispatcher waiting for an event.
#defineMPR_ERR   -1
 Default error code.
#defineMPR_ERR_ABORTED   -2
 Action aborted.
#defineMPR_ERR_ALREADY_EXISTS   -3
 Item already exists.
#defineMPR_ERR_BAD_ARGS   -4
 Bad arguments or paramaeters.
#defineMPR_ERR_BAD_FORMAT   -5
 Bad input format.
#defineMPR_ERR_BAD_HANDLE   -6
 Bad file handle.
#defineMPR_ERR_BAD_STATE   -7
 Module is in a bad state.
#defineMPR_ERR_BAD_SYNTAX   -8
 Input has bad syntax.
#defineMPR_ERR_BAD_TYPE   -9
 Bad object type.
#defineMPR_ERR_BAD_VALUE   -10
 Bad or unexpected value.
#defineMPR_ERR_BASE   -1
 Base error code.
#defineMPR_ERR_BUSY   -11
 Resource is busy.
#defineMPR_ERR_CANT_ACCESS   -12
 Cannot access the file or resource.
#defineMPR_ERR_CANT_ALLOCATE   -13
 Cannot allocate resource.
#defineMPR_ERR_CANT_COMPLETE   -14
 Operation can't complete.
#defineMPR_ERR_CANT_CONNECT   -15
 Cannot connect to network or resource.
#defineMPR_ERR_CANT_CREATE   -16
 Cannot create the file or resource.
#defineMPR_ERR_CANT_DELETE   -17
 Cannot delete the resource.
#defineMPR_ERR_CANT_FIND   -18
 Cannot find resource.
#defineMPR_ERR_CANT_INITIALIZE   -19
 Cannot initialize resource.
#defineMPR_ERR_CANT_LOAD   -20
 Cannot load the resource.
#defineMPR_ERR_CANT_OPEN   -21
 Cannot open the file or resource.
#defineMPR_ERR_CANT_READ   -22
 Cannot read from the file or resource.
#defineMPR_ERR_CANT_WRITE   -23
 Cannot write to the file or resource.
#defineMPR_ERR_DELETED   -24
 Resource has been deleted.
#defineMPR_ERR_MEMORY   -25
 Memory allocation error.
#defineMPR_ERR_NETWORK   -26
 Underlying network error.
#defineMPR_ERR_NOT_INITIALIZED   -27
 Module or resource is not initialized.
#defineMPR_ERR_NOT_READY   -28
 Resource is not ready.
#defineMPR_ERR_OK   0
 Success.
#defineMPR_ERR_READ_ONLY   -29
 The operation timed out.
#defineMPR_ERR_TIMEOUT   -30
 Operation exceeded specified time allowed.
#defineMPR_ERR_TOO_MANY   -31
 Too many requests or resources.
#defineMPR_ERR_WONT_FIT   -32
 Requested operation won't fit in available space.
#defineMPR_ERR_WOULD_BLOCK   -33
 Blocking operation would block.
#defineMPR_ERROR   1
 Standard logging trace levels are 0 to 9 with 0 being the most verbose.
#defineMPR_ERROR_MSG   0x20
 Originated from mprError.
#defineMPR_EVENT_CONTINUOUS   0x1
 Timer event runs is automatically rescheduled.
#defineMPR_EVENT_DONT_QUEUE   0x4
 Don't queue the event.
#defineMPR_EVENT_PRIORITY   50
 Normal priority.
#defineMPR_EVENT_QUICK   0x2
 Execute inline without executing via a thread.
#defineMPR_EVENT_RUNNING   0x10
 Event currently executing.
#defineMPR_EVENT_STATIC_DATA   0x8
 Event data is permanent and should not be marked by GC.
#defineMPR_EXIT_DEFAULT   0x1
 Exit as per MPR->defaultStrategy.
#defineMPR_EXIT_GRACEFUL   0x8
 Graceful shutdown waiting for requests to complete.
#defineMPR_EXIT_IMMEDIATE   0x2
 Immediate exit.
#defineMPR_EXIT_NORMAL   0x4
 Normal shutdown without waiting for requests to complete.
#defineMPR_EXIT_RESTART   0x10
 Restart after exiting.
#defineMPR_FATAL_MSG   0x800
 Fatal error, log and exit.
#defineMPR_FINISHED   0x8
 Mpr object destroyed.
#defineMPR_GC_COMPLETE   0x2
 mprRequestGC flags to do a complete collection (3 sweeps).
#defineMPR_GC_FORCE   0x1
 mprRequestGC flags to force a GC whether it is required or not.
#defineMPR_GC_NO_BLOCK   0x4
 mprRequestGC flags to not wait for the GC.
#defineMPR_GC_NO_YIELD   0x8
 mprRequestGC flag to trigger GC but not yield.
#defineMPR_GEN_ETERNAL   3
 Objects immune from collection.
#defineMPR_HASH_CASELESS   0x10
 Key comparisons ignore case.
#defineMPR_HASH_LIST   0x100
 Hash keys are numeric indicies.
#defineMPR_HASH_OWN   0x400
 For own use.
#defineMPR_HASH_STATIC_KEYS   0x40
 Keys are permanent - don't dup or mark.
#defineMPR_HASH_STATIC_VALUES   0x80
 Values are permanent - don't mark.
#defineMPR_HASH_UNICODE   0x20
 Hash keys are unicode strings.
#defineMPR_HASH_UNIQUE   0x200
 Add to existing will fail.
#defineMPR_HTTP_DATE   "%a, %d %b %Y %T GMT"
 Date format for use in HTTP (headers).
#defineMPR_INFO_MSG   0x40
 Originated from mprInfo.
#defineMPR_JSON_ARRAY   3
 The property is an array (MprHash with numeric keys).
#defineMPR_JSON_OBJ   2
 The property is an object (MprHash).
#defineMPR_JSON_PRETTY   0x1
 Serialize output in a more human readable, multiline "pretty" format.
#defineMPR_JSON_STRING   1
 The property is a string (char*).
#defineMPR_JSON_UNKNOWN   0
 The type of a property is unknown.
#defineMPR_LEVEL_MASK   0xf
 Level mask.
#defineMPR_LIST_STABLE   0x40
 For own use.
#defineMPR_LIST_STATIC_VALUES   0x20
 Flag for mprCreateList when values are permanent.
#defineMPR_LOCAL_TIMEZONE   MAXINT
 Constants for mprParseTime.
#defineMPR_LOG_ANEW   0x20
 Start anew on boot (rotate).
#defineMPR_LOG_APPEND   0x10
 Append to existing log files.
#defineMPR_LOG_MSG   0x80
 Originated from mprLog.
#defineMPR_MANAGE_FREE   0x1
 Block being freed.
#defineMPR_MANAGE_MARK   0x2
 Block being marked by GC.
#defineMPR_MARK_THREAD   0x4
 Start a dedicated marker thread for garbage collection.
#defineMPR_MAX_GEN   3
 Number of generations for object allocation.
#defineMPR_MEM_FAIL   0x4
 Memory allocation failed - immediate exit.
#defineMPR_MEM_LIMIT   0x2
 Memory use exceeds memory limit - invoking policy.
#defineMPR_MEM_REDLINE   0x1
 Memory use exceeds redline limit.
#defineMPR_MEM_TOO_BIG   0x4
 Memory allocation request is too big - immediate exit.
#defineMPR_MIN_TIME_FOR_GC   2
 Wait till 2 milliseconds of idle time possible.
#defineMPR_MODULE_STARTED   0x1
 Module stared.
#defineMPR_MODULE_STOPPED   0x2
 Module stopped.
#defineMPR_NO_WINDOW   0x20
 Don't create a windows Window.
#defineMPR_NORMAL_PRIORITY   50
 Normal (default) priority.
#defineMPR_OBJ_HASH   0x1
 Object is a hash.
#defineMPR_OBJ_LIST   0x1
 Object is a hash.
#defineMPR_PATH_DEPTH_FIRST   0x2
 Flag for mprGetPathFiles to do a depth-first traversal.
#defineMPR_PATH_DESCEND   0x1
 Flag for mprGetPathFiles to traverse subdirectories.
#defineMPR_PATH_INC_HIDDEN   0x4
 Flag for mprGetPathFiles to include hidden files.
#defineMPR_PATH_NODIRS   0x8
 Flag for mprGetPathFiles to exclude subdirectories.
#defineMPR_PATH_RELATIVE   0x10
 Flag for mprGetPathFiles to return paths relative to the directory.
#defineMPR_PROTO_ALL   0x1F
 All SSL protocols.
#defineMPR_PROTO_SSLV2   0x1
 SSL V2 protocol.
#defineMPR_PROTO_SSLV3   0x2
 SSL V3 protocol.
#defineMPR_PROTO_TLSV1   0x4
 TLS V1 protocol.
#defineMPR_PROTO_TLSV11   0x8
 TLS V1.1 protocol.
#defineMPR_PROTO_TLSV12   0x10
 TLS V1.2 protocol.
#defineMPR_RAW_MSG   0x100
 Raw message output.
#defineMPR_READABLE   0x2
 Read event mask.
#defineMPR_REQUEST_PRIORITY   50
 Normal priority.
#defineMPR_RFC_DATE   "%a, %d %b %Y %T %Z"
 Format a date according to RFC822: (Fri, 07 Jan 2003 12:12:21 PDT).
#defineMPR_SERVICE_NO_GC   0x8
 Don't run GC.
#defineMPR_SERVICE_ONE_THING   0x4
 Wait for one event or one I/O.
#defineMPR_SIGNAL_AFTER   0x2
 Flag to mprAddSignalHandler to run handler after existing handlers.
#defineMPR_SIGNAL_BEFORE   0x1
 Flag to mprAddSignalHandler to run handler before existing handlers.
#defineMPR_SOCKET_BLOCK   0x1
 Use blocking I/O.
#defineMPR_SOCKET_BROADCAST   0x2
 Broadcast mode.
#defineMPR_SOCKET_BUFFERED_READ   0x800
 Socket has buffered read data (in SSL stack).
#defineMPR_SOCKET_BUFFERED_WRITE   0x1000
 Socket has buffered write data (in SSL stack).
#defineMPR_SOCKET_CHECKED   0x2000
 Peer certificate has been checked.
#defineMPR_SOCKET_CLOSED   0x4
 MprSocket has been closed.
#defineMPR_SOCKET_CONNECTING   0x8
 MprSocket is connecting.
#defineMPR_SOCKET_DATAGRAM   0x10
 Use datagrams.
#defineMPR_SOCKET_DISCONNECTED   0x4000
 The mprDisconnectSocket has been called.
#defineMPR_SOCKET_EOF   0x20
 Seen end of file.
#defineMPR_SOCKET_GRACEFUL   1
 Do a graceful shutdown.
#defineMPR_SOCKET_HANDSHAKING   0x8000
 Doing an SSL handshake.
#defineMPR_SOCKET_LISTENER   0x40
 MprSocket is server listener.
#defineMPR_SOCKET_NODELAY   0x100
 Disable Nagle algorithm.
#defineMPR_SOCKET_NOREUSE   0x80
 Don't set SO_REUSEADDR option.
#defineMPR_SOCKET_SERVER   0x400
 Socket is on the server-side.
#defineMPR_SOCKET_THREAD   0x200
 Process callbacks on a worker thread.
#defineMPR_STARTED   0x1
 Mpr services started.
#defineMPR_STOPPING   0x2
 App is stopping.
#defineMPR_STOPPING_CORE   0x4
 Stopping core services: GC and event dispatch.
#defineMPR_SWEEP_THREAD   0x8
 Start a dedicated sweeper thread for garbage collection (unsupported).
#defineMPR_TICKS_PER_SEC   1000
 Time ticks per second.
#defineMPR_TIMEOUT_GC_SYNC   100
 Short wait period for threads to synchronize.
#defineMPR_TIMEOUT_LINGER   2000
 Close socket linger timeout.
#defineMPR_TIMEOUT_NAP   20
 Short pause.
#defineMPR_TIMEOUT_NO_BUSY   1000
 Wait period to minimize CPU drain.
#defineMPR_TIMEOUT_PRUNER   120000
 Time between worker thread pruner runs (2 min).
#defineMPR_TIMEOUT_START_TASK   10000
 Time to start tasks running.
#defineMPR_TIMEOUT_STOP   30000
 Default wait when stopping resources (30 sec).
#defineMPR_TIMEOUT_STOP_TASK   10000
 Time to stop or reap tasks (vxworks).
#defineMPR_TIMEOUT_WORKER   60000
 Prune worker that has been idle for 1 min.
#defineMPR_TRACE_MSG   0x200
 Originated from mprTrace.
#defineMPR_TRIM_BOTH   0x3
 Flag for strim to trim from both the start and the end of the string.
#defineMPR_TRIM_END   0x2
 Flag for strim to trim from the end of the string.
#defineMPR_TRIM_START   0x1
 Flag for strim to trim from the start of the string.
#defineMPR_USER_EVENTS_THREAD   0x10
 User will explicitly manage own mprServiceEvents calls.
#defineMPR_UTC_TIMEZONE   0
 Use UTC timezone.
#defineMPR_VERBOSE   9
 Highest level of trace.
#defineMPR_WAIT_NEW_DISPATCHER   0x2
 Wait handler flag to create a new dispatcher for each I/O event.
#defineMPR_WAIT_RECALL_HANDLER   0x1
 Wait handler flag to recall the handler asap.
#defineMPR_WARN   2
 Soft warning trace level.
#defineMPR_WARN_MSG   0x400
 Originated from mprWarn.
#defineMPR_WORKER_BUSY   0x1
 Worker currently running to a callback.
#defineMPR_WORKER_IDLE   0x4
 Worker is sleeping (idle) on idleCond.
#defineMPR_WORKER_PRIORITY   50
 Normal priority.
#defineMPR_WORKER_PRUNED   0x2
 Worker has been pruned and will be terminated.
#defineMPR_WRITABLE   0x4
 Write event mask.
#defineMPR_XML_AFTER_LS   2
 Seen "<".
#defineMPR_XML_ATT_EQ   6
 Seen "<tag att" =.
#defineMPR_XML_ATT_NAME   5
 Seen "<tag att".
#defineMPR_XML_BEGIN   1
 Before next tag.
#defineMPR_XML_CDATA   13
 Seen "<![CDATA[" U.
#defineMPR_XML_COMMENT   3
 Seen "<!&ndash;" (usr) U.
#defineMPR_XML_ELT_DATA   10
 Seen "<tag>....<" U.
#defineMPR_XML_ELT_DEFINED   9
 Seen "<tag...>" U.
#defineMPR_XML_END_ELT   11
 Seen "<tag>....</tag>" U.
#defineMPR_XML_EOF   -2
 End of input.
#defineMPR_XML_ERR   -1
 Error.
#defineMPR_XML_NEW_ATT   7
 Seen "<tag att = "val" U.
#defineMPR_XML_NEW_ELT   4
 Seen "<tag" (usr) U.
#defineMPR_XML_PI   12
 Seen "<?processingInst" U.
#defineMPR_XML_SOLO_ELT_DEFINED   8
 Seen "<tag../>" U.
#defineMPR_YIELD_BLOCK   0x2
 mprYield flag to yield and wait until GC the next GC occurs.
#defineMPR_YIELD_NO_BLOCK   0x1
 mprYield flag to yield but do not wait.
#defineMPR_YIELD_STICKY   0x4
 mprYield flag to yield and remain yielded until reset.
#definetassert   assertTrue(gp, MPR_LOC, C, #C)
 Assert macro for use by unit tests.
#definetassert   assertTrue(gp, MPR_LOC, C, #C)
 Assert macro for use by unit tests.

Mpr

Mpr

Primary MPR application control structure.

Description:
The Mpr structure stores critical application state information.
See Also:
mprAddTerminator, mprBreakpoint, mprCreate, mprCreateOsService, mprDecode64, mprDestroy, mprEmptyString, mprEncode64, mprEscapeCmd, mprGetAppDir, mprGetAppName, mprGetAppPath, mprGetAppTitle, mprGetAppVersion, mprGetCmdlineLogging, mprGetDebugMode, mprGetDomainName, mprGetEndian, mprGetError, mprGetHostName, mprGetIpAddr, mprGetLogLevel, mprGetMD5, mprGetMD5WithPrefix, mprGetOsError, mprGetRandomBytes, mprGetServerName, mprIsExiting, mprIsFinished, mprIsIdle, mprIsStopping, mprIsStoppingCore, mprMakeArgv, mprRandom, mprRestart, mprServicesAreIdle, mprSetAppName, mprSetCmdlineLogging, mprSetDebugMode, mprSetDomainName, mprSetExitStrategy, mprSetHostName, mprSetIdleCallback, mprSetIpAddr, mprSetLogLevel, mprSetServerName, mprShouldAbortRequests, mprShouldDenyNewRequests, mprSleep, mprStart, mprStartEventsThread, mprStartOsService, mprStopOsService, mprTerminate, mprUriDecode, mprUriEncode, mprWaitTillIdle
API Stability:
Internal.
Fields:
char *appDir Path of directory containing app executable.
char *appPath Path name of application executable.
void *appwebService Appweb service object.
char **argBuf Space for allocated argv.
intargc Count of command line args.
cchar **argv Application command line args (not alloced).
boolcmdlineLogging App has specified log on the command line.
struct MprCmdService *cmdService Command service object.
MprCond *cond Sync after starting events thread.
booldebugMode Run in debug mode (no timers).
struct MprDispatcher *dispatcher Primary dispatcher.
char *domainName Domain portion.
void *ediService EDI object.
void *ejsService Ejscript service.
char *emptyString Empty string.
void *espService ESP service object.
inteventing Servicing events thread is active.
struct MprEventService *eventService Event service object.
intexitStatus Proposed program exit status.
intexitStrategy How to exit the app (normal, immediate, graceful).
MprTicksexitTimeout Request timeout when exiting.
struct MprFileSystem *fileSystem File system service object.
intflags Misc flags.
inthasError Mpr has an initialization error.
MprHeap *heap Memory heap control.
char *hostName Host name (fully qualified name).
void *httpService Http service object.
MprIdleCallbackidleCallback Invoked to determine if the process is idle.
char *ip Public IP Address.
intlogBackup Number of log files preserved when backing up.
MprFile *logFile Log file.
MprLogHandlerlogHandler Current log handler callback.
intlogLevel Log trace level.
cchar *logPath Log path name.
ssizelogSize Maximum log size.
MprOsThreadmainOsThread Main OS thread ID.
MprHash *mimeTypes Table of mime types.
struct MprModuleService *moduleService Module service object.
MprMutex *mutex Thread synchronization.
char *name Product name.
struct MprDispatcher *nonBlock Nonblocking dispatcher.
struct MprOsService *osService O/S service object.
char *pathEnv Cached PATH env var. Used by MprCmd.
char *serverName Server name portion (no domain).
struct MprSignalService *signalService Signal service object.
struct MprSocketService *socketService Socket service object.
MprSpin *spin Quick thread synchronization.
MprTimestart When the MPR started.
intstate Processing state.
MprFile *stdError Standard error file.
MprFile *stdInput Standard input file.
MprFile *stdOutput Standard output file.
MprList *terminators Termination callbacks.
void *testService Test service object.
struct MprThreadService *threadService Thread service object.
MprHash *timeTokens Date/Time parsing tokens.
char *title Product title.
intverifySsl Default verification of SSL certificates.
char *version Product version.
struct MprWaitService *waitService IO Waiting service object.
struct MprWorkerService *workerService Worker service object.
void assert (bool cond)

Assert that a condition is true.

Parameters:
condBoolean result of a conditional test.
API Stability:
Evolving.
See Also:
mprAddTerminator, mprBreakpoint, mprCreate, mprCreateOsService, mprDecode64, mprDestroy, mprEmptyString, mprEncode64, mprEscapeCmd, mprGetAppDir, mprGetAppName, mprGetAppPath, mprGetAppTitle, mprGetAppVersion, mprGetCmdlineLogging, mprGetDebugMode, mprGetDomainName, mprGetEndian, mprGetError, mprGetHostName, mprGetIpAddr, mprGetLogLevel, mprGetMD5, mprGetMD5WithPrefix, mprGetOsError, mprGetRandomBytes, mprGetServerName, mprIsExiting, mprIsFinished, mprIsIdle, mprIsStopping, mprIsStoppingCore, mprMakeArgv, mprRandom, mprRestart, mprServicesAreIdle, mprSetAppName, mprSetCmdlineLogging, mprSetDebugMode, mprSetDomainName, mprSetExitStrategy, mprSetHostName, mprSetIdleCallback, mprSetIpAddr, mprSetLogLevel, mprSetServerName, mprShouldAbortRequests, mprShouldDenyNewRequests, mprSleep, mprStart, mprStartEventsThread, mprStartOsService, mprStopOsService, mprTerminate, mprUriDecode, mprUriEncode, mprWaitTillIdle
void mprAddTerminator (MprTerminator terminator)

Add a terminator callback.

Description:
When the MPR terminates, all terminator callbacks are invoked to give the application notice of impending exit.
Parameters:
terminatorMprTerminator callback function.
API Stability:
Stable.
See Also:
mprBreakpoint, mprCreate, mprCreateOsService, mprDecode64, mprDestroy, mprEmptyString, mprEncode64, mprEscapeCmd, mprGetAppDir, mprGetAppName, mprGetAppPath, mprGetAppTitle, mprGetAppVersion, mprGetCmdlineLogging, mprGetDebugMode, mprGetDomainName, mprGetEndian, mprGetError, mprGetHostName, mprGetIpAddr, mprGetLogLevel, mprGetMD5, mprGetMD5WithPrefix, mprGetOsError, mprGetRandomBytes, mprGetServerName, mprIsExiting, mprIsFinished, mprIsIdle, mprIsStopping, mprIsStoppingCore, mprMakeArgv, mprRandom, mprRestart, mprServicesAreIdle, mprSetAppName, mprSetCmdlineLogging, mprSetDebugMode, mprSetDomainName, mprSetExitStrategy, mprSetHostName, mprSetIdleCallback, mprSetIpAddr, mprSetLogLevel, mprSetServerName, mprShouldAbortRequests, mprShouldDenyNewRequests, mprSleep, mprStart, mprStartEventsThread, mprStartOsService, mprStopOsService, mprTerminate, mprUriDecode, mprUriEncode, mprWaitTillIdle
void mprBreakpoint ()

Trigger a breakpoint.

Description:
Triggers a breakpoint and traps to the debugger.
API Stability:
Stable.
See Also:
mprAddTerminator, mprCreate, mprCreateOsService, mprDecode64, mprDestroy, mprEmptyString, mprEncode64, mprEscapeCmd, mprGetAppDir, mprGetAppName, mprGetAppPath, mprGetAppTitle, mprGetAppVersion, mprGetCmdlineLogging, mprGetDebugMode, mprGetDomainName, mprGetEndian, mprGetError, mprGetHostName, mprGetIpAddr, mprGetLogLevel, mprGetMD5, mprGetMD5WithPrefix, mprGetOsError, mprGetRandomBytes, mprGetServerName, mprIsExiting, mprIsFinished, mprIsIdle, mprIsStopping, mprIsStoppingCore, mprMakeArgv, mprRandom, mprRestart, mprServicesAreIdle, mprSetAppName, mprSetCmdlineLogging, mprSetDebugMode, mprSetDomainName, mprSetExitStrategy, mprSetHostName, mprSetIdleCallback, mprSetIpAddr, mprSetLogLevel, mprSetServerName, mprShouldAbortRequests, mprShouldDenyNewRequests, mprSleep, mprStart, mprStartEventsThread, mprStartOsService, mprStopOsService, mprTerminate, mprUriDecode, mprUriEncode, mprWaitTillIdle
Mpr * mprCreate (int argc, char **argv, int flags)

Create an instance of the MPR.

Description:
Initializes the MPR and creates an Mpr control object. The Mpr Object manages all MPR facilities and services.
Parameters:
argcCount of command line args.
argvCommand line arguments for the application. Arguments may be passed into the Mpr for retrieval by the unit test framework.
flags
Returns:
Returns a pointer to the Mpr object.
API Stability:
Stable.
See Also:
mprAddTerminator, mprBreakpoint, mprCreateOsService, mprDecode64, mprDestroy, mprEmptyString, mprEncode64, mprEscapeCmd, mprGetAppDir, mprGetAppName, mprGetAppPath, mprGetAppTitle, mprGetAppVersion, mprGetCmdlineLogging, mprGetDebugMode, mprGetDomainName, mprGetEndian, mprGetError, mprGetHostName, mprGetIpAddr, mprGetLogLevel, mprGetMD5, mprGetMD5WithPrefix, mprGetOsError, mprGetRandomBytes, mprGetServerName, mprIsExiting, mprIsFinished, mprIsIdle, mprIsStopping, mprIsStoppingCore, mprMakeArgv, mprRandom, mprRestart, mprServicesAreIdle, mprSetAppName, mprSetCmdlineLogging, mprSetDebugMode, mprSetDomainName, mprSetExitStrategy, mprSetHostName, mprSetIdleCallback, mprSetIpAddr, mprSetLogLevel, mprSetServerName, mprShouldAbortRequests, mprShouldDenyNewRequests, mprSleep, mprStart, mprStartEventsThread, mprStartOsService, mprStopOsService, mprTerminate, mprUriDecode, mprUriEncode, mprWaitTillIdle
int mprCreateOsService ()

Create and initialze the O/S dependent subsystem.

API Stability:
Internal.
See Also:
mprAddTerminator, mprBreakpoint, mprCreate, mprDecode64, mprDestroy, mprEmptyString, mprEncode64, mprEscapeCmd, mprGetAppDir, mprGetAppName, mprGetAppPath, mprGetAppTitle, mprGetAppVersion, mprGetCmdlineLogging, mprGetDebugMode, mprGetDomainName, mprGetEndian, mprGetError, mprGetHostName, mprGetIpAddr, mprGetLogLevel, mprGetMD5, mprGetMD5WithPrefix, mprGetOsError, mprGetRandomBytes, mprGetServerName, mprIsExiting, mprIsFinished, mprIsIdle, mprIsStopping, mprIsStoppingCore, mprMakeArgv, mprRandom, mprRestart, mprServicesAreIdle, mprSetAppName, mprSetCmdlineLogging, mprSetDebugMode, mprSetDomainName, mprSetExitStrategy, mprSetHostName, mprSetIdleCallback, mprSetIpAddr, mprSetLogLevel, mprSetServerName, mprShouldAbortRequests, mprShouldDenyNewRequests, mprSleep, mprStart, mprStartEventsThread, mprStartOsService, mprStopOsService, mprTerminate, mprUriDecode, mprUriEncode, mprWaitTillIdle
char * mprDecode64 (cchar *str)

Decode a null terminated string using base-46 encoding.

Decoding will terminate at the first null or '='
Parameters:
strString to decode.
Returns:
Buffer containing the encoded data.
API Stability:
Stable.
See Also:
mprAddTerminator, mprBreakpoint, mprCreate, mprCreateOsService, mprDestroy, mprEmptyString, mprEncode64, mprEscapeCmd, mprGetAppDir, mprGetAppName, mprGetAppPath, mprGetAppTitle, mprGetAppVersion, mprGetCmdlineLogging, mprGetDebugMode, mprGetDomainName, mprGetEndian, mprGetError, mprGetHostName, mprGetIpAddr, mprGetLogLevel, mprGetMD5, mprGetMD5WithPrefix, mprGetOsError, mprGetRandomBytes, mprGetServerName, mprIsExiting, mprIsFinished, mprIsIdle, mprIsStopping, mprIsStoppingCore, mprMakeArgv, mprRandom, mprRestart, mprServicesAreIdle, mprSetAppName, mprSetCmdlineLogging, mprSetDebugMode, mprSetDomainName, mprSetExitStrategy, mprSetHostName, mprSetIdleCallback, mprSetIpAddr, mprSetLogLevel, mprSetServerName, mprShouldAbortRequests, mprShouldDenyNewRequests, mprSleep, mprStart, mprStartEventsThread, mprStartOsService, mprStopOsService, mprTerminate, mprUriDecode, mprUriEncode, mprWaitTillIdle
char * mprDecode64Block (cchar *buf, ssize *len, int flags)

Decode a null terminated string using base-46 encoding.

Parameters:
bufString to decode.
lenReturn parameter with the Length of the decoded data.
flagsSet to MPR_DECODE_TOKEQ to stop at the first '='.
Returns:
Buffer containing the encoded data and returns length in len.
API Stability:
Stable.
See Also:
mprAddTerminator, mprBreakpoint, mprCreate, mprCreateOsService, mprDecode64, mprDestroy, mprEmptyString, mprEncode64, mprEscapeCmd, mprGetAppDir, mprGetAppName, mprGetAppPath, mprGetAppTitle, mprGetAppVersion, mprGetCmdlineLogging, mprGetDebugMode, mprGetDomainName, mprGetEndian, mprGetError, mprGetHostName, mprGetIpAddr, mprGetLogLevel, mprGetMD5, mprGetMD5WithPrefix, mprGetOsError, mprGetRandomBytes, mprGetServerName, mprIsExiting, mprIsFinished, mprIsIdle, mprIsStopping, mprIsStoppingCore, mprMakeArgv, mprRandom, mprRestart, mprServicesAreIdle, mprSetAppName, mprSetCmdlineLogging, mprSetDebugMode, mprSetDomainName, mprSetExitStrategy, mprSetHostName, mprSetIdleCallback, mprSetIpAddr, mprSetLogLevel, mprSetServerName, mprShouldAbortRequests, mprShouldDenyNewRequests, mprSleep, mprStart, mprStartEventsThread, mprStartOsService, mprStopOsService, mprTerminate, mprUriDecode, mprUriEncode, mprWaitTillIdle
char * mprEmptyString ()

Reference to a permanent preallocated empty string.

Returns:
An empty string.
API Stability:
Stable.
See Also:
mprAddTerminator, mprBreakpoint, mprCreate, mprCreateOsService, mprDecode64, mprDestroy, mprEncode64, mprEscapeCmd, mprGetAppDir, mprGetAppName, mprGetAppPath, mprGetAppTitle, mprGetAppVersion, mprGetCmdlineLogging, mprGetDebugMode, mprGetDomainName, mprGetEndian, mprGetError, mprGetHostName, mprGetIpAddr, mprGetLogLevel, mprGetMD5, mprGetMD5WithPrefix, mprGetOsError, mprGetRandomBytes, mprGetServerName, mprIsExiting, mprIsFinished, mprIsIdle, mprIsStopping, mprIsStoppingCore, mprMakeArgv, mprRandom, mprRestart, mprServicesAreIdle, mprSetAppName, mprSetCmdlineLogging, mprSetDebugMode, mprSetDomainName, mprSetExitStrategy, mprSetHostName, mprSetIdleCallback, mprSetIpAddr, mprSetLogLevel, mprSetServerName, mprShouldAbortRequests, mprShouldDenyNewRequests, mprSleep, mprStart, mprStartEventsThread, mprStartOsService, mprStopOsService, mprTerminate, mprUriDecode, mprUriEncode, mprWaitTillIdle
char * mprEncode64 (cchar *str)

Encode a string using base-46 encoding.

Parameters:
strString to encode.
Returns:
Buffer containing the encoded string.
API Stability:
Stable.
See Also:
mprAddTerminator, mprBreakpoint, mprCreate, mprCreateOsService, mprDecode64, mprDestroy, mprEmptyString, mprEscapeCmd, mprGetAppDir, mprGetAppName, mprGetAppPath, mprGetAppTitle, mprGetAppVersion, mprGetCmdlineLogging, mprGetDebugMode, mprGetDomainName, mprGetEndian, mprGetError, mprGetHostName, mprGetIpAddr, mprGetLogLevel, mprGetMD5, mprGetMD5WithPrefix, mprGetOsError, mprGetRandomBytes, mprGetServerName, mprIsExiting, mprIsFinished, mprIsIdle, mprIsStopping, mprIsStoppingCore, mprMakeArgv, mprRandom, mprRestart, mprServicesAreIdle, mprSetAppName, mprSetCmdlineLogging, mprSetDebugMode, mprSetDomainName, mprSetExitStrategy, mprSetHostName, mprSetIdleCallback, mprSetIpAddr, mprSetLogLevel, mprSetServerName, mprShouldAbortRequests, mprShouldDenyNewRequests, mprSleep, mprStart, mprStartEventsThread, mprStartOsService, mprStopOsService, mprTerminate, mprUriDecode, mprUriEncode, mprWaitTillIdle
char * mprEncode64Block (cchar *buf, ssize len)

Encode buffer using base-46 encoding.

Parameters:
bufBuffer to encode.
lenLength of the buffer to encode.
Returns:
Buffer containing the encoded string.
API Stability:
Stable.
See Also:
mprAddTerminator, mprBreakpoint, mprCreate, mprCreateOsService, mprDecode64, mprDestroy, mprEmptyString, mprEncode64, mprEscapeCmd, mprGetAppDir, mprGetAppName, mprGetAppPath, mprGetAppTitle, mprGetAppVersion, mprGetCmdlineLogging, mprGetDebugMode, mprGetDomainName, mprGetEndian, mprGetError, mprGetHostName, mprGetIpAddr, mprGetLogLevel, mprGetMD5, mprGetMD5WithPrefix, mprGetOsError, mprGetRandomBytes, mprGetServerName, mprIsExiting, mprIsFinished, mprIsIdle, mprIsStopping, mprIsStoppingCore, mprMakeArgv, mprRandom, mprRestart, mprServicesAreIdle, mprSetAppName, mprSetCmdlineLogging, mprSetDebugMode, mprSetDomainName, mprSetExitStrategy, mprSetHostName, mprSetIdleCallback, mprSetIpAddr, mprSetLogLevel, mprSetServerName, mprShouldAbortRequests, mprShouldDenyNewRequests, mprSleep, mprStart, mprStartEventsThread, mprStartOsService, mprStopOsService, mprTerminate, mprUriDecode, mprUriEncode, mprWaitTillIdle
char * mprEscapeCmd (cchar *cmd, int escChar)

Encode a string escaping typical command (shell) characters.

Description:
Encode a string escaping all dangerous characters that have meaning for the unix or MS-DOS command shells.
Parameters:
cmdCommand string to encode.
escCharEscape character to use when encoding the command.
Returns:
An allocated string containing the escaped command.
API Stability:
Stable.
See Also:
mprAddTerminator, mprBreakpoint, mprCreate, mprCreateOsService, mprDecode64, mprDestroy, mprEmptyString, mprEncode64, mprGetAppDir, mprGetAppName, mprGetAppPath, mprGetAppTitle, mprGetAppVersion, mprGetCmdlineLogging, mprGetDebugMode, mprGetDomainName, mprGetEndian, mprGetError, mprGetHostName, mprGetIpAddr, mprGetLogLevel, mprGetMD5, mprGetMD5WithPrefix, mprGetOsError, mprGetRandomBytes, mprGetServerName, mprIsExiting, mprIsFinished, mprIsIdle, mprIsStopping, mprIsStoppingCore, mprMakeArgv, mprRandom, mprRestart, mprServicesAreIdle, mprSetAppName, mprSetCmdlineLogging, mprSetDebugMode, mprSetDomainName, mprSetExitStrategy, mprSetHostName, mprSetIdleCallback, mprSetIpAddr, mprSetLogLevel, mprSetServerName, mprShouldAbortRequests, mprShouldDenyNewRequests, mprSleep, mprStart, mprStartEventsThread, mprStartOsService, mprStopOsService, mprTerminate, mprUriDecode, mprUriEncode, mprWaitTillIdle
char * mprEscapeHtml (cchar *html)

Encode a string by escaping typical HTML characters.

Description:
Encode a string escaping all dangerous characters that have meaning in HTML documents.
Parameters:
htmlHTML content to encode.
Returns:
An allocated string containing the escaped HTML.
API Stability:
Stable.
See Also:
mprAddTerminator, mprBreakpoint, mprCreate, mprCreateOsService, mprDecode64, mprDestroy, mprEmptyString, mprEncode64, mprEscapeCmd, mprGetAppDir, mprGetAppName, mprGetAppPath, mprGetAppTitle, mprGetAppVersion, mprGetCmdlineLogging, mprGetDebugMode, mprGetDomainName, mprGetEndian, mprGetError, mprGetHostName, mprGetIpAddr, mprGetLogLevel, mprGetMD5, mprGetMD5WithPrefix, mprGetOsError, mprGetRandomBytes, mprGetServerName, mprIsExiting, mprIsFinished, mprIsIdle, mprIsStopping, mprIsStoppingCore, mprMakeArgv, mprRandom, mprRestart, mprServicesAreIdle, mprSetAppName, mprSetCmdlineLogging, mprSetDebugMode, mprSetDomainName, mprSetExitStrategy, mprSetHostName, mprSetIdleCallback, mprSetIpAddr, mprSetLogLevel, mprSetServerName, mprShouldAbortRequests, mprShouldDenyNewRequests, mprSleep, mprStart, mprStartEventsThread, mprStartOsService, mprStopOsService, mprTerminate, mprUriDecode, mprUriEncode, mprWaitTillIdle
char * mprGetAppDir ()

Get the application directory.

Description:
Get the directory containing the application executable.
Returns:
A string containing the application directory.
API Stability:
Stable.
See Also:
mprAddTerminator, mprBreakpoint, mprCreate, mprCreateOsService, mprDecode64, mprDestroy, mprEmptyString, mprEncode64, mprEscapeCmd, mprGetAppName, mprGetAppPath, mprGetAppTitle, mprGetAppVersion, mprGetCmdlineLogging, mprGetDebugMode, mprGetDomainName, mprGetEndian, mprGetError, mprGetHostName, mprGetIpAddr, mprGetLogLevel, mprGetMD5, mprGetMD5WithPrefix, mprGetOsError, mprGetRandomBytes, mprGetServerName, mprIsExiting, mprIsFinished, mprIsIdle, mprIsStopping, mprIsStoppingCore, mprMakeArgv, mprRandom, mprRestart, mprServicesAreIdle, mprSetAppName, mprSetCmdlineLogging, mprSetDebugMode, mprSetDomainName, mprSetExitStrategy, mprSetHostName, mprSetIdleCallback, mprSetIpAddr, mprSetLogLevel, mprSetServerName, mprShouldAbortRequests, mprShouldDenyNewRequests, mprSleep, mprStart, mprStartEventsThread, mprStartOsService, mprStopOsService, mprTerminate, mprUriDecode, mprUriEncode, mprWaitTillIdle
cchar * mprGetAppName ()

Get the application name defined via mprSetAppName.

Returns:
The one-word lower case application name defined via mprSetAppName.
API Stability:
Stable.
See Also:
mprAddTerminator, mprBreakpoint, mprCreate, mprCreateOsService, mprDecode64, mprDestroy, mprEmptyString, mprEncode64, mprEscapeCmd, mprGetAppDir, mprGetAppPath, mprGetAppTitle, mprGetAppVersion, mprGetCmdlineLogging, mprGetDebugMode, mprGetDomainName, mprGetEndian, mprGetError, mprGetHostName, mprGetIpAddr, mprGetLogLevel, mprGetMD5, mprGetMD5WithPrefix, mprGetOsError, mprGetRandomBytes, mprGetServerName, mprIsExiting, mprIsFinished, mprIsIdle, mprIsStopping, mprIsStoppingCore, mprMakeArgv, mprRandom, mprRestart, mprServicesAreIdle, mprSetAppName, mprSetCmdlineLogging, mprSetDebugMode, mprSetDomainName, mprSetExitStrategy, mprSetHostName, mprSetIdleCallback, mprSetIpAddr, mprSetLogLevel, mprSetServerName, mprShouldAbortRequests, mprShouldDenyNewRequests, mprSleep, mprStart, mprStartEventsThread, mprStartOsService, mprStopOsService, mprTerminate, mprUriDecode, mprUriEncode, mprWaitTillIdle
char * mprGetAppPath ()

Get the application executable path.

Returns:
A string containing the application executable path.
API Stability:
Stable.
See Also:
mprAddTerminator, mprBreakpoint, mprCreate, mprCreateOsService, mprDecode64, mprDestroy, mprEmptyString, mprEncode64, mprEscapeCmd, mprGetAppDir, mprGetAppName, mprGetAppTitle, mprGetAppVersion, mprGetCmdlineLogging, mprGetDebugMode, mprGetDomainName, mprGetEndian, mprGetError, mprGetHostName, mprGetIpAddr, mprGetLogLevel, mprGetMD5, mprGetMD5WithPrefix, mprGetOsError, mprGetRandomBytes, mprGetServerName, mprIsExiting, mprIsFinished, mprIsIdle, mprIsStopping, mprIsStoppingCore, mprMakeArgv, mprRandom, mprRestart, mprServicesAreIdle, mprSetAppName, mprSetCmdlineLogging, mprSetDebugMode, mprSetDomainName, mprSetExitStrategy, mprSetHostName, mprSetIdleCallback, mprSetIpAddr, mprSetLogLevel, mprSetServerName, mprShouldAbortRequests, mprShouldDenyNewRequests, mprSleep, mprStart, mprStartEventsThread, mprStartOsService, mprStopOsService, mprTerminate, mprUriDecode, mprUriEncode, mprWaitTillIdle
cchar * mprGetAppTitle ()

Get the application title string.

Returns:
A string containing the application title string.
API Stability:
Stable.
See Also:
mprAddTerminator, mprBreakpoint, mprCreate, mprCreateOsService, mprDecode64, mprDestroy, mprEmptyString, mprEncode64, mprEscapeCmd, mprGetAppDir, mprGetAppName, mprGetAppPath, mprGetAppVersion, mprGetCmdlineLogging, mprGetDebugMode, mprGetDomainName, mprGetEndian, mprGetError, mprGetHostName, mprGetIpAddr, mprGetLogLevel, mprGetMD5, mprGetMD5WithPrefix, mprGetOsError, mprGetRandomBytes, mprGetServerName, mprIsExiting, mprIsFinished, mprIsIdle, mprIsStopping, mprIsStoppingCore, mprMakeArgv, mprRandom, mprRestart, mprServicesAreIdle, mprSetAppName, mprSetCmdlineLogging, mprSetDebugMode, mprSetDomainName, mprSetExitStrategy, mprSetHostName, mprSetIdleCallback, mprSetIpAddr, mprSetLogLevel, mprSetServerName, mprShouldAbortRequests, mprShouldDenyNewRequests, mprSleep, mprStart, mprStartEventsThread, mprStartOsService, mprStopOsService, mprTerminate, mprUriDecode, mprUriEncode, mprWaitTillIdle
cchar * mprGetAppVersion ()

Get the application version string.

Returns:
A string containing the application version string.
API Stability:
Stable.
See Also:
mprAddTerminator, mprBreakpoint, mprCreate, mprCreateOsService, mprDecode64, mprDestroy, mprEmptyString, mprEncode64, mprEscapeCmd, mprGetAppDir, mprGetAppName, mprGetAppPath, mprGetAppTitle, mprGetCmdlineLogging, mprGetDebugMode, mprGetDomainName, mprGetEndian, mprGetError, mprGetHostName, mprGetIpAddr, mprGetLogLevel, mprGetMD5, mprGetMD5WithPrefix, mprGetOsError, mprGetRandomBytes, mprGetServerName, mprIsExiting, mprIsFinished, mprIsIdle, mprIsStopping, mprIsStoppingCore, mprMakeArgv, mprRandom, mprRestart, mprServicesAreIdle, mprSetAppName, mprSetCmdlineLogging, mprSetDebugMode, mprSetDomainName, mprSetExitStrategy, mprSetHostName, mprSetIdleCallback, mprSetIpAddr, mprSetLogLevel, mprSetServerName, mprShouldAbortRequests, mprShouldDenyNewRequests, mprSleep, mprStart, mprStartEventsThread, mprStartOsService, mprStopOsService, mprTerminate, mprUriDecode, mprUriEncode, mprWaitTillIdle
bool mprGetCmdlineLogging ()

Get if command line logging is being used.

Description:
Logging may be initiated by invoking an MPR based program with a "&ndash;log" switch. This API assists programs to tell the MPR that command line logging has been used.
Returns:
True if command line logging is in use.
API Stability:
Evolving.
See Also:
mprAddTerminator, mprBreakpoint, mprCreate, mprCreateOsService, mprDecode64, mprDestroy, mprEmptyString, mprEncode64, mprEscapeCmd, mprGetAppDir, mprGetAppName, mprGetAppPath, mprGetAppTitle, mprGetAppVersion, mprGetDebugMode, mprGetDomainName, mprGetEndian, mprGetError, mprGetHostName, mprGetIpAddr, mprGetLogLevel, mprGetMD5, mprGetMD5WithPrefix, mprGetOsError, mprGetRandomBytes, mprGetServerName, mprIsExiting, mprIsFinished, mprIsIdle, mprIsStopping, mprIsStoppingCore, mprMakeArgv, mprRandom, mprRestart, mprServicesAreIdle, mprSetAppName, mprSetCmdlineLogging, mprSetDebugMode, mprSetDomainName, mprSetExitStrategy, mprSetHostName, mprSetIdleCallback, mprSetIpAddr, mprSetLogLevel, mprSetServerName, mprShouldAbortRequests, mprShouldDenyNewRequests, mprSleep, mprStart, mprStartEventsThread, mprStartOsService, mprStopOsService, mprTerminate, mprUriDecode, mprUriEncode, mprWaitTillIdle
bool mprGetDebugMode ()

Get the debug mode.

Description:
Returns whether the debug mode is enabled. Some modules observe debug mode and disable timeouts and timers so that single-step debugging can be used.
Returns:
Returns true if debug mode is enabled, otherwise returns false.
API Stability:
Stable.
See Also:
mprAddTerminator, mprBreakpoint, mprCreate, mprCreateOsService, mprDecode64, mprDestroy, mprEmptyString, mprEncode64, mprEscapeCmd, mprGetAppDir, mprGetAppName, mprGetAppPath, mprGetAppTitle, mprGetAppVersion, mprGetCmdlineLogging, mprGetDomainName, mprGetEndian, mprGetError, mprGetHostName, mprGetIpAddr, mprGetLogLevel, mprGetMD5, mprGetMD5WithPrefix, mprGetOsError, mprGetRandomBytes, mprGetServerName, mprIsExiting, mprIsFinished, mprIsIdle, mprIsStopping, mprIsStoppingCore, mprMakeArgv, mprRandom, mprRestart, mprServicesAreIdle, mprSetAppName, mprSetCmdlineLogging, mprSetDebugMode, mprSetDomainName, mprSetExitStrategy, mprSetHostName, mprSetIdleCallback, mprSetIpAddr, mprSetLogLevel, mprSetServerName, mprShouldAbortRequests, mprShouldDenyNewRequests, mprSleep, mprStart, mprStartEventsThread, mprStartOsService, mprStopOsService, mprTerminate, mprUriDecode, mprUriEncode, mprWaitTillIdle
cchar * mprGetDomainName ()

Get the application domain name string.

Returns:
A string containing the application domain name string.
API Stability:
Stable.
See Also:
mprAddTerminator, mprBreakpoint, mprCreate, mprCreateOsService, mprDecode64, mprDestroy, mprEmptyString, mprEncode64, mprEscapeCmd, mprGetAppDir, mprGetAppName, mprGetAppPath, mprGetAppTitle, mprGetAppVersion, mprGetCmdlineLogging, mprGetDebugMode, mprGetEndian, mprGetError, mprGetHostName, mprGetIpAddr, mprGetLogLevel, mprGetMD5, mprGetMD5WithPrefix, mprGetOsError, mprGetRandomBytes, mprGetServerName, mprIsExiting, mprIsFinished, mprIsIdle, mprIsStopping, mprIsStoppingCore, mprMakeArgv, mprRandom, mprRestart, mprServicesAreIdle, mprSetAppName, mprSetCmdlineLogging, mprSetDebugMode, mprSetDomainName, mprSetExitStrategy, mprSetHostName, mprSetIdleCallback, mprSetIpAddr, mprSetLogLevel, mprSetServerName, mprShouldAbortRequests, mprShouldDenyNewRequests, mprSleep, mprStart, mprStartEventsThread, mprStartOsService, mprStopOsService, mprTerminate, mprUriDecode, mprUriEncode, mprWaitTillIdle
int mprGetEndian ()

Return the endian byte ordering for the application.

Returns:
MPR_LITTLE_ENDIAN or MPR_BIG_ENDIAN.
API Stability:
Stable.
See Also:
mprAddTerminator, mprBreakpoint, mprCreate, mprCreateOsService, mprDecode64, mprDestroy, mprEmptyString, mprEncode64, mprEscapeCmd, mprGetAppDir, mprGetAppName, mprGetAppPath, mprGetAppTitle, mprGetAppVersion, mprGetCmdlineLogging, mprGetDebugMode, mprGetDomainName, mprGetError, mprGetHostName, mprGetIpAddr, mprGetLogLevel, mprGetMD5, mprGetMD5WithPrefix, mprGetOsError, mprGetRandomBytes, mprGetServerName, mprIsExiting, mprIsFinished, mprIsIdle, mprIsStopping, mprIsStoppingCore, mprMakeArgv, mprRandom, mprRestart, mprServicesAreIdle, mprSetAppName, mprSetCmdlineLogging, mprSetDebugMode, mprSetDomainName, mprSetExitStrategy, mprSetHostName, mprSetIdleCallback, mprSetIpAddr, mprSetLogLevel, mprSetServerName, mprShouldAbortRequests, mprShouldDenyNewRequests, mprSleep, mprStart, mprStartEventsThread, mprStartOsService, mprStopOsService, mprTerminate, mprUriDecode, mprUriEncode, mprWaitTillIdle
int mprGetError ()

Return the error code for the most recent system or library operation.

Description:
Returns an error code from the most recent system call. This will be mapped to be either a POSIX error code or an MPR error code.
Returns:
The mapped error code.
API Stability:
Stable.
See Also:
mprAddTerminator, mprBreakpoint, mprCreate, mprCreateOsService, mprDecode64, mprDestroy, mprEmptyString, mprEncode64, mprEscapeCmd, mprGetAppDir, mprGetAppName, mprGetAppPath, mprGetAppTitle, mprGetAppVersion, mprGetCmdlineLogging, mprGetDebugMode, mprGetDomainName, mprGetEndian, mprGetHostName, mprGetIpAddr, mprGetLogLevel, mprGetMD5, mprGetMD5WithPrefix, mprGetOsError, mprGetRandomBytes, mprGetServerName, mprIsExiting, mprIsFinished, mprIsIdle, mprIsStopping, mprIsStoppingCore, mprMakeArgv, mprRandom, mprRestart, mprServicesAreIdle, mprSetAppName, mprSetCmdlineLogging, mprSetDebugMode, mprSetDomainName, mprSetExitStrategy, mprSetHostName, mprSetIdleCallback, mprSetIpAddr, mprSetLogLevel, mprSetServerName, mprShouldAbortRequests, mprShouldDenyNewRequests, mprSleep, mprStart, mprStartEventsThread, mprStartOsService, mprStopOsService, mprTerminate, mprUriDecode, mprUriEncode, mprWaitTillIdle
int mprGetExitStatus ()

Get the exit status.

Description:
Get the exit status set via mprTerminate()
Returns:
The proposed application exit status.
API Stability:
Stable.
See Also:
mprAddTerminator, mprBreakpoint, mprCreate, mprCreateOsService, mprDecode64, mprDestroy, mprEmptyString, mprEncode64, mprEscapeCmd, mprGetAppDir, mprGetAppName, mprGetAppPath, mprGetAppTitle, mprGetAppVersion, mprGetCmdlineLogging, mprGetDebugMode, mprGetDomainName, mprGetEndian, mprGetError, mprGetHostName, mprGetIpAddr, mprGetLogLevel, mprGetMD5, mprGetMD5WithPrefix, mprGetOsError, mprGetRandomBytes, mprGetServerName, mprIsExiting, mprIsFinished, mprIsIdle, mprIsStopping, mprIsStoppingCore, mprMakeArgv, mprRandom, mprRestart, mprServicesAreIdle, mprSetAppName, mprSetCmdlineLogging, mprSetDebugMode, mprSetDomainName, mprSetExitStrategy, mprSetHostName, mprSetIdleCallback, mprSetIpAddr, mprSetLogLevel, mprSetServerName, mprShouldAbortRequests, mprShouldDenyNewRequests, mprSleep, mprStart, mprStartEventsThread, mprStartOsService, mprStopOsService, mprTerminate, mprUriDecode, mprUriEncode, mprWaitTillIdle
cchar * mprGetHostName ()

Get the application host name string.

Returns:
A string containing the application host name string.
API Stability:
Stable.
See Also:
mprAddTerminator, mprBreakpoint, mprCreate, mprCreateOsService, mprDecode64, mprDestroy, mprEmptyString, mprEncode64, mprEscapeCmd, mprGetAppDir, mprGetAppName, mprGetAppPath, mprGetAppTitle, mprGetAppVersion, mprGetCmdlineLogging, mprGetDebugMode, mprGetDomainName, mprGetEndian, mprGetError, mprGetIpAddr, mprGetLogLevel, mprGetMD5, mprGetMD5WithPrefix, mprGetOsError, mprGetRandomBytes, mprGetServerName, mprIsExiting, mprIsFinished, mprIsIdle, mprIsStopping, mprIsStoppingCore, mprMakeArgv, mprRandom, mprRestart, mprServicesAreIdle, mprSetAppName, mprSetCmdlineLogging, mprSetDebugMode, mprSetDomainName, mprSetExitStrategy, mprSetHostName, mprSetIdleCallback, mprSetIpAddr, mprSetLogLevel, mprSetServerName, mprShouldAbortRequests, mprShouldDenyNewRequests, mprSleep, mprStart, mprStartEventsThread, mprStartOsService, mprStopOsService, mprTerminate, mprUriDecode, mprUriEncode, mprWaitTillIdle
cchar * mprGetIpAddr ()

Get the application IP address string.

Returns:
A string containing the application IP address string.
API Stability:
Stable.
See Also:
mprAddTerminator, mprBreakpoint, mprCreate, mprCreateOsService, mprDecode64, mprDestroy, mprEmptyString, mprEncode64, mprEscapeCmd, mprGetAppDir, mprGetAppName, mprGetAppPath, mprGetAppTitle, mprGetAppVersion, mprGetCmdlineLogging, mprGetDebugMode, mprGetDomainName, mprGetEndian, mprGetError, mprGetHostName, mprGetLogLevel, mprGetMD5, mprGetMD5WithPrefix, mprGetOsError, mprGetRandomBytes, mprGetServerName, mprIsExiting, mprIsFinished, mprIsIdle, mprIsStopping, mprIsStoppingCore, mprMakeArgv, mprRandom, mprRestart, mprServicesAreIdle, mprSetAppName, mprSetCmdlineLogging, mprSetDebugMode, mprSetDomainName, mprSetExitStrategy, mprSetHostName, mprSetIdleCallback, mprSetIpAddr, mprSetLogLevel, mprSetServerName, mprShouldAbortRequests, mprShouldDenyNewRequests, mprSleep, mprStart, mprStartEventsThread, mprStartOsService, mprStopOsService, mprTerminate, mprUriDecode, mprUriEncode, mprWaitTillIdle
int mprGetLogLevel ()

Get the current logging level.

Returns:
The current log level.
API Stability:
Stable.
See Also:
mprAddTerminator, mprBreakpoint, mprCreate, mprCreateOsService, mprDecode64, mprDestroy, mprEmptyString, mprEncode64, mprEscapeCmd, mprGetAppDir, mprGetAppName, mprGetAppPath, mprGetAppTitle, mprGetAppVersion, mprGetCmdlineLogging, mprGetDebugMode, mprGetDomainName, mprGetEndian, mprGetError, mprGetHostName, mprGetIpAddr, mprGetMD5, mprGetMD5WithPrefix, mprGetOsError, mprGetRandomBytes, mprGetServerName, mprIsExiting, mprIsFinished, mprIsIdle, mprIsStopping, mprIsStoppingCore, mprMakeArgv, mprRandom, mprRestart, mprServicesAreIdle, mprSetAppName, mprSetCmdlineLogging, mprSetDebugMode, mprSetDomainName, mprSetExitStrategy, mprSetHostName, mprSetIdleCallback, mprSetIpAddr, mprSetLogLevel, mprSetServerName, mprShouldAbortRequests, mprShouldDenyNewRequests, mprSleep, mprStart, mprStartEventsThread, mprStartOsService, mprStopOsService, mprTerminate, mprUriDecode, mprUriEncode, mprWaitTillIdle
char * mprGetMD5 (cchar *str)

Get an MD5 checksum.

Parameters:
strString to examine.
Returns:
An allocated MD5 checksum string.
API Stability:
Stable.
See Also:
mprAddTerminator, mprBreakpoint, mprCreate, mprCreateOsService, mprDecode64, mprDestroy, mprEmptyString, mprEncode64, mprEscapeCmd, mprGetAppDir, mprGetAppName, mprGetAppPath, mprGetAppTitle, mprGetAppVersion, mprGetCmdlineLogging, mprGetDebugMode, mprGetDomainName, mprGetEndian, mprGetError, mprGetHostName, mprGetIpAddr, mprGetLogLevel, mprGetMD5WithPrefix, mprGetOsError, mprGetRandomBytes, mprGetServerName, mprIsExiting, mprIsFinished, mprIsIdle, mprIsStopping, mprIsStoppingCore, mprMakeArgv, mprRandom, mprRestart, mprServicesAreIdle, mprSetAppName, mprSetCmdlineLogging, mprSetDebugMode, mprSetDomainName, mprSetExitStrategy, mprSetHostName, mprSetIdleCallback, mprSetIpAddr, mprSetLogLevel, mprSetServerName, mprShouldAbortRequests, mprShouldDenyNewRequests, mprSleep, mprStart, mprStartEventsThread, mprStartOsService, mprStopOsService, mprTerminate, mprUriDecode, mprUriEncode, mprWaitTillIdle
char * mprGetMD5WithPrefix (cchar *buf, ssize len, cchar *prefix)

Get an MD5 checksum with optional prefix string and buffer length.

Parameters:
bufBuffer to checksum.
lenSize of the buffer.
prefixString prefix to insert at the start of the result.
Returns:
An allocated MD5 checksum string.
API Stability:
Stable.
See Also:
mprAddTerminator, mprBreakpoint, mprCreate, mprCreateOsService, mprDecode64, mprDestroy, mprEmptyString, mprEncode64, mprEscapeCmd, mprGetAppDir, mprGetAppName, mprGetAppPath, mprGetAppTitle, mprGetAppVersion, mprGetCmdlineLogging, mprGetDebugMode, mprGetDomainName, mprGetEndian, mprGetError, mprGetHostName, mprGetIpAddr, mprGetLogLevel, mprGetMD5, mprGetOsError, mprGetRandomBytes, mprGetServerName, mprIsExiting, mprIsFinished, mprIsIdle, mprIsStopping, mprIsStoppingCore, mprMakeArgv, mprRandom, mprRestart, mprServicesAreIdle, mprSetAppName, mprSetCmdlineLogging, mprSetDebugMode, mprSetDomainName, mprSetExitStrategy, mprSetHostName, mprSetIdleCallback, mprSetIpAddr, mprSetLogLevel, mprSetServerName, mprShouldAbortRequests, mprShouldDenyNewRequests, mprSleep, mprStart, mprStartEventsThread, mprStartOsService, mprStopOsService, mprTerminate, mprUriDecode, mprUriEncode, mprWaitTillIdle
Mpr * mprGetMpr ()

Return the MPR control instance.

Description:
Return the MPR singleton control object.
Returns:
The MPR control object.
API Stability:
Stable.
See Also:
mprAddTerminator, mprBreakpoint, mprCreate, mprCreateOsService, mprDecode64, mprDestroy, mprEmptyString, mprEncode64, mprEscapeCmd, mprGetAppDir, mprGetAppName, mprGetAppPath, mprGetAppTitle, mprGetAppVersion, mprGetCmdlineLogging, mprGetDebugMode, mprGetDomainName, mprGetEndian, mprGetError, mprGetHostName, mprGetIpAddr, mprGetLogLevel, mprGetMD5, mprGetMD5WithPrefix, mprGetOsError, mprGetRandomBytes, mprGetServerName, mprIsExiting, mprIsFinished, mprIsIdle, mprIsStopping, mprIsStoppingCore, mprMakeArgv, mprRandom, mprRestart, mprServicesAreIdle, mprSetAppName, mprSetCmdlineLogging, mprSetDebugMode, mprSetDomainName, mprSetExitStrategy, mprSetHostName, mprSetIdleCallback, mprSetIpAddr, mprSetLogLevel, mprSetServerName, mprShouldAbortRequests, mprShouldDenyNewRequests, mprSleep, mprStart, mprStartEventsThread, mprStartOsService, mprStopOsService, mprTerminate, mprUriDecode, mprUriEncode, mprWaitTillIdle
int mprGetOsError ()

Return the O/S error code.

Description:
Returns an O/S error code from the most recent system call. This returns errno on Unix systems or GetLastError() on Windows.
Returns:
The O/S error code.
API Stability:
Stable.
See Also:
mprAddTerminator, mprBreakpoint, mprCreate, mprCreateOsService, mprDecode64, mprDestroy, mprEmptyString, mprEncode64, mprEscapeCmd, mprGetAppDir, mprGetAppName, mprGetAppPath, mprGetAppTitle, mprGetAppVersion, mprGetCmdlineLogging, mprGetDebugMode, mprGetDomainName, mprGetEndian, mprGetError, mprGetHostName, mprGetIpAddr, mprGetLogLevel, mprGetMD5, mprGetMD5WithPrefix, mprGetRandomBytes, mprGetServerName, mprIsExiting, mprIsFinished, mprIsIdle, mprIsStopping, mprIsStoppingCore, mprMakeArgv, mprRandom, mprRestart, mprServicesAreIdle, mprSetAppName, mprSetCmdlineLogging, mprSetDebugMode, mprSetDomainName, mprSetExitStrategy, mprSetHostName, mprSetIdleCallback, mprSetIpAddr, mprSetLogLevel, mprSetServerName, mprShouldAbortRequests, mprShouldDenyNewRequests, mprSleep, mprStart, mprStartEventsThread, mprStartOsService, mprStopOsService, mprTerminate, mprUriDecode, mprUriEncode, mprWaitTillIdle
int mprGetRandomBytes (char *buf, ssize size, bool block)

Get some random data.

Parameters:
bufReference to a buffer to hold the random data.
sizeSize of the buffer.
blockSet to true if it is acceptable to block while accumulating entropy sufficient to provide good random data. Setting to false will cause this API to not block and may return random data of a lower quality.
API Stability:
Stable.
See Also:
mprAddTerminator, mprBreakpoint, mprCreate, mprCreateOsService, mprDecode64, mprDestroy, mprEmptyString, mprEncode64, mprEscapeCmd, mprGetAppDir, mprGetAppName, mprGetAppPath, mprGetAppTitle, mprGetAppVersion, mprGetCmdlineLogging, mprGetDebugMode, mprGetDomainName, mprGetEndian, mprGetError, mprGetHostName, mprGetIpAddr, mprGetLogLevel, mprGetMD5, mprGetMD5WithPrefix, mprGetOsError, mprGetServerName, mprIsExiting, mprIsFinished, mprIsIdle, mprIsStopping, mprIsStoppingCore, mprMakeArgv, mprRandom, mprRestart, mprServicesAreIdle, mprSetAppName, mprSetCmdlineLogging, mprSetDebugMode, mprSetDomainName, mprSetExitStrategy, mprSetHostName, mprSetIdleCallback, mprSetIpAddr, mprSetLogLevel, mprSetServerName, mprShouldAbortRequests, mprShouldDenyNewRequests, mprSleep, mprStart, mprStartEventsThread, mprStartOsService, mprStopOsService, mprTerminate, mprUriDecode, mprUriEncode, mprWaitTillIdle
cchar * mprGetServerName ()

Get the application server name string.

Returns:
A string containing the application server name string.
API Stability:
Stable.
See Also:
mprAddTerminator, mprBreakpoint, mprCreate, mprCreateOsService, mprDecode64, mprDestroy, mprEmptyString, mprEncode64, mprEscapeCmd, mprGetAppDir, mprGetAppName, mprGetAppPath, mprGetAppTitle, mprGetAppVersion, mprGetCmdlineLogging, mprGetDebugMode, mprGetDomainName, mprGetEndian, mprGetError, mprGetHostName, mprGetIpAddr, mprGetLogLevel, mprGetMD5, mprGetMD5WithPrefix, mprGetOsError, mprGetRandomBytes, mprIsExiting, mprIsFinished, mprIsIdle, mprIsStopping, mprIsStoppingCore, mprMakeArgv, mprRandom, mprRestart, mprServicesAreIdle, mprSetAppName, mprSetCmdlineLogging, mprSetDebugMode, mprSetDomainName, mprSetExitStrategy, mprSetHostName, mprSetIdleCallback, mprSetIpAddr, mprSetLogLevel, mprSetServerName, mprShouldAbortRequests, mprShouldDenyNewRequests, mprSleep, mprStart, mprStartEventsThread, mprStartOsService, mprStopOsService, mprTerminate, mprUriDecode, mprUriEncode, mprWaitTillIdle
char * mprGetSHA (cchar *str)

Get an SHA1 checksum.

Parameters:
strString to examine.
Returns:
An allocated SHA1 checksum string.
API Stability:
Evolving.
See Also:
mprAddTerminator, mprBreakpoint, mprCreate, mprCreateOsService, mprDecode64, mprDestroy, mprEmptyString, mprEncode64, mprEscapeCmd, mprGetAppDir, mprGetAppName, mprGetAppPath, mprGetAppTitle, mprGetAppVersion, mprGetCmdlineLogging, mprGetDebugMode, mprGetDomainName, mprGetEndian, mprGetError, mprGetHostName, mprGetIpAddr, mprGetLogLevel, mprGetMD5, mprGetMD5WithPrefix, mprGetOsError, mprGetRandomBytes, mprGetServerName, mprIsExiting, mprIsFinished, mprIsIdle, mprIsStopping, mprIsStoppingCore, mprMakeArgv, mprRandom, mprRestart, mprServicesAreIdle, mprSetAppName, mprSetCmdlineLogging, mprSetDebugMode, mprSetDomainName, mprSetExitStrategy, mprSetHostName, mprSetIdleCallback, mprSetIpAddr, mprSetLogLevel, mprSetServerName, mprShouldAbortRequests, mprShouldDenyNewRequests, mprSleep, mprStart, mprStartEventsThread, mprStartOsService, mprStopOsService, mprTerminate, mprUriDecode, mprUriEncode, mprWaitTillIdle
char * mprGetSHABase64 (cchar *str)

Get an SHA1 checksum of a null terminated string.

Parameters:
strString to checksum.
Returns:
An allocated string containing an SHA1 checksum.
API Stability:
Evolving.
See Also:
mprAddTerminator, mprBreakpoint, mprCreate, mprCreateOsService, mprDecode64, mprDestroy, mprEmptyString, mprEncode64, mprEscapeCmd, mprGetAppDir, mprGetAppName, mprGetAppPath, mprGetAppTitle, mprGetAppVersion, mprGetCmdlineLogging, mprGetDebugMode, mprGetDomainName, mprGetEndian, mprGetError, mprGetHostName, mprGetIpAddr, mprGetLogLevel, mprGetMD5, mprGetMD5WithPrefix, mprGetOsError, mprGetRandomBytes, mprGetServerName, mprIsExiting, mprIsFinished, mprIsIdle, mprIsStopping, mprIsStoppingCore, mprMakeArgv, mprRandom, mprRestart, mprServicesAreIdle, mprSetAppName, mprSetCmdlineLogging, mprSetDebugMode, mprSetDomainName, mprSetExitStrategy, mprSetHostName, mprSetIdleCallback, mprSetIpAddr, mprSetLogLevel, mprSetServerName, mprShouldAbortRequests, mprShouldDenyNewRequests, mprSleep, mprStart, mprStartEventsThread, mprStartOsService, mprStopOsService, mprTerminate, mprUriDecode, mprUriEncode, mprWaitTillIdle
char * mprGetSHAWithPrefix (cchar *buf, ssize len, cchar *prefix)

Get an SHA1 checksum with optional prefix string and buffer length.

Parameters:
bufBuffer to checksum.
lenSize of the buffer.
prefixString prefix to insert at the start of the result.
Returns:
An allocated string containing an SHA1 checksum.
API Stability:
Evolving.
See Also:
mprAddTerminator, mprBreakpoint, mprCreate, mprCreateOsService, mprDecode64, mprDestroy, mprEmptyString, mprEncode64, mprEscapeCmd, mprGetAppDir, mprGetAppName, mprGetAppPath, mprGetAppTitle, mprGetAppVersion, mprGetCmdlineLogging, mprGetDebugMode, mprGetDomainName, mprGetEndian, mprGetError, mprGetHostName, mprGetIpAddr, mprGetLogLevel, mprGetMD5, mprGetMD5WithPrefix, mprGetOsError, mprGetRandomBytes, mprGetServerName, mprIsExiting, mprIsFinished, mprIsIdle, mprIsStopping, mprIsStoppingCore, mprMakeArgv, mprRandom, mprRestart, mprServicesAreIdle, mprSetAppName, mprSetCmdlineLogging, mprSetDebugMode, mprSetDomainName, mprSetExitStrategy, mprSetHostName, mprSetIdleCallback, mprSetIpAddr, mprSetLogLevel, mprSetServerName, mprShouldAbortRequests, mprShouldDenyNewRequests, mprSleep, mprStart, mprStartEventsThread, mprStartOsService, mprStopOsService, mprTerminate, mprUriDecode, mprUriEncode, mprWaitTillIdle
bool mprIsExiting ()

Determine if the MPR is exiting.

Description:
Returns true if the MPR is in the process of exiting.
Returns:
True if the App has been instructed to exit.
API Stability:
Stable.
See Also:
mprAddTerminator, mprBreakpoint, mprCreate, mprCreateOsService, mprDecode64, mprDestroy, mprEmptyString, mprEncode64, mprEscapeCmd, mprGetAppDir, mprGetAppName, mprGetAppPath, mprGetAppTitle, mprGetAppVersion, mprGetCmdlineLogging, mprGetDebugMode, mprGetDomainName, mprGetEndian, mprGetError, mprGetHostName, mprGetIpAddr, mprGetLogLevel, mprGetMD5, mprGetMD5WithPrefix, mprGetOsError, mprGetRandomBytes, mprGetServerName, mprIsFinished, mprIsIdle, mprIsStopping, mprIsStoppingCore, mprMakeArgv, mprRandom, mprRestart, mprServicesAreIdle, mprSetAppName, mprSetCmdlineLogging, mprSetDebugMode, mprSetDomainName, mprSetExitStrategy, mprSetHostName, mprSetIdleCallback, mprSetIpAddr, mprSetLogLevel, mprSetServerName, mprShouldAbortRequests, mprShouldDenyNewRequests, mprSleep, mprStart, mprStartEventsThread, mprStartOsService, mprStopOsService, mprTerminate, mprUriDecode, mprUriEncode, mprWaitTillIdle
bool mprIsFinished ()

Determine if the MPR has finished.

Description:
This is true if the MPR services have been shutdown completely. This is typically used to determine if the App has been gracefully shutdown.
Returns:
True if the App has been instructed to exit and all the MPR services have completed.
API Stability:
Stable.
See Also:
mprAddTerminator, mprBreakpoint, mprCreate, mprCreateOsService, mprDecode64, mprDestroy, mprEmptyString, mprEncode64, mprEscapeCmd, mprGetAppDir, mprGetAppName, mprGetAppPath, mprGetAppTitle, mprGetAppVersion, mprGetCmdlineLogging, mprGetDebugMode, mprGetDomainName, mprGetEndian, mprGetError, mprGetHostName, mprGetIpAddr, mprGetLogLevel, mprGetMD5, mprGetMD5WithPrefix, mprGetOsError, mprGetRandomBytes, mprGetServerName, mprIsExiting, mprIsIdle, mprIsStopping, mprIsStoppingCore, mprMakeArgv, mprRandom, mprRestart, mprServicesAreIdle, mprSetAppName, mprSetCmdlineLogging, mprSetDebugMode, mprSetDomainName, mprSetExitStrategy, mprSetHostName, mprSetIdleCallback, mprSetIpAddr, mprSetLogLevel, mprSetServerName, mprShouldAbortRequests, mprShouldDenyNewRequests, mprSleep, mprStart, mprStartEventsThread, mprStartOsService, mprStopOsService, mprTerminate, mprUriDecode, mprUriEncode, mprWaitTillIdle
bool mprIsIdle ()

Determine if the App is idle.

Description:
This call returns true if the App is not currently servicing any requests. By default this returns true if the MPR dispatcher, thread, worker and command subsytems are idle. Callers can replace or augment the standard idle testing by definining a new idle callback via mprSetIdleCallback.
Returns:
True if the App are idle.
API Stability:
Stable.
See Also:
mprAddTerminator, mprBreakpoint, mprCreate, mprCreateOsService, mprDecode64, mprDestroy, mprEmptyString, mprEncode64, mprEscapeCmd, mprGetAppDir, mprGetAppName, mprGetAppPath, mprGetAppTitle, mprGetAppVersion, mprGetCmdlineLogging, mprGetDebugMode, mprGetDomainName, mprGetEndian, mprGetError, mprGetHostName, mprGetIpAddr, mprGetLogLevel, mprGetMD5, mprGetMD5WithPrefix, mprGetOsError, mprGetRandomBytes, mprGetServerName, mprIsExiting, mprIsFinished, mprIsStopping, mprIsStoppingCore, mprMakeArgv, mprRandom, mprRestart, mprServicesAreIdle, mprSetAppName, mprSetCmdlineLogging, mprSetDebugMode, mprSetDomainName, mprSetExitStrategy, mprSetHostName, mprSetIdleCallback, mprSetIpAddr, mprSetLogLevel, mprSetServerName, mprShouldAbortRequests, mprShouldDenyNewRequests, mprSleep, mprStart, mprStartEventsThread, mprStartOsService, mprStopOsService, mprTerminate, mprUriDecode, mprUriEncode, mprWaitTillIdle
bool mprIsStopping ()

Test if the application is stopping.

Returns:
True if the application is in the process of exiting.
API Stability:
Stable.
See Also:
mprAddTerminator, mprBreakpoint, mprCreate, mprCreateOsService, mprDecode64, mprDestroy, mprEmptyString, mprEncode64, mprEscapeCmd, mprGetAppDir, mprGetAppName, mprGetAppPath, mprGetAppTitle, mprGetAppVersion, mprGetCmdlineLogging, mprGetDebugMode, mprGetDomainName, mprGetEndian, mprGetError, mprGetHostName, mprGetIpAddr, mprGetLogLevel, mprGetMD5, mprGetMD5WithPrefix, mprGetOsError, mprGetRandomBytes, mprGetServerName, mprIsExiting, mprIsFinished, mprIsIdle, mprIsStoppingCore, mprMakeArgv, mprRandom, mprRestart, mprServicesAreIdle, mprSetAppName, mprSetCmdlineLogging, mprSetDebugMode, mprSetDomainName, mprSetExitStrategy, mprSetHostName, mprSetIdleCallback, mprSetIpAddr, mprSetLogLevel, mprSetServerName, mprShouldAbortRequests, mprShouldDenyNewRequests, mprSleep, mprStart, mprStartEventsThread, mprStartOsService, mprStopOsService, mprTerminate, mprUriDecode, mprUriEncode, mprWaitTillIdle
bool mprIsStoppingCore ()

Test if the application is stopping and core services are being terminated.

Returns:
True if the application is in the process of exiting and core services should also exit.
API Stability:
Stable.
See Also:
mprAddTerminator, mprBreakpoint, mprCreate, mprCreateOsService, mprDecode64, mprDestroy, mprEmptyString, mprEncode64, mprEscapeCmd, mprGetAppDir, mprGetAppName, mprGetAppPath, mprGetAppTitle, mprGetAppVersion, mprGetCmdlineLogging, mprGetDebugMode, mprGetDomainName, mprGetEndian, mprGetError, mprGetHostName, mprGetIpAddr, mprGetLogLevel, mprGetMD5, mprGetMD5WithPrefix, mprGetOsError, mprGetRandomBytes, mprGetServerName, mprIsExiting, mprIsFinished, mprIsIdle, mprIsStopping, mprMakeArgv, mprRandom, mprRestart, mprServicesAreIdle, mprSetAppName, mprSetCmdlineLogging, mprSetDebugMode, mprSetDomainName, mprSetExitStrategy, mprSetHostName, mprSetIdleCallback, mprSetIpAddr, mprSetLogLevel, mprSetServerName, mprShouldAbortRequests, mprShouldDenyNewRequests, mprSleep, mprStart, mprStartEventsThread, mprStartOsService, mprStopOsService, mprTerminate, mprUriDecode, mprUriEncode, mprWaitTillIdle
int mprMakeArgv (cchar *command, cchar ***argv, int flags)

Make a argv style array of command arguments.

Description:
The given command is parsed and broken into separate arguments and returned in a null-terminated, argv array. Arguments in the command may be quoted with single or double quotes to group words into one argument. Use back-quote "\\" to escape quotes.
Parameters:
commandCommand string to parse.
argvOutput parameter containing the parsed arguments.
flagsSet to MPR_ARGV_ARGS_ONLY if the command string does not contain a program name. In this case, argv[0] will be set to "".
Returns:
The count of arguments in argv.
API Stability:
Stable.
See Also:
mprAddTerminator, mprBreakpoint, mprCreate, mprCreateOsService, mprDecode64, mprDestroy, mprEmptyString, mprEncode64, mprEscapeCmd, mprGetAppDir, mprGetAppName, mprGetAppPath, mprGetAppTitle, mprGetAppVersion, mprGetCmdlineLogging, mprGetDebugMode, mprGetDomainName, mprGetEndian, mprGetError, mprGetHostName, mprGetIpAddr, mprGetLogLevel, mprGetMD5, mprGetMD5WithPrefix, mprGetOsError, mprGetRandomBytes, mprGetServerName, mprIsExiting, mprIsFinished, mprIsIdle, mprIsStopping, mprIsStoppingCore, mprRandom, mprRestart, mprServicesAreIdle, mprSetAppName, mprSetCmdlineLogging, mprSetDebugMode, mprSetDomainName, mprSetExitStrategy, mprSetHostName, mprSetIdleCallback, mprSetIpAddr, mprSetLogLevel, mprSetServerName, mprShouldAbortRequests, mprShouldDenyNewRequests, mprSleep, mprStart, mprStartEventsThread, mprStartOsService, mprStopOsService, mprTerminate, mprUriDecode, mprUriEncode, mprWaitTillIdle
void mprNap (MprTicks msec)

Nap for a while.

Description:
This routine blocks and does not yield for GC. Only use it for very short naps.
Parameters:
msecNumber of milliseconds to sleep.
API Stability:
Stable.
See Also:
mprAddTerminator, mprBreakpoint, mprCreate, mprCreateOsService, mprDecode64, mprDestroy, mprEmptyString, mprEncode64, mprEscapeCmd, mprGetAppDir, mprGetAppName, mprGetAppPath, mprGetAppTitle, mprGetAppVersion, mprGetCmdlineLogging, mprGetDebugMode, mprGetDomainName, mprGetEndian, mprGetError, mprGetHostName, mprGetIpAddr, mprGetLogLevel, mprGetMD5, mprGetMD5WithPrefix, mprGetOsError, mprGetRandomBytes, mprGetServerName, mprIsExiting, mprIsFinished, mprIsIdle, mprIsStopping, mprIsStoppingCore, mprMakeArgv, mprRandom, mprRestart, mprServicesAreIdle, mprSetAppName, mprSetCmdlineLogging, mprSetDebugMode, mprSetDomainName, mprSetExitStrategy, mprSetHostName, mprSetIdleCallback, mprSetIpAddr, mprSetLogLevel, mprSetServerName, mprShouldAbortRequests, mprShouldDenyNewRequests, mprSleep, mprStart, mprStartEventsThread, mprStartOsService, mprStopOsService, mprTerminate, mprUriDecode, mprUriEncode, mprWaitTillIdle
int mprParseArgs (char *command, char **argv, int maxArgs)

Make a argv style array of command arguments.

Description:
The given command is parsed and broken into separate arguments and returned in a null-terminated, argv array. Arguments in the command may be quoted with single or double quotes to group words into one argument. Use back-quote "\\" to escape quotes. This routine modifies command and does not allocate any memory and may be used before mprCreate is invoked.
Parameters:
commandCommand string to parse.
argvArray for the arguments.
maxArgsSize of the argv array.
Returns:
The count of arguments in argv.
API Stability:
Stable.
See Also:
mprAddTerminator, mprBreakpoint, mprCreate, mprCreateOsService, mprDecode64, mprDestroy, mprEmptyString, mprEncode64, mprEscapeCmd, mprGetAppDir, mprGetAppName, mprGetAppPath, mprGetAppTitle, mprGetAppVersion, mprGetCmdlineLogging, mprGetDebugMode, mprGetDomainName, mprGetEndian, mprGetError, mprGetHostName, mprGetIpAddr, mprGetLogLevel, mprGetMD5, mprGetMD5WithPrefix, mprGetOsError, mprGetRandomBytes, mprGetServerName, mprIsExiting, mprIsFinished, mprIsIdle, mprIsStopping, mprIsStoppingCore, mprMakeArgv, mprRandom, mprRestart, mprServicesAreIdle, mprSetAppName, mprSetCmdlineLogging, mprSetDebugMode, mprSetDomainName, mprSetExitStrategy, mprSetHostName, mprSetIdleCallback, mprSetIpAddr, mprSetLogLevel, mprSetServerName, mprShouldAbortRequests, mprShouldDenyNewRequests, mprSleep, mprStart, mprStartEventsThread, mprStartOsService, mprStopOsService, mprTerminate, mprUriDecode, mprUriEncode, mprWaitTillIdle
int mprRandom ()

Return a random number.

Returns:
A random integer.
API Stability:
Stable.
See Also:
mprAddTerminator, mprBreakpoint, mprCreate, mprCreateOsService, mprDecode64, mprDestroy, mprEmptyString, mprEncode64, mprEscapeCmd, mprGetAppDir, mprGetAppName, mprGetAppPath, mprGetAppTitle, mprGetAppVersion, mprGetCmdlineLogging, mprGetDebugMode, mprGetDomainName, mprGetEndian, mprGetError, mprGetHostName, mprGetIpAddr, mprGetLogLevel, mprGetMD5, mprGetMD5WithPrefix, mprGetOsError, mprGetRandomBytes, mprGetServerName, mprIsExiting, mprIsFinished, mprIsIdle, mprIsStopping, mprIsStoppingCore, mprMakeArgv, mprRestart, mprServicesAreIdle, mprSetAppName, mprSetCmdlineLogging, mprSetDebugMode, mprSetDomainName, mprSetExitStrategy, mprSetHostName, mprSetIdleCallback, mprSetIpAddr, mprSetLogLevel, mprSetServerName, mprShouldAbortRequests, mprShouldDenyNewRequests, mprSleep, mprStart, mprStartEventsThread, mprStartOsService, mprStopOsService, mprTerminate, mprUriDecode, mprUriEncode, mprWaitTillIdle
void mprRestart ()

Restart the application.

Description:
This call immediately restarts the application. The standard input, output and error I/O channels are preserved. All other open file descriptors are closed.
API Stability:
Stable.
See Also:
mprAddTerminator, mprBreakpoint, mprCreate, mprCreateOsService, mprDecode64, mprDestroy, mprEmptyString, mprEncode64, mprEscapeCmd, mprGetAppDir, mprGetAppName, mprGetAppPath, mprGetAppTitle, mprGetAppVersion, mprGetCmdlineLogging, mprGetDebugMode, mprGetDomainName, mprGetEndian, mprGetError, mprGetHostName, mprGetIpAddr, mprGetLogLevel, mprGetMD5, mprGetMD5WithPrefix, mprGetOsError, mprGetRandomBytes, mprGetServerName, mprIsExiting, mprIsFinished, mprIsIdle, mprIsStopping, mprIsStoppingCore, mprMakeArgv, mprRandom, mprServicesAreIdle, mprSetAppName, mprSetCmdlineLogging, mprSetDebugMode, mprSetDomainName, mprSetExitStrategy, mprSetHostName, mprSetIdleCallback, mprSetIpAddr, mprSetLogLevel, mprSetServerName, mprShouldAbortRequests, mprShouldDenyNewRequests, mprSleep, mprStart, mprStartEventsThread, mprStartOsService, mprStopOsService, mprTerminate, mprUriDecode, mprUriEncode, mprWaitTillIdle
bool mprServicesAreIdle ()

Determine if the MPR services.

Description:
This is the default routine invoked by mprIsIdle()
Returns:
True if the MPR services are idle.
API Stability:
Stable.
See Also:
mprAddTerminator, mprBreakpoint, mprCreate, mprCreateOsService, mprDecode64, mprDestroy, mprEmptyString, mprEncode64, mprEscapeCmd, mprGetAppDir, mprGetAppName, mprGetAppPath, mprGetAppTitle, mprGetAppVersion, mprGetCmdlineLogging, mprGetDebugMode, mprGetDomainName, mprGetEndian, mprGetError, mprGetHostName, mprGetIpAddr, mprGetLogLevel, mprGetMD5, mprGetMD5WithPrefix, mprGetOsError, mprGetRandomBytes, mprGetServerName, mprIsExiting, mprIsFinished, mprIsIdle, mprIsStopping, mprIsStoppingCore, mprMakeArgv, mprRandom, mprRestart, mprSetAppName, mprSetCmdlineLogging, mprSetDebugMode, mprSetDomainName, mprSetExitStrategy, mprSetHostName, mprSetIdleCallback, mprSetIpAddr, mprSetLogLevel, mprSetServerName, mprShouldAbortRequests, mprShouldDenyNewRequests, mprSleep, mprStart, mprStartEventsThread, mprStartOsService, mprStopOsService, mprTerminate, mprUriDecode, mprUriEncode, mprWaitTillIdle
int mprSetAppName (cchar *name, cchar *title, cchar *version)

Set the application name, title and version.

Parameters:
nameOne word, lower case name for the app.
titlePascal case multi-word descriptive name.
versionVersion of the app. Major-Minor-Patch. E.g. 1.2.3.
Returns:
Zero if successful. Otherwise a negative MPR error code.
API Stability:
Stable.
See Also:
mprAddTerminator, mprBreakpoint, mprCreate, mprCreateOsService, mprDecode64, mprDestroy, mprEmptyString, mprEncode64, mprEscapeCmd, mprGetAppDir, mprGetAppName, mprGetAppPath, mprGetAppTitle, mprGetAppVersion, mprGetCmdlineLogging, mprGetDebugMode, mprGetDomainName, mprGetEndian, mprGetError, mprGetHostName, mprGetIpAddr, mprGetLogLevel, mprGetMD5, mprGetMD5WithPrefix, mprGetOsError, mprGetRandomBytes, mprGetServerName, mprIsExiting, mprIsFinished, mprIsIdle, mprIsStopping, mprIsStoppingCore, mprMakeArgv, mprRandom, mprRestart, mprServicesAreIdle, mprSetCmdlineLogging, mprSetDebugMode, mprSetDomainName, mprSetExitStrategy, mprSetHostName, mprSetIdleCallback, mprSetIpAddr, mprSetLogLevel, mprSetServerName, mprShouldAbortRequests, mprShouldDenyNewRequests, mprSleep, mprStart, mprStartEventsThread, mprStartOsService, mprStopOsService, mprTerminate, mprUriDecode, mprUriEncode, mprWaitTillIdle
void mprSetAppPath (cchar *path)

Set the application executable path.

Parameters:
pathA string containing the application executable path.
API Stability:
Stable.
See Also:
mprAddTerminator, mprBreakpoint, mprCreate, mprCreateOsService, mprDecode64, mprDestroy, mprEmptyString, mprEncode64, mprEscapeCmd, mprGetAppDir, mprGetAppName, mprGetAppPath, mprGetAppTitle, mprGetAppVersion, mprGetCmdlineLogging, mprGetDebugMode, mprGetDomainName, mprGetEndian, mprGetError, mprGetHostName, mprGetIpAddr, mprGetLogLevel, mprGetMD5, mprGetMD5WithPrefix, mprGetOsError, mprGetRandomBytes, mprGetServerName, mprIsExiting, mprIsFinished, mprIsIdle, mprIsStopping, mprIsStoppingCore, mprMakeArgv, mprRandom, mprRestart, mprServicesAreIdle, mprSetAppName, mprSetCmdlineLogging, mprSetDebugMode, mprSetDomainName, mprSetExitStrategy, mprSetHostName, mprSetIdleCallback, mprSetIpAddr, mprSetLogLevel, mprSetServerName, mprShouldAbortRequests, mprShouldDenyNewRequests, mprSleep, mprStart, mprStartEventsThread, mprStartOsService, mprStopOsService, mprTerminate, mprUriDecode, mprUriEncode, mprWaitTillIdle
bool mprSetCmdlineLogging (bool on)

Set if command line logging was requested.

Description:
Logging may be initiated by invoking an MPR based program with a "&ndash;log" switch. This API assists programs to tell the MPR that command line logging has been used.
Parameters:
onSet to true to indicate command line logging is being used.
Returns:
True if command line logging was enabled before this call.
API Stability:
Stable.
See Also:
mprAddTerminator, mprBreakpoint, mprCreate, mprCreateOsService, mprDecode64, mprDestroy, mprEmptyString, mprEncode64, mprEscapeCmd, mprGetAppDir, mprGetAppName, mprGetAppPath, mprGetAppTitle, mprGetAppVersion, mprGetCmdlineLogging, mprGetDebugMode, mprGetDomainName, mprGetEndian, mprGetError, mprGetHostName, mprGetIpAddr, mprGetLogLevel, mprGetMD5, mprGetMD5WithPrefix, mprGetOsError, mprGetRandomBytes, mprGetServerName, mprIsExiting, mprIsFinished, mprIsIdle, mprIsStopping, mprIsStoppingCore, mprMakeArgv, mprRandom, mprRestart, mprServicesAreIdle, mprSetAppName, mprSetDebugMode, mprSetDomainName, mprSetExitStrategy, mprSetHostName, mprSetIdleCallback, mprSetIpAddr, mprSetLogLevel, mprSetServerName, mprShouldAbortRequests, mprShouldDenyNewRequests, mprSleep, mprStart, mprStartEventsThread, mprStartOsService, mprStopOsService, mprTerminate, mprUriDecode, mprUriEncode, mprWaitTillIdle
void mprSetDebugMode (bool on)

Turn on debug mode.

Description:
Debug mode disables timeouts and timers. This makes debugging much easier.
Parameters:
onSet to true to enable debugging mode.
API Stability:
Stable.
See Also:
mprAddTerminator, mprBreakpoint, mprCreate, mprCreateOsService, mprDecode64, mprDestroy, mprEmptyString, mprEncode64, mprEscapeCmd, mprGetAppDir, mprGetAppName, mprGetAppPath, mprGetAppTitle, mprGetAppVersion, mprGetCmdlineLogging, mprGetDebugMode, mprGetDomainName, mprGetEndian, mprGetError, mprGetHostName, mprGetIpAddr, mprGetLogLevel, mprGetMD5, mprGetMD5WithPrefix, mprGetOsError, mprGetRandomBytes, mprGetServerName, mprIsExiting, mprIsFinished, mprIsIdle, mprIsStopping, mprIsStoppingCore, mprMakeArgv, mprRandom, mprRestart, mprServicesAreIdle, mprSetAppName, mprSetCmdlineLogging, mprSetDomainName, mprSetExitStrategy, mprSetHostName, mprSetIdleCallback, mprSetIpAddr, mprSetLogLevel, mprSetServerName, mprShouldAbortRequests, mprShouldDenyNewRequests, mprSleep, mprStart, mprStartEventsThread, mprStartOsService, mprStopOsService, mprTerminate, mprUriDecode, mprUriEncode, mprWaitTillIdle
void mprSetDomainName (cchar *s)

Set the application domain name string.

Parameters:
sNew value to use for the application domain name.
API Stability:
Stable.
See Also:
mprAddTerminator, mprBreakpoint, mprCreate, mprCreateOsService, mprDecode64, mprDestroy, mprEmptyString, mprEncode64, mprEscapeCmd, mprGetAppDir, mprGetAppName, mprGetAppPath, mprGetAppTitle, mprGetAppVersion, mprGetCmdlineLogging, mprGetDebugMode, mprGetDomainName, mprGetEndian, mprGetError, mprGetHostName, mprGetIpAddr, mprGetLogLevel, mprGetMD5, mprGetMD5WithPrefix, mprGetOsError, mprGetRandomBytes, mprGetServerName, mprIsExiting, mprIsFinished, mprIsIdle, mprIsStopping, mprIsStoppingCore, mprMakeArgv, mprRandom, mprRestart, mprServicesAreIdle, mprSetAppName, mprSetCmdlineLogging, mprSetDebugMode, mprSetExitStrategy, mprSetHostName, mprSetIdleCallback, mprSetIpAddr, mprSetLogLevel, mprSetServerName, mprShouldAbortRequests, mprShouldDenyNewRequests, mprSleep, mprStart, mprStartEventsThread, mprStartOsService, mprStopOsService, mprTerminate, mprUriDecode, mprUriEncode, mprWaitTillIdle
void mprSetEnv (cchar *key, cchar *value)

Set an environment variable value.

Parameters:
keyVariable name.
valueVariable value.
API Stability:
Stable.
See Also:
mprAddTerminator, mprBreakpoint, mprCreate, mprCreateOsService, mprDecode64, mprDestroy, mprEmptyString, mprEncode64, mprEscapeCmd, mprGetAppDir, mprGetAppName, mprGetAppPath, mprGetAppTitle, mprGetAppVersion, mprGetCmdlineLogging, mprGetDebugMode, mprGetDomainName, mprGetEndian, mprGetError, mprGetHostName, mprGetIpAddr, mprGetLogLevel, mprGetMD5, mprGetMD5WithPrefix, mprGetOsError, mprGetRandomBytes, mprGetServerName, mprIsExiting, mprIsFinished, mprIsIdle, mprIsStopping, mprIsStoppingCore, mprMakeArgv, mprRandom, mprRestart, mprServicesAreIdle, mprSetAppName, mprSetCmdlineLogging, mprSetDebugMode, mprSetDomainName, mprSetExitStrategy, mprSetHostName, mprSetIdleCallback, mprSetIpAddr, mprSetLogLevel, mprSetServerName, mprShouldAbortRequests, mprShouldDenyNewRequests, mprSleep, mprStart, mprStartEventsThread, mprStartOsService, mprStopOsService, mprTerminate, mprUriDecode, mprUriEncode, mprWaitTillIdle
void mprSetExitStrategy (int strategy)

Set the exit strategy for when the application terminates.

Parameters:
strategySet strategy to MPR_EXIT_IMMEDIATE for the application to exit immediately when terminated. Set to MPR_EXIT_GRACEFUL for the application to exit gracefully after allowing all current requests to complete before terminating.
API Stability:
Stable.
See Also:
mprAddTerminator, mprBreakpoint, mprCreate, mprCreateOsService, mprDecode64, mprDestroy, mprEmptyString, mprEncode64, mprEscapeCmd, mprGetAppDir, mprGetAppName, mprGetAppPath, mprGetAppTitle, mprGetAppVersion, mprGetCmdlineLogging, mprGetDebugMode, mprGetDomainName, mprGetEndian, mprGetError, mprGetHostName, mprGetIpAddr, mprGetLogLevel, mprGetMD5, mprGetMD5WithPrefix, mprGetOsError, mprGetRandomBytes, mprGetServerName, mprIsExiting, mprIsFinished, mprIsIdle, mprIsStopping, mprIsStoppingCore, mprMakeArgv, mprRandom, mprRestart, mprServicesAreIdle, mprSetAppName, mprSetCmdlineLogging, mprSetDebugMode, mprSetDomainName, mprSetHostName, mprSetIdleCallback, mprSetIpAddr, mprSetLogLevel, mprSetServerName, mprShouldAbortRequests, mprShouldDenyNewRequests, mprSleep, mprStart, mprStartEventsThread, mprStartOsService, mprStopOsService, mprTerminate, mprUriDecode, mprUriEncode, mprWaitTillIdle
void mprSetExitTimeout (MprTicks timeout)

Set the exit timeout for a graceful shutdown or restart.

A graceful shutdown waits for existing requests to complete before exiting
Parameters:
timeoutTime in milliseconds to wait when terminating the MPR.
API Stability:
Stable.
See Also:
mprAddTerminator, mprBreakpoint, mprCreate, mprCreateOsService, mprDecode64, mprDestroy, mprEmptyString, mprEncode64, mprEscapeCmd, mprGetAppDir, mprGetAppName, mprGetAppPath, mprGetAppTitle, mprGetAppVersion, mprGetCmdlineLogging, mprGetDebugMode, mprGetDomainName, mprGetEndian, mprGetError, mprGetHostName, mprGetIpAddr, mprGetLogLevel, mprGetMD5, mprGetMD5WithPrefix, mprGetOsError, mprGetRandomBytes, mprGetServerName, mprIsExiting, mprIsFinished, mprIsIdle, mprIsStopping, mprIsStoppingCore, mprMakeArgv, mprRandom, mprRestart, mprServicesAreIdle, mprSetAppName, mprSetCmdlineLogging, mprSetDebugMode, mprSetDomainName, mprSetExitStrategy, mprSetHostName, mprSetIdleCallback, mprSetIpAddr, mprSetLogLevel, mprSetServerName, mprShouldAbortRequests, mprShouldDenyNewRequests, mprSleep, mprStart, mprStartEventsThread, mprStartOsService, mprStopOsService, mprTerminate, mprUriDecode, mprUriEncode, mprWaitTillIdle
void mprSetFilesLimit (int limit)

Set the maximum number of open file/socket descriptors.

Parameters:
limitLimit to enforce.
API Stability:
Evolving.
See Also:
mprAddTerminator, mprBreakpoint, mprCreate, mprCreateOsService, mprDecode64, mprDestroy, mprEmptyString, mprEncode64, mprEscapeCmd, mprGetAppDir, mprGetAppName, mprGetAppPath, mprGetAppTitle, mprGetAppVersion, mprGetCmdlineLogging, mprGetDebugMode, mprGetDomainName, mprGetEndian, mprGetError, mprGetHostName, mprGetIpAddr, mprGetLogLevel, mprGetMD5, mprGetMD5WithPrefix, mprGetOsError, mprGetRandomBytes, mprGetServerName, mprIsExiting, mprIsFinished, mprIsIdle, mprIsStopping, mprIsStoppingCore, mprMakeArgv, mprRandom, mprRestart, mprServicesAreIdle, mprSetAppName, mprSetCmdlineLogging, mprSetDebugMode, mprSetDomainName, mprSetExitStrategy, mprSetHostName, mprSetIdleCallback, mprSetIpAddr, mprSetLogLevel, mprSetServerName, mprShouldAbortRequests, mprShouldDenyNewRequests, mprSleep, mprStart, mprStartEventsThread, mprStartOsService, mprStopOsService, mprTerminate, mprUriDecode, mprUriEncode, mprWaitTillIdle
void mprSetHostName (cchar *s)

Set the application host name string.

This is internal to the application and does not affect the O/S host name
Parameters:
sNew host name to use within the application.
API Stability:
Stable.
See Also:
mprAddTerminator, mprBreakpoint, mprCreate, mprCreateOsService, mprDecode64, mprDestroy, mprEmptyString, mprEncode64, mprEscapeCmd, mprGetAppDir, mprGetAppName, mprGetAppPath, mprGetAppTitle, mprGetAppVersion, mprGetCmdlineLogging, mprGetDebugMode, mprGetDomainName, mprGetEndian, mprGetError, mprGetHostName, mprGetIpAddr, mprGetLogLevel, mprGetMD5, mprGetMD5WithPrefix, mprGetOsError, mprGetRandomBytes, mprGetServerName, mprIsExiting, mprIsFinished, mprIsIdle, mprIsStopping, mprIsStoppingCore, mprMakeArgv, mprRandom, mprRestart, mprServicesAreIdle, mprSetAppName, mprSetCmdlineLogging, mprSetDebugMode, mprSetDomainName, mprSetExitStrategy, mprSetIdleCallback, mprSetIpAddr, mprSetLogLevel, mprSetServerName, mprShouldAbortRequests, mprShouldDenyNewRequests, mprSleep, mprStart, mprStartEventsThread, mprStartOsService, mprStopOsService, mprTerminate, mprUriDecode, mprUriEncode, mprWaitTillIdle
MprIdleCallback mprSetIdleCallback (MprIdleCallback idleCallback)

Define a new idle callback to be invoked by mprIsIdle()

Parameters:
idleCallbackCallback function to invoke to test if the application is idle.
API Stability:
Stable.
See Also:
mprAddTerminator, mprBreakpoint, mprCreate, mprCreateOsService, mprDecode64, mprDestroy, mprEmptyString, mprEncode64, mprEscapeCmd, mprGetAppDir, mprGetAppName, mprGetAppPath, mprGetAppTitle, mprGetAppVersion, mprGetCmdlineLogging, mprGetDebugMode, mprGetDomainName, mprGetEndian, mprGetError, mprGetHostName, mprGetIpAddr, mprGetLogLevel, mprGetMD5, mprGetMD5WithPrefix, mprGetOsError, mprGetRandomBytes, mprGetServerName, mprIsExiting, mprIsFinished, mprIsIdle, mprIsStopping, mprIsStoppingCore, mprMakeArgv, mprRandom, mprRestart, mprServicesAreIdle, mprSetAppName, mprSetCmdlineLogging, mprSetDebugMode, mprSetDomainName, mprSetExitStrategy, mprSetHostName, mprSetIpAddr, mprSetLogLevel, mprSetServerName, mprShouldAbortRequests, mprShouldDenyNewRequests, mprSleep, mprStart, mprStartEventsThread, mprStartOsService, mprStopOsService, mprTerminate, mprUriDecode, mprUriEncode, mprWaitTillIdle
void mprSetIpAddr (cchar *ip)

Sete the application IP address string.

Parameters:
ipIP address string to store for the application.
API Stability:
Stable.
See Also:
mprAddTerminator, mprBreakpoint, mprCreate, mprCreateOsService, mprDecode64, mprDestroy, mprEmptyString, mprEncode64, mprEscapeCmd, mprGetAppDir, mprGetAppName, mprGetAppPath, mprGetAppTitle, mprGetAppVersion, mprGetCmdlineLogging, mprGetDebugMode, mprGetDomainName, mprGetEndian, mprGetError, mprGetHostName, mprGetIpAddr, mprGetLogLevel, mprGetMD5, mprGetMD5WithPrefix, mprGetOsError, mprGetRandomBytes, mprGetServerName, mprIsExiting, mprIsFinished, mprIsIdle, mprIsStopping, mprIsStoppingCore, mprMakeArgv, mprRandom, mprRestart, mprServicesAreIdle, mprSetAppName, mprSetCmdlineLogging, mprSetDebugMode, mprSetDomainName, mprSetExitStrategy, mprSetHostName, mprSetIdleCallback, mprSetLogLevel, mprSetServerName, mprShouldAbortRequests, mprShouldDenyNewRequests, mprSleep, mprStart, mprStartEventsThread, mprStartOsService, mprStopOsService, mprTerminate, mprUriDecode, mprUriEncode, mprWaitTillIdle
void mprSetOsError (int error)

Set the O/S error code.

Description:
Set errno or equivalent.
API Stability:
Stable.
See Also:
mprAddTerminator, mprBreakpoint, mprCreate, mprCreateOsService, mprDecode64, mprDestroy, mprEmptyString, mprEncode64, mprEscapeCmd, mprGetAppDir, mprGetAppName, mprGetAppPath, mprGetAppTitle, mprGetAppVersion, mprGetCmdlineLogging, mprGetDebugMode, mprGetDomainName, mprGetEndian, mprGetError, mprGetHostName, mprGetIpAddr, mprGetLogLevel, mprGetMD5, mprGetMD5WithPrefix, mprGetOsError, mprGetRandomBytes, mprGetServerName, mprIsExiting, mprIsFinished, mprIsIdle, mprIsStopping, mprIsStoppingCore, mprMakeArgv, mprRandom, mprRestart, mprServicesAreIdle, mprSetAppName, mprSetCmdlineLogging, mprSetDebugMode, mprSetDomainName, mprSetExitStrategy, mprSetHostName, mprSetIdleCallback, mprSetIpAddr, mprSetLogLevel, mprSetServerName, mprShouldAbortRequests, mprShouldDenyNewRequests, mprSleep, mprStart, mprStartEventsThread, mprStartOsService, mprStopOsService, mprTerminate, mprUriDecode, mprUriEncode, mprWaitTillIdle
void mprSetServerName (cchar *s)

Set the application server name string.

Parameters:
sNew application server name to use within the application.
API Stability:
Stable.
See Also:
mprAddTerminator, mprBreakpoint, mprCreate, mprCreateOsService, mprDecode64, mprDestroy, mprEmptyString, mprEncode64, mprEscapeCmd, mprGetAppDir, mprGetAppName, mprGetAppPath, mprGetAppTitle, mprGetAppVersion, mprGetCmdlineLogging, mprGetDebugMode, mprGetDomainName, mprGetEndian, mprGetError, mprGetHostName, mprGetIpAddr, mprGetLogLevel, mprGetMD5, mprGetMD5WithPrefix, mprGetOsError, mprGetRandomBytes, mprGetServerName, mprIsExiting, mprIsFinished, mprIsIdle, mprIsStopping, mprIsStoppingCore, mprMakeArgv, mprRandom, mprRestart, mprServicesAreIdle, mprSetAppName, mprSetCmdlineLogging, mprSetDebugMode, mprSetDomainName, mprSetExitStrategy, mprSetHostName, mprSetIdleCallback, mprSetIpAddr, mprSetLogLevel, mprShouldAbortRequests, mprShouldDenyNewRequests, mprSleep, mprStart, mprStartEventsThread, mprStartOsService, mprStopOsService, mprTerminate, mprUriDecode, mprUriEncode, mprWaitTillIdle
bool mprShouldAbortRequests ()

Test if requests should be aborted.

Description:
This is useful to determine if current requests should be terminated due to the application exiting.
Returns:
True if new requests should be denied.
API Stability:
Stable.
See Also:
mprAddTerminator, mprBreakpoint, mprCreate, mprCreateOsService, mprDecode64, mprDestroy, mprEmptyString, mprEncode64, mprEscapeCmd, mprGetAppDir, mprGetAppName, mprGetAppPath, mprGetAppTitle, mprGetAppVersion, mprGetCmdlineLogging, mprGetDebugMode, mprGetDomainName, mprGetEndian, mprGetError, mprGetHostName, mprGetIpAddr, mprGetLogLevel, mprGetMD5, mprGetMD5WithPrefix, mprGetOsError, mprGetRandomBytes, mprGetServerName, mprIsExiting, mprIsFinished, mprIsIdle, mprIsStopping, mprIsStoppingCore, mprMakeArgv, mprRandom, mprRestart, mprServicesAreIdle, mprSetAppName, mprSetCmdlineLogging, mprSetDebugMode, mprSetDomainName, mprSetExitStrategy, mprSetHostName, mprSetIdleCallback, mprSetIpAddr, mprSetLogLevel, mprSetServerName, mprShouldDenyNewRequests, mprSleep, mprStart, mprStartEventsThread, mprStartOsService, mprStopOsService, mprTerminate, mprUriDecode, mprUriEncode, mprWaitTillIdle
bool mprShouldDenyNewRequests ()

Test if new requests should be denied.

This is useful in denying new requests when doing a graceful shutdown while continuing to service existing requests
Returns:
True if new requests should be denied.
API Stability:
Stable.
See Also:
mprAddTerminator, mprBreakpoint, mprCreate, mprCreateOsService, mprDecode64, mprDestroy, mprEmptyString, mprEncode64, mprEscapeCmd, mprGetAppDir, mprGetAppName, mprGetAppPath, mprGetAppTitle, mprGetAppVersion, mprGetCmdlineLogging, mprGetDebugMode, mprGetDomainName, mprGetEndian, mprGetError, mprGetHostName, mprGetIpAddr, mprGetLogLevel, mprGetMD5, mprGetMD5WithPrefix, mprGetOsError, mprGetRandomBytes, mprGetServerName, mprIsExiting, mprIsFinished, mprIsIdle, mprIsStopping, mprIsStoppingCore, mprMakeArgv, mprRandom, mprRestart, mprServicesAreIdle, mprSetAppName, mprSetCmdlineLogging, mprSetDebugMode, mprSetDomainName, mprSetExitStrategy, mprSetHostName, mprSetIdleCallback, mprSetIpAddr, mprSetLogLevel, mprSetServerName, mprShouldAbortRequests, mprSleep, mprStart, mprStartEventsThread, mprStartOsService, mprStopOsService, mprTerminate, mprUriDecode, mprUriEncode, mprWaitTillIdle
void mprSleep (MprTicks msec)

Sleep for a while.

Description:
This routine blocks for the given time and yields for GC during that time. Ensure all memory is held before the sleep.
Parameters:
msecNumber of milliseconds to sleep.
API Stability:
Stable.
See Also:
mprAddTerminator, mprBreakpoint, mprCreate, mprCreateOsService, mprDecode64, mprDestroy, mprEmptyString, mprEncode64, mprEscapeCmd, mprGetAppDir, mprGetAppName, mprGetAppPath, mprGetAppTitle, mprGetAppVersion, mprGetCmdlineLogging, mprGetDebugMode, mprGetDomainName, mprGetEndian, mprGetError, mprGetHostName, mprGetIpAddr, mprGetLogLevel, mprGetMD5, mprGetMD5WithPrefix, mprGetOsError, mprGetRandomBytes, mprGetServerName, mprIsExiting, mprIsFinished, mprIsIdle, mprIsStopping, mprIsStoppingCore, mprMakeArgv, mprRandom, mprRestart, mprServicesAreIdle, mprSetAppName, mprSetCmdlineLogging, mprSetDebugMode, mprSetDomainName, mprSetExitStrategy, mprSetHostName, mprSetIdleCallback, mprSetIpAddr, mprSetLogLevel, mprSetServerName, mprShouldAbortRequests, mprShouldDenyNewRequests, mprStart, mprStartEventsThread, mprStartOsService, mprStopOsService, mprTerminate, mprUriDecode, mprUriEncode, mprWaitTillIdle
int mprStart ()

Start the Mpr services.

API Stability:
Stable.
See Also:
mprAddTerminator, mprBreakpoint, mprCreate, mprCreateOsService, mprDecode64, mprDestroy, mprEmptyString, mprEncode64, mprEscapeCmd, mprGetAppDir, mprGetAppName, mprGetAppPath, mprGetAppTitle, mprGetAppVersion, mprGetCmdlineLogging, mprGetDebugMode, mprGetDomainName, mprGetEndian, mprGetError, mprGetHostName, mprGetIpAddr, mprGetLogLevel, mprGetMD5, mprGetMD5WithPrefix, mprGetOsError, mprGetRandomBytes, mprGetServerName, mprIsExiting, mprIsFinished, mprIsIdle, mprIsStopping, mprIsStoppingCore, mprMakeArgv, mprRandom, mprRestart, mprServicesAreIdle, mprSetAppName, mprSetCmdlineLogging, mprSetDebugMode, mprSetDomainName, mprSetExitStrategy, mprSetHostName, mprSetIdleCallback, mprSetIpAddr, mprSetLogLevel, mprSetServerName, mprShouldAbortRequests, mprShouldDenyNewRequests, mprSleep, mprStartEventsThread, mprStartOsService, mprStopOsService, mprTerminate, mprUriDecode, mprUriEncode, mprWaitTillIdle
int mprStartEventsThread ()

Start an thread dedicated to servicing events.

This will create a new thread and invoke mprServiceEvents
Returns:
Zero if successful.
API Stability:
Stable.
See Also:
mprAddTerminator, mprBreakpoint, mprCreate, mprCreateOsService, mprDecode64, mprDestroy, mprEmptyString, mprEncode64, mprEscapeCmd, mprGetAppDir, mprGetAppName, mprGetAppPath, mprGetAppTitle, mprGetAppVersion, mprGetCmdlineLogging, mprGetDebugMode, mprGetDomainName, mprGetEndian, mprGetError, mprGetHostName, mprGetIpAddr, mprGetLogLevel, mprGetMD5, mprGetMD5WithPrefix, mprGetOsError, mprGetRandomBytes, mprGetServerName, mprIsExiting, mprIsFinished, mprIsIdle, mprIsStopping, mprIsStoppingCore, mprMakeArgv, mprRandom, mprRestart, mprServicesAreIdle, mprSetAppName, mprSetCmdlineLogging, mprSetDebugMode, mprSetDomainName, mprSetExitStrategy, mprSetHostName, mprSetIdleCallback, mprSetIpAddr, mprSetLogLevel, mprSetServerName, mprShouldAbortRequests, mprShouldDenyNewRequests, mprSleep, mprStart, mprStartOsService, mprStopOsService, mprTerminate, mprUriDecode, mprUriEncode, mprWaitTillIdle
int mprStartOsService ()

Start the O/S dependent subsystem.

API Stability:
Internal.
See Also:
mprAddTerminator, mprBreakpoint, mprCreate, mprCreateOsService, mprDecode64, mprDestroy, mprEmptyString, mprEncode64, mprEscapeCmd, mprGetAppDir, mprGetAppName, mprGetAppPath, mprGetAppTitle, mprGetAppVersion, mprGetCmdlineLogging, mprGetDebugMode, mprGetDomainName, mprGetEndian, mprGetError, mprGetHostName, mprGetIpAddr, mprGetLogLevel, mprGetMD5, mprGetMD5WithPrefix, mprGetOsError, mprGetRandomBytes, mprGetServerName, mprIsExiting, mprIsFinished, mprIsIdle, mprIsStopping, mprIsStoppingCore, mprMakeArgv, mprRandom, mprRestart, mprServicesAreIdle, mprSetAppName, mprSetCmdlineLogging, mprSetDebugMode, mprSetDomainName, mprSetExitStrategy, mprSetHostName, mprSetIdleCallback, mprSetIpAddr, mprSetLogLevel, mprSetServerName, mprShouldAbortRequests, mprShouldDenyNewRequests, mprSleep, mprStart, mprStartEventsThread, mprStopOsService, mprTerminate, mprUriDecode, mprUriEncode, mprWaitTillIdle
void mprStopOsService ()

Stop the O/S dependent subsystem.

API Stability:
Internal.
See Also:
mprAddTerminator, mprBreakpoint, mprCreate, mprCreateOsService, mprDecode64, mprDestroy, mprEmptyString, mprEncode64, mprEscapeCmd, mprGetAppDir, mprGetAppName, mprGetAppPath, mprGetAppTitle, mprGetAppVersion, mprGetCmdlineLogging, mprGetDebugMode, mprGetDomainName, mprGetEndian, mprGetError, mprGetHostName, mprGetIpAddr, mprGetLogLevel, mprGetMD5, mprGetMD5WithPrefix, mprGetOsError, mprGetRandomBytes, mprGetServerName, mprIsExiting, mprIsFinished, mprIsIdle, mprIsStopping, mprIsStoppingCore, mprMakeArgv, mprRandom, mprRestart, mprServicesAreIdle, mprSetAppName, mprSetCmdlineLogging, mprSetDebugMode, mprSetDomainName, mprSetExitStrategy, mprSetHostName, mprSetIdleCallback, mprSetIpAddr, mprSetLogLevel, mprSetServerName, mprShouldAbortRequests, mprShouldDenyNewRequests, mprSleep, mprStart, mprStartEventsThread, mprStartOsService, mprTerminate, mprUriDecode, mprUriEncode, mprWaitTillIdle
void mprTerminate (int flags, int status)

Terminate the application.

Description:
Terminates the application and disposes of all allocated resources. The mprTerminate function will recursively free all memory allocated by the MPR.
Parameters:
flagsTermination control flags. Use MPR_EXIT_IMMEDIATE for an immediate abortive shutdown. Finalizers will not be run. Use MPR_EXIT_NORMAL to allow garbage collection and finalizers to run. Use MPR_EXIT_GRACEFUL to allow all current requests and commands to complete before exiting.
statusProposed program exit status.
API Stability:
Stable.
See Also:
mprAddTerminator, mprBreakpoint, mprCreate, mprCreateOsService, mprDecode64, mprDestroy, mprEmptyString, mprEncode64, mprEscapeCmd, mprGetAppDir, mprGetAppName, mprGetAppPath, mprGetAppTitle, mprGetAppVersion, mprGetCmdlineLogging, mprGetDebugMode, mprGetDomainName, mprGetEndian, mprGetError, mprGetHostName, mprGetIpAddr, mprGetLogLevel, mprGetMD5, mprGetMD5WithPrefix, mprGetOsError, mprGetRandomBytes, mprGetServerName, mprIsExiting, mprIsFinished, mprIsIdle, mprIsStopping, mprIsStoppingCore, mprMakeArgv, mprRandom, mprRestart, mprServicesAreIdle, mprSetAppName, mprSetCmdlineLogging, mprSetDebugMode, mprSetDomainName, mprSetExitStrategy, mprSetHostName, mprSetIdleCallback, mprSetIpAddr, mprSetLogLevel, mprSetServerName, mprShouldAbortRequests, mprShouldDenyNewRequests, mprSleep, mprStart, mprStartEventsThread, mprStartOsService, mprStopOsService, mprUriDecode, mprUriEncode, mprWaitTillIdle
char * mprUriDecode (cchar *uri)

Decode a URI string by de-scaping URI characters.

Description:
Decode a string with www-encoded characters that have meaning for URIs.
Parameters:
uriURI to decode.
Returns:
A reference to the buf argument.
API Stability:
Stable.
See Also:
mprAddTerminator, mprBreakpoint, mprCreate, mprCreateOsService, mprDecode64, mprDestroy, mprEmptyString, mprEncode64, mprEscapeCmd, mprGetAppDir, mprGetAppName, mprGetAppPath, mprGetAppTitle, mprGetAppVersion, mprGetCmdlineLogging, mprGetDebugMode, mprGetDomainName, mprGetEndian, mprGetError, mprGetHostName, mprGetIpAddr, mprGetLogLevel, mprGetMD5, mprGetMD5WithPrefix, mprGetOsError, mprGetRandomBytes, mprGetServerName, mprIsExiting, mprIsFinished, mprIsIdle, mprIsStopping, mprIsStoppingCore, mprMakeArgv, mprRandom, mprRestart, mprServicesAreIdle, mprSetAppName, mprSetCmdlineLogging, mprSetDebugMode, mprSetDomainName, mprSetExitStrategy, mprSetHostName, mprSetIdleCallback, mprSetIpAddr, mprSetLogLevel, mprSetServerName, mprShouldAbortRequests, mprShouldDenyNewRequests, mprSleep, mprStart, mprStartEventsThread, mprStartOsService, mprStopOsService, mprTerminate, mprUriEncode, mprWaitTillIdle
char * mprUriDecodeInSitu (char *uri)

Decode a URI string by de-scaping URI characters.

Description:
Decode a string with www-encoded characters that have meaning for URIs. This routines operates in-situ and modifies the buffer.
Parameters:
uriURI to decode.
Returns:
A reference to the buf argument.
API Stability:
Stable.
See Also:
mprAddTerminator, mprBreakpoint, mprCreate, mprCreateOsService, mprDecode64, mprDestroy, mprEmptyString, mprEncode64, mprEscapeCmd, mprGetAppDir, mprGetAppName, mprGetAppPath, mprGetAppTitle, mprGetAppVersion, mprGetCmdlineLogging, mprGetDebugMode, mprGetDomainName, mprGetEndian, mprGetError, mprGetHostName, mprGetIpAddr, mprGetLogLevel, mprGetMD5, mprGetMD5WithPrefix, mprGetOsError, mprGetRandomBytes, mprGetServerName, mprIsExiting, mprIsFinished, mprIsIdle, mprIsStopping, mprIsStoppingCore, mprMakeArgv, mprRandom, mprRestart, mprServicesAreIdle, mprSetAppName, mprSetCmdlineLogging, mprSetDebugMode, mprSetDomainName, mprSetExitStrategy, mprSetHostName, mprSetIdleCallback, mprSetIpAddr, mprSetLogLevel, mprSetServerName, mprShouldAbortRequests, mprShouldDenyNewRequests, mprSleep, mprStart, mprStartEventsThread, mprStartOsService, mprStopOsService, mprTerminate, mprUriDecode, mprUriEncode, mprWaitTillIdle
char * mprUriEncode (cchar *uri, int map)

Encode a string by escaping URI characters.

Description:
Encode a string escaping all characters that have meaning for URIs.
Parameters:
uriURI to encode.
mapMap to encode characters. Select from MPR_ENCODE_URI or MPR_ENCODE_URI_COMPONENT.
Returns:
An allocated string containing the encoded URI.
API Stability:
Stable.
See Also:
mprAddTerminator, mprBreakpoint, mprCreate, mprCreateOsService, mprDecode64, mprDestroy, mprEmptyString, mprEncode64, mprEscapeCmd, mprGetAppDir, mprGetAppName, mprGetAppPath, mprGetAppTitle, mprGetAppVersion, mprGetCmdlineLogging, mprGetDebugMode, mprGetDomainName, mprGetEndian, mprGetError, mprGetHostName, mprGetIpAddr, mprGetLogLevel, mprGetMD5, mprGetMD5WithPrefix, mprGetOsError, mprGetRandomBytes, mprGetServerName, mprIsExiting, mprIsFinished, mprIsIdle, mprIsStopping, mprIsStoppingCore, mprMakeArgv, mprRandom, mprRestart, mprServicesAreIdle, mprSetAppName, mprSetCmdlineLogging, mprSetDebugMode, mprSetDomainName, mprSetExitStrategy, mprSetHostName, mprSetIdleCallback, mprSetIpAddr, mprSetLogLevel, mprSetServerName, mprShouldAbortRequests, mprShouldDenyNewRequests, mprSleep, mprStart, mprStartEventsThread, mprStartOsService, mprStopOsService, mprTerminate, mprUriDecode, mprWaitTillIdle
int mprWaitTillIdle (MprTicks timeout)

Wait until the application is idle.

Description:
This call blocks until application services are idle.
Parameters:
timeoutTime in milliseconds to wait for the application to be idle.
Returns:
True if the application is idle.
API Stability:
Evolving.
See Also:
mprAddTerminator, mprBreakpoint, mprCreate, mprCreateOsService, mprDecode64, mprDestroy, mprEmptyString, mprEncode64, mprEscapeCmd, mprGetAppDir, mprGetAppName, mprGetAppPath, mprGetAppTitle, mprGetAppVersion, mprGetCmdlineLogging, mprGetDebugMode, mprGetDomainName, mprGetEndian, mprGetError, mprGetHostName, mprGetIpAddr, mprGetLogLevel, mprGetMD5, mprGetMD5WithPrefix, mprGetOsError, mprGetRandomBytes, mprGetServerName, mprIsExiting, mprIsFinished, mprIsIdle, mprIsStopping, mprIsStoppingCore, mprMakeArgv, mprRandom, mprRestart, mprServicesAreIdle, mprSetAppName, mprSetCmdlineLogging, mprSetDebugMode, mprSetDomainName, mprSetExitStrategy, mprSetHostName, mprSetIdleCallback, mprSetIpAddr, mprSetLogLevel, mprSetServerName, mprShouldAbortRequests, mprShouldDenyNewRequests, mprSleep, mprStart, mprStartEventsThread, mprStartOsService, mprStopOsService, mprTerminate, mprUriDecode, mprUriEncode

MprBuf

MprBuf

Dynamic Buffer Module.

Description:
MprBuf is a flexible, dynamic growable buffer structure. It has start and end pointers to the data buffer which act as read/write pointers. Routines are provided to get and put data into and out of the buffer and automatically advance the appropriate start/end pointer. By definition, the buffer is empty when the start pointer == the end pointer. Buffers can be created with a fixed size or can grow dynamically as more data is added to the buffer.

For performance, the specification of MprBuf is deliberately exposed. All members of MprBuf are implicitly public. However, it is still recommended that wherever possible, you use the accessor routines provided.
See Also:
MprBufProc, mprAddNullToBuf, mprAdjustBufEnd, mprAdjustBufStart, mprBufToString, mprCloneBuf, mprCompactBuf, mprCreateBuf, mprFlushBuf, mprGetBlockFromBuf, mprGetBufEnd, mprGetBufLength, mprGetBufRefillProc, mprGetBufSize, mprGetBufSpace, mprGetBufStart, mprGetCharFromBuf, mprGrowBuf, mprInsertCharToBuf, mprLookAtLastCharInBuf, mprLookAtNextCharInBuf, mprPutBlockToBuf, mprPutCharToBuf, mprPutIntToBuf, mprPutPadToBuf, mprPutStringToBuf, mprPutSubStringToBuf, mprRefillBuf, mprResetBufIfEmpty, mprSetBufMax, mprSetBufRefillProc, mprSetBufSize
API Stability:
Internal.
Fields:
ssizebuflen Current size of buffer.
char *data Actual buffer for data.
char *end Pointer one past the last data chr.
char *endbuf Pointer one past the end of buffer.
ssizegrowBy Next growth increment to use.
ssizemaxsize Max size the buffer can ever grow.
void *refillArg Refill arg - must be alloced memory.
MprBufProcrefillProc Auto-refill procedure.
char *start Pointer to next data char.
void mprAddNullToBuf (MprBuf *buf)

Add a null character to the buffer contents.

Description:
Add a null byte but do not change the buffer content lengths. The null is added outside the "official" content length. This is useful when calling mprGetBufStart and using the returned pointer as a "C" string pointer.
Parameters:
bufBuffer created via mprCreateBuf.
API Stability:
Stable.
See Also:
MprBuf, MprBufProc, mprAdjustBufEnd, mprAdjustBufStart, mprBufToString, mprCloneBuf, mprCompactBuf, mprCreateBuf, mprFlushBuf, mprGetBlockFromBuf, mprGetBufEnd, mprGetBufLength, mprGetBufRefillProc, mprGetBufSize, mprGetBufSpace, mprGetBufStart, mprGetCharFromBuf, mprGrowBuf, mprInsertCharToBuf, mprLookAtLastCharInBuf, mprLookAtNextCharInBuf, mprPutBlockToBuf, mprPutCharToBuf, mprPutIntToBuf, mprPutPadToBuf, mprPutStringToBuf, mprPutSubStringToBuf, mprRefillBuf, mprResetBufIfEmpty, mprSetBufMax, mprSetBufRefillProc, mprSetBufSize
void mprAdjustBufEnd (MprBuf *buf, ssize count)

Adjust the buffer end position.

Description:
Adjust the buffer end position by the specified amount. This is typically used to advance the end position as content is appended to the buffer. Adjusting the start or end position will change the value returned by mprGetBufLength. If using the mprPutBlock or mprPutChar routines, adjusting the end position is done automatically.
Parameters:
bufBuffer created via mprCreateBuf.
countPositive or negative count of bytes to adjust the end position.
API Stability:
Stable.
See Also:
MprBuf, MprBufProc, mprAddNullToBuf, mprAdjustBufStart, mprBufToString, mprCloneBuf, mprCompactBuf, mprCreateBuf, mprFlushBuf, mprGetBlockFromBuf, mprGetBufEnd, mprGetBufLength, mprGetBufRefillProc, mprGetBufSize, mprGetBufSpace, mprGetBufStart, mprGetCharFromBuf, mprGrowBuf, mprInsertCharToBuf, mprLookAtLastCharInBuf, mprLookAtNextCharInBuf, mprPutBlockToBuf, mprPutCharToBuf, mprPutIntToBuf, mprPutPadToBuf, mprPutStringToBuf, mprPutSubStringToBuf, mprRefillBuf, mprResetBufIfEmpty, mprSetBufMax, mprSetBufRefillProc, mprSetBufSize
void mprAdjustBufStart (MprBuf *buf, ssize count)

Adjust the buffer start position.

Description:
Adjust the buffer start position by the specified amount. This is typically used to advance the start position as content is consumed. Adjusting the start or end position will change the value returned by mprGetBufLength. If using the mprGetBlock or mprGetChar routines, adjusting the start position is done automatically.
Parameters:
bufBuffer created via mprCreateBuf.
countPositive or negative count of bytes to adjust the start position.
API Stability:
Stable.
See Also:
MprBuf, MprBufProc, mprAddNullToBuf, mprAdjustBufEnd, mprBufToString, mprCloneBuf, mprCompactBuf, mprCreateBuf, mprFlushBuf, mprGetBlockFromBuf, mprGetBufEnd, mprGetBufLength, mprGetBufRefillProc, mprGetBufSize, mprGetBufSpace, mprGetBufStart, mprGetCharFromBuf, mprGrowBuf, mprInsertCharToBuf, mprLookAtLastCharInBuf, mprLookAtNextCharInBuf, mprPutBlockToBuf, mprPutCharToBuf, mprPutIntToBuf, mprPutPadToBuf, mprPutStringToBuf, mprPutSubStringToBuf, mprRefillBuf, mprResetBufIfEmpty, mprSetBufMax, mprSetBufRefillProc, mprSetBufSize
char * mprBufToString (MprBuf *buf)

Convert the buffer contents to a string.

Parameters:
bufBuffer created via mprCreateBuf.
Returns:
Allocated string.
API Stability:
Stable.
See Also:
MprBuf, MprBufProc, mprAddNullToBuf, mprAdjustBufEnd, mprAdjustBufStart, mprCloneBuf, mprCompactBuf, mprCreateBuf, mprFlushBuf, mprGetBlockFromBuf, mprGetBufEnd, mprGetBufLength, mprGetBufRefillProc, mprGetBufSize, mprGetBufSpace, mprGetBufStart, mprGetCharFromBuf, mprGrowBuf, mprInsertCharToBuf, mprLookAtLastCharInBuf, mprLookAtNextCharInBuf, mprPutBlockToBuf, mprPutCharToBuf, mprPutIntToBuf, mprPutPadToBuf, mprPutStringToBuf, mprPutSubStringToBuf, mprRefillBuf, mprResetBufIfEmpty, mprSetBufMax, mprSetBufRefillProc, mprSetBufSize
void mprCompactBuf (MprBuf *buf)

Compact the buffer contents.

Description:
Compact the buffer contents by copying the contents down to start the the buffer origin.
Parameters:
bufBuffer created via mprCreateBuf.
API Stability:
Stable.
See Also:
MprBuf, MprBufProc, mprAddNullToBuf, mprAdjustBufEnd, mprAdjustBufStart, mprBufToString, mprCloneBuf, mprCreateBuf, mprFlushBuf, mprGetBlockFromBuf, mprGetBufEnd, mprGetBufLength, mprGetBufRefillProc, mprGetBufSize, mprGetBufSpace, mprGetBufStart, mprGetCharFromBuf, mprGrowBuf, mprInsertCharToBuf, mprLookAtLastCharInBuf, mprLookAtNextCharInBuf, mprPutBlockToBuf, mprPutCharToBuf, mprPutIntToBuf, mprPutPadToBuf, mprPutStringToBuf, mprPutSubStringToBuf, mprRefillBuf, mprResetBufIfEmpty, mprSetBufMax, mprSetBufRefillProc, mprSetBufSize
MprBuf * mprCreateBuf (ssize initialSize, ssize maxSize)

Create a new buffer.

Description:
Create a new buffer.
Parameters:
initialSizeInitial size of the buffer.
maxSizeMaximum size the buffer can grow to.
Returns:
A new buffer.
API Stability:
Stable.
See Also:
MprBuf, MprBufProc, mprAddNullToBuf, mprAdjustBufEnd, mprAdjustBufStart, mprBufToString, mprCloneBuf, mprCompactBuf, mprFlushBuf, mprGetBlockFromBuf, mprGetBufEnd, mprGetBufLength, mprGetBufRefillProc, mprGetBufSize, mprGetBufSpace, mprGetBufStart, mprGetCharFromBuf, mprGrowBuf, mprInsertCharToBuf, mprLookAtLastCharInBuf, mprLookAtNextCharInBuf, mprPutBlockToBuf, mprPutCharToBuf, mprPutIntToBuf, mprPutPadToBuf, mprPutStringToBuf, mprPutSubStringToBuf, mprRefillBuf, mprResetBufIfEmpty, mprSetBufMax, mprSetBufRefillProc, mprSetBufSize
void mprFlushBuf (MprBuf *buf)

Flush the buffer contents.

Description:
Discard the buffer contents and reset the start end content pointers.
Parameters:
bufBuffer created via mprCreateBuf.
API Stability:
Stable.
See Also:
MprBuf, MprBufProc, mprAddNullToBuf, mprAdjustBufEnd, mprAdjustBufStart, mprBufToString, mprCloneBuf, mprCompactBuf, mprCreateBuf, mprGetBlockFromBuf, mprGetBufEnd, mprGetBufLength, mprGetBufRefillProc, mprGetBufSize, mprGetBufSpace, mprGetBufStart, mprGetCharFromBuf, mprGrowBuf, mprInsertCharToBuf, mprLookAtLastCharInBuf, mprLookAtNextCharInBuf, mprPutBlockToBuf, mprPutCharToBuf, mprPutIntToBuf, mprPutPadToBuf, mprPutStringToBuf, mprPutSubStringToBuf, mprRefillBuf, mprResetBufIfEmpty, mprSetBufMax, mprSetBufRefillProc, mprSetBufSize
ssize mprGetBlockFromBuf (MprBuf *buf, char *blk, ssize count)

Get a block of data from the buffer.

Description:
Get a block of data from the buffer start and advance the start position. If the requested length is greater than the available buffer content, then return whatever data is available.
Parameters:
bufBuffer created via mprCreateBuf.
blkDestination block for the read data.
countCount of bytes to read from the buffer.
Returns:
The count of bytes read into the block or -1 if the buffer is empty.
API Stability:
Stable.
See Also:
MprBuf, MprBufProc, mprAddNullToBuf, mprAdjustBufEnd, mprAdjustBufStart, mprBufToString, mprCloneBuf, mprCompactBuf, mprCreateBuf, mprFlushBuf, mprGetBufEnd, mprGetBufLength, mprGetBufRefillProc, mprGetBufSize, mprGetBufSpace, mprGetBufStart, mprGetCharFromBuf, mprGrowBuf, mprInsertCharToBuf, mprLookAtLastCharInBuf, mprLookAtNextCharInBuf, mprPutBlockToBuf, mprPutCharToBuf, mprPutIntToBuf, mprPutPadToBuf, mprPutStringToBuf, mprPutSubStringToBuf, mprRefillBuf, mprResetBufIfEmpty, mprSetBufMax, mprSetBufRefillProc, mprSetBufSize
char * mprGetBuf (MprBuf *buf)

Get the origin of the buffer content storage.

Description:
Get a pointer to the start of the buffer content storage. This is always and allocated block.
Parameters:
bufBuffer created via mprCreateBuf.
Returns:
A pointer to the buffer content storage.
API Stability:
Stable.
See Also:
MprBuf, MprBufProc, mprAddNullToBuf, mprAdjustBufEnd, mprAdjustBufStart, mprBufToString, mprCloneBuf, mprCompactBuf, mprCreateBuf, mprFlushBuf, mprGetBlockFromBuf, mprGetBufEnd, mprGetBufLength, mprGetBufRefillProc, mprGetBufSize, mprGetBufSpace, mprGetBufStart, mprGetCharFromBuf, mprGrowBuf, mprInsertCharToBuf, mprLookAtLastCharInBuf, mprLookAtNextCharInBuf, mprPutBlockToBuf, mprPutCharToBuf, mprPutIntToBuf, mprPutPadToBuf, mprPutStringToBuf, mprPutSubStringToBuf, mprRefillBuf, mprResetBufIfEmpty, mprSetBufMax, mprSetBufRefillProc, mprSetBufSize
char * mprGetBufEnd (MprBuf *buf)

Get a reference to the end of the buffer contents.

Description:
Get a pointer to the location immediately after the end of the buffer contents.
Parameters:
bufBuffer created via mprCreateBuf.
Returns:
Pointer to the end of the buffer data contents. Points to the location one after the last data byte.
API Stability:
Stable.
See Also:
MprBuf, MprBufProc, mprAddNullToBuf, mprAdjustBufEnd, mprAdjustBufStart, mprBufToString, mprCloneBuf, mprCompactBuf, mprCreateBuf, mprFlushBuf, mprGetBlockFromBuf, mprGetBufLength, mprGetBufRefillProc, mprGetBufSize, mprGetBufSpace, mprGetBufStart, mprGetCharFromBuf, mprGrowBuf, mprInsertCharToBuf, mprLookAtLastCharInBuf, mprLookAtNextCharInBuf, mprPutBlockToBuf, mprPutCharToBuf, mprPutIntToBuf, mprPutPadToBuf, mprPutStringToBuf, mprPutSubStringToBuf, mprRefillBuf, mprResetBufIfEmpty, mprSetBufMax, mprSetBufRefillProc, mprSetBufSize
ssize mprGetBufLength (MprBuf *buf)

Get the buffer content length.

Description:
Get the length of the buffer contents. This is not the same as the buffer size which may be larger.
Parameters:
bufBuffer created via mprCreateBuf.
Returns:
The length of the content stored in the buffer in bytes.
API Stability:
Stable.
See Also:
MprBuf, MprBufProc, mprAddNullToBuf, mprAdjustBufEnd, mprAdjustBufStart, mprBufToString, mprCloneBuf, mprCompactBuf, mprCreateBuf, mprFlushBuf, mprGetBlockFromBuf, mprGetBufEnd, mprGetBufRefillProc, mprGetBufSize, mprGetBufSpace, mprGetBufStart, mprGetCharFromBuf, mprGrowBuf, mprInsertCharToBuf, mprLookAtLastCharInBuf, mprLookAtNextCharInBuf, mprPutBlockToBuf, mprPutCharToBuf, mprPutIntToBuf, mprPutPadToBuf, mprPutStringToBuf, mprPutSubStringToBuf, mprRefillBuf, mprResetBufIfEmpty, mprSetBufMax, mprSetBufRefillProc, mprSetBufSize
MprBufProc mprGetBufRefillProc (MprBuf *buf)

Get the buffer refill procedure.

Description:
Return the buffer refill callback function.
Parameters:
bufBuffer created via mprCreateBuf.
Returns:
The refill call back function if defined.
API Stability:
Stable.
See Also:
MprBuf, MprBufProc, mprAddNullToBuf, mprAdjustBufEnd, mprAdjustBufStart, mprBufToString, mprCloneBuf, mprCompactBuf, mprCreateBuf, mprFlushBuf, mprGetBlockFromBuf, mprGetBufEnd, mprGetBufLength, mprGetBufSize, mprGetBufSpace, mprGetBufStart, mprGetCharFromBuf, mprGrowBuf, mprInsertCharToBuf, mprLookAtLastCharInBuf, mprLookAtNextCharInBuf, mprPutBlockToBuf, mprPutCharToBuf, mprPutIntToBuf, mprPutPadToBuf, mprPutStringToBuf, mprPutSubStringToBuf, mprRefillBuf, mprResetBufIfEmpty, mprSetBufMax, mprSetBufRefillProc, mprSetBufSize
ssize mprGetBufSize (MprBuf *buf)

Get the current size of the buffer content storage.

Description:
This returns the size of the memory block allocated for storing the buffer contents.
Parameters:
bufBuffer created via mprCreateBuf.
Returns:
The size of the buffer content storage.
API Stability:
Stable.
See Also:
MprBuf, MprBufProc, mprAddNullToBuf, mprAdjustBufEnd, mprAdjustBufStart, mprBufToString, mprCloneBuf, mprCompactBuf, mprCreateBuf, mprFlushBuf, mprGetBlockFromBuf, mprGetBufEnd, mprGetBufLength, mprGetBufRefillProc, mprGetBufSpace, mprGetBufStart, mprGetCharFromBuf, mprGrowBuf, mprInsertCharToBuf, mprLookAtLastCharInBuf, mprLookAtNextCharInBuf, mprPutBlockToBuf, mprPutCharToBuf, mprPutIntToBuf, mprPutPadToBuf, mprPutStringToBuf, mprPutSubStringToBuf, mprRefillBuf, mprResetBufIfEmpty, mprSetBufMax, mprSetBufRefillProc, mprSetBufSize
ssize mprGetBufSpace (MprBuf *buf)

Get the space available to store content.

Description:
Get the number of bytes available to store content in the buffer.
Parameters:
bufBuffer created via mprCreateBuf.
Returns:
The number of bytes available.
API Stability:
Stable.
See Also:
MprBuf, MprBufProc, mprAddNullToBuf, mprAdjustBufEnd, mprAdjustBufStart, mprBufToString, mprCloneBuf, mprCompactBuf, mprCreateBuf, mprFlushBuf, mprGetBlockFromBuf, mprGetBufEnd, mprGetBufLength, mprGetBufRefillProc, mprGetBufSize, mprGetBufStart, mprGetCharFromBuf, mprGrowBuf, mprInsertCharToBuf, mprLookAtLastCharInBuf, mprLookAtNextCharInBuf, mprPutBlockToBuf, mprPutCharToBuf, mprPutIntToBuf, mprPutPadToBuf, mprPutStringToBuf, mprPutSubStringToBuf, mprRefillBuf, mprResetBufIfEmpty, mprSetBufMax, mprSetBufRefillProc, mprSetBufSize
char * mprGetBufStart (MprBuf *buf)

Get the start of the buffer contents.

Description:
Get a pointer to the start of the buffer contents. Use mprGetBufLength to determine the length of the content. Use mprGetBufEnd to get a pointer to the location after the end of the content.
Parameters:
bufBuffer created via mprCreateBuf.
Returns:
Pointer to the start of the buffer data contents.
API Stability:
Stable.
See Also:
MprBuf, MprBufProc, mprAddNullToBuf, mprAdjustBufEnd, mprAdjustBufStart, mprBufToString, mprCloneBuf, mprCompactBuf, mprCreateBuf, mprFlushBuf, mprGetBlockFromBuf, mprGetBufEnd, mprGetBufLength, mprGetBufRefillProc, mprGetBufSize, mprGetBufSpace, mprGetCharFromBuf, mprGrowBuf, mprInsertCharToBuf, mprLookAtLastCharInBuf, mprLookAtNextCharInBuf, mprPutBlockToBuf, mprPutCharToBuf, mprPutIntToBuf, mprPutPadToBuf, mprPutStringToBuf, mprPutSubStringToBuf, mprRefillBuf, mprResetBufIfEmpty, mprSetBufMax, mprSetBufRefillProc, mprSetBufSize
int mprGetCharFromBuf (MprBuf *buf)

Get a character from the buffer.

Description:
Get the next byte from the buffer start and advance the start position.
Parameters:
bufBuffer created via mprCreateBuf.
Returns:
The character or -1 if the buffer is empty.
API Stability:
Stable.
See Also:
MprBuf, MprBufProc, mprAddNullToBuf, mprAdjustBufEnd, mprAdjustBufStart, mprBufToString, mprCloneBuf, mprCompactBuf, mprCreateBuf, mprFlushBuf, mprGetBlockFromBuf, mprGetBufEnd, mprGetBufLength, mprGetBufRefillProc, mprGetBufSize, mprGetBufSpace, mprGetBufStart, mprGrowBuf, mprInsertCharToBuf, mprLookAtLastCharInBuf, mprLookAtNextCharInBuf, mprPutBlockToBuf, mprPutCharToBuf, mprPutIntToBuf, mprPutPadToBuf, mprPutStringToBuf, mprPutSubStringToBuf, mprRefillBuf, mprResetBufIfEmpty, mprSetBufMax, mprSetBufRefillProc, mprSetBufSize
int mprGrowBuf (MprBuf *buf, ssize count)

Grow the buffer.

Description:
Grow the storage allocated for content for the buffer. The new size must be less than the maximum limit specified via mprCreateBuf or mprSetBufSize
Parameters:
bufBuffer created via mprCreateBuf.
countCount of bytes by which to grow the buffer content size.
Returns:
Zero if successful and otherwise a negative error code.
API Stability:
Stable.
See Also:
MprBuf, MprBufProc, mprAddNullToBuf, mprAdjustBufEnd, mprAdjustBufStart, mprBufToString, mprCloneBuf, mprCompactBuf, mprCreateBuf, mprFlushBuf, mprGetBlockFromBuf, mprGetBufEnd, mprGetBufLength, mprGetBufRefillProc, mprGetBufSize, mprGetBufSpace, mprGetBufStart, mprGetCharFromBuf, mprInsertCharToBuf, mprLookAtLastCharInBuf, mprLookAtNextCharInBuf, mprPutBlockToBuf, mprPutCharToBuf, mprPutIntToBuf, mprPutPadToBuf, mprPutStringToBuf, mprPutSubStringToBuf, mprRefillBuf, mprResetBufIfEmpty, mprSetBufMax, mprSetBufRefillProc, mprSetBufSize
int mprInsertCharToBuf (MprBuf *buf, int c)

Insert a character into the buffer.

Description:
Insert a character into to the buffer prior to the current buffer start point.
Parameters:
bufBuffer created via mprCreateBuf.
cCharacter to append.
Returns:
Zero if successful and otherwise a negative error code.
API Stability:
Stable.
See Also:
MprBuf, MprBufProc, mprAddNullToBuf, mprAdjustBufEnd, mprAdjustBufStart, mprBufToString, mprCloneBuf, mprCompactBuf, mprCreateBuf, mprFlushBuf, mprGetBlockFromBuf, mprGetBufEnd, mprGetBufLength, mprGetBufRefillProc, mprGetBufSize, mprGetBufSpace, mprGetBufStart, mprGetCharFromBuf, mprGrowBuf, mprLookAtLastCharInBuf, mprLookAtNextCharInBuf, mprPutBlockToBuf, mprPutCharToBuf, mprPutIntToBuf, mprPutPadToBuf, mprPutStringToBuf, mprPutSubStringToBuf, mprRefillBuf, mprResetBufIfEmpty, mprSetBufMax, mprSetBufRefillProc, mprSetBufSize
int mprLookAtLastCharInBuf (MprBuf *buf)

Peek at the last character in the buffer.

Description:
Non-destructively return the last character from just prior to the end position in the buffer. The character is returned and the end position is not altered.
Parameters:
bufBuffer created via mprCreateBuf.
Returns:
Zero if successful and otherwise a negative error code.
API Stability:
Stable.
See Also:
MprBuf, MprBufProc, mprAddNullToBuf, mprAdjustBufEnd, mprAdjustBufStart, mprBufToString, mprCloneBuf, mprCompactBuf, mprCreateBuf, mprFlushBuf, mprGetBlockFromBuf, mprGetBufEnd, mprGetBufLength, mprGetBufRefillProc, mprGetBufSize, mprGetBufSpace, mprGetBufStart, mprGetCharFromBuf, mprGrowBuf, mprInsertCharToBuf, mprLookAtNextCharInBuf, mprPutBlockToBuf, mprPutCharToBuf, mprPutIntToBuf, mprPutPadToBuf, mprPutStringToBuf, mprPutSubStringToBuf, mprRefillBuf, mprResetBufIfEmpty, mprSetBufMax, mprSetBufRefillProc, mprSetBufSize
int mprLookAtNextCharInBuf (MprBuf *buf)

Peek at the next character in the buffer.

Description:
Non-destructively return the next character from the start position in the buffer. The character is returned and the start position is not altered.
Parameters:
bufBuffer created via mprCreateBuf.
Returns:
Zero if successful and otherwise a negative error code.
API Stability:
Stable.
See Also:
MprBuf, MprBufProc, mprAddNullToBuf, mprAdjustBufEnd, mprAdjustBufStart, mprBufToString, mprCloneBuf, mprCompactBuf, mprCreateBuf, mprFlushBuf, mprGetBlockFromBuf, mprGetBufEnd, mprGetBufLength, mprGetBufRefillProc, mprGetBufSize, mprGetBufSpace, mprGetBufStart, mprGetCharFromBuf, mprGrowBuf, mprInsertCharToBuf, mprLookAtLastCharInBuf, mprPutBlockToBuf, mprPutCharToBuf, mprPutIntToBuf, mprPutPadToBuf, mprPutStringToBuf, mprPutSubStringToBuf, mprRefillBuf, mprResetBufIfEmpty, mprSetBufMax, mprSetBufRefillProc, mprSetBufSize
ssize mprPutBlockToBuf (MprBuf *buf, cchar *ptr, ssize size)

Put a block to the buffer.

Description:
Append a block of data to the buffer at the end position and increment the end pointer.
Parameters:
bufBuffer created via mprCreateBuf.
ptrBlock to append.
sizeSize of block to append.
Returns:
Zero if successful and otherwise a negative error code.
API Stability:
Stable.
See Also:
MprBuf, MprBufProc, mprAddNullToBuf, mprAdjustBufEnd, mprAdjustBufStart, mprBufToString, mprCloneBuf, mprCompactBuf, mprCreateBuf, mprFlushBuf, mprGetBlockFromBuf, mprGetBufEnd, mprGetBufLength, mprGetBufRefillProc, mprGetBufSize, mprGetBufSpace, mprGetBufStart, mprGetCharFromBuf, mprGrowBuf, mprInsertCharToBuf, mprLookAtLastCharInBuf, mprLookAtNextCharInBuf, mprPutCharToBuf, mprPutIntToBuf, mprPutPadToBuf, mprPutStringToBuf, mprPutSubStringToBuf, mprRefillBuf, mprResetBufIfEmpty, mprSetBufMax, mprSetBufRefillProc, mprSetBufSize
int mprPutCharToBuf (MprBuf *buf, int c)

Put a character to the buffer.

Description:
Append a character to the buffer at the end position and increment the end pointer.
Parameters:
bufBuffer created via mprCreateBuf.
cCharacter to append.
Returns:
Zero if successful and otherwise a negative error code.
API Stability:
Stable.
See Also:
MprBuf, MprBufProc, mprAddNullToBuf, mprAdjustBufEnd, mprAdjustBufStart, mprBufToString, mprCloneBuf, mprCompactBuf, mprCreateBuf, mprFlushBuf, mprGetBlockFromBuf, mprGetBufEnd, mprGetBufLength, mprGetBufRefillProc, mprGetBufSize, mprGetBufSpace, mprGetBufStart, mprGetCharFromBuf, mprGrowBuf, mprInsertCharToBuf, mprLookAtLastCharInBuf, mprLookAtNextCharInBuf, mprPutBlockToBuf, mprPutIntToBuf, mprPutPadToBuf, mprPutStringToBuf, mprPutSubStringToBuf, mprRefillBuf, mprResetBufIfEmpty, mprSetBufMax, mprSetBufRefillProc, mprSetBufSize
ssize mprPutIntToBuf (MprBuf *buf, int64 i)

Put an integer to the buffer.

Description:
Append a integer to the buffer at the end position and increment the end pointer.
Parameters:
bufBuffer created via mprCreateBuf.
iInteger to append to the buffer.
Returns:
Number of characters added to the buffer, otherwise a negative error code.
API Stability:
Stable.
See Also:
MprBuf, MprBufProc, mprAddNullToBuf, mprAdjustBufEnd, mprAdjustBufStart, mprBufToString, mprCloneBuf, mprCompactBuf, mprCreateBuf, mprFlushBuf, mprGetBlockFromBuf, mprGetBufEnd, mprGetBufLength, mprGetBufRefillProc, mprGetBufSize, mprGetBufSpace, mprGetBufStart, mprGetCharFromBuf, mprGrowBuf, mprInsertCharToBuf, mprLookAtLastCharInBuf, mprLookAtNextCharInBuf, mprPutBlockToBuf, mprPutCharToBuf, mprPutPadToBuf, mprPutStringToBuf, mprPutSubStringToBuf, mprRefillBuf, mprResetBufIfEmpty, mprSetBufMax, mprSetBufRefillProc, mprSetBufSize
ssize mprPutPadToBuf (MprBuf *buf, int c, ssize count)

Put padding characters to the buffer.

Description:
Append padding characters to the buffer at the end position and increment the end pointer.
Parameters:
bufBuffer created via mprCreateBuf.
cCharacter to append.
countCount of pad characters to put.
Returns:
Zero if successful and otherwise a negative error code.
API Stability:
Evolving.
See Also:
MprBuf, MprBufProc, mprAddNullToBuf, mprAdjustBufEnd, mprAdjustBufStart, mprBufToString, mprCloneBuf, mprCompactBuf, mprCreateBuf, mprFlushBuf, mprGetBlockFromBuf, mprGetBufEnd, mprGetBufLength, mprGetBufRefillProc, mprGetBufSize, mprGetBufSpace, mprGetBufStart, mprGetCharFromBuf, mprGrowBuf, mprInsertCharToBuf, mprLookAtLastCharInBuf, mprLookAtNextCharInBuf, mprPutBlockToBuf, mprPutCharToBuf, mprPutIntToBuf, mprPutStringToBuf, mprPutSubStringToBuf, mprRefillBuf, mprResetBufIfEmpty, mprSetBufMax, mprSetBufRefillProc, mprSetBufSize
ssize mprPutStringToBuf (MprBuf *buf, cchar *str)

Put a string to the buffer.

Description:
Append a null terminated string to the buffer at the end position and increment the end pointer.
Parameters:
bufBuffer created via mprCreateBuf.
strString to append.
Returns:
Zero if successful and otherwise a negative error code.
API Stability:
Stable.
See Also:
MprBuf, MprBufProc, mprAddNullToBuf, mprAdjustBufEnd, mprAdjustBufStart, mprBufToString, mprCloneBuf, mprCompactBuf, mprCreateBuf, mprFlushBuf, mprGetBlockFromBuf, mprGetBufEnd, mprGetBufLength, mprGetBufRefillProc, mprGetBufSize, mprGetBufSpace, mprGetBufStart, mprGetCharFromBuf, mprGrowBuf, mprInsertCharToBuf, mprLookAtLastCharInBuf, mprLookAtNextCharInBuf, mprPutBlockToBuf, mprPutCharToBuf, mprPutIntToBuf, mprPutPadToBuf, mprPutSubStringToBuf, mprRefillBuf, mprResetBufIfEmpty, mprSetBufMax, mprSetBufRefillProc, mprSetBufSize
ssize mprPutSubStringToBuf (MprBuf *buf, cchar *str, ssize count)

Put a substring to the buffer.

Description:
Append a null terminated substring to the buffer at the end position and increment the end pointer.
Parameters:
bufBuffer created via mprCreateBuf.
strString to append.
countPut at most count characters to the buffer.
Returns:
Zero if successful and otherwise a negative error code.
API Stability:
Stable.
See Also:
MprBuf, MprBufProc, mprAddNullToBuf, mprAdjustBufEnd, mprAdjustBufStart, mprBufToString, mprCloneBuf, mprCompactBuf, mprCreateBuf, mprFlushBuf, mprGetBlockFromBuf, mprGetBufEnd, mprGetBufLength, mprGetBufRefillProc, mprGetBufSize, mprGetBufSpace, mprGetBufStart, mprGetCharFromBuf, mprGrowBuf, mprInsertCharToBuf, mprLookAtLastCharInBuf, mprLookAtNextCharInBuf, mprPutBlockToBuf, mprPutCharToBuf, mprPutIntToBuf, mprPutPadToBuf, mprPutStringToBuf, mprRefillBuf, mprResetBufIfEmpty, mprSetBufMax, mprSetBufRefillProc, mprSetBufSize
ssize mprPutToBuf (MprBuf *buf, cchar *fmt, ...)

Put a formatted string to the buffer.

Description:
Format a string and append to the buffer at the end position and increment the end pointer.
Parameters:
bufBuffer created via mprCreateBuf.
fmtPrintf style format string.
...Variable arguments for the format string.
Returns:
Zero if successful and otherwise a negative error code.
API Stability:
Evolving.
See Also:
MprBuf, MprBufProc, mprAddNullToBuf, mprAdjustBufEnd, mprAdjustBufStart, mprBufToString, mprCloneBuf, mprCompactBuf, mprCreateBuf, mprFlushBuf, mprGetBlockFromBuf, mprGetBufEnd, mprGetBufLength, mprGetBufRefillProc, mprGetBufSize, mprGetBufSpace, mprGetBufStart, mprGetCharFromBuf, mprGrowBuf, mprInsertCharToBuf, mprLookAtLastCharInBuf, mprLookAtNextCharInBuf, mprPutBlockToBuf, mprPutCharToBuf, mprPutIntToBuf, mprPutPadToBuf, mprPutStringToBuf, mprPutSubStringToBuf, mprRefillBuf, mprResetBufIfEmpty, mprSetBufMax, mprSetBufRefillProc, mprSetBufSize
int mprRefillBuf (MprBuf *buf)

Refill the buffer with data.

Description:
Refill the buffer by calling the refill procedure specified via mprSetBufRefillProc
Parameters:
bufBuffer created via mprCreateBuf.
Returns:
Zero if successful and otherwise a negative error code.
API Stability:
Stable.
See Also:
MprBuf, MprBufProc, mprAddNullToBuf, mprAdjustBufEnd, mprAdjustBufStart, mprBufToString, mprCloneBuf, mprCompactBuf, mprCreateBuf, mprFlushBuf, mprGetBlockFromBuf, mprGetBufEnd, mprGetBufLength, mprGetBufRefillProc, mprGetBufSize, mprGetBufSpace, mprGetBufStart, mprGetCharFromBuf, mprGrowBuf, mprInsertCharToBuf, mprLookAtLastCharInBuf, mprLookAtNextCharInBuf, mprPutBlockToBuf, mprPutCharToBuf, mprPutIntToBuf, mprPutPadToBuf, mprPutStringToBuf, mprPutSubStringToBuf, mprResetBufIfEmpty, mprSetBufMax, mprSetBufRefillProc, mprSetBufSize
void mprResetBufIfEmpty (MprBuf *buf)

Reset the buffer.

Description:
If the buffer is empty, reset the buffer start and end pointers to the beginning of the buffer.
Parameters:
bufBuffer created via mprCreateBuf.
API Stability:
Stable.
See Also:
MprBuf, MprBufProc, mprAddNullToBuf, mprAdjustBufEnd, mprAdjustBufStart, mprBufToString, mprCloneBuf, mprCompactBuf, mprCreateBuf, mprFlushBuf, mprGetBlockFromBuf, mprGetBufEnd, mprGetBufLength, mprGetBufRefillProc, mprGetBufSize, mprGetBufSpace, mprGetBufStart, mprGetCharFromBuf, mprGrowBuf, mprInsertCharToBuf, mprLookAtLastCharInBuf, mprLookAtNextCharInBuf, mprPutBlockToBuf, mprPutCharToBuf, mprPutIntToBuf, mprPutPadToBuf, mprPutStringToBuf, mprPutSubStringToBuf, mprRefillBuf, mprSetBufMax, mprSetBufRefillProc, mprSetBufSize
void mprSetBufMax (MprBuf *buf, ssize maxSize)

Set the maximum buffer size.

Description:
Update the maximum buffer size set when the buffer was created.
Parameters:
bufBuffer created via mprCreateBuf.
maxSizeNew maximum size the buffer can grow to.
API Stability:
Stable.
See Also:
MprBuf, MprBufProc, mprAddNullToBuf, mprAdjustBufEnd, mprAdjustBufStart, mprBufToString, mprCloneBuf, mprCompactBuf, mprCreateBuf, mprFlushBuf, mprGetBlockFromBuf, mprGetBufEnd, mprGetBufLength, mprGetBufRefillProc, mprGetBufSize, mprGetBufSpace, mprGetBufStart, mprGetCharFromBuf, mprGrowBuf, mprInsertCharToBuf, mprLookAtLastCharInBuf, mprLookAtNextCharInBuf, mprPutBlockToBuf, mprPutCharToBuf, mprPutIntToBuf, mprPutPadToBuf, mprPutStringToBuf, mprPutSubStringToBuf, mprRefillBuf, mprResetBufIfEmpty, mprSetBufRefillProc, mprSetBufSize
void mprSetBufRefillProc (MprBuf *buf, MprBufProc fn, void *arg)

Set the buffer refill procedure.

Description:
Define a buffer refill procedure. The MprBuf module will not invoke or manage this refill procedure. It is simply stored to allow upper layers to use and provide their own auto-refill mechanism.
Parameters:
bufBuffer created via mprCreateBuf.
fnCallback function to store.
argCallback data argument.
API Stability:
Stable.
See Also:
MprBuf, MprBufProc, mprAddNullToBuf, mprAdjustBufEnd, mprAdjustBufStart, mprBufToString, mprCloneBuf, mprCompactBuf, mprCreateBuf, mprFlushBuf, mprGetBlockFromBuf, mprGetBufEnd, mprGetBufLength, mprGetBufRefillProc, mprGetBufSize, mprGetBufSpace, mprGetBufStart, mprGetCharFromBuf, mprGrowBuf, mprInsertCharToBuf, mprLookAtLastCharInBuf, mprLookAtNextCharInBuf, mprPutBlockToBuf, mprPutCharToBuf, mprPutIntToBuf, mprPutPadToBuf, mprPutStringToBuf, mprPutSubStringToBuf, mprRefillBuf, mprResetBufIfEmpty, mprSetBufMax, mprSetBufSize
int mprSetBufSize (MprBuf *buf, ssize size, ssize maxSize)

Set the buffer size.

Description:
Set the current buffer content size and maximum size limit. Setting a current size will immediately grow the buffer to be this size. If the size is less than the current buffer size, the requested size will be ignored. ie. this call will not shrink the buffer. Setting a maxSize will define a maximum limit for how big the buffer contents can grow. Set either argument to -1 to be ignored.
Parameters:
bufBuffer created via mprCreateBuf.
sizeSize to immediately make the buffer. If size is less than the current buffer size, it will be ignored. Set to -1 to ignore this parameter.
maxSizeMaximum size the buffer contents can grow to.
Returns:
Zero if successful and otherwise a negative error code.
API Stability:
Stable.
See Also:
MprBuf, MprBufProc, mprAddNullToBuf, mprAdjustBufEnd, mprAdjustBufStart, mprBufToString, mprCloneBuf, mprCompactBuf, mprCreateBuf, mprFlushBuf, mprGetBlockFromBuf, mprGetBufEnd, mprGetBufLength, mprGetBufRefillProc, mprGetBufSize, mprGetBufSpace, mprGetBufStart, mprGetCharFromBuf, mprGrowBuf, mprInsertCharToBuf, mprLookAtLastCharInBuf, mprLookAtNextCharInBuf, mprPutBlockToBuf, mprPutCharToBuf, mprPutIntToBuf, mprPutPadToBuf, mprPutStringToBuf, mprPutSubStringToBuf, mprRefillBuf, mprResetBufIfEmpty, mprSetBufMax, mprSetBufRefillProc

MprCache

MprCache

In-memory caching.

See Also:
mprCreateCache, mprDestroyCache, mprExpireCache, mprIncCache, mprReadCache, mprRemoveCache, mprSetCacheLimits, mprWriteCache
API Stability:
Internal.
Fields:
MprTickslifespan Default lifespan (msec).
ssizemaxKeys Max number of keys.
ssizemaxMem Max memory for session data.
MprMutex *mutex Cache lock.
intresolution Frequence for pruner.
struct MprCache *shared Shared common cache.
MprHash *store Key/value store.
MprEvent *timer Pruning timer.
ssizeusedMem Memory in use for keys and data.
MprCache * mprCreateCache (int options)

Create a new cache object.

Parameters:
optionsSet of option flags. Select from MPR_CACHE_SHARED, MPR_CACHE_ADD, MPR_CACHE_ADD, MPR_CACHE_SET, MPR_CACHE_APPEND, MPR_CACHE_PREPEND
Returns:
A cache instance object. On error, return null.
API Stability:
Evolving.
See Also:
mprDestroyCache, mprExpireCache, mprIncCache, mprReadCache, mprRemoveCache, mprSetCacheLimits, mprWriteCache
void * mprDestroyCache (MprCache *cache)

Destroy a new cache object.

Parameters:
cacheThe cache instance object returned from mprCreateCache
API Stability:
Evolving.
See Also:
mprCreateCache, mprExpireCache, mprIncCache, mprReadCache, mprRemoveCache, mprSetCacheLimits, mprWriteCache
int mprExpireCache (MprCache *cache, cchar *key, MprTicks expires)

Set the expiry date for a cache item.

Parameters:
cacheThe cache instance object returned from mprCreateCache
keyCache item key.
expiresTime when the cache item will expire. If expires is zero, the item is immediately removed from the cache.
Returns:
Zero if the expiry is successfully updated. Return MPR_ERR_CANT_FIND if the cache item is not present in the cache.
API Stability:
Evolving.
See Also:
mprCreateCache, mprDestroyCache, mprIncCache, mprReadCache, mprRemoveCache, mprSetCacheLimits, mprWriteCache
int64 mprIncCache (MprCache *cache, cchar *key, int64 amount)

Increment a numeric cache item.

Parameters:
cacheThe cache instance object returned from mprCreateCache
keyCache item key.
amountNumeric amount to increment the cache item. This may be a negative number to decrement the item.
Returns:
The new value for the cache item after incrementing.
API Stability:
Evolving.
See Also:
mprCreateCache, mprDestroyCache, mprExpireCache, mprReadCache, mprRemoveCache, mprSetCacheLimits, mprWriteCache
void mprPruneCache (MprCache *cache)

Prune the cache.

Description:
Prune the cache and discard all cached items.
Parameters:
cacheThe cache instance object returned from mprCreateCache
API Stability:
Evolving.
See Also:
mprCreateCache, mprDestroyCache, mprExpireCache, mprIncCache, mprReadCache, mprRemoveCache, mprSetCacheLimits, mprWriteCache
char * mprReadCache (MprCache *cache, cchar *key, MprTime *modified, int64 *version)

Read an item from the cache.

Parameters:
cacheThe cache instance object returned from mprCreateCache
keyCache item key.
modifiedOptional MprTime value reference to receive the last modified time of the cache item. Set to null if not required.
versionOptional int64 value reference to receive the version number of the cache item. Set to null if not required. Cache items have a version number that is incremented every time the item is updated.
Returns:
The cache item value.
API Stability:
Evolving.
See Also:
mprCreateCache, mprDestroyCache, mprExpireCache, mprIncCache, mprRemoveCache, mprSetCacheLimits, mprWriteCache
bool mprRemoveCache (MprCache *cache, cchar *key)

Remove items from the cache.

Parameters:
cacheThe cache instance object returned from mprCreateCache
keyCache item key. If set to null, then remove all keys from the cache.
Returns:
True if the cache item was removed.
API Stability:
Evolving.
See Also:
mprCreateCache, mprDestroyCache, mprExpireCache, mprIncCache, mprReadCache, mprSetCacheLimits, mprWriteCache
void mprSetCacheLimits (MprCache *cache, int64 keys, MprTicks lifespan, int64 memory, int resolution)

Set the cache resource limits.

Parameters:
cacheThe cache instance object returned from mprCreateCache
keysSet the maximum number of keys the cache can store.
lifespanSet the default lifespan for cache items in milliseconds.
memoryMemory limit in bytes for all cache keys and items.
resolutionSet the cache item pruner resolution. This defines how frequently the cache manager will check items for expiration.
API Stability:
Evolving.
See Also:
mprCreateCache, mprDestroyCache, mprExpireCache, mprIncCache, mprReadCache, mprRemoveCache, mprWriteCache
ssize mprWriteCache (MprCache *cache, cchar *key, cchar *value, MprTime modified, MprTicks lifespan, int64 version, int options)

Write a cache item.

Parameters:
cacheThe cache instance object returned from mprCreateCache
keyCache item key to write.
valueValue to set for the cache item.
modifiedValue to set for the cache last modified time. If set to zero, the current time is obtained via mprGetTime
lifespanLifespan of the item in milliseconds. The item will be removed from the cache by the Cache manager when the lifetime expires unless it is rewritten to extend the lifespan.
versionExpected version number of the item. This is used to do transactional writes to the cache item. First the version number is retrieved via mprReadCache and that version number is supplied to mprWriteCache when the item is updated. If another caller updates the item in between the read/write, the version number will not match when the item is subsequently written and this call will fail with the MPR_ERR_BAD_STATE return code. Set to zero if version checking is not required.
optionsOptions to control how the item value is updated. Use MPR_CACHE_SET to update the cache item and create if it does not exist. Use MPR_CACHE_ADD to add the item only if it does not already exits. Use MPR_CACHE_APPEND to append the parameter value to any existing cache item value. Use MPR_CACHE_PREPEND to prepend the value.
Returns:
If writing the cache item was successful this call returns the number of bytes written. Otherwise a negative MPR error code is returned. MPR_ERR_BAD_STATE will be returned if an invalid version number is supplied. MPR_ERR_ALREADY_EXISTS will be returned if MPR_CACHE_ADD is specified and the cache item already exists.
API Stability:
Evolving.
See Also:
mprCreateCache, mprDestroyCache, mprExpireCache, mprIncCache, mprReadCache, mprRemoveCache, mprSetCacheLimits

MprCmd

MprCmd

Command execution Service.

Description:
The MprCmd service enables execution of local commands. It uses three full-duplex pipes to communicate read, write and error data with the command.
API Stability:
Stable.
See Also:
mprCloseCmdFd, mprCreateCmd, mprDestroyCmd, mprDisableCmdEvents, mprDisconnectCmd, mprEnableCmdEvents, mprFinalizeCmd, mprGetCmdBuf, mprGetCmdExitStatus, mprGetCmdFd, mprIsCmdComplete, mprIsCmdRunning, mprReadCmd, mprReapCmd, mprRunCmd, mprRunCmdV, mprSetCmdCallback, mprSetCmdDir, mprSetCmdEnv, mprSetCmdSearchPath, mprStartCmd, mprStopCmd, mprWaitForCmd, mprWriteCmd, mprWriteCmdBlock
API Stability:
Internal.
Fields:
intargc Count of args in argv.
cchar **argv List of args. Null terminated.
MprCmdProccallback Handler for client output and completion.
intcomplete All channels EOF and status gathered.
cchar **defaultEnv Environment to use if no env passed to mprStartCmd.
char *dir Current working dir for the process.
MprDispatcher *dispatcher Dispatcher to use for wait events.
MprList *env List of environment variables. Null terminated.
inteofCount Count of end-of-files.
MprCmdFilefiles[MPR_CMD_MAX_PIPE] Stdin, stdout for the command.
intflags Control flags (userFlags not here).
MprForkCallbackforkCallback Forked client callback.
cchar **makeArgv Allocated argv.
MprMutex *mutex Multithread sync.
intpid Process ID of the created process.
intpid2 Persistent copy of the pid.
cchar *program Program path name.
intrequiredEof Number of EOFs required for an exit.
char *searchPath Search path to use to locate the command.
MprSignal *signal Signal handler for SIGCHLD.
intstatus Command exit status.
MprBuf *stderrBuf Standard error output from the client.
MprBuf *stdoutBuf Standard output from the client.
intstopped Command stopped.
inttimedout Request has timedout.
void *userData User data storage.
intuserFlags User flags storage.
bool mprAreCmdEventsEnabled (MprCmd *cmd, int channel)

Return true if command events are enabled.

Parameters:
cmdMprCmd object created via mprCreateCmd.
channelChannel number to close. Should be either MPR_CMD_STDIN, MPR_CMD_STDOUT or MPR_CMD_STDERR.
Returns:
True if I/O events are enabled for the given channel.
API Stability:
Internal.
See Also:
mprCloseCmdFd, mprCreateCmd, mprDestroyCmd, mprDisableCmdEvents, mprDisconnectCmd, mprEnableCmdEvents, mprFinalizeCmd, mprGetCmdBuf, mprGetCmdExitStatus, mprGetCmdFd, mprIsCmdComplete, mprIsCmdRunning, mprReadCmd, mprReapCmd, mprRunCmd, mprRunCmdV, mprSetCmdCallback, mprSetCmdDir, mprSetCmdEnv, mprSetCmdSearchPath, mprStartCmd, mprStopCmd, mprWaitForCmd, mprWriteCmd, mprWriteCmdBlock
void mprCloseCmdFd (MprCmd *cmd, int channel)

Close the command channel.

Parameters:
cmdMprCmd object created via mprCreateCmd.
channelChannel number to close. Should be either MPR_CMD_STDIN, MPR_CMD_STDOUT or MPR_CMD_STDERR.
API Stability:
Stable.
See Also:
mprCreateCmd, mprDestroyCmd, mprDisableCmdEvents, mprDisconnectCmd, mprEnableCmdEvents, mprFinalizeCmd, mprGetCmdBuf, mprGetCmdExitStatus, mprGetCmdFd, mprIsCmdComplete, mprIsCmdRunning, mprReadCmd, mprReapCmd, mprRunCmd, mprRunCmdV, mprSetCmdCallback, mprSetCmdDir, mprSetCmdEnv, mprSetCmdSearchPath, mprStartCmd, mprStopCmd, mprWaitForCmd, mprWriteCmd, mprWriteCmdBlock
MprCmd * mprCreateCmd (MprDispatcher *dispatcher)

Create a new Command object.

Returns:
A newly allocated MprCmd object.
API Stability:
Stable.
See Also:
mprCloseCmdFd, mprDestroyCmd, mprDisableCmdEvents, mprDisconnectCmd, mprEnableCmdEvents, mprFinalizeCmd, mprGetCmdBuf, mprGetCmdExitStatus, mprGetCmdFd, mprIsCmdComplete, mprIsCmdRunning, mprReadCmd, mprReapCmd, mprRunCmd, mprRunCmdV, mprSetCmdCallback, mprSetCmdDir, mprSetCmdEnv, mprSetCmdSearchPath, mprStartCmd, mprStopCmd, mprWaitForCmd, mprWriteCmd, mprWriteCmdBlock
void mprDestroyCmd (MprCmd *cmd)

Destroy the command.

Parameters:
cmdMprCmd object created via mprCreateCmd.
API Stability:
Stable.
See Also:
mprCloseCmdFd, mprCreateCmd, mprDisableCmdEvents, mprDisconnectCmd, mprEnableCmdEvents, mprFinalizeCmd, mprGetCmdBuf, mprGetCmdExitStatus, mprGetCmdFd, mprIsCmdComplete, mprIsCmdRunning, mprReadCmd, mprReapCmd, mprRunCmd, mprRunCmdV, mprSetCmdCallback, mprSetCmdDir, mprSetCmdEnv, mprSetCmdSearchPath, mprStartCmd, mprStopCmd, mprWaitForCmd, mprWriteCmd, mprWriteCmdBlock
void mprDisableCmdEvents (MprCmd *cmd, int channel)

Disable command I/O events.

This disables events on a given channel
Parameters:
cmdMprCmd object created via mprCreateCmd.
channelChannel number to close. Should be either MPR_CMD_STDIN, MPR_CMD_STDOUT or MPR_CMD_STDERR.
API Stability:
Stable.
See Also:
mprCloseCmdFd, mprCreateCmd, mprDestroyCmd, mprDisconnectCmd, mprEnableCmdEvents, mprFinalizeCmd, mprGetCmdBuf, mprGetCmdExitStatus, mprGetCmdFd, mprIsCmdComplete, mprIsCmdRunning, mprReadCmd, mprReapCmd, mprRunCmd, mprRunCmdV, mprSetCmdCallback, mprSetCmdDir, mprSetCmdEnv, mprSetCmdSearchPath, mprStartCmd, mprStopCmd, mprWaitForCmd, mprWriteCmd, mprWriteCmdBlock
void mprDisconnectCmd (MprCmd *cmd)

Disconnect a command its underlying I/O channels.

This is used to prevent further I/O wait events while still preserving the MprCmd object
Parameters:
cmdMprCmd object created via mprCreateCmd.
API Stability:
Stable.
See Also:
mprCloseCmdFd, mprCreateCmd, mprDestroyCmd, mprDisableCmdEvents, mprEnableCmdEvents, mprFinalizeCmd, mprGetCmdBuf, mprGetCmdExitStatus, mprGetCmdFd, mprIsCmdComplete, mprIsCmdRunning, mprReadCmd, mprReapCmd, mprRunCmd, mprRunCmdV, mprSetCmdCallback, mprSetCmdDir, mprSetCmdEnv, mprSetCmdSearchPath, mprStartCmd, mprStopCmd, mprWaitForCmd, mprWriteCmd, mprWriteCmdBlock
void mprEnableCmdEvents (MprCmd *cmd, int channel)

Enable command I/O events.

This enables events on a given channel
Parameters:
cmdMprCmd object created via mprCreateCmd.
channelChannel number to close. Should be either MPR_CMD_STDIN, MPR_CMD_STDOUT or MPR_CMD_STDERR.
API Stability:
Stable.
See Also:
mprCloseCmdFd, mprCreateCmd, mprDestroyCmd, mprDisableCmdEvents, mprDisconnectCmd, mprFinalizeCmd, mprGetCmdBuf, mprGetCmdExitStatus, mprGetCmdFd, mprIsCmdComplete, mprIsCmdRunning, mprReadCmd, mprReapCmd, mprRunCmd, mprRunCmdV, mprSetCmdCallback, mprSetCmdDir, mprSetCmdEnv, mprSetCmdSearchPath, mprStartCmd, mprStopCmd, mprWaitForCmd, mprWriteCmd, mprWriteCmdBlock
void mprEnableCmdOutputEvents (MprCmd *cmd, bool on)

Enable command I/O events for the command's STDOUT and STDERR channels.

Parameters:
cmdMprCmd object created via mprCreateCmd.
onSet to true to enable events. Set to false to disable.
Returns:
True if I/O events are enabled for the given channel.
API Stability:
Stable.
See Also:
mprCloseCmdFd, mprCreateCmd, mprDestroyCmd, mprDisableCmdEvents, mprDisconnectCmd, mprEnableCmdEvents, mprFinalizeCmd, mprGetCmdBuf, mprGetCmdExitStatus, mprGetCmdFd, mprIsCmdComplete, mprIsCmdRunning, mprReadCmd, mprReapCmd, mprRunCmd, mprRunCmdV, mprSetCmdCallback, mprSetCmdDir, mprSetCmdEnv, mprSetCmdSearchPath, mprStartCmd, mprStopCmd, mprWaitForCmd, mprWriteCmd, mprWriteCmdBlock
void mprFinalizeCmd (MprCmd *cmd)

Finalize the writing of data to the command process.

Parameters:
cmdMprCmd object created via mprCreateCmd.
API Stability:
Stable.
See Also:
mprCloseCmdFd, mprCreateCmd, mprDestroyCmd, mprDisableCmdEvents, mprDisconnectCmd, mprEnableCmdEvents, mprGetCmdBuf, mprGetCmdExitStatus, mprGetCmdFd, mprIsCmdComplete, mprIsCmdRunning, mprReadCmd, mprReapCmd, mprRunCmd, mprRunCmdV, mprSetCmdCallback, mprSetCmdDir, mprSetCmdEnv, mprSetCmdSearchPath, mprStartCmd, mprStopCmd, mprWaitForCmd, mprWriteCmd, mprWriteCmdBlock
MprBuf * mprGetCmdBuf (MprCmd *cmd, int channel)

Get the underlying buffer for a channel.

Parameters:
cmdMprCmd object created via mprCreateCmd.
channelChannel number to close. Should be either MPR_CMD_STDIN, MPR_CMD_STDOUT or MPR_CMD_STDERR.
Returns:
A reference to the MprBuf buffer structure.
API Stability:
Stable.
See Also:
mprCloseCmdFd, mprCreateCmd, mprDestroyCmd, mprDisableCmdEvents, mprDisconnectCmd, mprEnableCmdEvents, mprFinalizeCmd, mprGetCmdExitStatus, mprGetCmdFd, mprIsCmdComplete, mprIsCmdRunning, mprReadCmd, mprReapCmd, mprRunCmd, mprRunCmdV, mprSetCmdCallback, mprSetCmdDir, mprSetCmdEnv, mprSetCmdSearchPath, mprStartCmd, mprStopCmd, mprWaitForCmd, mprWriteCmd, mprWriteCmdBlock
int mprGetCmdExitStatus (MprCmd *cmd)

Get the command exit status.

Parameters:
cmdMprCmd object created via mprCreateCmd.
Returns:
Status If the command has exited, a status between 0 and 255 is returned. Otherwise, a negative error code is returned.
API Stability:
Stable.
See Also:
mprCloseCmdFd, mprCreateCmd, mprDestroyCmd, mprDisableCmdEvents, mprDisconnectCmd, mprEnableCmdEvents, mprFinalizeCmd, mprGetCmdBuf, mprGetCmdFd, mprIsCmdComplete, mprIsCmdRunning, mprReadCmd, mprReapCmd, mprRunCmd, mprRunCmdV, mprSetCmdCallback, mprSetCmdDir, mprSetCmdEnv, mprSetCmdSearchPath, mprStartCmd, mprStopCmd, mprWaitForCmd, mprWriteCmd, mprWriteCmdBlock
int mprGetCmdFd (MprCmd *cmd, int channel)

Get the underlying file descriptor for an I/O channel.

Parameters:
cmdMprCmd object created via mprCreateCmd.
channelChannel number to close. Should be either MPR_CMD_STDIN, MPR_CMD_STDOUT or MPR_CMD_STDERR.
Returns:
The file descriptor.
API Stability:
Stable.
See Also:
mprCloseCmdFd, mprCreateCmd, mprDestroyCmd, mprDisableCmdEvents, mprDisconnectCmd, mprEnableCmdEvents, mprFinalizeCmd, mprGetCmdBuf, mprGetCmdExitStatus, mprIsCmdComplete, mprIsCmdRunning, mprReadCmd, mprReapCmd, mprRunCmd, mprRunCmdV, mprSetCmdCallback, mprSetCmdDir, mprSetCmdEnv, mprSetCmdSearchPath, mprStartCmd, mprStopCmd, mprWaitForCmd, mprWriteCmd, mprWriteCmdBlock
bool mprIsCmdRunning (MprCmd *cmd)

Test if the command is still running.

Parameters:
cmdMprCmd object created via mprCreateCmd.
Returns:
True if the command is still running.
API Stability:
Stable.
See Also:
mprCloseCmdFd, mprCreateCmd, mprDestroyCmd, mprDisableCmdEvents, mprDisconnectCmd, mprEnableCmdEvents, mprFinalizeCmd, mprGetCmdBuf, mprGetCmdExitStatus, mprGetCmdFd, mprIsCmdComplete, mprReadCmd, mprReapCmd, mprRunCmd, mprRunCmdV, mprSetCmdCallback, mprSetCmdDir, mprSetCmdEnv, mprSetCmdSearchPath, mprStartCmd, mprStopCmd, mprWaitForCmd, mprWriteCmd, mprWriteCmdBlock
void mprPollWinCmd (MprCmd *cmd, MprTicks timeout)

Poll for I/O on the command pipes.

This is only used on windows which can't adequately detect EOF on a named pipe
Parameters:
cmdMprCmd object created via mprCreateCmd.
timeoutTime in milliseconds to wait for the command to complete and exit.
API Stability:
Stable.
See Also:
mprCloseCmdFd, mprCreateCmd, mprDestroyCmd, mprDisableCmdEvents, mprDisconnectCmd, mprEnableCmdEvents, mprFinalizeCmd, mprGetCmdBuf, mprGetCmdExitStatus, mprGetCmdFd, mprIsCmdComplete, mprIsCmdRunning, mprReadCmd, mprReapCmd, mprRunCmd, mprRunCmdV, mprSetCmdCallback, mprSetCmdDir, mprSetCmdEnv, mprSetCmdSearchPath, mprStartCmd, mprStopCmd, mprWaitForCmd, mprWriteCmd, mprWriteCmdBlock
ssize mprReadCmd (MprCmd *cmd, int channel, char *buf, ssize bufsize)

Make the I/O channels to send and receive data to and from the command.

Parameters:
cmdMprCmd object created via mprCreateCmd.
channelChannel number to read from. Should be either MPR_CMD_STDIN, MPR_CMD_STDOUT or MPR_CMD_STDERR.
bufBuffer to read into.
bufsizeSize of buffer.
Returns:
Zero if successful. Otherwise a negative MPR error code.
API Stability:
Stable.
See Also:
mprCloseCmdFd, mprCreateCmd, mprDestroyCmd, mprDisableCmdEvents, mprDisconnectCmd, mprEnableCmdEvents, mprFinalizeCmd, mprGetCmdBuf, mprGetCmdExitStatus, mprGetCmdFd, mprIsCmdComplete, mprIsCmdRunning, mprReapCmd, mprRunCmd, mprRunCmdV, mprSetCmdCallback, mprSetCmdDir, mprSetCmdEnv, mprSetCmdSearchPath, mprStartCmd, mprStopCmd, mprWaitForCmd, mprWriteCmd, mprWriteCmdBlock
int mprReapCmd (MprCmd *cmd, MprTicks timeout)

Reap the command.

This waits for and collect the command exit status
Parameters:
cmdMprCmd object created via mprCreateCmd.
timeoutTime in milliseconds to wait for the command to complete and exit.
Returns:
Zero if successful. Otherwise a negative MPR error code.
API Stability:
Stable.
See Also:
mprCloseCmdFd, mprCreateCmd, mprDestroyCmd, mprDisableCmdEvents, mprDisconnectCmd, mprEnableCmdEvents, mprFinalizeCmd, mprGetCmdBuf, mprGetCmdExitStatus, mprGetCmdFd, mprIsCmdComplete, mprIsCmdRunning, mprReadCmd, mprRunCmd, mprRunCmdV, mprSetCmdCallback, mprSetCmdDir, mprSetCmdEnv, mprSetCmdSearchPath, mprStartCmd, mprStopCmd, mprWaitForCmd, mprWriteCmd, mprWriteCmdBlock
int mprRunCmd (MprCmd *cmd, cchar *command, cchar **envp, char **out, char **err, MprTicks timeout, int flags)

Run a command using a string command line.

This starts the command via mprStartCmd() and waits for its completion
Parameters:
cmdMprCmd object created via mprCreateCmd.
commandCommand line to run.
envpArray of environment strings. Each environment string should be of the form: "KEY=VALUE". The array must be null terminated.
outReference to a string to receive the stdout from the command.
errReference to a string to receive the stderr from the command.
timeoutTime in milliseconds to wait for the command to complete and exit.
flagsFlags to modify execution. Valid flags are: MPR_CMD_NEW_SESSION Create a new session on Unix MPR_CMD_SHOW Show the commands window on Windows MPR_CMD_IN Connect to stdin MPR_CMD_EXACT_ENV Use the exact environment supplied. Don't inherit and blend with existing environment.
Returns:
Zero if successful. Otherwise a negative MPR error code.
API Stability:
Stable.
See Also:
mprCloseCmdFd, mprCreateCmd, mprDestroyCmd, mprDisableCmdEvents, mprDisconnectCmd, mprEnableCmdEvents, mprFinalizeCmd, mprGetCmdBuf, mprGetCmdExitStatus, mprGetCmdFd, mprIsCmdComplete, mprIsCmdRunning, mprReadCmd, mprReapCmd, mprRunCmdV, mprSetCmdCallback, mprSetCmdDir, mprSetCmdEnv, mprSetCmdSearchPath, mprStartCmd, mprStopCmd, mprWaitForCmd, mprWriteCmd, mprWriteCmdBlock
int mprRunCmdV (MprCmd *cmd, int argc, cchar **argv, cchar **envp, char **out, char **err, MprTicks timeout, int flags)

Run a command using an argv[] array of arguments.

This invokes mprStartCmd() and waits for its completion
Parameters:
cmdMprCmd object created via mprCreateCmd.
argcCount of arguments in argv.
argvCommand arguments array.
envpArray of environment strings. Each environment string should be of the form: "KEY=VALUE". The array must be null terminated.
outReference to a string to receive the stdout from the command.
errReference to a string to receive the stderr from the command.
timeoutTime in milliseconds to wait for the command to complete and exit.
flagsFlags to modify execution. Valid flags are: MPR_CMD_NEW_SESSION Create a new session on Unix MPR_CMD_SHOW Show the commands window on Windows MPR_CMD_IN Connect to stdin.
Returns:
Zero if successful. Otherwise a negative MPR error code.
API Stability:
Stable.
See Also:
mprCloseCmdFd, mprCreateCmd, mprDestroyCmd, mprDisableCmdEvents, mprDisconnectCmd, mprEnableCmdEvents, mprFinalizeCmd, mprGetCmdBuf, mprGetCmdExitStatus, mprGetCmdFd, mprIsCmdComplete, mprIsCmdRunning, mprReadCmd, mprReapCmd, mprRunCmd, mprSetCmdCallback, mprSetCmdDir, mprSetCmdEnv, mprSetCmdSearchPath, mprStartCmd, mprStopCmd, mprWaitForCmd, mprWriteCmd, mprWriteCmdBlock
void mprSetCmdCallback (MprCmd *cmd, MprCmdProc callback, void *data)

Define a callback to be invoked to receive response data from the command.

Parameters:
cmdMprCmd object created via mprCreateCmd.
callbackFunction of the signature MprCmdProc which will be invoked for receive notification for data from the commands stdout and stderr channels. MprCmdProc has the signature: int callback(MprCmd *cmd, int channel, void *data) {}.
dataUser defined data to be passed to the callback.
API Stability:
Stable.
See Also:
mprCloseCmdFd, mprCreateCmd, mprDestroyCmd, mprDisableCmdEvents, mprDisconnectCmd, mprEnableCmdEvents, mprFinalizeCmd, mprGetCmdBuf, mprGetCmdExitStatus, mprGetCmdFd, mprIsCmdComplete, mprIsCmdRunning, mprReadCmd, mprReapCmd, mprRunCmd, mprRunCmdV, mprSetCmdDir, mprSetCmdEnv, mprSetCmdSearchPath, mprStartCmd, mprStopCmd, mprWaitForCmd, mprWriteCmd, mprWriteCmdBlock
void mprSetCmdDefaultEnv (MprCmd *cmd, cchar **env)

Set the default environment to use for commands.

Description:
This environment is used if one is not defined via mprStartCmd
Parameters:
cmdMprCmd object created via mprCreateCmd.
envArray of environment "KEY=VALUE" strings. Null terminated.
API Stability:
Stable.
See Also:
mprCloseCmdFd, mprCreateCmd, mprDestroyCmd, mprDisableCmdEvents, mprDisconnectCmd, mprEnableCmdEvents, mprFinalizeCmd, mprGetCmdBuf, mprGetCmdExitStatus, mprGetCmdFd, mprIsCmdComplete, mprIsCmdRunning, mprReadCmd, mprReapCmd, mprRunCmd, mprRunCmdV, mprSetCmdCallback, mprSetCmdDir, mprSetCmdEnv, mprSetCmdSearchPath, mprStartCmd, mprStopCmd, mprWaitForCmd, mprWriteCmd, mprWriteCmdBlock
void mprSetCmdDir (MprCmd *cmd, cchar *dir)

Set the home directory for the command.

Parameters:
cmdMprCmd object created via mprCreateCmd.
dirString directory path name.
API Stability:
Stable.
See Also:
mprCloseCmdFd, mprCreateCmd, mprDestroyCmd, mprDisableCmdEvents, mprDisconnectCmd, mprEnableCmdEvents, mprFinalizeCmd, mprGetCmdBuf, mprGetCmdExitStatus, mprGetCmdFd, mprIsCmdComplete, mprIsCmdRunning, mprReadCmd, mprReapCmd, mprRunCmd, mprRunCmdV, mprSetCmdCallback, mprSetCmdEnv, mprSetCmdSearchPath, mprStartCmd, mprStopCmd, mprWaitForCmd, mprWriteCmd, mprWriteCmdBlock
void mprSetCmdEnv (MprCmd *cmd, cchar **env)

Set the command environment.

Parameters:
cmdMprCmd object created via mprCreateCmd.
envArray of environment strings. Each environment string should be of the form: "KEY=VALUE". The array must be null terminated.
API Stability:
Stable.
See Also:
mprCloseCmdFd, mprCreateCmd, mprDestroyCmd, mprDisableCmdEvents, mprDisconnectCmd, mprEnableCmdEvents, mprFinalizeCmd, mprGetCmdBuf, mprGetCmdExitStatus, mprGetCmdFd, mprIsCmdComplete, mprIsCmdRunning, mprReadCmd, mprReapCmd, mprRunCmd, mprRunCmdV, mprSetCmdCallback, mprSetCmdDir, mprSetCmdSearchPath, mprStartCmd, mprStopCmd, mprWaitForCmd, mprWriteCmd, mprWriteCmdBlock
void mprSetCmdSearchPath (MprCmd *cmd, cchar *search)

Set the default command search path.

Description:
The search path is used to locate the program to run for the command.
Parameters:
cmdMprCmd object created via mprCreateCmd.
searchSearch string. This is in a format similar to the PATH environment variable.
API Stability:
Stable.
See Also:
mprCloseCmdFd, mprCreateCmd, mprDestroyCmd, mprDisableCmdEvents, mprDisconnectCmd, mprEnableCmdEvents, mprFinalizeCmd, mprGetCmdBuf, mprGetCmdExitStatus, mprGetCmdFd, mprIsCmdComplete, mprIsCmdRunning, mprReadCmd, mprReapCmd, mprRunCmd, mprRunCmdV, mprSetCmdCallback, mprSetCmdDir, mprSetCmdEnv, mprStartCmd, mprStopCmd, mprWaitForCmd, mprWriteCmd, mprWriteCmdBlock
int mprStartCmd (MprCmd *cmd, int argc, cchar **argv, cchar **envp, int flags)

Start the command.

This starts the command but does not wait for its completion. Once started, mprWriteCmd can be used to write to the command and response data can be received via mprReadCmd
Parameters:
cmdMprCmd object created via mprCreateCmd.
argcCount of arguments in argv.
argvCommand arguments array.
envpArray of environment strings. Each environment string should be of the form: "KEY=VALUE". The array must be null terminated.
flagsFlags to modify execution. Valid flags are: MPR_CMD_NEW_SESSION Create a new session on Unix MPR_CMD_SHOW Show the commands window on Windows MPR_CMD_IN Connect to stdin.
Returns:
Zero if successful. Otherwise a negative MPR error code.
API Stability:
Stable.
See Also:
mprCloseCmdFd, mprCreateCmd, mprDestroyCmd, mprDisableCmdEvents, mprDisconnectCmd, mprEnableCmdEvents, mprFinalizeCmd, mprGetCmdBuf, mprGetCmdExitStatus, mprGetCmdFd, mprIsCmdComplete, mprIsCmdRunning, mprReadCmd, mprReapCmd, mprRunCmd, mprRunCmdV, mprSetCmdCallback, mprSetCmdDir, mprSetCmdEnv, mprSetCmdSearchPath, mprStopCmd, mprWaitForCmd, mprWriteCmd, mprWriteCmdBlock
int mprStopCmd (MprCmd *cmd, int signal)

Stop the command.

The command is immediately killed
Parameters:
cmdMprCmd object created via mprCreateCmd.
signalSignal to send to the command to kill if required.
API Stability:
Stable.
See Also:
mprCloseCmdFd, mprCreateCmd, mprDestroyCmd, mprDisableCmdEvents, mprDisconnectCmd, mprEnableCmdEvents, mprFinalizeCmd, mprGetCmdBuf, mprGetCmdExitStatus, mprGetCmdFd, mprIsCmdComplete, mprIsCmdRunning, mprReadCmd, mprReapCmd, mprRunCmd, mprRunCmdV, mprSetCmdCallback, mprSetCmdDir, mprSetCmdEnv, mprSetCmdSearchPath, mprStartCmd, mprWaitForCmd, mprWriteCmd, mprWriteCmdBlock
int mprWaitForCmd (MprCmd *cmd, MprTicks timeout)

Wait for the command to complete.

Parameters:
cmdMprCmd object created via mprCreateCmd.
timeoutTime in milliseconds to wait for the command to complete and exit.
Returns:
Zero if successful. Otherwise a negative MPR error code.
API Stability:
Stable.
See Also:
mprCloseCmdFd, mprCreateCmd, mprDestroyCmd, mprDisableCmdEvents, mprDisconnectCmd, mprEnableCmdEvents, mprFinalizeCmd, mprGetCmdBuf, mprGetCmdExitStatus, mprGetCmdFd, mprIsCmdComplete, mprIsCmdRunning, mprReadCmd, mprReapCmd, mprRunCmd, mprRunCmdV, mprSetCmdCallback, mprSetCmdDir, mprSetCmdEnv, mprSetCmdSearchPath, mprStartCmd, mprStopCmd, mprWriteCmd, mprWriteCmdBlock
ssize mprWriteCmd (MprCmd *cmd, int channel, char *buf, ssize bufsize)

Write data to an I/O channel.

Description:
This is a non-blocking write and may return having written less than requested.
Parameters:
cmdMprCmd object created via mprCreateCmd.
channelChannel number to read from. Should be either MPR_CMD_STDIN, MPR_CMD_STDOUT or MPR_CMD_STDERR.
bufBuffer to read into.
bufsizeSize of buffer.
Returns:
Count of bytes written.
API Stability:
Stable.
See Also:
mprCloseCmdFd, mprCreateCmd, mprDestroyCmd, mprDisableCmdEvents, mprDisconnectCmd, mprEnableCmdEvents, mprFinalizeCmd, mprGetCmdBuf, mprGetCmdExitStatus, mprGetCmdFd, mprIsCmdComplete, mprIsCmdRunning, mprReadCmd, mprReapCmd, mprRunCmd, mprRunCmdV, mprSetCmdCallback, mprSetCmdDir, mprSetCmdEnv, mprSetCmdSearchPath, mprStartCmd, mprStopCmd, mprWaitForCmd, mprWriteCmdBlock
ssize mprWriteCmdBlock (MprCmd *cmd, int channel, char *buf, ssize bufsize)

Write data to an I/O channel.

Description:
This is a blocking write.
Parameters:
cmdMprCmd object created via mprCreateCmd.
channelChannel number to read from. Should be either MPR_CMD_STDIN, MPR_CMD_STDOUT or MPR_CMD_STDERR.
bufBuffer to read into.
bufsizeSize of buffer.
Returns:
Count of bytes written.
API Stability:
Stable.
See Also:
mprCloseCmdFd, mprCreateCmd, mprDestroyCmd, mprDisableCmdEvents, mprDisconnectCmd, mprEnableCmdEvents, mprFinalizeCmd, mprGetCmdBuf, mprGetCmdExitStatus, mprGetCmdFd, mprIsCmdComplete, mprIsCmdRunning, mprReadCmd, mprReapCmd, mprRunCmd, mprRunCmdV, mprSetCmdCallback, mprSetCmdDir, mprSetCmdEnv, mprSetCmdSearchPath, mprStartCmd, mprStopCmd, mprWaitForCmd, mprWriteCmd

MprDispatcher

MprDispatcher

Event Dispatcher.

API Stability:
Internal.
Fields:
MprCond *cond Multi-thread sync.
MprEvent *currentQ Currently executing events.
MprEvent *eventQ Event queue.
intflags Dispatcher control flags.
cchar *name Dispatcher name / purpose.
struct MprDispatcher *next Next dispatcher linkage.
MprOsThreadowner Owning thread of the dispatcher.
struct MprDispatcher *parent Queue pointer.
struct MprDispatcher *prev Previous dispatcher linkage.
struct MprWorker *requiredWorker Worker affinity.
struct MprEventService *service Event service reference.
MprDispatcher * mprCreateDispatcher (cchar *name, int flags)

Create a new event dispatcher.

Parameters:
nameUseful name for debugging.
flagsInitial dispatcher flags. Set MPR_DISPATCHER_ENABLED to enable.
Returns:
A Dispatcher object that can manage events and be used with mprCreateEvent.
API Stability:
Internal.
See Also:
void mprDisableDispatcher (MprDispatcher *dispatcher)

Disable a dispatcher from service events.

This removes the dispatcher from any dispatcher queues and allows it to be garbage collected
Parameters:
dispatcherDispatcher to disable.
API Stability:
Internal.
See Also:
void mprEnableDispatcher (MprDispatcher *dispatcher)

Enable a dispatcher to service events.

The mprCreateDispatcher routiner may create a dispatchers in the disabled state. Use mprEnableDispatcher to enable them to begin servicing events
Parameters:
dispatcherDispatcher to enable.
API Stability:
Internal.
See Also:
MprDispatcher * mprGetDispatcher ()

Get the MPR primary dispatcher.

Returns:
The MPR dispatcher object.
API Stability:
Internal.
See Also:
int mprServiceEvents (MprTicks delay, int flags)

Service events.

This can be called by any thread. Typically an app will dedicate one thread to be an event service thread. This call will service events until the timeout expires or if MPR_SERVICE_ONE_THING is specified in flags, after one event. This will service all enabled dispatcher queues and pending I/O events
Parameters:
delayTime in milliseconds to wait. Set to zero for no wait. Set to -1 to wait forever.
flagsIf set to MPR_SERVICE_ONE_THING, this call will service at most one event. Otherwise set to zero.
Returns:
The number of events serviced. Returns MPR_ERR_BUSY is another thread is servicing events and timeout is zero.
API Stability:
Stable.
See Also:
void mprSignalDispatcher (MprDispatcher *dispatcher)

Signal the dispatcher to wakeup and re-examine its queues.

Parameters:
dispatcherEvent dispatcher to monitor.
API Stability:
Internal.
See Also:
int mprWaitForEvent (MprDispatcher *dispatcher, MprTicks timeout)

Wait for an event to occur on the given dispatcher.

Parameters:
dispatcherEvent dispatcher to monitor.
timeoutfor waiting in milliseconds.
Returns:
Zero if successful and an event occurred before the timeout expired. Returns MPR_ERR_TIMEOUT if no event is fired before the timeout expires.
API Stability:
Stable.
See Also:

MprEvent

MprEvent

Event object.

Description:
The MPR provides a powerful priority based eventing mechanism. Events are described by MprEvent objects which are created and queued via mprCreateEvent. Each event may have a priority and may be one-shot or be continuously rescheduled according to a specified period. The event subsystem provides the basis for callback timers.
See Also:
MprDispatcher, MprEventProc, mprCreateDispatcher, mprCreateEvent, mprCreateEventOutside, mprCreateTimerEvent, mprEnableContinuousEvent, mprEnableDispatcher, mprGetDispatcher, mprRemoveEvent, mprRescheduleEvent, mprRestartContinuousEvent, mprServiceEvents, mprSignalDispatcher, mprStopContinuousEvent, mprWaitForEvent
API Stability:
Internal.
API Stability:
Internal.
Fields:
void *data Event private data.
struct MprDispatcher *dispatcher Event dispatcher service.
MprTicksdue When is the event due.
intflags Event flags.
struct MprWaitHandler *handler Optional wait handler.
intmask I/O mask of events.
cchar *name Static debug name of the event.
struct MprEvent *next Next event linkage.
MprTicksperiod Reschedule period.
struct MprEvent *prev Previous event linkage.
MprEventProcproc Callback procedure.
MprTickstimestamp When was the event created.
MprEvent * mprCreateEvent (MprDispatcher *dispatcher, cchar *name, MprTicks period, void *proc, void *data, int flags)

Create a new event.

Description:
Create a new event for service.
Parameters:
dispatcherDispatcher object created via mprCreateDispatcher.
nameDebug name of the event.
periodTime in milliseconds used by continuous events between firing of the event.
procFunction to invoke when the event is run.
dataData to associate with the event and stored in event->data. The data must be either an allocated memory object or MPR_EVENT_STATIC_DATA must be specified in flags.
flagsFlags to modify the behavior of the event. Valid values are: MPR_EVENT_CONTINUOUS to create an event which will be automatically rescheduled accoring to the specified period. Use MPR_EVENT_STATIC_DATA if the data argument does not point to an allocated memory object.
Returns:
The event object if successful.
API Stability:
Stable.
See Also:
MprDispatcher, MprEvent, MprEventProc, mprCreateDispatcher, mprCreateEventOutside, mprCreateTimerEvent, mprEnableContinuousEvent, mprEnableDispatcher, mprGetDispatcher, mprRemoveEvent, mprRescheduleEvent, mprRestartContinuousEvent, mprServiceEvents, mprSignalDispatcher, mprStopContinuousEvent, mprWaitForEvent
int mprCreateEventOutside (MprDispatcher *dispatcher, void *proc, void *data)

Create an event outside the MPR.

Description:
Create a new event when executing a non-MPR thread.
Parameters:
dispatcherDispatcher object created via mprCreateDispatcher.
procFunction to invoke when the event is run.
dataData to associate with the event and stored in event->data. The data must be non-MPR memory.
Returns:
Returns zero if successful, otherwise a negative MPR error code.
API Stability:
Stable.
See Also:
MprDispatcher, MprEvent, MprEventProc, mprCreateDispatcher, mprCreateEvent, mprCreateTimerEvent, mprEnableContinuousEvent, mprEnableDispatcher, mprGetDispatcher, mprRemoveEvent, mprRescheduleEvent, mprRestartContinuousEvent, mprServiceEvents, mprSignalDispatcher, mprStopContinuousEvent, mprWaitForEvent
MprEvent * mprCreateTimerEvent (MprDispatcher *dispatcher, cchar *name, MprTicks period, void *proc, void *data, int flags)

Create a timer event.

Description:
Create and queue a timer event for service. This is a convenience wrapper to create continuous events over the mprCreateEvent call.
Parameters:
dispatcherDispatcher object created via mprCreateDispatcher
nameDebug name of the event.
procFunction to invoke when the event is run.
periodTime in milliseconds used by continuous events between firing of the event.
dataData to associate with the event and stored in event->data.
flagsNot used.
API Stability:
Stable.
See Also:
MprDispatcher, MprEvent, MprEventProc, mprCreateDispatcher, mprCreateEvent, mprCreateEventOutside, mprEnableContinuousEvent, mprEnableDispatcher, mprGetDispatcher, mprRemoveEvent, mprRescheduleEvent, mprRestartContinuousEvent, mprServiceEvents, mprSignalDispatcher, mprStopContinuousEvent, mprWaitForEvent
void mprEnableContinuousEvent (MprEvent *event, int enable)

Enable or disable an event being continous.

Description:
This call will modify the continuous property for an event.
Parameters:
eventEvent object returned from mprCreateEvent
enableSet to 1 to enable continous scheduling of the event.
API Stability:
Stable.
See Also:
MprDispatcher, MprEvent, MprEventProc, mprCreateDispatcher, mprCreateEvent, mprCreateEventOutside, mprCreateTimerEvent, mprEnableDispatcher, mprGetDispatcher, mprRemoveEvent, mprRescheduleEvent, mprRestartContinuousEvent, mprServiceEvents, mprSignalDispatcher, mprStopContinuousEvent, mprWaitForEvent
void mprRemoveEvent (MprEvent *event)

Remove an event.

Description:
Remove a queued event. This is useful to remove continuous events from the event queue.
Parameters:
eventEvent object returned from mprCreateEvent
API Stability:
Stable.
See Also:
MprDispatcher, MprEvent, MprEventProc, mprCreateDispatcher, mprCreateEvent, mprCreateEventOutside, mprCreateTimerEvent, mprEnableContinuousEvent, mprEnableDispatcher, mprGetDispatcher, mprRescheduleEvent, mprRestartContinuousEvent, mprServiceEvents, mprSignalDispatcher, mprStopContinuousEvent, mprWaitForEvent
void mprRescheduleEvent (MprEvent *event, MprTicks period)

Reschedule an event.

Description:
Reschedule a continuous event by modifying its period.
Parameters:
eventEvent object returned from mprCreateEvent
periodTime in milliseconds used by continuous events between firing of the event.
API Stability:
Stable.
See Also:
MprDispatcher, MprEvent, MprEventProc, mprCreateDispatcher, mprCreateEvent, mprCreateEventOutside, mprCreateTimerEvent, mprEnableContinuousEvent, mprEnableDispatcher, mprGetDispatcher, mprRemoveEvent, mprRestartContinuousEvent, mprServiceEvents, mprSignalDispatcher, mprStopContinuousEvent, mprWaitForEvent
void mprRestartContinuousEvent (MprEvent *event)

Restart an event.

Description:
Restart a continuous event after it has been stopped via mprStopContinuousEvent. This call will add the event to the event queue and it will run after the configured event period has expired.
Parameters:
eventEvent object returned from mprCreateEvent
API Stability:
Stable.
See Also:
MprDispatcher, MprEvent, MprEventProc, mprCreateDispatcher, mprCreateEvent, mprCreateEventOutside, mprCreateTimerEvent, mprEnableContinuousEvent, mprEnableDispatcher, mprGetDispatcher, mprRemoveEvent, mprRescheduleEvent, mprServiceEvents, mprSignalDispatcher, mprStopContinuousEvent, mprWaitForEvent
void mprStopContinuousEvent (MprEvent *event)

Stop an event.

Description:
Stop a continuous event and remove from the queue.
Parameters:
eventEvent object returned from mprCreateEvent
API Stability:
Stable.
See Also:
MprDispatcher, MprEvent, MprEventProc, mprCreateDispatcher, mprCreateEvent, mprCreateEventOutside, mprCreateTimerEvent, mprEnableContinuousEvent, mprEnableDispatcher, mprGetDispatcher, mprRemoveEvent, mprRescheduleEvent, mprRestartContinuousEvent, mprServiceEvents, mprSignalDispatcher, mprWaitForEvent

MprFile

MprFile

File I/O Module.

Description:
MprFile is the cross platform File I/O abstraction control structure. An instance will be created when a file is created or opened via mprOpenFile
API Stability:
Stable.
See Also:
mprAttachFileFd, mprCloseFile, mprDisableFileBuffering, mprEnableFileBuffering, mprFlushFile, mprGetFileChar, mprGetFileFd, mprGetFilePosition, mprGetFileSize, mprGetStderr, mprGetStdin, mprGetStdout, mprOpenFile, mprPeekFileChar, mprPutFileChar, mprPutFileString, mprReadFile, mprReadLine, mprSeekFile, mprTruncateFile, mprWriteFile
API Stability:
Internal.
Fields:
intattached Attached to existing descriptor.
MprBuf *buf Buffer for I/O if buffered.
intfd File handle.
MprFileSystem *fileSystem File system owning this file.
MprRomInode *inode Reference to ROM file.
MprOffiopos Raw I/O position.
intmode File open mode.
char *path Filename.
intperms File permissions.
MprOffpos Current read position.
MprOffsize Current file size.
MprFile * mprAttachFileFd (int fd, cchar *name, int omode)

Attach to an existing file descriptor.

Description:
Attach a file to an open file decriptor and return a file object.
Parameters:
fdFile descriptor to attach to.
nameDescriptive name for the file.
omodePosix style file open mode mask. The open mode may contain the following mask values ored together:
  • O_RDONLY Open read only
  • O_WRONLY Open write only
  • O_RDWR Open for read and write
  • O_CREAT Create or re-create
  • O_TRUNC Truncate
  • O_BINARY Open for binary data
  • O_TEXT Open for text data
  • O_EXCL Open with an exclusive lock
  • O_APPEND Open to append
Returns:
Returns an MprFile object to use in other file operations.
API Stability:
Evolving.
See Also:
MprFile, mprCloseFile, mprDisableFileBuffering, mprEnableFileBuffering, mprFlushFile, mprGetFileChar, mprGetFileFd, mprGetFilePosition, mprGetFileSize, mprGetStderr, mprGetStdin, mprGetStdout, mprOpenFile, mprPeekFileChar, mprPutFileChar, mprPutFileString, mprReadFile, mprReadLine, mprSeekFile, mprTruncateFile, mprWriteFile
int mprCloseFile (MprFile *file)

Close a file.

Description:
This call closes a file without destroying the file object.
Parameters:
fileFile instance returned from mprOpenFile
Returns:
Returns zero if successful, otherwise a negative MPR error code.
API Stability:
Stable.
See Also:
MprFile, mprAttachFileFd, mprDisableFileBuffering, mprEnableFileBuffering, mprFlushFile, mprGetFileChar, mprGetFileFd, mprGetFilePosition, mprGetFileSize, mprGetStderr, mprGetStdin, mprGetStdout, mprOpenFile, mprPeekFileChar, mprPutFileChar, mprPutFileString, mprReadFile, mprReadLine, mprSeekFile, mprTruncateFile, mprWriteFile
void mprDisableFileBuffering (MprFile *file)

Disable file buffering.

Description:
Disable any buffering of data when using the buffer.
Parameters:
fileFile instance returned from mprOpenFile
API Stability:
Evolving.
See Also:
MprFile, mprAttachFileFd, mprCloseFile, mprEnableFileBuffering, mprFlushFile, mprGetFileChar, mprGetFileFd, mprGetFilePosition, mprGetFileSize, mprGetStderr, mprGetStdin, mprGetStdout, mprOpenFile, mprPeekFileChar, mprPutFileChar, mprPutFileString, mprReadFile, mprReadLine, mprSeekFile, mprTruncateFile, mprWriteFile
int mprEnableFileBuffering (MprFile *file, ssize size, ssize maxSize)

Enable file buffering.

Description:
Enable data buffering when using the buffer.
Parameters:
fileFile instance returned from mprOpenFile
sizeSize to allocate for the buffer.
maxSizeMaximum size the data buffer can grow to.
API Stability:
Evolving.
See Also:
MprFile, mprAttachFileFd, mprCloseFile, mprDisableFileBuffering, mprFlushFile, mprGetFileChar, mprGetFileFd, mprGetFilePosition, mprGetFileSize, mprGetStderr, mprGetStdin, mprGetStdout, mprOpenFile, mprPeekFileChar, mprPutFileChar, mprPutFileString, mprReadFile, mprReadLine, mprSeekFile, mprTruncateFile, mprWriteFile
int mprFlushFile (MprFile *file)

Flush any buffered write data.

Description:
Write buffered write data and then reset the internal buffers.
Parameters:
filePointer to an MprFile object returned via MprOpen.
Returns:
Zero if successful, otherwise a negative MPR error code.
API Stability:
Evolving.
See Also:
MprFile, mprAttachFileFd, mprCloseFile, mprDisableFileBuffering, mprEnableFileBuffering, mprGetFileChar, mprGetFileFd, mprGetFilePosition, mprGetFileSize, mprGetStderr, mprGetStdin, mprGetStdout, mprOpenFile, mprPeekFileChar, mprPutFileChar, mprPutFileString, mprReadFile, mprReadLine, mprSeekFile, mprTruncateFile, mprWriteFile
int mprGetFileChar (MprFile *file)

Read a character from the file.

Description:
Read a single character from the file and advance the read position.
Parameters:
filePointer to an MprFile object returned via MprOpen.
Returns:
If successful, return the character just read. Otherwise return a negative MPR error code. End of file is signified by reading 0.
API Stability:
Stable.
See Also:
MprFile, mprAttachFileFd, mprCloseFile, mprDisableFileBuffering, mprEnableFileBuffering, mprFlushFile, mprGetFileFd, mprGetFilePosition, mprGetFileSize, mprGetStderr, mprGetStdin, mprGetStdout, mprOpenFile, mprPeekFileChar, mprPutFileChar, mprPutFileString, mprReadFile, mprReadLine, mprSeekFile, mprTruncateFile, mprWriteFile
int mprGetFileFd (MprFile *file)

Get the file descriptor for a file.

Parameters:
fileFile object returned via mprOpenFile
Returns:
An integer O/S file descriptor.
API Stability:
Stable.
See Also:
MprFile, mprAttachFileFd, mprCloseFile, mprDisableFileBuffering, mprEnableFileBuffering, mprFlushFile, mprGetFileChar, mprGetFilePosition, mprGetFileSize, mprGetStderr, mprGetStdin, mprGetStdout, mprOpenFile, mprPeekFileChar, mprPutFileChar, mprPutFileString, mprReadFile, mprReadLine, mprSeekFile, mprTruncateFile, mprWriteFile
MprOff mprGetFilePosition (MprFile *file)

Return the current file position.

Description:
Return the current read/write file position.
Parameters:
fileA file object returned from mprOpenFile
Returns:
The current file offset position if successful. Returns a negative MPR error code on errors.
See Also:
MprFile, mprAttachFileFd, mprCloseFile, mprDisableFileBuffering, mprEnableFileBuffering, mprFlushFile, mprGetFileChar, mprGetFileFd, mprGetFileSize, mprGetStderr, mprGetStdin, mprGetStdout, mprOpenFile, mprPeekFileChar, mprPutFileChar, mprPutFileString, mprReadFile, mprReadLine, mprSeekFile, mprTruncateFile, mprWriteFile
MprOff mprGetFileSize (MprFile *file)

Get the size of the file.

Description:
Return the current file size.
Parameters:
fileA file object returned from mprOpenFile
Returns:
The current file size if successful. Returns a negative MPR error code on errors.
API Stability:
Stable.
See Also:
MprFile, mprAttachFileFd, mprCloseFile, mprDisableFileBuffering, mprEnableFileBuffering, mprFlushFile, mprGetFileChar, mprGetFileFd, mprGetFilePosition, mprGetStderr, mprGetStdin, mprGetStdout, mprOpenFile, mprPeekFileChar, mprPutFileChar, mprPutFileString, mprReadFile, mprReadLine, mprSeekFile, mprTruncateFile, mprWriteFile
MprFile * mprGetStderr ()

Return a file object for the Stderr I/O channel.

Returns:
A file object.
API Stability:
Stable.
See Also:
MprFile, mprAttachFileFd, mprCloseFile, mprDisableFileBuffering, mprEnableFileBuffering, mprFlushFile, mprGetFileChar, mprGetFileFd, mprGetFilePosition, mprGetFileSize, mprGetStdin, mprGetStdout, mprOpenFile, mprPeekFileChar, mprPutFileChar, mprPutFileString, mprReadFile, mprReadLine, mprSeekFile, mprTruncateFile, mprWriteFile
MprFile * mprGetStdin ()

Return a file object for the Stdin I/O channel.

Returns:
A file object.
API Stability:
Stable.
See Also:
MprFile, mprAttachFileFd, mprCloseFile, mprDisableFileBuffering, mprEnableFileBuffering, mprFlushFile, mprGetFileChar, mprGetFileFd, mprGetFilePosition, mprGetFileSize, mprGetStderr, mprGetStdout, mprOpenFile, mprPeekFileChar, mprPutFileChar, mprPutFileString, mprReadFile, mprReadLine, mprSeekFile, mprTruncateFile, mprWriteFile
MprFile * mprGetStdout ()

Return a file object for the Stdout I/O channel.

Returns:
A file object.
API Stability:
Stable.
See Also:
MprFile, mprAttachFileFd, mprCloseFile, mprDisableFileBuffering, mprEnableFileBuffering, mprFlushFile, mprGetFileChar, mprGetFileFd, mprGetFilePosition, mprGetFileSize, mprGetStderr, mprGetStdin, mprOpenFile, mprPeekFileChar, mprPutFileChar, mprPutFileString, mprReadFile, mprReadLine, mprSeekFile, mprTruncateFile, mprWriteFile
MprFile * mprOpenFile (cchar *filename, int omode, int perms)

Open a file.

Description:
Open a file and return a file object.
Parameters:
filenameString containing the filename to open or create.
omodePosix style file open mode mask. The open mode may contain the following mask values ored together:
  • O_RDONLY Open read only
  • O_WRONLY Open write only
  • O_RDWR Open for read and write
  • O_CREAT Create or re-create
  • O_TRUNC Truncate
  • O_BINARY Open for binary data
  • O_TEXT Open for text data
  • O_EXCL Open with an exclusive lock
  • O_APPEND Open to append
permsPosix style file permissions mask.
Returns:
Returns an MprFile object to use in other file operations.
API Stability:
Stable.
See Also:
MprFile, mprAttachFileFd, mprCloseFile, mprDisableFileBuffering, mprEnableFileBuffering, mprFlushFile, mprGetFileChar, mprGetFileFd, mprGetFilePosition, mprGetFileSize, mprGetStderr, mprGetStdin, mprGetStdout, mprPeekFileChar, mprPutFileChar, mprPutFileString, mprReadFile, mprReadLine, mprSeekFile, mprTruncateFile, mprWriteFile
int mprPeekFileChar (MprFile *file)

Non-destructively read a character from the file.

Description:
Read a single character from the file without advancing the read position.
Parameters:
filePointer to an MprFile object returned via MprOpen.
Returns:
If successful, return the character just read. Otherwise return a negative MPR error code. End of file is signified by reading 0.
API Stability:
Stable.
See Also:
MprFile, mprAttachFileFd, mprCloseFile, mprDisableFileBuffering, mprEnableFileBuffering, mprFlushFile, mprGetFileChar, mprGetFileFd, mprGetFilePosition, mprGetFileSize, mprGetStderr, mprGetStdin, mprGetStdout, mprOpenFile, mprPutFileChar, mprPutFileString, mprReadFile, mprReadLine, mprSeekFile, mprTruncateFile, mprWriteFile
ssize mprPutFileChar (MprFile *file, int c)

Write a character to the file.

Description:
Writes a single character to the file. Output is buffered and is flushed as required or when mprClose is called.
Parameters:
filePointer to an MprFile object returned via MprOpen.
cCharacter to write.
Returns:
One if successful, otherwise returns a negative MPR error code on errors.
API Stability:
Stable.
See Also:
MprFile, mprAttachFileFd, mprCloseFile, mprDisableFileBuffering, mprEnableFileBuffering, mprFlushFile, mprGetFileChar, mprGetFileFd, mprGetFilePosition, mprGetFileSize, mprGetStderr, mprGetStdin, mprGetStdout, mprOpenFile, mprPeekFileChar, mprPutFileString, mprReadFile, mprReadLine, mprSeekFile, mprTruncateFile, mprWriteFile
ssize mprPutFileString (MprFile *file, cchar *str)

Write a string to the file.

Description:
Writes a string to the file. Output is buffered and is flushed as required or when mprClose is called.
Parameters:
filePointer to an MprFile object returned via MprOpen.
strString to write.
Returns:
The number of characters written to the file. Returns a negative MPR error code on errors.
API Stability:
Stable.
See Also:
MprFile, mprAttachFileFd, mprCloseFile, mprDisableFileBuffering, mprEnableFileBuffering, mprFlushFile, mprGetFileChar, mprGetFileFd, mprGetFilePosition, mprGetFileSize, mprGetStderr, mprGetStdin, mprGetStdout, mprOpenFile, mprPeekFileChar, mprPutFileChar, mprReadFile, mprReadLine, mprSeekFile, mprTruncateFile, mprWriteFile
ssize mprReadFile (MprFile *file, void *buf, ssize size)

Read data from a file.

Description:
Reads data from a file.
Parameters:
filePointer to an MprFile object returned via MprOpen.
bufBuffer to contain the read data.
sizeSize of buf in characters.
Returns:
The number of characters read from the file. Returns a negative MPR error code on errors.
API Stability:
Stable.
See Also:
MprFile, mprAttachFileFd, mprCloseFile, mprDisableFileBuffering, mprEnableFileBuffering, mprFlushFile, mprGetFileChar, mprGetFileFd, mprGetFilePosition, mprGetFileSize, mprGetStderr, mprGetStdin, mprGetStdout, mprOpenFile, mprPeekFileChar, mprPutFileChar, mprPutFileString, mprReadLine, mprSeekFile, mprTruncateFile, mprWriteFile
char * mprReadLine (MprFile *file, ssize size, ssize *len)

Read a line from the file.

Description:
Read a single line from the file. Lines are delimited by the newline character. The newline is not included in the returned buffer. This call will read lines up to the given size in length. If no newline is found, all available characters, up to size, will be returned.
Parameters:
filePointer to an MprFile object returned via MprOpen.
sizeMaximum number of characters in a line.
lenPointer to an integer to hold the length of the returned string.
Returns:
An allocated string and sets *len to the number of bytes read.
API Stability:
Stable.
See Also:
MprFile, mprAttachFileFd, mprCloseFile, mprDisableFileBuffering, mprEnableFileBuffering, mprFlushFile, mprGetFileChar, mprGetFileFd, mprGetFilePosition, mprGetFileSize, mprGetStderr, mprGetStdin, mprGetStdout, mprOpenFile, mprPeekFileChar, mprPutFileChar, mprPutFileString, mprReadFile, mprSeekFile, mprTruncateFile, mprWriteFile
MprOff mprSeekFile (MprFile *file, int seekType, MprOff distance)

Seek the I/O pointer to a new location in the file.

Description:
Move the position in the file to/from which I/O will be performed in the file. Seeking prior to a read or write will cause the next I/O to occur at that location.
Parameters:
filePointer to an MprFile object returned via MprOpen.
seekTypeSeek type may be one of the following three values:
  • SEEK_SET Seek to a position relative to the start of the file
  • SEEK_CUR Seek relative to the current position
  • SEEK_END Seek relative to the end of the file
distanceA positive or negative byte offset.
Returns:
The new file position if successful otherwise a negative MPR error code is returned.
API Stability:
Stable.
See Also:
MprFile, mprAttachFileFd, mprCloseFile, mprDisableFileBuffering, mprEnableFileBuffering, mprFlushFile, mprGetFileChar, mprGetFileFd, mprGetFilePosition, mprGetFileSize, mprGetStderr, mprGetStdin, mprGetStdout, mprOpenFile, mprPeekFileChar, mprPutFileChar, mprPutFileString, mprReadFile, mprReadLine, mprTruncateFile, mprWriteFile
int mprTruncateFile (cchar *path, MprOff size)

Truncate a file.

Description:
Truncate a file to a given size. Note this works on a path and not on an open file.
Parameters:
pathFile to truncate.
sizeNew maximum size for the file.
Returns:
Zero if successful.
API Stability:
Stable.
See Also:
MprFile, mprAttachFileFd, mprCloseFile, mprDisableFileBuffering, mprEnableFileBuffering, mprFlushFile, mprGetFileChar, mprGetFileFd, mprGetFilePosition, mprGetFileSize, mprGetStderr, mprGetStdin, mprGetStdout, mprOpenFile, mprPeekFileChar, mprPutFileChar, mprPutFileString, mprReadFile, mprReadLine, mprSeekFile, mprWriteFile
ssize mprWriteFile (MprFile *file, cvoid *buf, ssize count)

Write data to a file.

Description:
Writes data to a file.
Parameters:
filePointer to an MprFile object returned via MprOpen.
bufBuffer containing the data to write.
countCound of characters in buf to write.
Returns:
The number of characters actually written to the file. Returns a negative MPR error code on errors.
API Stability:
Stable.
See Also:
MprFile, mprAttachFileFd, mprCloseFile, mprDisableFileBuffering, mprEnableFileBuffering, mprFlushFile, mprGetFileChar, mprGetFileFd, mprGetFilePosition, mprGetFileSize, mprGetStderr, mprGetStdin, mprGetStdout, mprOpenFile, mprPeekFileChar, mprPutFileChar, mprPutFileString, mprReadFile, mprReadLine, mprSeekFile, mprTruncateFile
ssize mprWriteFileFmt (MprFile *file, cchar *fmt, ...)

Write formatted data to a file.

Description:
Writes a formatted string to a file.
Parameters:
filePointer to an MprFile object returned via MprOpen.
fmtFormat string.
Returns:
The number of characters actually written to the file. Returns a negative MPR error code on errors.
API Stability:
Stable.
See Also:
MprFile, mprAttachFileFd, mprCloseFile, mprDisableFileBuffering, mprEnableFileBuffering, mprFlushFile, mprGetFileChar, mprGetFileFd, mprGetFilePosition, mprGetFileSize, mprGetStderr, mprGetStdin, mprGetStdout, mprOpenFile, mprPeekFileChar, mprPutFileChar, mprPutFileString, mprReadFile, mprReadLine, mprSeekFile, mprTruncateFile, mprWriteFile
ssize mprWriteFileString (MprFile *file, cchar *str)

Write a string to a file.

Description:
Writes a string to a file.
Parameters:
filePointer to an MprFile object returned via MprOpen.
strString to write.
Returns:
The number of characters actually written to the file. Returns a negative MPR error code on errors.
API Stability:
Stable.
See Also:
MprFile, mprAttachFileFd, mprCloseFile, mprDisableFileBuffering, mprEnableFileBuffering, mprFlushFile, mprGetFileChar, mprGetFileFd, mprGetFilePosition, mprGetFileSize, mprGetStderr, mprGetStdin, mprGetStdout, mprOpenFile, mprPeekFileChar, mprPutFileChar, mprPutFileString, mprReadFile, mprReadLine, mprSeekFile, mprTruncateFile, mprWriteFile

MprFileSystem

MprFileSystem

File system service.

Description:
The MPR provides a file system abstraction to support non-disk based file access such as flash or other ROM based file systems. The MprFileSystem structure defines a virtual file system interface that will be invoked by the various MPR file routines.
See Also:
MprRomInode, mprAddFileSystem, mprCreateFileSystem, mprCreateRomFileSystem, mprLookupFileSystem, mprSetPathNewline, mprSetPathSeparators, mprSetRomFileSystem
API Stability:
Internal.
Fields:
MprAccessFileProcaccessPath Virtual access file routine.
boolcaseSensitive Path comparisons are case sensitive.
MprCloseFileProccloseFile Virtual close file routine.
MprDeleteFileProcdeletePath Virtual delete file routine.
MprGetPathInfoProcgetPathInfo Virtual get file information routine.
MprGetPathLinkProcgetPathLink Virtual get the symbolic link target.
boolhasDriveSpecs Paths can have drive specifications.
MprMakeDirProcmakeDir Virtual make directory routine.
MprMakeLinkProcmakeLink Virtual make link routine.
char *newline Newline for text files.
MprOpenFileProcopenFile Virtual open file routine.
MprReadFileProcreadFile Virtual read file routine.
cchar *root Root file path.
MprSeekFileProcseekFile Virtual seek file routine.
char *separators Filename path separators. First separator is the preferred separator.
MprSetBufferedProcsetBuffered Virtual set buffered I/O routine.
MprTruncateFileProctruncateFile Virtual truncate file routine.
MprWriteFileProcwriteFile Virtual write file routine.
void mprAddFileSystem (MprFileSystem *fs)

Create and initialize the disk FileSystem.

Description:
This is an internal routine called by the MPR during initialization.
Parameters:
fsFile system object.
API Stability:
Internal.
See Also:
MprRomInode, mprCreateFileSystem, mprCreateRomFileSystem, mprLookupFileSystem, mprSetPathNewline, mprSetPathSeparators, mprSetRomFileSystem
MprFileSystem * mprCreateFileSystem (cchar *path)

Create and initialize the FileSystem subsystem.

Description:
This is an internal routine called by the MPR during initialization.
Parameters:
pathPath name to the root of the file system.
Returns:
Returns a new file system object.
API Stability:
Internal.
See Also:
MprRomInode, mprAddFileSystem, mprCreateRomFileSystem, mprLookupFileSystem, mprSetPathNewline, mprSetPathSeparators, mprSetRomFileSystem
MprRomFileSystem * mprCreateRomFileSystem (cchar *path)

Create and initialize the ROM FileSystem.

Description:
This is an internal routine called by the MPR during initialization.
Parameters:
pathPath name to the root of the file system.
Returns:
Returns a new file system object.
API Stability:
Internal.
See Also:
MprRomInode, mprAddFileSystem, mprCreateFileSystem, mprLookupFileSystem, mprSetPathNewline, mprSetPathSeparators, mprSetRomFileSystem
MprFileSystem * mprLookupFileSystem (cchar *path)

Lookup a file system.

Parameters:
pathPath representing a file in the file system.
Returns:
Returns a file system object.
API Stability:
Internal.
See Also:
MprRomInode, mprAddFileSystem, mprCreateFileSystem, mprCreateRomFileSystem, mprSetPathNewline, mprSetPathSeparators, mprSetRomFileSystem
void mprSetPathNewline (cchar *path, cchar *newline)

Set the file system new line character string.

Parameters:
pathPath representing a file in the file system.
newlineString containing the newline character(s). "\\n". Windows uses "\\r\\n".
API Stability:
Stable.
See Also:
MprRomInode, mprAddFileSystem, mprCreateFileSystem, mprCreateRomFileSystem, mprLookupFileSystem, mprSetPathSeparators, mprSetRomFileSystem
void mprSetPathSeparators (cchar *path, cchar *separators)

Set the file system path separators.

Parameters:
pathPath representing a file in the file system.
separatorsString containing the directory path separators. Defaults to "/". Windows uses "/\/".
API Stability:
Stable.
See Also:
MprRomInode, mprAddFileSystem, mprCreateFileSystem, mprCreateRomFileSystem, mprLookupFileSystem, mprSetPathNewline, mprSetRomFileSystem
int mprSetRomFileSystem (MprRomInode *inodeList)

Set the ROM file system data.

Description:
This defines the list of files present in the ROM file system. Use makerom to generate the inodeList data.
Parameters:
inodeListReference to the ROM file system list of files (inodes). This is generated by the makerom tool.
Returns:
Returns zero if successful.
API Stability:
Stable.
See Also:
MprRomInode, mprAddFileSystem, mprCreateFileSystem, mprCreateRomFileSystem, mprLookupFileSystem, mprSetPathNewline, mprSetPathSeparators

MprFloat

MprFloat

Floating Point Services.

API Stability:
Stable.
See Also:
mprIsInfinite, mprIsNan, mprIsZero
API Stability:
Internal.
Fields:
int mprIsInfinite (double value)

Test if a double value is infinte.

Parameters:
valueValue to test.
Returns:
True if the value is +Infinity or -Infinity.
API Stability:
Stable.
See Also:
mprIsNan, mprIsZero
int mprIsNan (double value)

Test if a double value is not-a-number.

Parameters:
valueValue to test.
Returns:
True if the value is NaN.
API Stability:
Stable.
See Also:
mprIsInfinite, mprIsZero
int mprIsZero (double value)

Test if a double value is zero.

Parameters:
valueValue to test.
Returns:
True if the value is zero.
API Stability:
Stable.
See Also:
mprIsInfinite, mprIsNan

MprHash

MprHash

Hash table entry structure.

Description:
The hash structure supports growable hash tables with high performance, collision resistant hashes. Each hash entry has a descriptor entry. This is used to manage the hash table link chains.
See Also:
MprHashProc, mprAddKey, mprAddKeyFmt, mprBlendHash, mprCloneHash, mprCreateHash, mprGetFirstKey, mprGetHashLength, mprGetNextKey, mprLookupKey, mprLookupKeyEntry, mprRemoveKey
API Stability:
Internal.
Fields:
MprKey **buckets Hash collision bucket table.
intflags Hash control flags.
MprHashProcfn Hash function.
intlength Number of symbols in the table.
MprMutex *mutex GC marker sync.
intsize Size of the buckets array.
MprKey * mprAddDuplicateKey (MprHash *table, cvoid *key, cvoid *ptr)

Add a duplicate symbol value into the hash table.

Description:
Add a symbol to the hash which may clash with an existing entry. Duplicate symbols can be added to the hash, but only one may be retrieved via mprLookupKey. To recover duplicate entries walk the hash using mprGetNextKey
Parameters:
tableSymbol table returned via mprCreateSymbolTable.
keyString key of the symbole entry to delete.
ptrArbitrary pointer to associate with the key in the table.
Returns:
Integer count of the number of entries.
API Stability:
Stable.
See Also:
MprHash
MprKey * mprAddKey (MprHash *table, cvoid *key, cvoid *ptr)

Add a symbol value into the hash table.

Description:
Associate an arbitrary value with a string symbol key and insert into the symbol table.
Parameters:
tableSymbol table returned via mprCreateSymbolTable.
keyString key of the symbole entry to delete.
ptrArbitrary pointer to associate with the key in the table.
Returns:
Integer count of the number of entries.
API Stability:
Stable.
See Also:
MprHash
MprKey * mprAddKeyFmt (MprHash *table, cvoid *key, cchar *fmt, ...)

Add a key with a formatting value into the hash table.

Description:
Associate a formatted value with a key and insert into the symbol table.
Parameters:
tableSymbol table returned via mprCreateSymbolTable.
keyString key of the symbole entry to delete.
fmtFormat string. See mprPrintf
Returns:
Integer count of the number of entries.
API Stability:
Stable.
See Also:
MprHash
MprHash * mprBlendHash (MprHash *target, MprHash *other)

Blend two hash tables.

Description:
Blend a hash table into a target hash.
Parameters:
targetTarget hash to receive the properties from the other hash.
otherHash to provide properties to blend.
Returns:
Returns target.
API Stability:
Stable.
See Also:
MprHash
MprHash * mprCloneHash (MprHash *table)

Copy a hash table.

Description:
Create a new hash table and copy all the entries from an existing table.
Parameters:
tableSymbol table returned via mprCreateSymbolTable.
Returns:
A new hash table initialized with the contents of the original hash table.
API Stability:
Stable.
See Also:
MprHash
MprHash * mprCreateHash (int hashSize, int flags)

Create a hash table.

Description:
Creates a hash table that can store arbitrary objects associated with string key values.
Parameters:
hashSizeSize of the hash table for the symbol table. Should be a prime number. Set to 0 or -1 to get a default (small) hash table.
flagsTable control flags. Use MPR_HASH_CASELESS for case insensitive comparisions, MPR_HASH_UNICODE if the hash keys are unicode strings, MPR_HASH_STATIC_KEYS if the keys are permanent and should not be managed for Garbage collection, and MPR_HASH_STATIC_VALUES if the values are permanent. MPR_HASH_OWN to create an optimized list for private use that is not thread-safe.
Returns:
Returns a pointer to the allocated symbol table.
API Stability:
Stable.
See Also:
MprHash
MprHash * mprCreateHashFromWords (cchar *str)

Create a hash of words.

Description:
Create a hash table of words from the given string. The hash key entry is the same as the key.
Parameters:
strString containing white space or comma separated words.
Returns:
Returns a hash of words.
API Stability:
Stable.
See Also:
MprHash
MprKey * mprGetFirstKey (MprHash *table)

Return the first symbol in a symbol entry.

Description:
Prepares for walking the contents of a symbol table by returning the first entry in the symbol table.
Parameters:
tableSymbol table returned via mprCreateSymbolTable.
Returns:
Pointer to the first entry in the symbol table.
API Stability:
Stable.
See Also:
MprHash
int mprGetHashLength (MprHash *table)

Return the count of symbols in a symbol entry.

Description:
Returns the number of symbols currently existing in a symbol table.
Parameters:
tableSymbol table returned via mprCreateSymbolTable.
Returns:
Integer count of the number of entries.
API Stability:
Stable.
See Also:
MprHash
MprKey * mprGetNextKey (MprHash *table, MprKey *last)

Return the next symbol in a symbol entry.

Description:
Continues walking the contents of a symbol table by returning the next entry in the symbol table. A previous call to mprGetFirstSymbol or mprGetNextSymbol is required to supply the value of the last argument.
Parameters:
tableSymbol table returned via mprCreateSymbolTable.
lastSymbol table entry returned via mprGetFirstSymbol or mprGetNextSymbol.
Returns:
Pointer to the first entry in the symbol table.
API Stability:
Stable.
See Also:
MprHash
void * mprLookupKey (MprHash *table, cvoid *key)

Lookup a symbol in the hash table.

Description:
Lookup a symbol key and return the value associated with that key.
Parameters:
tableSymbol table returned via mprCreateSymbolTable.
keyString key of the symbole entry to delete.
Returns:
Value associated with the key when the entry was inserted via mprInsertSymbol.
API Stability:
Stable.
See Also:
MprHash
MprKey * mprLookupKeyEntry (MprHash *table, cvoid *key)

Lookup a symbol in the hash table and return the hash entry.

Description:
Lookup a symbol key and return the hash table descriptor associated with that key.
Parameters:
tableSymbol table returned via mprCreateSymbolTable.
keyString key of the symbole entry to delete.
Returns:
MprKey for the entry.
API Stability:
Stable.
See Also:
MprHash
int mprRemoveKey (MprHash *table, cvoid *key)

Remove a symbol entry from the hash table.

Description:
Removes a symbol entry from the symbol table. The entry is looked up via the supplied key.
Parameters:
tableSymbol table returned via mprCreateSymbolTable.
keyString key of the symbole entry to delete.
Returns:
Returns zero if successful, otherwise a negative MPR error code is returned.
API Stability:
Stable.
See Also:
MprHash

MprJson

MprJson

JSON parser.

See Also:
MprObj, mprDeserialize, mprJsonParseError, mprSerialize
API Stability:
Internal.
Fields:
MprObj * mprDeserialize (cchar *str)

Deserialize a JSON string into an object tree.

Description:
Serializes a top level JSON object created via mprDeserialize into a characters string in JSON format.
Parameters:
strJSON string to deserialize.
Returns:
Returns a tree of objects. Each object represents a level in the JSON input stream. Each object is a hash table (MprHash). The hash table key entry will store the property type in the MprKey.type field. This will be set to MPR_JSON_STRING, MPR_JSON_OBJ or MPR_JSON_ARRAY.
API Stability:
Stable.
See Also:
MprObj, mprJsonParseError, mprSerialize
MprObj * mprDeserializeCustom (cchar *str, MprJsonCallback callback, void *data)

Custom deserialization from a JSON string into an object tree.

Description:
Serializes a top level JSON object created via mprDeserialize into a characters string in JSON format. This extended deserialization API takes callback functions to control how the object tree is constructed.
Parameters:
strJSON string to deserialize.
callbackCallback functions. This is an instance of the MprJsonCallback structure.
dataOpaque object to pass to the given callbacks.
Returns:
Returns a serialized JSON character string.
API Stability:
Internal.
See Also:
MprObj, mprDeserialize, mprJsonParseError, mprSerialize
void mprJsonParseError (MprJson *jp, cchar *fmt, ...)

Signal a parse error in the JSON input stream.

Description:
JSON callback functions will invoke mprJsonParseError when JSON parse or data semantic errors are encountered.
Parameters:
jpJSON control structure.
fmtPrintf style format string.
API Stability:
Evolving.
See Also:
MprObj, mprDeserialize, mprSerialize
cchar * mprSerialize (MprObj *obj, int flags)

Serialize a JSON object tree into a string.

Description:
Serializes a top level JSON object created via mprDeserialize into a characters string in JSON format.
Parameters:
objObject returned via mprDeserialize
flagsSerialization flags. Supported flags include MPR_JSON_PRETTY.
Returns:
Returns a serialized JSON character string.
API Stability:
Stable.
See Also:
MprObj, mprDeserialize, mprJsonParseError

MprList

MprList

List data structure.

Description:
The MprList is a dynamic, growable list suitable for storing pointers to arbitrary objects.
See Also:
MprListCompareProc, mprAddItem, mprAddNullItem, mprAppendList, mprClearList, mprCloneList, mprCreateKeyPair, mprCreateList, mprGetFirstItem, mprGetItem, mprGetLastItem, mprGetListCapacity, mprGetListLength, mprGetNextItem, mprGetPrevItem, mprInitList, mprInsertItemAtPos, mprLookupItem, mprLookupStringItem, mprPopItem, mprPushItem, mprRemoveItem, mprRemoveItemAtPos, mprRemoveRangeOfItems, mprRemoveStringItem, mprSetItem, mprSetListLimits, mprSortList
API Stability:
Internal.
Fields:
intflags Control flags.
void **items List item data.
intlength Current length of the list contents.
intmaxSize Maximum capacity.
MprMutex *mutex Multithread lock.
intsize Current list capacity.
int mprAddItem (MprList *list, cvoid *item)

Add an item to a list.

Description:
Add the specified item to the list. The list must have been previously created via mprCreateList. The list will grow as required to store the item.
Parameters:
listList pointer returned from mprCreateList
itemPointer to item to store.
Returns:
Returns a positive list index for the inserted item. If the item cannot be inserted due to a memory allocation failure, -1 is returned.
API Stability:
Stable.
See Also:
MprList, MprListCompareProc, mprAddNullItem, mprAppendList, mprClearList, mprCloneList, mprCreateKeyPair, mprCreateList, mprGetFirstItem, mprGetItem, mprGetLastItem, mprGetListCapacity, mprGetListLength, mprGetNextItem, mprGetPrevItem, mprInitList, mprInsertItemAtPos, mprLookupItem, mprLookupStringItem, mprPopItem, mprPushItem, mprRemoveItem, mprRemoveItemAtPos, mprRemoveRangeOfItems, mprRemoveStringItem, mprSetItem, mprSetListLimits, mprSortList
int mprAddNullItem (MprList *list)

Add a null item to the list.

Description:
Add a null item to the list. This item does not count in the length returned by mprGetListLength and will not be visible when iterating using mprGetNextItem
API Stability:
Stable.
See Also:
MprList, MprListCompareProc, mprAddItem, mprAppendList, mprClearList, mprCloneList, mprCreateKeyPair, mprCreateList, mprGetFirstItem, mprGetItem, mprGetLastItem, mprGetListCapacity, mprGetListLength, mprGetNextItem, mprGetPrevItem, mprInitList, mprInsertItemAtPos, mprLookupItem, mprLookupStringItem, mprPopItem, mprPushItem, mprRemoveItem, mprRemoveItemAtPos, mprRemoveRangeOfItems, mprRemoveStringItem, mprSetItem, mprSetListLimits, mprSortList
MprList * mprAppendList (MprList *list, MprList *add)

Append a list.

Description:
Append the contents of one list to another. The list will grow as required to store the item.
Parameters:
listList pointer returned from mprCreateList
addList whose contents are added.
Returns:
Returns a pointer to the original list if successful. Returns NULL on memory allocation errors.
API Stability:
Stable.
See Also:
MprList, MprListCompareProc, mprAddItem, mprAddNullItem, mprClearList, mprCloneList, mprCreateKeyPair, mprCreateList, mprGetFirstItem, mprGetItem, mprGetLastItem, mprGetListCapacity, mprGetListLength, mprGetNextItem, mprGetPrevItem, mprInitList, mprInsertItemAtPos, mprLookupItem, mprLookupStringItem, mprPopItem, mprPushItem, mprRemoveItem, mprRemoveItemAtPos, mprRemoveRangeOfItems, mprRemoveStringItem, mprSetItem, mprSetListLimits, mprSortList
void mprClearList (MprList *list)

Clears the list of all items.

Description:
Resets the list length to zero and clears all items.
Parameters:
listList pointer returned from mprCreateList.
API Stability:
Stable.
See Also:
MprList, MprListCompareProc, mprAddItem, mprAddNullItem, mprAppendList, mprCloneList, mprCreateKeyPair, mprCreateList, mprGetFirstItem, mprGetItem, mprGetLastItem, mprGetListCapacity, mprGetListLength, mprGetNextItem, mprGetPrevItem, mprInitList, mprInsertItemAtPos, mprLookupItem, mprLookupStringItem, mprPopItem, mprPushItem, mprRemoveItem, mprRemoveItemAtPos, mprRemoveRangeOfItems, mprRemoveStringItem, mprSetItem, mprSetListLimits, mprSortList
MprList * mprCloneList (MprList *src)

Clone a list and all elements.

Description:
Copy the contents of a list into a new list.
Parameters:
srcSource list to copy.
Returns:
Returns a new list reference.
API Stability:
Stable.
See Also:
MprList, MprListCompareProc, mprAddItem, mprAddNullItem, mprAppendList, mprClearList, mprCreateKeyPair, mprCreateList, mprGetFirstItem, mprGetItem, mprGetLastItem, mprGetListCapacity, mprGetListLength, mprGetNextItem, mprGetPrevItem, mprInitList, mprInsertItemAtPos, mprLookupItem, mprLookupStringItem, mprPopItem, mprPushItem, mprRemoveItem, mprRemoveItemAtPos, mprRemoveRangeOfItems, mprRemoveStringItem, mprSetItem, mprSetListLimits, mprSortList
int mprCopyListContents (MprList *dest, MprList *src)

Copy list contents.

Description:
Copy the contents of a list into an existing list. The destination list is cleared first and has its dimensions set to that of the source clist.
Parameters:
destDestination list for the copy.
srcSource list.
Returns:
Returns zero if successful, otherwise a negative MPR error code.
API Stability:
Stable.
See Also:
MprList, MprListCompareProc, mprAddItem, mprAddNullItem, mprAppendList, mprClearList, mprCloneList, mprCreateKeyPair, mprCreateList, mprGetFirstItem, mprGetItem, mprGetLastItem, mprGetListCapacity, mprGetListLength, mprGetNextItem, mprGetPrevItem, mprInitList, mprInsertItemAtPos, mprLookupItem, mprLookupStringItem, mprPopItem, mprPushItem, mprRemoveItem, mprRemoveItemAtPos, mprRemoveRangeOfItems, mprRemoveStringItem, mprSetItem, mprSetListLimits, mprSortList
MprKeyValue * mprCreateKeyPair (cchar *key, cchar *value)

Create a key / value pair.

Description:
Allocate and initialize a key value pair for use by the MprList or MprHash modules.
Parameters:
keyKey string.
valueKey value string.
Returns:
An initialized MprKeyValue
API Stability:
Stable.
See Also:
MprList, MprListCompareProc, mprAddItem, mprAddNullItem, mprAppendList, mprClearList, mprCloneList, mprCreateList, mprGetFirstItem, mprGetItem, mprGetLastItem, mprGetListCapacity, mprGetListLength, mprGetNextItem, mprGetPrevItem, mprInitList, mprInsertItemAtPos, mprLookupItem, mprLookupStringItem, mprPopItem, mprPushItem, mprRemoveItem, mprRemoveItemAtPos, mprRemoveRangeOfItems, mprRemoveStringItem, mprSetItem, mprSetListLimits, mprSortList
MprList * mprCreateList (int size, int flags)

Create a list.

Description:
Creates an empty list. MprList's can store generic pointers. They automatically grow as required when items are added to the list.
Parameters:
sizeInitial capacity of the list. Set to < 0 to get a growable list with a default initial size. Set to 0 to to create the list but without any initial list storage. Then call mprSetListLimits to define the initial and maximum list size.
flagsControl flags. Possible values are: MPR_LIST_STATIC_VALUES to indicate list items are static and should not be marked for GC. MPR_LIST_STABLE to create an optimized list for private use that is not thread-safe.
Returns:
Returns a pointer to the list.
API Stability:
Stable.
See Also:
MprList, MprListCompareProc, mprAddItem, mprAddNullItem, mprAppendList, mprClearList, mprCloneList, mprCreateKeyPair, mprGetFirstItem, mprGetItem, mprGetLastItem, mprGetListCapacity, mprGetListLength, mprGetNextItem, mprGetPrevItem, mprInitList, mprInsertItemAtPos, mprLookupItem, mprLookupStringItem, mprPopItem, mprPushItem, mprRemoveItem, mprRemoveItemAtPos, mprRemoveRangeOfItems, mprRemoveStringItem, mprSetItem, mprSetListLimits, mprSortList
void * mprGetFirstItem (MprList *list)

Get the first item in the list.

Description:
Returns the value of the first item in the list. After calling this routine, the remaining list items can be walked using mprGetNextItem.
Parameters:
listList pointer returned from mprCreateList.
API Stability:
Stable.
See Also:
MprList, MprListCompareProc, mprAddItem, mprAddNullItem, mprAppendList, mprClearList, mprCloneList, mprCreateKeyPair, mprCreateList, mprGetItem, mprGetLastItem, mprGetListCapacity, mprGetListLength, mprGetNextItem, mprGetPrevItem, mprInitList, mprInsertItemAtPos, mprLookupItem, mprLookupStringItem, mprPopItem, mprPushItem, mprRemoveItem, mprRemoveItemAtPos, mprRemoveRangeOfItems, mprRemoveStringItem, mprSetItem, mprSetListLimits, mprSortList
void * mprGetItem (MprList *list, int index)

Get an list item.

Description:
Get an list item specified by its index.
Parameters:
listList pointer returned from mprCreateList.
indexItem index into the list. Indexes have a range from zero to the lenghth of the list - 1.
API Stability:
Stable.
See Also:
MprList, MprListCompareProc, mprAddItem, mprAddNullItem, mprAppendList, mprClearList, mprCloneList, mprCreateKeyPair, mprCreateList, mprGetFirstItem, mprGetLastItem, mprGetListCapacity, mprGetListLength, mprGetNextItem, mprGetPrevItem, mprInitList, mprInsertItemAtPos, mprLookupItem, mprLookupStringItem, mprPopItem, mprPushItem, mprRemoveItem, mprRemoveItemAtPos, mprRemoveRangeOfItems, mprRemoveStringItem, mprSetItem, mprSetListLimits, mprSortList
void * mprGetLastItem (MprList *list)

Get the last item in the list.

Description:
Returns the value of the last item in the list. After calling this routine, the remaining list items can be walked using mprGetPrevItem.
Parameters:
listList pointer returned from mprCreateList.
API Stability:
Stable.
See Also:
MprList, MprListCompareProc, mprAddItem, mprAddNullItem, mprAppendList, mprClearList, mprCloneList, mprCreateKeyPair, mprCreateList, mprGetFirstItem, mprGetItem, mprGetListCapacity, mprGetListLength, mprGetNextItem, mprGetPrevItem, mprInitList, mprInsertItemAtPos, mprLookupItem, mprLookupStringItem, mprPopItem, mprPushItem, mprRemoveItem, mprRemoveItemAtPos, mprRemoveRangeOfItems, mprRemoveStringItem, mprSetItem, mprSetListLimits, mprSortList
int mprGetListCapacity (MprList *list)

Get the current capacity of the list.

Description:
Returns the capacity of the list. This will always be equal to or greater than the list length.
Parameters:
listList pointer returned from mprCreateList.
API Stability:
Stable.
See Also:
MprList, MprListCompareProc, mprAddItem, mprAddNullItem, mprAppendList, mprClearList, mprCloneList, mprCreateKeyPair, mprCreateList, mprGetFirstItem, mprGetItem, mprGetLastItem, mprGetListLength, mprGetNextItem, mprGetPrevItem, mprInitList, mprInsertItemAtPos, mprLookupItem, mprLookupStringItem, mprPopItem, mprPushItem, mprRemoveItem, mprRemoveItemAtPos, mprRemoveRangeOfItems, mprRemoveStringItem, mprSetItem, mprSetListLimits, mprSortList
int mprGetListLength (MprList *list)

Get the number of items in the list.

Description:
Returns the number of items in the list. This will always be less than or equal to the list capacity.
Parameters:
listList pointer returned from mprCreateList.
API Stability:
Stable.
See Also:
MprList, MprListCompareProc, mprAddItem, mprAddNullItem, mprAppendList, mprClearList, mprCloneList, mprCreateKeyPair, mprCreateList, mprGetFirstItem, mprGetItem, mprGetLastItem, mprGetListCapacity, mprGetNextItem, mprGetPrevItem, mprInitList, mprInsertItemAtPos, mprLookupItem, mprLookupStringItem, mprPopItem, mprPushItem, mprRemoveItem, mprRemoveItemAtPos, mprRemoveRangeOfItems, mprRemoveStringItem, mprSetItem, mprSetListLimits, mprSortList
void * mprGetNextItem (MprList *list, int *lastIndex)

Get the next item in the list.

Description:
Returns the value of the next item in the list. Before calling this routine, mprGetFirstItem must be called to initialize the traversal of the list.
Parameters:
listList pointer returned from mprCreateList.
lastIndexPointer to an integer that will hold the last index retrieved.
API Stability:
Stable.
See Also:
MprList, MprListCompareProc, mprAddItem, mprAddNullItem, mprAppendList, mprClearList, mprCloneList, mprCreateKeyPair, mprCreateList, mprGetFirstItem, mprGetItem, mprGetLastItem, mprGetListCapacity, mprGetListLength, mprGetPrevItem, mprInitList, mprInsertItemAtPos, mprLookupItem, mprLookupStringItem, mprPopItem, mprPushItem, mprRemoveItem, mprRemoveItemAtPos, mprRemoveRangeOfItems, mprRemoveStringItem, mprSetItem, mprSetListLimits, mprSortList
void * mprGetNextStableItem (MprList *list, int *lastIndex)

Get the next item in a stable list.

Description:
Returns the value of the next item in the list. Before calling this routine, mprGetFirstItem must be called to initialize the traversal of the list.
Parameters:
listList pointer returned from mprCreateList.
lastIndexPointer to an integer that will hold the last index retrieved.
See Also:
MprList, MprListCompareProc, mprAddItem, mprAddNullItem, mprAppendList, mprClearList, mprCloneList, mprCreateKeyPair, mprCreateList, mprGetFirstItem, mprGetItem, mprGetLastItem, mprGetListCapacity, mprGetListLength, mprGetNextItem, mprGetPrevItem, mprInitList, mprInsertItemAtPos, mprLookupItem, mprLookupStringItem, mprPopItem, mprPushItem, mprRemoveItem, mprRemoveItemAtPos, mprRemoveRangeOfItems, mprRemoveStringItem, mprSetItem, mprSetListLimits, mprSortList
void * mprGetPrevItem (MprList *list, int *lastIndex)

Get the previous item in the list.

Description:
Returns the value of the previous item in the list. Before calling this routine, mprGetFirstItem and/or mprGetNextItem must be called to initialize the traversal of the list.
Parameters:
listList pointer returned from mprCreateList.
lastIndexPointer to an integer that will hold the last index retrieved.
API Stability:
Stable.
See Also:
MprList, MprListCompareProc, mprAddItem, mprAddNullItem, mprAppendList, mprClearList, mprCloneList, mprCreateKeyPair, mprCreateList, mprGetFirstItem, mprGetItem, mprGetLastItem, mprGetListCapacity, mprGetListLength, mprGetNextItem, mprInitList, mprInsertItemAtPos, mprLookupItem, mprLookupStringItem, mprPopItem, mprPushItem, mprRemoveItem, mprRemoveItemAtPos, mprRemoveRangeOfItems, mprRemoveStringItem, mprSetItem, mprSetListLimits, mprSortList
void mprInitList (MprList *list, int flags)

Initialize a list structure.

Description:
If a list is statically declared inside another structure, mprInitList can be used to initialize it before use.
Parameters:
listReference to the MprList struct.
flagsControl flags. Possible values are: MPR_LIST_STATIC_VALUES to indicate list items are static and should not be marked for GC. MPR_LIST_STABLE to create an optimized list for private use that is not thread-safe.
API Stability:
Stable.
See Also:
MprList, MprListCompareProc, mprAddItem, mprAddNullItem, mprAppendList, mprClearList, mprCloneList, mprCreateKeyPair, mprCreateList, mprGetFirstItem, mprGetItem, mprGetLastItem, mprGetListCapacity, mprGetListLength, mprGetNextItem, mprGetPrevItem, mprInsertItemAtPos, mprLookupItem, mprLookupStringItem, mprPopItem, mprPushItem, mprRemoveItem, mprRemoveItemAtPos, mprRemoveRangeOfItems, mprRemoveStringItem, mprSetItem, mprSetListLimits, mprSortList
int mprInsertItemAtPos (MprList *list, int index, cvoid *item)

Insert an item into a list at a specific position.

Description:
Insert the item into the list before the specified position. The list will grow as required to store the item.
Parameters:
listList pointer returned from mprCreateList
indexLocation at which to store the item. The previous item at this index is moved up to make room.
itemPointer to item to store.
Returns:
The position index (positive integer) if successful. If the item cannot be inserted due to a memory allocation failure, -1 is returned.
API Stability:
Stable.
See Also:
MprList, MprListCompareProc, mprAddItem, mprAddNullItem, mprAppendList, mprClearList, mprCloneList, mprCreateKeyPair, mprCreateList, mprGetFirstItem, mprGetItem, mprGetLastItem, mprGetListCapacity, mprGetListLength, mprGetNextItem, mprGetPrevItem, mprInitList, mprLookupItem, mprLookupStringItem, mprPopItem, mprPushItem, mprRemoveItem, mprRemoveItemAtPos, mprRemoveRangeOfItems, mprRemoveStringItem, mprSetItem, mprSetListLimits, mprSortList
int mprLookupItem (MprList *list, cvoid *item)

Find an item and return its index.

Description:
Search for an item in the list and return its index.
Parameters:
listList pointer returned from mprCreateList.
itemPointer to value stored in the list.
Returns:
Positive list index if found, otherwise a negative MPR error code.
API Stability:
Stable.
See Also:
MprList, MprListCompareProc, mprAddItem, mprAddNullItem, mprAppendList, mprClearList, mprCloneList, mprCreateKeyPair, mprCreateList, mprGetFirstItem, mprGetItem, mprGetLastItem, mprGetListCapacity, mprGetListLength, mprGetNextItem, mprGetPrevItem, mprInitList, mprInsertItemAtPos, mprLookupStringItem, mprPopItem, mprPushItem, mprRemoveItem, mprRemoveItemAtPos, mprRemoveRangeOfItems, mprRemoveStringItem, mprSetItem, mprSetListLimits, mprSortList
int mprLookupStringItem (MprList *list, cchar *str)

Find a string item and return its index.

Description:
Search for the first matching string in the list and return its index.
Parameters:
listList pointer returned from mprCreateList.
strPointer to string to look for.
Returns:
Positive list index if found, otherwise a negative MPR error code.
API Stability:
Stable.
See Also:
MprList, MprListCompareProc, mprAddItem, mprAddNullItem, mprAppendList, mprClearList, mprCloneList, mprCreateKeyPair, mprCreateList, mprGetFirstItem, mprGetItem, mprGetLastItem, mprGetListCapacity, mprGetListLength, mprGetNextItem, mprGetPrevItem, mprInitList, mprInsertItemAtPos, mprLookupItem, mprPopItem, mprPushItem, mprRemoveItem, mprRemoveItemAtPos, mprRemoveRangeOfItems, mprRemoveStringItem, mprSetItem, mprSetListLimits, mprSortList
void * mprPopItem (MprList *list)

Pop an item.

Description:
Treat the list as a stack and pop the last pushed item.
Parameters:
listList pointer returned from mprCreateList.
Returns:
The last pushed item. If the list is empty, returns NULL.
API Stability:
Stable.
See Also:
MprList, MprListCompareProc, mprAddItem, mprAddNullItem, mprAppendList, mprClearList, mprCloneList, mprCreateKeyPair, mprCreateList, mprGetFirstItem, mprGetItem, mprGetLastItem, mprGetListCapacity, mprGetListLength, mprGetNextItem, mprGetPrevItem, mprInitList, mprInsertItemAtPos, mprLookupItem, mprLookupStringItem, mprPushItem, mprRemoveItem, mprRemoveItemAtPos, mprRemoveRangeOfItems, mprRemoveStringItem, mprSetItem, mprSetListLimits, mprSortList
int mprPushItem (MprList *list, cvoid *item)

Push an item onto the list.

Description:
Treat the list as a stack and push the last pushed item.
Parameters:
listList pointer returned from mprCreateList.
itemItem to push onto the list.
Returns:
Returns a positive integer list index for the inserted item. If the item cannot be inserted due to a memory allocation failure, -1 is returned.
API Stability:
Stable.
See Also:
MprList, MprListCompareProc, mprAddItem, mprAddNullItem, mprAppendList, mprClearList, mprCloneList, mprCreateKeyPair, mprCreateList, mprGetFirstItem, mprGetItem, mprGetLastItem, mprGetListCapacity, mprGetListLength, mprGetNextItem, mprGetPrevItem, mprInitList, mprInsertItemAtPos, mprLookupItem, mprLookupStringItem, mprPopItem, mprRemoveItem, mprRemoveItemAtPos, mprRemoveRangeOfItems, mprRemoveStringItem, mprSetItem, mprSetListLimits, mprSortList
int mprRemoveItem (MprList *list, cvoid *item)

Remove an item from the list.

Description:
Search for a specified item and then remove it from the list.
Parameters:
listList pointer returned from mprCreateList.
itemItem pointer to remove.
Returns:
The positive index of the removed item, otherwise a negative MPR error code.
API Stability:
Stable.
See Also:
MprList, MprListCompareProc, mprAddItem, mprAddNullItem, mprAppendList, mprClearList, mprCloneList, mprCreateKeyPair, mprCreateList, mprGetFirstItem, mprGetItem, mprGetLastItem, mprGetListCapacity, mprGetListLength, mprGetNextItem, mprGetPrevItem, mprInitList, mprInsertItemAtPos, mprLookupItem, mprLookupStringItem, mprPopItem, mprPushItem, mprRemoveItemAtPos, mprRemoveRangeOfItems, mprRemoveStringItem, mprSetItem, mprSetListLimits, mprSortList
int mprRemoveItemAtPos (MprList *list, int index)

Remove an item from the list.

Description:
Removes the element specified by index, from the list. The list index is provided by mprInsertItem.
Returns:
The positive index of the removed item, otherwise a negative MPR error code.
API Stability:
Stable.
See Also:
MprList, MprListCompareProc, mprAddItem, mprAddNullItem, mprAppendList, mprClearList, mprCloneList, mprCreateKeyPair, mprCreateList, mprGetFirstItem, mprGetItem, mprGetLastItem, mprGetListCapacity, mprGetListLength, mprGetNextItem, mprGetPrevItem, mprInitList, mprInsertItemAtPos, mprLookupItem, mprLookupStringItem, mprPopItem, mprPushItem, mprRemoveItem, mprRemoveRangeOfItems, mprRemoveStringItem, mprSetItem, mprSetListLimits, mprSortList
int mprRemoveLastItem (MprList *list)

Remove the last item from the list.

Description:
Remove the item at the highest index position.
Parameters:
listList pointer returned from mprCreateList.
Returns:
The positive index of the removed item, otherwise a negative MPR error code.
API Stability:
Stable.
See Also:
MprList, MprListCompareProc, mprAddItem, mprAddNullItem, mprAppendList, mprClearList, mprCloneList, mprCreateKeyPair, mprCreateList, mprGetFirstItem, mprGetItem, mprGetLastItem, mprGetListCapacity, mprGetListLength, mprGetNextItem, mprGetPrevItem, mprInitList, mprInsertItemAtPos, mprLookupItem, mprLookupStringItem, mprPopItem, mprPushItem, mprRemoveItem, mprRemoveItemAtPos, mprRemoveRangeOfItems, mprRemoveStringItem, mprSetItem, mprSetListLimits, mprSortList
int mprRemoveRangeOfItems (MprList *list, int start, int end)

Remove a range of items from the list.

Description:
Remove a range of items from the list. The range is specified from the start index up to and including the end index.
Parameters:
listList pointer returned from mprCreateList.
startStarting item index to remove (inclusive).
endEnding item index to remove (inclusive).
Returns:
Returns zero if successful, otherwise a negative MPR error code.
API Stability:
Stable.
See Also:
MprList, MprListCompareProc, mprAddItem, mprAddNullItem, mprAppendList, mprClearList, mprCloneList, mprCreateKeyPair, mprCreateList, mprGetFirstItem, mprGetItem, mprGetLastItem, mprGetListCapacity, mprGetListLength, mprGetNextItem, mprGetPrevItem, mprInitList, mprInsertItemAtPos, mprLookupItem, mprLookupStringItem, mprPopItem, mprPushItem, mprRemoveItem, mprRemoveItemAtPos, mprRemoveStringItem, mprSetItem, mprSetListLimits, mprSortList
int mprRemoveStringItem (MprList *list, cchar *str)

Remove a string item from the list.

Description:
Search for the first matching string and then remove it from the list.
Parameters:
listList pointer returned from mprCreateList.
strString value to remove.
Returns:
The positive index of the removed item, otherwise a negative MPR error code.
API Stability:
Stable.
See Also:
MprList, MprListCompareProc, mprAddItem, mprAddNullItem, mprAppendList, mprClearList, mprCloneList, mprCreateKeyPair, mprCreateList, mprGetFirstItem, mprGetItem, mprGetLastItem, mprGetListCapacity, mprGetListLength, mprGetNextItem, mprGetPrevItem, mprInitList, mprInsertItemAtPos, mprLookupItem, mprLookupStringItem, mprPopItem, mprPushItem, mprRemoveItem, mprRemoveItemAtPos, mprRemoveRangeOfItems, mprSetItem, mprSetListLimits, mprSortList
void * mprSetItem (MprList *list, int index, cvoid *item)

Set a list item.

Description:
Update the list item stored at the specified index.
Parameters:
listList pointer returned from mprCreateList.
indexLocation to update.
itemPointer to item to store.
Returns:
The old item previously at that location index.
API Stability:
Stable.
See Also:
MprList, MprListCompareProc, mprAddItem, mprAddNullItem, mprAppendList, mprClearList, mprCloneList, mprCreateKeyPair, mprCreateList, mprGetFirstItem, mprGetItem, mprGetLastItem, mprGetListCapacity, mprGetListLength, mprGetNextItem, mprGetPrevItem, mprInitList, mprInsertItemAtPos, mprLookupItem, mprLookupStringItem, mprPopItem, mprPushItem, mprRemoveItem, mprRemoveItemAtPos, mprRemoveRangeOfItems, mprRemoveStringItem, mprSetListLimits, mprSortList
int mprSetListLimits (MprList *list, int initialSize, int maxSize)

Define the list size limits.

Description:
Define the list initial size and maximum size it can grow to.
Parameters:
listList pointer returned from mprCreateList.
initialSizeInitial size for the list. This call will allocate space for at least this number of items.
maxSizeSet the maximum limit the list can grow to become.
Returns:
Returns zero if successful, otherwise a negative MPR error code.
API Stability:
Stable.
See Also:
MprList, MprListCompareProc, mprAddItem, mprAddNullItem, mprAppendList, mprClearList, mprCloneList, mprCreateKeyPair, mprCreateList, mprGetFirstItem, mprGetItem, mprGetLastItem, mprGetListCapacity, mprGetListLength, mprGetNextItem, mprGetPrevItem, mprInitList, mprInsertItemAtPos, mprLookupItem, mprLookupStringItem, mprPopItem, mprPushItem, mprRemoveItem, mprRemoveItemAtPos, mprRemoveRangeOfItems, mprRemoveStringItem, mprSetItem, mprSortList
void mprSort (void *base, ssize num, ssize width, MprSortProc compare, void *ctx)

Quicksort.

Description:
This is a quicksort with a context argument.
Parameters:
baseBase of array to sort.
numNumber of array elements.
widthWidth of array elements.
compareComparison function.
ctxContext argument to provide to comparison function.
API Stability:
Stable.
See Also:
MprList, MprListCompareProc, mprAddItem, mprAddNullItem, mprAppendList, mprClearList, mprCloneList, mprCreateKeyPair, mprCreateList, mprGetFirstItem, mprGetItem, mprGetLastItem, mprGetListCapacity, mprGetListLength, mprGetNextItem, mprGetPrevItem, mprInitList, mprInsertItemAtPos, mprLookupItem, mprLookupStringItem, mprPopItem, mprPushItem, mprRemoveItem, mprRemoveItemAtPos, mprRemoveRangeOfItems, mprRemoveStringItem, mprSetItem, mprSetListLimits, mprSortList
MprList * mprSortList (MprList *list, MprSortProc compare, void *ctx)

Sort a list.

Description:
Sort a list using the sort ordering dictated by the supplied compare function.
Parameters:
listList pointer returned from mprCreateList.
compareComparison function. If null, then a default string comparison is used.
ctxContext to provide to comparison function.
Returns:
The sorted list.
API Stability:
Stable.
See Also:
MprList, MprListCompareProc, mprAddItem, mprAddNullItem, mprAppendList, mprClearList, mprCloneList, mprCreateKeyPair, mprCreateList, mprGetFirstItem, mprGetItem, mprGetLastItem, mprGetListCapacity, mprGetListLength, mprGetNextItem, mprGetPrevItem, mprInitList, mprInsertItemAtPos, mprLookupItem, mprLookupStringItem, mprPopItem, mprPushItem, mprRemoveItem, mprRemoveItemAtPos, mprRemoveRangeOfItems, mprRemoveStringItem, mprSetItem, mprSetListLimits

MprLog

MprLog

Logging Services.

See Also:
MprLogHandler, mprAssert, mprError, mprGetLogFile, mprGetLogHandler, mprInfo, mprLog, mprRawLog, mprSetLogFile, mprSetLogHandler, mprSetLogLevel, mprTrace, mprUsingDefaultLogHandler, mprWarn
API Stability:
Internal.
Fields:
void mprAssert (cchar *loc, cchar *msg)

Output an assure assertion failed message.

Description:
This will emit an assure assertion failed message to the standard error output. It may bypass the logging system.
Parameters:
locSource code location string. Use MPR_LOC to define a file name and line number string suitable for this parameter.
msgSimple string message to output.
API Stability:
Evolving.
See Also:
MprLogHandler, mprError, mprGetLogFile, mprGetLogHandler, mprInfo, mprLog, mprRawLog, mprSetLogFile, mprSetLogHandler, mprSetLogLevel, mprTrace, mprUsingDefaultLogHandler, mprWarn
int mprBackupLog (cchar *path, int count)

Backup a log.

Parameters:
pathBase log filename.
countCount of archived logs to keep.
API Stability:
Stable.
See Also:
MprLogHandler, mprAssert, mprError, mprGetLogFile, mprGetLogHandler, mprInfo, mprLog, mprRawLog, mprSetLogFile, mprSetLogHandler, mprSetLogLevel, mprTrace, mprUsingDefaultLogHandler, mprWarn
void mprCreateLogService ()

Initialize the log service.

API Stability:
Internal.
See Also:
MprLogHandler, mprAssert, mprError, mprGetLogFile, mprGetLogHandler, mprInfo, mprLog, mprRawLog, mprSetLogFile, mprSetLogHandler, mprSetLogLevel, mprTrace, mprUsingDefaultLogHandler, mprWarn
void mprError (cchar *fmt, ...)

Log an error message.

Description:
Send an error message to the MPR debug logging subsystem. The message will be to the log handler defined by mprSetLogHandler. It is up to the log handler to respond appropriately and log the message.
Parameters:
fmtPrintf style format string. Variable number of arguments to.
...Variable number of arguments for printf data.
API Stability:
Stable.
See Also:
MprLogHandler, mprAssert, mprGetLogFile, mprGetLogHandler, mprInfo, mprLog, mprRawLog, mprSetLogFile, mprSetLogHandler, mprSetLogLevel, mprTrace, mprUsingDefaultLogHandler, mprWarn
struct MprFile * MprFile* mprGetLogFile ()

Get the log file object.

Description:
Returns the MprFile object used for logging.
Returns:
An MprFile object for logging.
API Stability:
Evolving.
See Also:
MprLogHandler, mprAssert, mprError, mprGetLogHandler, mprInfo, mprLog, mprRawLog, mprSetLogFile, mprSetLogHandler, mprSetLogLevel, mprTrace, mprUsingDefaultLogHandler, mprWarn
MprLogHandler mprGetLogHandler ()

Get the current MPR debug log handler.

Description:
Get the log handler defined via mprSetLogHandler
Returns:
A function of the signature MprLogHandler
API Stability:
Evolving.
See Also:
MprLogHandler, mprAssert, mprError, mprGetLogFile, mprInfo, mprLog, mprRawLog, mprSetLogFile, mprSetLogHandler, mprSetLogLevel, mprTrace, mprUsingDefaultLogHandler, mprWarn
void mprInfo (cchar *fmt, ...)

Log an informational message.

Description:
Send an informational message to the MPR debug logging subsystem. The message will be to the log handler defined by mprSetLogHandler. It is up to the log handler to respond appropriately and log the message.
Parameters:
fmtPrintf style format string. Variable number of arguments to.
...Variable number of arguments for printf data.
API Stability:
Evolving.
See Also:
MprLogHandler, mprAssert, mprError, mprGetLogFile, mprGetLogHandler, mprLog, mprRawLog, mprSetLogFile, mprSetLogHandler, mprSetLogLevel, mprTrace, mprUsingDefaultLogHandler, mprWarn
void mprLog (int level, cchar *fmt, ...)

Write a message to the log file.

Description:
Send a message to the MPR logging subsystem. Logging support is enabled via the BIT_MPR_LOGGING define which is typically set via the Bit setting "logging: true". Logging typically is enabled in both debug and release builds. The mprLog function is a macro which translates into the mprLogProc function.
Parameters:
levelLogging level for this message. The level is 0-9 with zero being the most verbose.
fmtPrintf style format string. Variable number of arguments to.
...Variable number of arguments for printf data.
Remarks:
MprLog is highly useful as a debugging aid when integrating or when developing new modules.
API Stability:
Stable.
See Also:
MprLogHandler, mprAssert, mprError, mprGetLogFile, mprGetLogHandler, mprInfo, mprRawLog, mprSetLogFile, mprSetLogHandler, mprSetLogLevel, mprTrace, mprUsingDefaultLogHandler, mprWarn
void mprLogHeader ()

Emit a descriptive log header.

API Stability:
Evolving.
See Also:
MprLogHandler, mprAssert, mprError, mprGetLogFile, mprGetLogHandler, mprInfo, mprLog, mprRawLog, mprSetLogFile, mprSetLogHandler, mprSetLogLevel, mprTrace, mprUsingDefaultLogHandler, mprWarn
void mprRawLog (int level, cchar *fmt, ...)

Write a raw log message to the diagnostic log file.

Description:
Send a raw message to the MPR logging subsystem. Raw messages do not have any application prefix attached to the message and do not append a newline to the message.
Parameters:
levelLogging level for this message. The level is 0-9 with zero being the most verbose.
fmtPrintf style format string. Variable number of arguments to.
...Variable number of arguments for printf data.
Remarks:
MprLog is highly useful as a debugging aid when integrating or when developing new modules.
API Stability:
Stable.
See Also:
MprLogHandler, mprAssert, mprError, mprGetLogFile, mprGetLogHandler, mprInfo, mprLog, mprSetLogFile, mprSetLogHandler, mprSetLogLevel, mprTrace, mprUsingDefaultLogHandler, mprWarn
void mprSetLogBackup (ssize logSize, int backupCount, int flags)

Set the log rotation parameters.

Parameters:
logSizeIf the size is zero, then the log file will be rotated on each application boot. Otherwise, the log file will be rotated if on application boot, the log file is larger than this size.
backupCountCount of the number of log files to keep.
flagsSet to MPR_LOG_APPEND to append to existing log files. Set to MPR_LOG_TRUNCATE to truncate log files on application restart.
API Stability:
Evolving.
See Also:
MprLogHandler, mprAssert, mprError, mprGetLogFile, mprGetLogHandler, mprInfo, mprLog, mprRawLog, mprSetLogFile, mprSetLogHandler, mprSetLogLevel, mprTrace, mprUsingDefaultLogHandler, mprWarn
void mprSetLogLevel (int level)

Set the current logging level.

Description:
This call defines the maximum level of messages that will be logged. Calls to mprLog specify a message level. If the message level is greater than the defined logging level, the message is ignored.
Parameters:
levelNew logging level. Must be 0-9 inclusive.
Returns:
The previous logging level.
API Stability:
Stable.
See Also:
MprLogHandler, mprAssert, mprError, mprGetLogFile, mprGetLogHandler, mprInfo, mprLog, mprRawLog, mprSetLogFile, mprSetLogHandler, mprTrace, mprUsingDefaultLogHandler, mprWarn
int mprStartLogging (cchar *logSpec, int showConfig)

Start logging.

Parameters:
logSpecSet the log file name and level. The format is "pathName[:level]". The following levels are generally observed:
  • 0 - Essential messages, fatal errors and critical warnings
  • 1 - Hard errors
  • 2 - Configuration setup and soft warnings
  • 3 - Useful informational messages
  • 4 - Debug information
  • 5-9 - Increasing levels of internal Appweb trace useful for debugging
showConfigSet to true to log an initial system configuration.
Returns:
Zero if successful, otherwise a negative Mpr error code. See the Appweb log for diagnostics.
API Stability:
Evolving.
See Also:
MprLogHandler, mprAssert, mprError, mprGetLogFile, mprGetLogHandler, mprInfo, mprLog, mprRawLog, mprSetLogFile, mprSetLogHandler, mprSetLogLevel, mprTrace, mprUsingDefaultLogHandler, mprWarn
void mprTrace (int level, cchar *fmt, ...)

Write a trace message to the diagnostic log file.

Description:
Send a trace message to the MPR logging subsystem. Debug tracing support is enabled via the BIT_MPR_TRACING define which is typically set via the Bit setting "tracing: true". Tracing is typically is enabled in only debug builds. The mprTrace function is a macro which translates into the mprTraceProc function.
Description:
Sends a debug trace message to the MPR logging subsystem.
Parameters:
levelLogging level for this message. The level is 0-9 with zero being the most verbose.
fmtPrintf style format string. Variable number of arguments to.
...Variable number of arguments for printf data.
Remarks:
MprTrace is highly useful as a debugging aid when integrating or when developing new modules.
API Stability:
Stable.
See Also:
MprLogHandler, mprAssert, mprError, mprGetLogFile, mprGetLogHandler, mprInfo, mprLog, mprRawLog, mprSetLogFile, mprSetLogHandler, mprSetLogLevel, mprUsingDefaultLogHandler, mprWarn
int mprUsingDefaultLogHandler ()

Determine if the app is using the default MPR log handler.

Description:
Returns true if no custom log handler has been installed.
Returns:
True if using the default log handler.
API Stability:
Evolving.
See Also:
MprLogHandler, mprAssert, mprError, mprGetLogFile, mprGetLogHandler, mprInfo, mprLog, mprRawLog, mprSetLogFile, mprSetLogHandler, mprSetLogLevel, mprTrace, mprWarn
void mprWarn (cchar *fmt, ...)

Log a warning message.

Description:
Send a warning message to the MPR debug logging subsystem. The message will be to the log handler defined by mprSetLogHandler. It is up to the log handler to respond appropriately and log the message.
Parameters:
fmtPrintf style format string. Variable number of arguments to.
...Variable number of arguments for printf data.
API Stability:
Stable.
See Also:
MprLogHandler, mprAssert, mprError, mprGetLogFile, mprGetLogHandler, mprInfo, mprLog, mprRawLog, mprSetLogFile, mprSetLogHandler, mprSetLogLevel, mprTrace, mprUsingDefaultLogHandler

MprMem

MprMem

Memory Allocation Service.

Description:
The MPR provides an application specific memory allocator to use instead of malloc. This allocator is tailored to the needs of embedded applications and is faster than most general purpose malloc allocators. It is deterministic and allocates and frees in constant time O(1). It exhibits very low fragmentation and accurate coalescing.

The allocator uses a garbage collector for freeing unused memory. The collector is a generational, cooperative, non-compacting, parallel collector. The allocator is optimized for frequent allocations of small blocks (< 4K) and uses a scheme of free queues for fast allocation. Allocations are aligned on 16 byte boundaries on 64-bit systems and otherwise on 8 byte boundaries. It will return chunks unused memory back to the O/S.

The allocator handles memory allocation errors globally. The application may configure a memory limit so that memory depletion can be proactively detected and handled before memory allocations actually fail.

A memory block that is being used must be marked as active to prevent the garbage collector from reclaiming it. To mark a block as active, mprMarkBlock must be called for each garbage collection cycle. When allocating non-temporal memroy blocks, a manager callback can be specified via mprAllocObj. This manager routine will be called by the collector so that dependant memory blocks can be marked as active.
API Stability:
Internal.
See Also:
MprFreeMem, MprHeap, MprManager, MprMemNotifier, MprRegion, mprAddRoot, mprAlloc, mprAllocMem, mprAllocObj, mprAllocZeroed, mprCreateMemService, mprDestroyMemService, mprEnableGC, mprGetBlockSize, mprGetMem, mprGetMemStats, mprGetMpr, mprGetPageSize, mprHasMemError, mprHold, mprIsValid, mprMark, mprMemcmp, mprMemcpy, mprMemdup, mprPrintMem, mprRealloc, mprRelease, mprRemoveRoot, mprRequestGC, mprResetMemError, mprSetManager, mprSetMemError, mprSetMemLimits, mprSetMemNotifier, mprSetMemPolicy, mprValidateBlock, mprVerifyMem, mprVirtAlloc, mprVirtFree
Fields:
size_tfield1 Pointer to adjacent, prior block in memory with last, manager fields.
size_tfield2 Internal block length including header with gen and mark fields.
void mprAddRoot (void *ptr)

Add a memory block as a root for garbage collection.

Parameters:
ptrAny memory pointer.
API Stability:
Stable.
See Also:
MprFreeMem, MprHeap, MprManager, MprMemNotifier, MprRegion, mprAlloc, mprAllocMem, mprAllocObj, mprAllocZeroed, mprCreateMemService, mprDestroyMemService, mprEnableGC, mprGetBlockSize, mprGetMem, mprGetMemStats, mprGetMpr, mprGetPageSize, mprHasMemError, mprHold, mprIsValid, mprMark, mprMemcmp, mprMemcpy, mprMemdup, mprPrintMem, mprRealloc, mprRelease, mprRemoveRoot, mprRequestGC, mprResetMemError, mprSetManager, mprSetMemError, mprSetMemLimits, mprSetMemNotifier, mprSetMemPolicy, mprValidateBlock, mprVerifyMem, mprVirtAlloc, mprVirtFree
void * mprAlloc (ssize size)

Allocate a block of memory.

Description:
Allocates a block of memory of the required size. The memory is not zeroed.
Parameters:
sizeSize of the memory block to allocate.
Returns:
Returns a pointer to the allocated block. If memory is not available the memory exhaustion handler specified via mprCreate will be called to allow global recovery.
Remarks:
Do not mix calls to malloc and mprAlloc.
API Stability:
Stable.
See Also:
MprFreeMem, MprHeap, MprManager, MprMemNotifier, MprRegion, mprAddRoot, mprAllocMem, mprAllocObj, mprAllocZeroed, mprCreateMemService, mprDestroyMemService, mprEnableGC, mprGetBlockSize, mprGetMem, mprGetMemStats, mprGetMpr, mprGetPageSize, mprHasMemError, mprHold, mprIsValid, mprMark, mprMemcmp, mprMemcpy, mprMemdup, mprPrintMem, mprRealloc, mprRelease, mprRemoveRoot, mprRequestGC, mprResetMemError, mprSetManager, mprSetMemError, mprSetMemLimits, mprSetMemNotifier, mprSetMemPolicy, mprValidateBlock, mprVerifyMem, mprVirtAlloc, mprVirtFree
void * mprAllocMem (ssize size, int flags)

Allocate a block of memory.

Description:
This is the lowest level of memory allocation routine. Memory is freed via the garbage collector. To protect an active memory block memory block from being reclaimed, it must have a reference to it. Memory blocks can specify a manager routine via mprAllocObj. The manager is is invoked by the garbage collector to "mark" dependant active blocks. Marked blocks will not be reclaimed by the garbage collector.
Parameters:
sizeSize of the memory block to allocate.
flagsAllocation flags. Supported flags include: MPR_ALLOC_MANAGER to reserve room for a manager callback and MPR_ALLOC_ZERO to zero allocated memory.
Returns:
Returns a pointer to the allocated block. If memory is not available the memory exhaustion handler specified via mprCreate will be called to allow global recovery.
Remarks:
Do not mix calls to malloc and mprAlloc.
API Stability:
Stable.
See Also:
MprFreeMem, MprHeap, MprManager, MprMemNotifier, MprRegion, mprAddRoot, mprAlloc, mprAllocObj, mprAllocZeroed, mprCreateMemService, mprDestroyMemService, mprEnableGC, mprGetBlockSize, mprGetMem, mprGetMemStats, mprGetMpr, mprGetPageSize, mprHasMemError, mprHold, mprIsValid, mprMark, mprMemcmp, mprMemcpy, mprMemdup, mprPrintMem, mprRealloc, mprRelease, mprRemoveRoot, mprRequestGC, mprResetMemError, mprSetManager, mprSetMemError, mprSetMemLimits, mprSetMemNotifier, mprSetMemPolicy, mprValidateBlock, mprVerifyMem, mprVirtAlloc, mprVirtFree
void * mprAllocObj (Type type, MprManager manager)

Allocate an object of a given type.

Description:
Allocates a zeroed block of memory large enough to hold an instance of the specified type with a manager callback. This call associates a manager function with an object that will be invoked when the object is freed or the garbage collector needs the object to mark internal properties as being used. This call is implemented as a macro.
Parameters:
typeType of the object to allocate.
managerManager function to invoke when the allocation is managed.
Returns:
Returns a pointer to the allocated block. If memory is not available the memory exhaustion handler specified via mprCreate will be called to allow global recovery.
Remarks:
Do not mix calls to malloc and mprAlloc.
API Stability:
Stable.
See Also:
MprFreeMem, MprHeap, MprManager, MprMemNotifier, MprRegion, mprAddRoot, mprAlloc, mprAllocMem, mprAllocZeroed, mprCreateMemService, mprDestroyMemService, mprEnableGC, mprGetBlockSize, mprGetMem, mprGetMemStats, mprGetMpr, mprGetPageSize, mprHasMemError, mprHold, mprIsValid, mprMark, mprMemcmp, mprMemcpy, mprMemdup, mprPrintMem, mprRealloc, mprRelease, mprRemoveRoot, mprRequestGC, mprResetMemError, mprSetManager, mprSetMemError, mprSetMemLimits, mprSetMemNotifier, mprSetMemPolicy, mprValidateBlock, mprVerifyMem, mprVirtAlloc, mprVirtFree
void * mprAllocZeroed (ssize size)

Allocate a zeroed block of memory.

Description:
Allocates a zeroed block of memory.
Parameters:
sizeSize of the memory block to allocate.
Returns:
Returns a pointer to the allocated block. If memory is not available the memory exhaustion handler specified via mprCreate will be called to allow global recovery.
Remarks:
Do not mix calls to malloc and mprAlloc.
API Stability:
Stable.
See Also:
MprFreeMem, MprHeap, MprManager, MprMemNotifier, MprRegion, mprAddRoot, mprAlloc, mprAllocMem, mprAllocObj, mprCreateMemService, mprDestroyMemService, mprEnableGC, mprGetBlockSize, mprGetMem, mprGetMemStats, mprGetMpr, mprGetPageSize, mprHasMemError, mprHold, mprIsValid, mprMark, mprMemcmp, mprMemcpy, mprMemdup, mprPrintMem, mprRealloc, mprRelease, mprRemoveRoot, mprRequestGC, mprResetMemError, mprSetManager, mprSetMemError, mprSetMemLimits, mprSetMemNotifier, mprSetMemPolicy, mprValidateBlock, mprVerifyMem, mprVirtAlloc, mprVirtFree
struct Mpr * Mpr* mprCreateMemService (MprManager manager, int flags)

Create and initialize the Memory service.

Parameters:
managerMemory manager to manage the Mpr object.
flagsMemory initialization control flags.
Returns:
The Mpr control structure.
API Stability:
Internal.
See Also:
MprFreeMem, MprHeap, MprManager, MprMemNotifier, MprRegion, mprAddRoot, mprAlloc, mprAllocMem, mprAllocObj, mprAllocZeroed, mprDestroyMemService, mprEnableGC, mprGetBlockSize, mprGetMem, mprGetMemStats, mprGetMpr, mprGetPageSize, mprHasMemError, mprHold, mprIsValid, mprMark, mprMemcmp, mprMemcpy, mprMemdup, mprPrintMem, mprRealloc, mprRelease, mprRemoveRoot, mprRequestGC, mprResetMemError, mprSetManager, mprSetMemError, mprSetMemLimits, mprSetMemNotifier, mprSetMemPolicy, mprValidateBlock, mprVerifyMem, mprVirtAlloc, mprVirtFree
void mprDestroyMemService ()

Destroy the memory service.

Called as the last thing before exiting
API Stability:
Internal.
See Also:
MprFreeMem, MprHeap, MprManager, MprMemNotifier, MprRegion, mprAddRoot, mprAlloc, mprAllocMem, mprAllocObj, mprAllocZeroed, mprCreateMemService, mprEnableGC, mprGetBlockSize, mprGetMem, mprGetMemStats, mprGetMpr, mprGetPageSize, mprHasMemError, mprHold, mprIsValid, mprMark, mprMemcmp, mprMemcpy, mprMemdup, mprPrintMem, mprRealloc, mprRelease, mprRemoveRoot, mprRequestGC, mprResetMemError, mprSetManager, mprSetMemError, mprSetMemLimits, mprSetMemNotifier, mprSetMemPolicy, mprValidateBlock, mprVerifyMem, mprVirtAlloc, mprVirtFree
bool mprEnableGC (bool on)

Enable or disable the garbage collector.

Parameters:
onSet to one to enable and zero to disable.
Returns:
Returns one if the collector was previously enabled. Otherwise returns zero.
API Stability:
Stable.
See Also:
MprFreeMem, MprHeap, MprManager, MprMemNotifier, MprRegion, mprAddRoot, mprAlloc, mprAllocMem, mprAllocObj, mprAllocZeroed, mprCreateMemService, mprDestroyMemService, mprGetBlockSize, mprGetMem, mprGetMemStats, mprGetMpr, mprGetPageSize, mprHasMemError, mprHold, mprIsValid, mprMark, mprMemcmp, mprMemcpy, mprMemdup, mprPrintMem, mprRealloc, mprRelease, mprRemoveRoot, mprRequestGC, mprResetMemError, mprSetManager, mprSetMemError, mprSetMemLimits, mprSetMemNotifier, mprSetMemPolicy, mprValidateBlock, mprVerifyMem, mprVirtAlloc, mprVirtFree
ssize mprGetBlockSize (cvoid *ptr)

Get the allocated size of a memory block.

Parameters:
ptrAny memory allocated by mprAlloc.
Returns:
The block size in bytes.
API Stability:
Internal.
See Also:
MprFreeMem, MprHeap, MprManager, MprMemNotifier, MprRegion, mprAddRoot, mprAlloc, mprAllocMem, mprAllocObj, mprAllocZeroed, mprCreateMemService, mprDestroyMemService, mprEnableGC, mprGetMem, mprGetMemStats, mprGetMpr, mprGetPageSize, mprHasMemError, mprHold, mprIsValid, mprMark, mprMemcmp, mprMemcpy, mprMemdup, mprPrintMem, mprRealloc, mprRelease, mprRemoveRoot, mprRequestGC, mprResetMemError, mprSetManager, mprSetMemError, mprSetMemLimits, mprSetMemNotifier, mprSetMemPolicy, mprValidateBlock, mprVerifyMem, mprVirtAlloc, mprVirtFree
ssize mprGetMem ()

Return the amount of memory currently used by the application.

On Unix, this returns the total application memory size including code, stack, data and heap. On Windows, VxWorks and other operatings systems, it returns the amount of allocated heap memory
Returns:
The amount of memory used by the application in bytes.
API Stability:
Stable.
See Also:
MprFreeMem, MprHeap, MprManager, MprMemNotifier, MprRegion, mprAddRoot, mprAlloc, mprAllocMem, mprAllocObj, mprAllocZeroed, mprCreateMemService, mprDestroyMemService, mprEnableGC, mprGetBlockSize, mprGetMemStats, mprGetMpr, mprGetPageSize, mprHasMemError, mprHold, mprIsValid, mprMark, mprMemcmp, mprMemcpy, mprMemdup, mprPrintMem, mprRealloc, mprRelease, mprRemoveRoot, mprRequestGC, mprResetMemError, mprSetManager, mprSetMemError, mprSetMemLimits, mprSetMemNotifier, mprSetMemPolicy, mprValidateBlock, mprVerifyMem, mprVirtAlloc, mprVirtFree
MprMemStats * mprGetMemStats ()

Return the current allocation memory statistics block.

Returns:
A reference to the allocation memory statistics. Do not modify its contents.
API Stability:
Internal.
See Also:
MprFreeMem, MprHeap, MprManager, MprMemNotifier, MprRegion, mprAddRoot, mprAlloc, mprAllocMem, mprAllocObj, mprAllocZeroed, mprCreateMemService, mprDestroyMemService, mprEnableGC, mprGetBlockSize, mprGetMem, mprGetMpr, mprGetPageSize, mprHasMemError, mprHold, mprIsValid, mprMark, mprMemcmp, mprMemcpy, mprMemdup, mprPrintMem, mprRealloc, mprRelease, mprRemoveRoot, mprRequestGC, mprResetMemError, mprSetManager, mprSetMemError, mprSetMemLimits, mprSetMemNotifier, mprSetMemPolicy, mprValidateBlock, mprVerifyMem, mprVirtAlloc, mprVirtFree
int mprGetPageSize ()

Get the current O/S virtual page size.

Returns:
The page size in bytes.
API Stability:
Stable.
See Also:
MprFreeMem, MprHeap, MprManager, MprMemNotifier, MprRegion, mprAddRoot, mprAlloc, mprAllocMem, mprAllocObj, mprAllocZeroed, mprCreateMemService, mprDestroyMemService, mprEnableGC, mprGetBlockSize, mprGetMem, mprGetMemStats, mprGetMpr, mprHasMemError, mprHold, mprIsValid, mprMark, mprMemcmp, mprMemcpy, mprMemdup, mprPrintMem, mprRealloc, mprRelease, mprRemoveRoot, mprRequestGC, mprResetMemError, mprSetManager, mprSetMemError, mprSetMemLimits, mprSetMemNotifier, mprSetMemPolicy, mprValidateBlock, mprVerifyMem, mprVirtAlloc, mprVirtFree
bool mprHasMemError ()

Determine if the MPR has encountered memory allocation errors.

Description:
Returns true if the MPR has had a memory allocation error. Allocation errors occur if any memory allocation would cause the application to exceed the configured redline limit, or if any O/S memory allocation request fails.
Returns:
TRUE if a memory allocation error has occurred. Otherwise returns FALSE.
API Stability:
Stable.
See Also:
MprFreeMem, MprHeap, MprManager, MprMemNotifier, MprRegion, mprAddRoot, mprAlloc, mprAllocMem, mprAllocObj, mprAllocZeroed, mprCreateMemService, mprDestroyMemService, mprEnableGC, mprGetBlockSize, mprGetMem, mprGetMemStats, mprGetMpr, mprGetPageSize, mprHold, mprIsValid, mprMark, mprMemcmp, mprMemcpy, mprMemdup, mprPrintMem, mprRealloc, mprRelease, mprRemoveRoot, mprRequestGC, mprResetMemError, mprSetManager, mprSetMemError, mprSetMemLimits, mprSetMemNotifier, mprSetMemPolicy, mprValidateBlock, mprVerifyMem, mprVirtAlloc, mprVirtFree
void mprHold (void *ptr)

Hold a memory block.

Description:
This call will protect a memory block from freeing by the garbage collector. Call mprRelease to allow the block to be collected.
Parameters:
ptrAny memory block.
API Stability:
Stable.
See Also:
MprFreeMem, MprHeap, MprManager, MprMemNotifier, MprRegion, mprAddRoot, mprAlloc, mprAllocMem, mprAllocObj, mprAllocZeroed, mprCreateMemService, mprDestroyMemService, mprEnableGC, mprGetBlockSize, mprGetMem, mprGetMemStats, mprGetMpr, mprGetPageSize, mprHasMemError, mprIsValid, mprMark, mprMemcmp, mprMemcpy, mprMemdup, mprPrintMem, mprRealloc, mprRelease, mprRemoveRoot, mprRequestGC, mprResetMemError, mprSetManager, mprSetMemError, mprSetMemLimits, mprSetMemNotifier, mprSetMemPolicy, mprValidateBlock, mprVerifyMem, mprVirtAlloc, mprVirtFree
int mprIsValid (cvoid *ptr)

Test is a pointer is a valid memory context.

This is used to test if a block has been dynamically allocated
Parameters:
ptrAny memory context allocated by mprAlloc or mprCreate.
API Stability:
Internal.
See Also:
MprFreeMem, MprHeap, MprManager, MprMemNotifier, MprRegion, mprAddRoot, mprAlloc, mprAllocMem, mprAllocObj, mprAllocZeroed, mprCreateMemService, mprDestroyMemService, mprEnableGC, mprGetBlockSize, mprGetMem, mprGetMemStats, mprGetMpr, mprGetPageSize, mprHasMemError, mprHold, mprMark, mprMemcmp, mprMemcpy, mprMemdup, mprPrintMem, mprRealloc, mprRelease, mprRemoveRoot, mprRequestGC, mprResetMemError, mprSetManager, mprSetMemError, mprSetMemLimits, mprSetMemNotifier, mprSetMemPolicy, mprValidateBlock, mprVerifyMem, mprVirtAlloc, mprVirtFree
void mprMarkBlock (cvoid *ptr)

Mark a block as "in-use" for the Garbage Collector.

The MPR memory garbage collector requires that all allocated memory be marked as in-use during a garbage collection sweep. When a memory block is allocated, it may provide a "manage" callback function that will be invoked during garbage collection so the block can be marked as "in-use"
Parameters:
ptrReference to the block to mark as currently being used.
API Stability:
Stable.
See Also:
MprFreeMem, MprHeap, MprManager, MprMemNotifier, MprRegion, mprAddRoot, mprAlloc, mprAllocMem, mprAllocObj, mprAllocZeroed, mprCreateMemService, mprDestroyMemService, mprEnableGC, mprGetBlockSize, mprGetMem, mprGetMemStats, mprGetMpr, mprGetPageSize, mprHasMemError, mprHold, mprIsValid, mprMark, mprMemcmp, mprMemcpy, mprMemdup, mprPrintMem, mprRealloc, mprRelease, mprRemoveRoot, mprRequestGC, mprResetMemError, mprSetManager, mprSetMemError, mprSetMemLimits, mprSetMemNotifier, mprSetMemPolicy, mprValidateBlock, mprVerifyMem, mprVirtAlloc, mprVirtFree
int mprMemcmp (cvoid *b1, ssize b1Len, cvoid *b2, ssize b2Len)

Compare two byte strings.

Description:
Safely compare two byte strings. This is a safe replacement for memcmp.
Parameters:
b1Pointer to the first byte string.
b1LenLength of the first byte string.
b2Pointer to the second byte string.
b2LenLength of the second byte string.
Returns:
Returns zero if the byte strings are identical. Otherwise returns -1 if the first string is less than the second. Returns 1 if the first is greater than the first.
API Stability:
Stable.
See Also:
MprFreeMem, MprHeap, MprManager, MprMemNotifier, MprRegion, mprAddRoot, mprAlloc, mprAllocMem, mprAllocObj, mprAllocZeroed, mprCreateMemService, mprDestroyMemService, mprEnableGC, mprGetBlockSize, mprGetMem, mprGetMemStats, mprGetMpr, mprGetPageSize, mprHasMemError, mprHold, mprIsValid, mprMark, mprMemcpy, mprMemdup, mprPrintMem, mprRealloc, mprRelease, mprRemoveRoot, mprRequestGC, mprResetMemError, mprSetManager, mprSetMemError, mprSetMemLimits, mprSetMemNotifier, mprSetMemPolicy, mprValidateBlock, mprVerifyMem, mprVirtAlloc, mprVirtFree
ssize mprMemcpy (void *dest, ssize destMax, cvoid *src, ssize nbytes)

Safe copy for a block of data.

Description:
Safely copy a block of data into an existing memory block. The call ensures the destination block is not overflowed and returns the size of the block actually copied. This is similar to memcpy, but is a safer alternative.
Parameters:
destPointer to the destination block.
destMaxMaximum size of the destination block.
srcBlock to copy.
nbytesSize of the source block.
Returns:
The number of characters in the allocated block.
API Stability:
Stable.
See Also:
MprFreeMem, MprHeap, MprManager, MprMemNotifier, MprRegion, mprAddRoot, mprAlloc, mprAllocMem, mprAllocObj, mprAllocZeroed, mprCreateMemService, mprDestroyMemService, mprEnableGC, mprGetBlockSize, mprGetMem, mprGetMemStats, mprGetMpr, mprGetPageSize, mprHasMemError, mprHold, mprIsValid, mprMark, mprMemcmp, mprMemdup, mprPrintMem, mprRealloc, mprRelease, mprRemoveRoot, mprRequestGC, mprResetMemError, mprSetManager, mprSetMemError, mprSetMemLimits, mprSetMemNotifier, mprSetMemPolicy, mprValidateBlock, mprVerifyMem, mprVirtAlloc, mprVirtFree
void * mprMemdup (cvoid *ptr, ssize size)

Duplicate a block of memory.

Description:
Copy a block of memory into a newly allocated block.
Parameters:
ptrPointer to the block to duplicate.
sizeSize of the block to copy.
Returns:
Returns an allocated block.
API Stability:
Stable.
See Also:
MprFreeMem, MprHeap, MprManager, MprMemNotifier, MprRegion, mprAddRoot, mprAlloc, mprAllocMem, mprAllocObj, mprAllocZeroed, mprCreateMemService, mprDestroyMemService, mprEnableGC, mprGetBlockSize, mprGetMem, mprGetMemStats, mprGetMpr, mprGetPageSize, mprHasMemError, mprHold, mprIsValid, mprMark, mprMemcmp, mprMemcpy, mprPrintMem, mprRealloc, mprRelease, mprRemoveRoot, mprRequestGC, mprResetMemError, mprSetManager, mprSetMemError, mprSetMemLimits, mprSetMemNotifier, mprSetMemPolicy, mprValidateBlock, mprVerifyMem, mprVirtAlloc, mprVirtFree
void mprPrintMem (cchar *msg, int detail)

Print a memory usage report to stdout.

Parameters:
msgPrefix message to the report.
detailIf true, print free queue detail report.
API Stability:
Internal.
See Also:
MprFreeMem, MprHeap, MprManager, MprMemNotifier, MprRegion, mprAddRoot, mprAlloc, mprAllocMem, mprAllocObj, mprAllocZeroed, mprCreateMemService, mprDestroyMemService, mprEnableGC, mprGetBlockSize, mprGetMem, mprGetMemStats, mprGetMpr, mprGetPageSize, mprHasMemError, mprHold, mprIsValid, mprMark, mprMemcmp, mprMemcpy, mprMemdup, mprRealloc, mprRelease, mprRemoveRoot, mprRequestGC, mprResetMemError, mprSetManager, mprSetMemError, mprSetMemLimits, mprSetMemNotifier, mprSetMemPolicy, mprValidateBlock, mprVerifyMem, mprVirtAlloc, mprVirtFree
void * mprRealloc (void *ptr, ssize size)

Reallocate a block.

Description:
Reallocates a block increasing its size. If the specified size is less than the current block size, the call will ignore the request and simply return the existing block. The memory is not zeroed.
Parameters:
ptrMemory to reallocate. If NULL, call malloc.
sizeNew size of the required memory block.
Returns:
Returns a pointer to the allocated block. If memory is not available the memory exhaustion handler specified via mprCreate will be called to allow global recovery.
Remarks:
Do not mix calls to realloc and mprRealloc.
API Stability:
Stable.
See Also:
MprFreeMem, MprHeap, MprManager, MprMemNotifier, MprRegion, mprAddRoot, mprAlloc, mprAllocMem, mprAllocObj, mprAllocZeroed, mprCreateMemService, mprDestroyMemService, mprEnableGC, mprGetBlockSize, mprGetMem, mprGetMemStats, mprGetMpr, mprGetPageSize, mprHasMemError, mprHold, mprIsValid, mprMark, mprMemcmp, mprMemcpy, mprMemdup, mprPrintMem, mprRelease, mprRemoveRoot, mprRequestGC, mprResetMemError, mprSetManager, mprSetMemError, mprSetMemLimits, mprSetMemNotifier, mprSetMemPolicy, mprValidateBlock, mprVerifyMem, mprVirtAlloc, mprVirtFree
void mprRelease (void *ptr)

Release a memory block.

Description:
This call is used to allow a memory block to be freed by the garbage collector after calling mprHold.
Parameters:
ptrAny memory block.
API Stability:
Stable.
See Also:
MprFreeMem, MprHeap, MprManager, MprMemNotifier, MprRegion, mprAddRoot, mprAlloc, mprAllocMem, mprAllocObj, mprAllocZeroed, mprCreateMemService, mprDestroyMemService, mprEnableGC, mprGetBlockSize, mprGetMem, mprGetMemStats, mprGetMpr, mprGetPageSize, mprHasMemError, mprHold, mprIsValid, mprMark, mprMemcmp, mprMemcpy, mprMemdup, mprPrintMem, mprRealloc, mprRemoveRoot, mprRequestGC, mprResetMemError, mprSetManager, mprSetMemError, mprSetMemLimits, mprSetMemNotifier, mprSetMemPolicy, mprValidateBlock, mprVerifyMem, mprVirtAlloc, mprVirtFree
void mprRemoveRoot (void *ptr)

remove a memory block as a root for garbage collection.

Parameters:
ptrAny memory pointer.
API Stability:
Stable.
See Also:
MprFreeMem, MprHeap, MprManager, MprMemNotifier, MprRegion, mprAddRoot, mprAlloc, mprAllocMem, mprAllocObj, mprAllocZeroed, mprCreateMemService, mprDestroyMemService, mprEnableGC, mprGetBlockSize, mprGetMem, mprGetMemStats, mprGetMpr, mprGetPageSize, mprHasMemError, mprHold, mprIsValid, mprMark, mprMemcmp, mprMemcpy, mprMemdup, mprPrintMem, mprRealloc, mprRelease, mprRequestGC, mprResetMemError, mprSetManager, mprSetMemError, mprSetMemLimits, mprSetMemNotifier, mprSetMemPolicy, mprValidateBlock, mprVerifyMem, mprVirtAlloc, mprVirtFree
void mprRequestGC (int flags)

Collect garbage.

Description:
Initiates garbage collection to free unreachable memory blocks. This call may return before collection is complete if garbage collection has been configured via mprCreate() to use dedicated threads for collection. A single garbage collection may not free all memory. Use mprRequestGC(MPR_GC_FORCE) to free all unused memory blocks.
Parameters:
flagsFlags to control the collection. Set flags to MPR_GC_FORCE to force one sweep. Set to zero to perform a conditional sweep where the sweep is only performed if there is sufficient garbage to warrant a collection.
API Stability:
Stable.
See Also:
MprFreeMem, MprHeap, MprManager, MprMemNotifier, MprRegion, mprAddRoot, mprAlloc, mprAllocMem, mprAllocObj, mprAllocZeroed, mprCreateMemService, mprDestroyMemService, mprEnableGC, mprGetBlockSize, mprGetMem, mprGetMemStats, mprGetMpr, mprGetPageSize, mprHasMemError, mprHold, mprIsValid, mprMark, mprMemcmp, mprMemcpy, mprMemdup, mprPrintMem, mprRealloc, mprRelease, mprRemoveRoot, mprResetMemError, mprSetManager, mprSetMemError, mprSetMemLimits, mprSetMemNotifier, mprSetMemPolicy, mprValidateBlock, mprVerifyMem, mprVirtAlloc, mprVirtFree
void mprResetMemError ()

Reset the memory allocation error flag.

Description:
Reset the alloc error flag triggered.
API Stability:
Internal.
See Also:
MprFreeMem, MprHeap, MprManager, MprMemNotifier, MprRegion, mprAddRoot, mprAlloc, mprAllocMem, mprAllocObj, mprAllocZeroed, mprCreateMemService, mprDestroyMemService, mprEnableGC, mprGetBlockSize, mprGetMem, mprGetMemStats, mprGetMpr, mprGetPageSize, mprHasMemError, mprHold, mprIsValid, mprMark, mprMemcmp, mprMemcpy, mprMemdup, mprPrintMem, mprRealloc, mprRelease, mprRemoveRoot, mprRequestGC, mprSetManager, mprSetMemError, mprSetMemLimits, mprSetMemNotifier, mprSetMemPolicy, mprValidateBlock, mprVerifyMem, mprVirtAlloc, mprVirtFree
void * mprSetManager (void *ptr, MprManager manager)

Update the manager for a block of memory.

Description:
This call updates the manager for a block of memory allocated via mprAllocWithManager.
Parameters:
ptrMemory to free. If NULL, take no action.
managerManager function to invoke when the memory is released.
Returns:
The original object.
API Stability:
Stable.
See Also:
MprFreeMem, MprHeap, MprManager, MprMemNotifier, MprRegion, mprAddRoot, mprAlloc, mprAllocMem, mprAllocObj, mprAllocZeroed, mprCreateMemService, mprDestroyMemService, mprEnableGC, mprGetBlockSize, mprGetMem, mprGetMemStats, mprGetMpr, mprGetPageSize, mprHasMemError, mprHold, mprIsValid, mprMark, mprMemcmp, mprMemcpy, mprMemdup, mprPrintMem, mprRealloc, mprRelease, mprRemoveRoot, mprRequestGC, mprResetMemError, mprSetMemError, mprSetMemLimits, mprSetMemNotifier, mprSetMemPolicy, mprValidateBlock, mprVerifyMem, mprVirtAlloc, mprVirtFree
void mprSetMemError ()

Set an memory allocation error condition on a memory context.

This will set an allocation error condition on the given context and all its parents. This way, you can test the ultimate parent and detect if any memory allocation errors have occurred
API Stability:
Stable.
See Also:
MprFreeMem, MprHeap, MprManager, MprMemNotifier, MprRegion, mprAddRoot, mprAlloc, mprAllocMem, mprAllocObj, mprAllocZeroed, mprCreateMemService, mprDestroyMemService, mprEnableGC, mprGetBlockSize, mprGetMem, mprGetMemStats, mprGetMpr, mprGetPageSize, mprHasMemError, mprHold, mprIsValid, mprMark, mprMemcmp, mprMemcpy, mprMemdup, mprPrintMem, mprRealloc, mprRelease, mprRemoveRoot, mprRequestGC, mprResetMemError, mprSetManager, mprSetMemLimits, mprSetMemNotifier, mprSetMemPolicy, mprValidateBlock, mprVerifyMem, mprVirtAlloc, mprVirtFree
void mprSetMemLimits (ssize redline, ssize maxMemory)

Configure the application memory limits.

Description:
Configure memory limits to constrain memory usage by the application. The memory allocation subsystem will check these limits before granting memory allocation requrests. The redLine is a soft limit that if exceeded will invoke the memory allocation callback, but will still honor the request. The maxMemory limit is a hard limit. The MPR will prevent allocations which exceed this maximum. The memory callback handler is defined via the mprCreate call.
Parameters:
redlineSoft memory limit. If exceeded, the request will be granted, but the memory handler will be invoked.
maxMemoryHard memory limit. If exceeded, the request will not be granted, and the memory handler will be invoked.
API Stability:
Stable.
See Also:
MprFreeMem, MprHeap, MprManager, MprMemNotifier, MprRegion, mprAddRoot, mprAlloc, mprAllocMem, mprAllocObj, mprAllocZeroed, mprCreateMemService, mprDestroyMemService, mprEnableGC, mprGetBlockSize, mprGetMem, mprGetMemStats, mprGetMpr, mprGetPageSize, mprHasMemError, mprHold, mprIsValid, mprMark, mprMemcmp, mprMemcpy, mprMemdup, mprPrintMem, mprRealloc, mprRelease, mprRemoveRoot, mprRequestGC, mprResetMemError, mprSetManager, mprSetMemError, mprSetMemNotifier, mprSetMemPolicy, mprValidateBlock, mprVerifyMem, mprVirtAlloc, mprVirtFree
void mprSetMemNotifier (MprMemNotifier cback)

Define a memory notifier.

Description:
A notifier callback will be invoked for memory allocation errors for the given memory context.
Parameters:
cbackNotifier callback function.
API Stability:
Stable.
See Also:
MprFreeMem, MprHeap, MprManager, MprMemNotifier, MprRegion, mprAddRoot, mprAlloc, mprAllocMem, mprAllocObj, mprAllocZeroed, mprCreateMemService, mprDestroyMemService, mprEnableGC, mprGetBlockSize, mprGetMem, mprGetMemStats, mprGetMpr, mprGetPageSize, mprHasMemError, mprHold, mprIsValid, mprMark, mprMemcmp, mprMemcpy, mprMemdup, mprPrintMem, mprRealloc, mprRelease, mprRemoveRoot, mprRequestGC, mprResetMemError, mprSetManager, mprSetMemError, mprSetMemLimits, mprSetMemPolicy, mprValidateBlock, mprVerifyMem, mprVirtAlloc, mprVirtFree
void mprSetMemPolicy (int policy)

Set the memory allocation policy for when allocations fail.

Parameters:
policySet to MPR_ALLOC_POLICY_EXIT for the application to immediately exit on memory allocation errors. Set to MPR_ALLOC_POLICY_RESTART to restart the appplication on memory allocation errors.
API Stability:
Stable.
See Also:
MprFreeMem, MprHeap, MprManager, MprMemNotifier, MprRegion, mprAddRoot, mprAlloc, mprAllocMem, mprAllocObj, mprAllocZeroed, mprCreateMemService, mprDestroyMemService, mprEnableGC, mprGetBlockSize, mprGetMem, mprGetMemStats, mprGetMpr, mprGetPageSize, mprHasMemError, mprHold, mprIsValid, mprMark, mprMemcmp, mprMemcpy, mprMemdup, mprPrintMem, mprRealloc, mprRelease, mprRemoveRoot, mprRequestGC, mprResetMemError, mprSetManager, mprSetMemError, mprSetMemLimits, mprSetMemNotifier, mprValidateBlock, mprVerifyMem, mprVirtAlloc, mprVirtFree
void mprValidateBlock (void *ptr)

Validate a memory block and issue asserts if the memory block is not valid.

Parameters:
ptrPointer to allocated memory.
API Stability:
Internal.
See Also:
MprFreeMem, MprHeap, MprManager, MprMemNotifier, MprRegion, mprAddRoot, mprAlloc, mprAllocMem, mprAllocObj, mprAllocZeroed, mprCreateMemService, mprDestroyMemService, mprEnableGC, mprGetBlockSize, mprGetMem, mprGetMemStats, mprGetMpr, mprGetPageSize, mprHasMemError, mprHold, mprIsValid, mprMark, mprMemcmp, mprMemcpy, mprMemdup, mprPrintMem, mprRealloc, mprRelease, mprRemoveRoot, mprRequestGC, mprResetMemError, mprSetManager, mprSetMemError, mprSetMemLimits, mprSetMemNotifier, mprSetMemPolicy, mprVerifyMem, mprVirtAlloc, mprVirtFree
void mprVerifyMem ()

Verify all memory.

This checks the integrity of all memory blocks by verifying the block headers and contents of all free memory blocks. Will only do anything meaningful when the product is compiled in debug mode
See Also:
MprFreeMem, MprHeap, MprManager, MprMemNotifier, MprRegion, mprAddRoot, mprAlloc, mprAllocMem, mprAllocObj, mprAllocZeroed, mprCreateMemService, mprDestroyMemService, mprEnableGC, mprGetBlockSize, mprGetMem, mprGetMemStats, mprGetMpr, mprGetPageSize, mprHasMemError, mprHold, mprIsValid, mprMark, mprMemcmp, mprMemcpy, mprMemdup, mprPrintMem, mprRealloc, mprRelease, mprRemoveRoot, mprRequestGC, mprResetMemError, mprSetManager, mprSetMemError, mprSetMemLimits, mprSetMemNotifier, mprSetMemPolicy, mprValidateBlock, mprVirtAlloc, mprVirtFree
void * mprVirtAlloc (ssize size, int mode)

Memory virtual memory into the applications address space.

Parameters:
sizeof virtual memory to map. This size will be rounded up to the nearest page boundary.
modeMask set to MPR_MAP_READ | MPR_MAP_WRITE.
API Stability:
Stable.
See Also:
MprFreeMem, MprHeap, MprManager, MprMemNotifier, MprRegion, mprAddRoot, mprAlloc, mprAllocMem, mprAllocObj, mprAllocZeroed, mprCreateMemService, mprDestroyMemService, mprEnableGC, mprGetBlockSize, mprGetMem, mprGetMemStats, mprGetMpr, mprGetPageSize, mprHasMemError, mprHold, mprIsValid, mprMark, mprMemcmp, mprMemcpy, mprMemdup, mprPrintMem, mprRealloc, mprRelease, mprRemoveRoot, mprRequestGC, mprResetMemError, mprSetManager, mprSetMemError, mprSetMemLimits, mprSetMemNotifier, mprSetMemPolicy, mprValidateBlock, mprVerifyMem, mprVirtFree
void mprVirtFree (void *ptr, ssize size)

Free (unpin) a mapped section of virtual memory.

Parameters:
ptrVirtual address to free. Should be page aligned.
sizeSize of memory to free in bytes.
API Stability:
Stable.
See Also:
MprFreeMem, MprHeap, MprManager, MprMemNotifier, MprRegion, mprAddRoot, mprAlloc, mprAllocMem, mprAllocObj, mprAllocZeroed, mprCreateMemService, mprDestroyMemService, mprEnableGC, mprGetBlockSize, mprGetMem, mprGetMemStats, mprGetMpr, mprGetPageSize, mprHasMemError, mprHold, mprIsValid, mprMark, mprMemcmp, mprMemcpy, mprMemdup, mprPrintMem, mprRealloc, mprRelease, mprRemoveRoot, mprRequestGC, mprResetMemError, mprSetManager, mprSetMemError, mprSetMemLimits, mprSetMemNotifier, mprSetMemPolicy, mprValidateBlock, mprVerifyMem, mprVirtAlloc
void * palloc (ssize size)

Allocate a "permanent" block of memory that is not subject GC.

Description:
This allocates a block of memory using the MPR allocator. It then calls mprHold on the block. to prevent GC from freeing the block.
Parameters:
sizeSize of the memory block to allocate.
Returns:
Returns a pointer to the allocated block. If memory is not available the memory exhaustion handler specified via mprCreate will be called to allow global recovery.
Remarks:
Do not mix calls to palloc and malloc.
API Stability:
Prototype.
See Also:
MprFreeMem, MprHeap, MprManager, MprMemNotifier, MprRegion, mprAddRoot, mprAlloc, mprAllocMem, mprAllocObj, mprAllocZeroed, mprCreateMemService, mprDestroyMemService, mprEnableGC, mprGetBlockSize, mprGetMem, mprGetMemStats, mprGetMpr, mprGetPageSize, mprHasMemError, mprHold, mprIsValid, mprMark, mprMemcmp, mprMemcpy, mprMemdup, mprPrintMem, mprRealloc, mprRelease, mprRemoveRoot, mprRequestGC, mprResetMemError, mprSetManager, mprSetMemError, mprSetMemLimits, mprSetMemNotifier, mprSetMemPolicy, mprValidateBlock, mprVerifyMem, mprVirtAlloc, mprVirtFree
void pfree (void *ptr)

Free a "permanent" block of memory allocated via "palloc".

Description:
This releases a block of memory allocated via "palloc" to be collected by the garbage collector.
Parameters:
ptrPointer to the block.
Remarks:
Do not mix calls to pfree and free.
API Stability:
Prototype.
See Also:
MprFreeMem, MprHeap, MprManager, MprMemNotifier, MprRegion, mprAddRoot, mprAlloc, mprAllocMem, mprAllocObj, mprAllocZeroed, mprCreateMemService, mprDestroyMemService, mprEnableGC, mprGetBlockSize, mprGetMem, mprGetMemStats, mprGetMpr, mprGetPageSize, mprHasMemError, mprHold, mprIsValid, mprMark, mprMemcmp, mprMemcpy, mprMemdup, mprPrintMem, mprRealloc, mprRelease, mprRemoveRoot, mprRequestGC, mprResetMemError, mprSetManager, mprSetMemError, mprSetMemLimits, mprSetMemNotifier, mprSetMemPolicy, mprValidateBlock, mprVerifyMem, mprVirtAlloc, mprVirtFree
void * prealloc (void *ptr, ssize size)

Reallocate a "permanent" block of memory allocated via "palloc".

Description:
This increases the size of a block of memory allocated via "palloc".
Parameters:
ptrPointer to the block.
sizeNew block size.
Returns:
Returns a pointer to the allocated block. If memory is not available the memory exhaustion handler specified via mprCreate will be called to allow global recovery.
Remarks:
Do not mix calls to prealloc and malloc.
API Stability:
Prototype.
See Also:
MprFreeMem, MprHeap, MprManager, MprMemNotifier, MprRegion, mprAddRoot, mprAlloc, mprAllocMem, mprAllocObj, mprAllocZeroed, mprCreateMemService, mprDestroyMemService, mprEnableGC, mprGetBlockSize, mprGetMem, mprGetMemStats, mprGetMpr, mprGetPageSize, mprHasMemError, mprHold, mprIsValid, mprMark, mprMemcmp, mprMemcpy, mprMemdup, mprPrintMem, mprRealloc, mprRelease, mprRemoveRoot, mprRequestGC, mprResetMemError, mprSetManager, mprSetMemError, mprSetMemLimits, mprSetMemNotifier, mprSetMemPolicy, mprValidateBlock, mprVerifyMem, mprVirtAlloc, mprVirtFree

MprMime

MprMime

Mime Type hash table entry (the URL extension is the key).

API Stability:
Stable.
See Also:
mprAddMime, mprCreateMimeTypes, mprGetMimeProgram, mprLookupMime, mprSetMimeProgram
API Stability:
Internal.
Fields:
char *program Mime type string.
char *type Mime type string.
MprMime * mprAddMime (MprHash *table, cchar *ext, cchar *mimeType)

Add a mime type to the mime type table.

Parameters:
tabletype hash table returned by mprCreateMimeTypes
extFilename extension to use as a key for the given mime type.
mimeTypeMime type string to associate with the ext key.
Returns:
Mime type entry object. This is owned by the mime type table.
API Stability:
Stable.
See Also:
MprMime, mprCreateMimeTypes, mprGetMimeProgram, mprLookupMime, mprSetMimeProgram
MprHash * mprCreateMimeTypes (cchar *path)

Create the mime types.

Parameters:
pathFilename of a mime types definition file.
Returns:
Hash table of mime types keyed by file extension.
API Stability:
Stable.
See Also:
MprMime, mprAddMime, mprGetMimeProgram, mprLookupMime, mprSetMimeProgram
cchar * mprGetMimeProgram (MprHash *table, cchar *mimeType)

Get the mime type program for a given mimeType.

Parameters:
tabletype hash table returned by mprCreateMimeTypes
mimeTypeMime type to update.
Returns:
The program name associated with this mime type.
API Stability:
Stable.
See Also:
MprMime, mprAddMime, mprCreateMimeTypes, mprLookupMime, mprSetMimeProgram
cchar * mprLookupMime (MprHash *table, cchar *ext)

Get the mime type for an extension.

This call will return the mime type from a limited internal set of mime types for the given path or extension
Parameters:
tableHash table of mime types to examine.
extPath or extension to examine.
Returns:
Mime type string.
API Stability:
Stable.
See Also:
MprMime, mprAddMime, mprCreateMimeTypes, mprGetMimeProgram, mprSetMimeProgram
int mprSetMimeProgram (MprHash *table, cchar *mimeType, cchar *program)

Set the mime type program.

Parameters:
tabletype hash table returned by mprCreateMimeTypes
mimeTypeMime type to update.
programProgram name to associate with this mime type.
Returns:
Zero if the update is successful. Otherwise return MPR_ERR_CANT_FIND if the mime type is not present in the mime type table.
API Stability:
Stable.
See Also:
MprMime, mprAddMime, mprCreateMimeTypes, mprGetMimeProgram, mprLookupMime

MprModule

MprModule

Loadable Module Service.

Description:
The MPR provides services to load and unload shared libraries.
See Also:
MprModuleEntry, MprModuleProc, mprCreateModule, mprGetModuleSearchPath, mprLoadModule, mprLoadNativeModule, mprLookupModule, mprLookupModuleData, mprSearchForModule, mprSetModuleFinalizer, mprSetModuleSearchPath, mprSetModuleTimeout, mprStartModule, mprStopModule, mprUnloadModule, mprUnloadNativeModule
API Stability:
Stable.
API Stability:
Internal.
Fields:
char *entry Module library init entry point.
intflags Module control flags.
void *handle O/S shared library load handle.
MprTickslastActivity When the module was last used.
MprTimemodified When the module file was last modified.
void *moduleData Module specific data - must be alloced data.
char *name Unique module name.
char *path Module library filename.
MprModuleProcstart Start the module.
MprModuleProcstop Stop the module. Should be unloadable after stopping.
MprTickstimeout Inactivity unload timeout.
MprModule * mprCreateModule (cchar *name, cchar *path, cchar *entry, void *data)

Create a module.

Description:
This call will create a module object for a loadable module. This should be invoked by the module itself in its module entry point to register itself with the MPR.
Parameters:
nameName of the module.
pathOptional filename of a module library to load. When loading, the filename will be searched using the defined module search path (see mprSetModuleSearchPath). The filename may or may not include a platform specific shared library extension such as .dll, .so or .dylib. By omitting the library extension, code can portably load shared libraries.
entryName of function to invoke after loading the module.
dataArbitrary data pointer. This will be defined in MprModule.data and passed into the module initialization entry point.
Returns:
A module object for this module.
API Stability:
Stable.
See Also:
MprModule, MprModuleEntry, MprModuleProc, mprGetModuleSearchPath, mprLoadModule, mprLoadNativeModule, mprLookupModule, mprLookupModuleData, mprSearchForModule, mprSetModuleFinalizer, mprSetModuleSearchPath, mprSetModuleTimeout, mprStartModule, mprStopModule, mprUnloadModule, mprUnloadNativeModule
cchar * mprGetModuleSearchPath ()

Get the module search path.

Description:
Get the directory search path used by the MPR when loading dynamic modules. This is a colon separated (or semicolon on Windows) set of directories.
Returns:
The module search path.
API Stability:
Stable.
See Also:
MprModule, MprModuleEntry, MprModuleProc, mprCreateModule, mprLoadModule, mprLoadNativeModule, mprLookupModule, mprLookupModuleData, mprSearchForModule, mprSetModuleFinalizer, mprSetModuleSearchPath, mprSetModuleTimeout, mprStartModule, mprStopModule, mprUnloadModule, mprUnloadNativeModule
int mprLoadModule (MprModule *mp)

Load a module.

Description:
Load a module library. This will load a dynamic shared object (shared library) and call the modules library entry point. If the module is already loaded, this call will do nothing.
Parameters:
mpModule object created via mprCreateModule
Returns:
Zero if successful, otherwise a negative MPR error code.
API Stability:
Stable.
See Also:
MprModule, MprModuleEntry, MprModuleProc, mprCreateModule, mprGetModuleSearchPath, mprLoadNativeModule, mprLookupModule, mprLookupModuleData, mprSearchForModule, mprSetModuleFinalizer, mprSetModuleSearchPath, mprSetModuleTimeout, mprStartModule, mprStopModule, mprUnloadModule, mprUnloadNativeModule
int mprLoadNativeModule (MprModule *mp)

Load a native module.

Parameters:
mpModule object created via mprCreateModule
Returns:
Zero if successful, otherwise a negative MPR error code.
API Stability:
Stable.
See Also:
MprModule, MprModuleEntry, MprModuleProc, mprCreateModule, mprGetModuleSearchPath, mprLoadModule, mprLookupModule, mprLookupModuleData, mprSearchForModule, mprSetModuleFinalizer, mprSetModuleSearchPath, mprSetModuleTimeout, mprStartModule, mprStopModule, mprUnloadModule, mprUnloadNativeModule
MprModule * mprLookupModule (cchar *name)

Lookup a module.

Description:
Lookup a module by name and return the module object.
Parameters:
nameName of the module specified to mprCreateModule
Returns:
A module object for this module created in the module entry point by calling mprCreateModule
API Stability:
Stable.
See Also:
MprModule, MprModuleEntry, MprModuleProc, mprCreateModule, mprGetModuleSearchPath, mprLoadModule, mprLoadNativeModule, mprLookupModuleData, mprSearchForModule, mprSetModuleFinalizer, mprSetModuleSearchPath, mprSetModuleTimeout, mprStartModule, mprStopModule, mprUnloadModule, mprUnloadNativeModule
void * mprLookupModuleData (cchar *name)

Lookup a module and return the module data.

Description:
Lookup a module by name and return the module specific data defined via mprCreateModule
Parameters:
nameName of the module specified to mprCreateModule
Returns:
The module data.
API Stability:
Stable.
See Also:
MprModule, MprModuleEntry, MprModuleProc, mprCreateModule, mprGetModuleSearchPath, mprLoadModule, mprLoadNativeModule, mprLookupModule, mprSearchForModule, mprSetModuleFinalizer, mprSetModuleSearchPath, mprSetModuleTimeout, mprStartModule, mprStopModule, mprUnloadModule, mprUnloadNativeModule
char * mprSearchForModule (cchar *module)

Search for a module on the current module path.

Parameters:
moduleName of the module to locate.
Returns:
A string containing the full path to the module. Returns NULL if the module filename cannot be found.
API Stability:
Stable.
See Also:
MprModule, MprModuleEntry, MprModuleProc, mprCreateModule, mprGetModuleSearchPath, mprLoadModule, mprLoadNativeModule, mprLookupModule, mprLookupModuleData, mprSetModuleFinalizer, mprSetModuleSearchPath, mprSetModuleTimeout, mprStartModule, mprStopModule, mprUnloadModule, mprUnloadNativeModule
void mprSetModuleFinalizer (MprModule *module, MprModuleProc stop)

Define a module finalizer that will be called before a module is stopped.

Parameters:
moduleModule object to modify.
stopCallback function to invoke before stopping the module.
API Stability:
Stable.
See Also:
MprModule, MprModuleEntry, MprModuleProc, mprCreateModule, mprGetModuleSearchPath, mprLoadModule, mprLoadNativeModule, mprLookupModule, mprLookupModuleData, mprSearchForModule, mprSetModuleSearchPath, mprSetModuleTimeout, mprStartModule, mprStopModule, mprUnloadModule, mprUnloadNativeModule
void mprSetModuleSearchPath (char *searchPath)

Set the module search path.

Description:
Set the directory search path used by the MPR when loading dynamic modules. This path string must should be a colon separated (or semicolon on Windows) set of directories.
Parameters:
searchPathColon separated set of directories.
Returns:
The module search path.
API Stability:
Stable.
See Also:
MprModule, MprModuleEntry, MprModuleProc, mprCreateModule, mprGetModuleSearchPath, mprLoadModule, mprLoadNativeModule, mprLookupModule, mprLookupModuleData, mprSearchForModule, mprSetModuleFinalizer, mprSetModuleTimeout, mprStartModule, mprStopModule, mprUnloadModule, mprUnloadNativeModule
void mprSetModuleTimeout (MprModule *module, MprTicks timeout)

Set a module timeout.

Parameters:
moduleModule object to modify.
timeoutInactivity timeout in milliseconds before unloading the module.
API Stability:
Internal.
See Also:
MprModule, MprModuleEntry, MprModuleProc, mprCreateModule, mprGetModuleSearchPath, mprLoadModule, mprLoadNativeModule, mprLookupModule, mprLookupModuleData, mprSearchForModule, mprSetModuleFinalizer, mprSetModuleSearchPath, mprStartModule, mprStopModule, mprUnloadModule, mprUnloadNativeModule
int mprStartModule (MprModule *mp)

Start a module.

Description:
Invoke the module start entry point. The start routine is only called once.
Parameters:
mpModule object returned via mprLookupModule
API Stability:
Internal.
See Also:
MprModule, MprModuleEntry, MprModuleProc, mprCreateModule, mprGetModuleSearchPath, mprLoadModule, mprLoadNativeModule, mprLookupModule, mprLookupModuleData, mprSearchForModule, mprSetModuleFinalizer, mprSetModuleSearchPath, mprSetModuleTimeout, mprStopModule, mprUnloadModule, mprUnloadNativeModule
int mprStopModule (MprModule *mp)

Stop a module.

Description:
Invoke the module stop entry point. The stop routine is only called once.
Parameters:
mpModule object returned via mprLookupModule
API Stability:
Internal.
See Also:
MprModule, MprModuleEntry, MprModuleProc, mprCreateModule, mprGetModuleSearchPath, mprLoadModule, mprLoadNativeModule, mprLookupModule, mprLookupModuleData, mprSearchForModule, mprSetModuleFinalizer, mprSetModuleSearchPath, mprSetModuleTimeout, mprStartModule, mprUnloadModule, mprUnloadNativeModule
int mprUnloadModule (MprModule *mp)

Unload a module.

Description:
Unload a module from the MPR. This will unload a dynamic shared object (shared library). This routine is not fully supported by the MPR and is often fraught with issues. A module must usually be completely inactive with no allocated memory when it is unloaded. USE WITH CARE.
Parameters:
mpModule object returned via mprLookupModule
Returns:
Zero if the module can be unloaded. Otherwise a negative MPR error code.
API Stability:
Internal.
See Also:
MprModule, MprModuleEntry, MprModuleProc, mprCreateModule, mprGetModuleSearchPath, mprLoadModule, mprLoadNativeModule, mprLookupModule, mprLookupModuleData, mprSearchForModule, mprSetModuleFinalizer, mprSetModuleSearchPath, mprSetModuleTimeout, mprStartModule, mprStopModule, mprUnloadNativeModule
int mprUnloadNativeModule (MprModule *mp)

Unload a native module.

Description:
WARNING: modules must be designed to be unloaded and must be quiesced before unloading.
Parameters:
mpModule object created via mprCreateModule
Returns:
Zero if successful, otherwise a negative MPR error code.
API Stability:
Stable.
See Also:
MprModule, MprModuleEntry, MprModuleProc, mprCreateModule, mprGetModuleSearchPath, mprLoadModule, mprLoadNativeModule, mprLookupModule, mprLookupModuleData, mprSearchForModule, mprSetModuleFinalizer, mprSetModuleSearchPath, mprSetModuleTimeout, mprStartModule, mprStopModule, mprUnloadModule

MprModuleSerivce

MprModuleSerivce

Loadable module service.

See Also:
mprCreateModuleService, mprStartModuleService, mprStopModuleService
API Stability:
Internal.

MprPath

MprPath

Path (filename) Information.

Description:
MprPath is the cross platform Path (filename) information structure.
API Stability:
Internal.
See Also:
MprDirEntry, MprFile, mprCopyPath, mprDeletePath, mprGetAbsPath, mprGetCurrentPath, mprGetFirstPathSeparator, mprGetNativePath, mprGetPathBase, mprGetPathDir, mprGetPathExt, mprGetPathFiles, mprGetPathLink, mprGetPathNewline, mprGetPathParent, mprGetPathSeparators, mprGetPortablePath, mprGetRelPath, mprGetTempPath, mprGetWinPath, mprJoinPath, mprJoinPathExt, mprMakeDir, mprMakeLink, mprMapSeparators, mprNormalizePath, mprPathExists, mprReplacePathExt, mprResolvePath, mprSamePath, mprSamePathCount, mprSearchPath, mprTransformPath, mprTrimPathExt
Fields:
MprTimeatime Access time.
boolcaseMatters Case comparisons matter.
intchecked Path has been checked.
MprTimectime Create time.
intgroup Group ID.
int64inode Inode number.
boolisDir Set if directory.
boolisLink Set if a symbolic link.
boolisReg Set if a regular file.
MprTimemtime Modified time.
intowner Owner ID.
intperms Permission mask.
MprOffsize File length.
intvalid Valid data bit.
int mprCopyPath (cchar *from, cchar *to, int omode)

Copy a file.

Description:
Create a new copy of a file with the specified open permissions mode.
Parameters:
fromPath of the existing file to copy.
toName of the new file copy.
omodePosix style file open mode mask. See mprOpenFile for the various modes.
Returns:
True if the file exists and can be accessed.
API Stability:
Stable.
See Also:
MprDirEntry, MprFile, MprPath, mprDeletePath, mprGetAbsPath, mprGetCurrentPath, mprGetFirstPathSeparator, mprGetNativePath, mprGetPathBase, mprGetPathDir, mprGetPathExt, mprGetPathFiles, mprGetPathLink, mprGetPathNewline, mprGetPathParent, mprGetPathSeparators, mprGetPortablePath, mprGetRelPath, mprGetTempPath, mprGetWinPath, mprJoinPath, mprJoinPathExt, mprMakeDir, mprMakeLink, mprMapSeparators, mprNormalizePath, mprPathExists, mprReplacePathExt, mprResolvePath, mprSamePath, mprSamePathCount, mprSearchPath, mprTransformPath, mprTrimPathExt
int mprDeletePath (cchar *path)

Delete a file.

Description:
Delete a file or directory.
Parameters:
pathString containing the path to delete.
Returns:
Returns zero if successful otherwise a negative MPR error code is returned.
API Stability:
Stable.
See Also:
MprDirEntry, MprFile, MprPath, mprCopyPath, mprGetAbsPath, mprGetCurrentPath, mprGetFirstPathSeparator, mprGetNativePath, mprGetPathBase, mprGetPathDir, mprGetPathExt, mprGetPathFiles, mprGetPathLink, mprGetPathNewline, mprGetPathParent, mprGetPathSeparators, mprGetPortablePath, mprGetRelPath, mprGetTempPath, mprGetWinPath, mprJoinPath, mprJoinPathExt, mprMakeDir, mprMakeLink, mprMapSeparators, mprNormalizePath, mprPathExists, mprReplacePathExt, mprResolvePath, mprSamePath, mprSamePathCount, mprSearchPath, mprTransformPath, mprTrimPathExt
char * mprGetAbsPath (cchar *path)

Convert a path to an absolute path.

Description:
Get an absolute (canonical) equivalent representation of a path. On windows this path will have back-slash directory separators and will have a drive specifier. On Cygwin, the path will be a Cygwin style path with forward-slash directory specifiers and without a drive specifier. If the path is outside the cygwin filesystem (outside c:/cygwin), the path will have a /cygdrive/DRIVE prefix. To get a windows style path, use mprGetWinPath.
Parameters:
pathPath to examine.
Returns:
An absolute path.
API Stability:
Stable.
See Also:
MprDirEntry, MprFile, MprPath, mprCopyPath, mprDeletePath, mprGetCurrentPath, mprGetFirstPathSeparator, mprGetNativePath, mprGetPathBase, mprGetPathDir, mprGetPathExt, mprGetPathFiles, mprGetPathLink, mprGetPathNewline, mprGetPathParent, mprGetPathSeparators, mprGetPortablePath, mprGetRelPath, mprGetTempPath, mprGetWinPath, mprJoinPath, mprJoinPathExt, mprMakeDir, mprMakeLink, mprMapSeparators, mprNormalizePath, mprPathExists, mprReplacePathExt, mprResolvePath, mprSamePath, mprSamePathCount, mprSearchPath, mprTransformPath, mprTrimPathExt
char * mprGetCurrentPath ()

Return the current working directory.

Returns:
Returns an allocated string with the current working directory as an absolute path.
API Stability:
Stable.
See Also:
MprDirEntry, MprFile, MprPath, mprCopyPath, mprDeletePath, mprGetAbsPath, mprGetFirstPathSeparator, mprGetNativePath, mprGetPathBase, mprGetPathDir, mprGetPathExt, mprGetPathFiles, mprGetPathLink, mprGetPathNewline, mprGetPathParent, mprGetPathSeparators, mprGetPortablePath, mprGetRelPath, mprGetTempPath, mprGetWinPath, mprJoinPath, mprJoinPathExt, mprMakeDir, mprMakeLink, mprMapSeparators, mprNormalizePath, mprPathExists, mprReplacePathExt, mprResolvePath, mprSamePath, mprSamePathCount, mprSearchPath, mprTransformPath, mprTrimPathExt
cchar * mprGetFirstPathSeparator (cchar *path)

Get the first path separator in a path.

Parameters:
pathPath to examine.
Returns:
Returns a reference to the first path separator in the given path.
API Stability:
Stable.
See Also:
MprDirEntry, MprFile, MprPath, mprCopyPath, mprDeletePath, mprGetAbsPath, mprGetCurrentPath, mprGetNativePath, mprGetPathBase, mprGetPathDir, mprGetPathExt, mprGetPathFiles, mprGetPathLink, mprGetPathNewline, mprGetPathParent, mprGetPathSeparators, mprGetPortablePath, mprGetRelPath, mprGetTempPath, mprGetWinPath, mprJoinPath, mprJoinPathExt, mprMakeDir, mprMakeLink, mprMapSeparators, mprNormalizePath, mprPathExists, mprReplacePathExt, mprResolvePath, mprSamePath, mprSamePathCount, mprSearchPath, mprTransformPath, mprTrimPathExt
char * mprGetNativePath (cchar *path)

Get a path formatted according to the native O/S conventions.

Description:
Get an equivalent absolute path formatted using the directory separators native to the O/S platform. On Windows, it will use backward slashes ("\") as the directory separator and will contain a drive specification.
Parameters:
pathPath name to examine.
Returns:
An allocated string containing the new path.
API Stability:
Stable.
See Also:
MprDirEntry, MprFile, MprPath, mprCopyPath, mprDeletePath, mprGetAbsPath, mprGetCurrentPath, mprGetFirstPathSeparator, mprGetPathBase, mprGetPathDir, mprGetPathExt, mprGetPathFiles, mprGetPathLink, mprGetPathNewline, mprGetPathParent, mprGetPathSeparators, mprGetPortablePath, mprGetRelPath, mprGetTempPath, mprGetWinPath, mprJoinPath, mprJoinPathExt, mprMakeDir, mprMakeLink, mprMapSeparators, mprNormalizePath, mprPathExists, mprReplacePathExt, mprResolvePath, mprSamePath, mprSamePathCount, mprSearchPath, mprTransformPath, mprTrimPathExt
char * mprGetPathBase (cchar *path)

Get the base portion of a path.

Description:
Get the base portion of a path by stripping off all directory components.
Parameters:
pathPath name to examine.
Returns:
A path without any directory portion.
API Stability:
Stable.
See Also:
MprDirEntry, MprFile, MprPath, mprCopyPath, mprDeletePath, mprGetAbsPath, mprGetCurrentPath, mprGetFirstPathSeparator, mprGetNativePath, mprGetPathDir, mprGetPathExt, mprGetPathFiles, mprGetPathLink, mprGetPathNewline, mprGetPathParent, mprGetPathSeparators, mprGetPortablePath, mprGetRelPath, mprGetTempPath, mprGetWinPath, mprJoinPath, mprJoinPathExt, mprMakeDir, mprMakeLink, mprMapSeparators, mprNormalizePath, mprPathExists, mprReplacePathExt, mprResolvePath, mprSamePath, mprSamePathCount, mprSearchPath, mprTransformPath, mprTrimPathExt
cchar * mprGetPathBaseRef (cchar *path)

Get a reference to the base portion of a path.

Description:
Get the base portion of a path by stripping off all directory components. This returns a reference into the original path.
Parameters:
pathPath name to examine.
Returns:
A path without any directory portion. The path is a reference into the original file string.
API Stability:
Stable.
See Also:
MprDirEntry, MprFile, MprPath, mprCopyPath, mprDeletePath, mprGetAbsPath, mprGetCurrentPath, mprGetFirstPathSeparator, mprGetNativePath, mprGetPathBase, mprGetPathDir, mprGetPathExt, mprGetPathFiles, mprGetPathLink, mprGetPathNewline, mprGetPathParent, mprGetPathSeparators, mprGetPortablePath, mprGetRelPath, mprGetTempPath, mprGetWinPath, mprJoinPath, mprJoinPathExt, mprMakeDir, mprMakeLink, mprMapSeparators, mprNormalizePath, mprPathExists, mprReplacePathExt, mprResolvePath, mprSamePath, mprSamePathCount, mprSearchPath, mprTransformPath, mprTrimPathExt
char * mprGetPathDir (cchar *path)

Get the directory portion of a path.

Description:
Get the directory portion of a path by stripping off the base name.
Parameters:
pathPath name to examine.
Returns:
A new string containing the directory name.
API Stability:
Stable.
See Also:
MprDirEntry, MprFile, MprPath, mprCopyPath, mprDeletePath, mprGetAbsPath, mprGetCurrentPath, mprGetFirstPathSeparator, mprGetNativePath, mprGetPathBase, mprGetPathExt, mprGetPathFiles, mprGetPathLink, mprGetPathNewline, mprGetPathParent, mprGetPathSeparators, mprGetPortablePath, mprGetRelPath, mprGetTempPath, mprGetWinPath, mprJoinPath, mprJoinPathExt, mprMakeDir, mprMakeLink, mprMapSeparators, mprNormalizePath, mprPathExists, mprReplacePathExt, mprResolvePath, mprSamePath, mprSamePathCount, mprSearchPath, mprTransformPath, mprTrimPathExt
char * mprGetPathExt (cchar *path)

Get the file extension portion of a path.

Description:
Get the file extension portion of a path. The file extension is the portion starting with the last "." in the path. It thus includes "." as the first charcter.
Parameters:
pathPath name to examine.
Returns:
A path extension.
API Stability:
Stable.
See Also:
MprDirEntry, MprFile, MprPath, mprCopyPath, mprDeletePath, mprGetAbsPath, mprGetCurrentPath, mprGetFirstPathSeparator, mprGetNativePath, mprGetPathBase, mprGetPathDir, mprGetPathFiles, mprGetPathLink, mprGetPathNewline, mprGetPathParent, mprGetPathSeparators, mprGetPortablePath, mprGetRelPath, mprGetTempPath, mprGetWinPath, mprJoinPath, mprJoinPathExt, mprMakeDir, mprMakeLink, mprMapSeparators, mprNormalizePath, mprPathExists, mprReplacePathExt, mprResolvePath, mprSamePath, mprSamePathCount, mprSearchPath, mprTransformPath, mprTrimPathExt
MprList * mprGetPathFiles (cchar *dir, int flags)

Create a list of files in a directory or subdirectories.

This call returns a list of MprDirEntry objects
Description:
Get the list of files in a directory and return a list.
Parameters:
dirDirectory to list.
flagsThe flags may be set to MPR_PATH_DESCEND to traverse subdirectories. Set MPR_PATH_NODIRS to exclude directories from the results. Set to MPR_PATH_HIDDEN to include hidden files that start with ".". Set to MPR_PATH_DEPTH_FIRST to do a depth-first traversal, i.e. traverse subdirectories before considering adding the directory to the list.
Returns:
A list (MprList) of MprDirEntry objects.
API Stability:
Stable.
See Also:
MprDirEntry, MprFile, MprPath, mprCopyPath, mprDeletePath, mprGetAbsPath, mprGetCurrentPath, mprGetFirstPathSeparator, mprGetNativePath, mprGetPathBase, mprGetPathDir, mprGetPathExt, mprGetPathLink, mprGetPathNewline, mprGetPathParent, mprGetPathSeparators, mprGetPortablePath, mprGetRelPath, mprGetTempPath, mprGetWinPath, mprJoinPath, mprJoinPathExt, mprMakeDir, mprMakeLink, mprMapSeparators, mprNormalizePath, mprPathExists, mprReplacePathExt, mprResolvePath, mprSamePath, mprSamePathCount, mprSearchPath, mprTransformPath, mprTrimPathExt
char * mprGetPathFirstDir (cchar *path)

Get the first directory portion of a path.

Parameters:
pathPath name to examine.
Returns:
A new string containing the directory name.
API Stability:
Stable.
See Also:
MprDirEntry, MprFile, MprPath, mprCopyPath, mprDeletePath, mprGetAbsPath, mprGetCurrentPath, mprGetFirstPathSeparator, mprGetNativePath, mprGetPathBase, mprGetPathDir, mprGetPathExt, mprGetPathFiles, mprGetPathLink, mprGetPathNewline, mprGetPathParent, mprGetPathSeparators, mprGetPortablePath, mprGetRelPath, mprGetTempPath, mprGetWinPath, mprJoinPath, mprJoinPathExt, mprMakeDir, mprMakeLink, mprMapSeparators, mprNormalizePath, mprPathExists, mprReplacePathExt, mprResolvePath, mprSamePath, mprSamePathCount, mprSearchPath, mprTransformPath, mprTrimPathExt
int mprGetPathInfo (cchar *path, MprPath *info)

Return information about a file represented by a path.

Description:
Returns file status information regarding the path.
Parameters:
pathString containing the path to query.
infoPointer to a pre-allocated MprPath structure.
Returns:
Returns zero if successful, otherwise a negative MPR error code is returned.
API Stability:
Stable.
See Also:
MprDirEntry, MprFile, MprPath, mprCopyPath, mprDeletePath, mprGetAbsPath, mprGetCurrentPath, mprGetFirstPathSeparator, mprGetNativePath, mprGetPathBase, mprGetPathDir, mprGetPathExt, mprGetPathFiles, mprGetPathLink, mprGetPathNewline, mprGetPathParent, mprGetPathSeparators, mprGetPortablePath, mprGetRelPath, mprGetTempPath, mprGetWinPath, mprJoinPath, mprJoinPathExt, mprMakeDir, mprMakeLink, mprMapSeparators, mprNormalizePath, mprPathExists, mprReplacePathExt, mprResolvePath, mprSamePath, mprSamePathCount, mprSearchPath, mprTransformPath, mprTrimPathExt
char * mprGetPathLink (cchar *path)

Get the target of a symbolic link.

Description:
Return the path pointed to by a symbolic link. Not all platforms support symbolic links.
Parameters:
pathPath name to examine.
Returns:
A path representing the target of the symbolic link.
API Stability:
Evolving.
See Also:
MprDirEntry, MprFile, MprPath, mprCopyPath, mprDeletePath, mprGetAbsPath, mprGetCurrentPath, mprGetFirstPathSeparator, mprGetNativePath, mprGetPathBase, mprGetPathDir, mprGetPathExt, mprGetPathFiles, mprGetPathNewline, mprGetPathParent, mprGetPathSeparators, mprGetPortablePath, mprGetRelPath, mprGetTempPath, mprGetWinPath, mprJoinPath, mprJoinPathExt, mprMakeDir, mprMakeLink, mprMapSeparators, mprNormalizePath, mprPathExists, mprReplacePathExt, mprResolvePath, mprSamePath, mprSamePathCount, mprSearchPath, mprTransformPath, mprTrimPathExt
cchar * mprGetPathNewline (cchar *path)

Get the file newline character string for a given path.

Return the character string used to delimit new lines in text files
Parameters:
pathUse this path to specify either the root of the file system or a file on the file system.
Returns:
A string used to delimit new lines. This is typically "\n" or "\r\n".
API Stability:
Stable.
See Also:
MprDirEntry, MprFile, MprPath, mprCopyPath, mprDeletePath, mprGetAbsPath, mprGetCurrentPath, mprGetFirstPathSeparator, mprGetNativePath, mprGetPathBase, mprGetPathDir, mprGetPathExt, mprGetPathFiles, mprGetPathLink, mprGetPathParent, mprGetPathSeparators, mprGetPortablePath, mprGetRelPath, mprGetTempPath, mprGetWinPath, mprJoinPath, mprJoinPathExt, mprMakeDir, mprMakeLink, mprMapSeparators, mprNormalizePath, mprPathExists, mprReplacePathExt, mprResolvePath, mprSamePath, mprSamePathCount, mprSearchPath, mprTransformPath, mprTrimPathExt
char * mprGetPathParent (cchar *path)

Get the parent directory of a path.

Parameters:
pathPath name to examine.
Returns:
An allocated string containing the parent directory.
API Stability:
Stable.
See Also:
MprDirEntry, MprFile, MprPath, mprCopyPath, mprDeletePath, mprGetAbsPath, mprGetCurrentPath, mprGetFirstPathSeparator, mprGetNativePath, mprGetPathBase, mprGetPathDir, mprGetPathExt, mprGetPathFiles, mprGetPathLink, mprGetPathNewline, mprGetPathSeparators, mprGetPortablePath, mprGetRelPath, mprGetTempPath, mprGetWinPath, mprJoinPath, mprJoinPathExt, mprMakeDir, mprMakeLink, mprMapSeparators, mprNormalizePath, mprPathExists, mprReplacePathExt, mprResolvePath, mprSamePath, mprSamePathCount, mprSearchPath, mprTransformPath, mprTrimPathExt
cchar * mprGetPathSeparators (cchar *path)

Get the path directory separator.

Return the directory separator characters used to separate directories on a given file system. Typically "/" or "\" The first entry is the default separator
Parameters:
pathUse this path to specify either the root of the file system or a file on the file system.
Returns:
The string of path separators. The first entry is the default separator.
API Stability:
Stable.
See Also:
MprDirEntry, MprFile, MprPath, mprCopyPath, mprDeletePath, mprGetAbsPath, mprGetCurrentPath, mprGetFirstPathSeparator, mprGetNativePath, mprGetPathBase, mprGetPathDir, mprGetPathExt, mprGetPathFiles, mprGetPathLink, mprGetPathNewline, mprGetPathParent, mprGetPortablePath, mprGetRelPath, mprGetTempPath, mprGetWinPath, mprJoinPath, mprJoinPathExt, mprMakeDir, mprMakeLink, mprMapSeparators, mprNormalizePath, mprPathExists, mprReplacePathExt, mprResolvePath, mprSamePath, mprSamePathCount, mprSearchPath, mprTransformPath, mprTrimPathExt
char * mprGetPortablePath (cchar *path)

Get a portable path.

Description:
Get an equivalent absolute path that is somewhat portable. This means it will use forward slashes ("/") as the directory separator. This call will not remove drive specifiers.
Parameters:
pathPath name to examine.
Returns:
An allocated string containing the new path.
API Stability:
Stable.
See Also:
MprDirEntry, MprFile, MprPath, mprCopyPath, mprDeletePath, mprGetAbsPath, mprGetCurrentPath, mprGetFirstPathSeparator, mprGetNativePath, mprGetPathBase, mprGetPathDir, mprGetPathExt, mprGetPathFiles, mprGetPathLink, mprGetPathNewline, mprGetPathParent, mprGetPathSeparators, mprGetRelPath, mprGetTempPath, mprGetWinPath, mprJoinPath, mprJoinPathExt, mprMakeDir, mprMakeLink, mprMapSeparators, mprNormalizePath, mprPathExists, mprReplacePathExt, mprResolvePath, mprSamePath, mprSamePathCount, mprSearchPath, mprTransformPath, mprTrimPathExt
char * mprGetRelPath (cchar *dest, cchar *origin)

Get a relative path.

Description:
Get a relative path path from an origin path to a destination.
Parameters:
destDestination file.
originStarting location from which to compute a relative path to the destination If the origin is null, use the application's current working directory as the origin.
Returns:
An allocated string containing the relative directory.
API Stability:
Stable.
See Also:
MprDirEntry, MprFile, MprPath, mprCopyPath, mprDeletePath, mprGetAbsPath, mprGetCurrentPath, mprGetFirstPathSeparator, mprGetNativePath, mprGetPathBase, mprGetPathDir, mprGetPathExt, mprGetPathFiles, mprGetPathLink, mprGetPathNewline, mprGetPathParent, mprGetPathSeparators, mprGetPortablePath, mprGetTempPath, mprGetWinPath, mprJoinPath, mprJoinPathExt, mprMakeDir, mprMakeLink, mprMapSeparators, mprNormalizePath, mprPathExists, mprReplacePathExt, mprResolvePath, mprSamePath, mprSamePathCount, mprSearchPath, mprTransformPath, mprTrimPathExt
char * mprGetTempPath (cchar *tmpDir)

Make a temporary file.

Description:
Thread-safe way to make a unique temporary file.
Parameters:
tmpDirBase directory in which the temp file will be allocated.
Returns:
An allocated string containing the path of the temp file.
API Stability:
Stable.
See Also:
MprDirEntry, MprFile, MprPath, mprCopyPath, mprDeletePath, mprGetAbsPath, mprGetCurrentPath, mprGetFirstPathSeparator, mprGetNativePath, mprGetPathBase, mprGetPathDir, mprGetPathExt, mprGetPathFiles, mprGetPathLink, mprGetPathNewline, mprGetPathParent, mprGetPathSeparators, mprGetPortablePath, mprGetRelPath, mprGetWinPath, mprJoinPath, mprJoinPathExt, mprMakeDir, mprMakeLink, mprMapSeparators, mprNormalizePath, mprPathExists, mprReplacePathExt, mprResolvePath, mprSamePath, mprSamePathCount, mprSearchPath, mprTransformPath, mprTrimPathExt
char * mprGetWinPath (cchar *path)

Convert a path to an absolute windows path.

Description:
Get a windows style, absolute (canonical) equivalent representation of a path. This path will have back-slash delimiters and a drive specifier. On non-windows systems, this returns an absolute path using mprGetAbsPath.
Parameters:
pathPath to examine.
Returns:
A windows-style absolute path.
API Stability:
Stable.
See Also:
MprDirEntry, MprFile, MprPath, mprCopyPath, mprDeletePath, mprGetAbsPath, mprGetCurrentPath, mprGetFirstPathSeparator, mprGetNativePath, mprGetPathBase, mprGetPathDir, mprGetPathExt, mprGetPathFiles, mprGetPathLink, mprGetPathNewline, mprGetPathParent, mprGetPathSeparators, mprGetPortablePath, mprGetRelPath, mprGetTempPath, mprJoinPath, mprJoinPathExt, mprMakeDir, mprMakeLink, mprMapSeparators, mprNormalizePath, mprPathExists, mprReplacePathExt, mprResolvePath, mprSamePath, mprSamePathCount, mprSearchPath, mprTransformPath, mprTrimPathExt
bool mprIsPathAbs (cchar *path)

Determine if a path is absolute.

Parameters:
pathPath name to examine.
Returns:
True if the path is absolue.
API Stability:
Stable.
See Also:
MprDirEntry, MprFile, MprPath, mprCopyPath, mprDeletePath, mprGetAbsPath, mprGetCurrentPath, mprGetFirstPathSeparator, mprGetNativePath, mprGetPathBase, mprGetPathDir, mprGetPathExt, mprGetPathFiles, mprGetPathLink, mprGetPathNewline, mprGetPathParent, mprGetPathSeparators, mprGetPortablePath, mprGetRelPath, mprGetTempPath, mprGetWinPath, mprJoinPath, mprJoinPathExt, mprMakeDir, mprMakeLink, mprMapSeparators, mprNormalizePath, mprPathExists, mprReplacePathExt, mprResolvePath, mprSamePath, mprSamePathCount, mprSearchPath, mprTransformPath, mprTrimPathExt
bool mprIsPathDir (cchar *path)

Determine if a path is a directory.

Parameters:
pathPath name to examine.
Returns:
True if the path is a directory.
API Stability:
Stable.
See Also:
MprDirEntry, MprFile, MprPath, mprCopyPath, mprDeletePath, mprGetAbsPath, mprGetCurrentPath, mprGetFirstPathSeparator, mprGetNativePath, mprGetPathBase, mprGetPathDir, mprGetPathExt, mprGetPathFiles, mprGetPathLink, mprGetPathNewline, mprGetPathParent, mprGetPathSeparators, mprGetPortablePath, mprGetRelPath, mprGetTempPath, mprGetWinPath, mprJoinPath, mprJoinPathExt, mprMakeDir, mprMakeLink, mprMapSeparators, mprNormalizePath, mprPathExists, mprReplacePathExt, mprResolvePath, mprSamePath, mprSamePathCount, mprSearchPath, mprTransformPath, mprTrimPathExt
bool mprIsPathRel (cchar *path)

Determine if a path is relative.

Parameters:
pathPath name to examine.
Returns:
True if the path is relative.
API Stability:
Stable.
See Also:
MprDirEntry, MprFile, MprPath, mprCopyPath, mprDeletePath, mprGetAbsPath, mprGetCurrentPath, mprGetFirstPathSeparator, mprGetNativePath, mprGetPathBase, mprGetPathDir, mprGetPathExt, mprGetPathFiles, mprGetPathLink, mprGetPathNewline, mprGetPathParent, mprGetPathSeparators, mprGetPortablePath, mprGetRelPath, mprGetTempPath, mprGetWinPath, mprJoinPath, mprJoinPathExt, mprMakeDir, mprMakeLink, mprMapSeparators, mprNormalizePath, mprPathExists, mprReplacePathExt, mprResolvePath, mprSamePath, mprSamePathCount, mprSearchPath, mprTransformPath, mprTrimPathExt
bool mprIsPathSeparator (cchar *path, cchar c)

Test if a character is a path separarator.

Parameters:
pathPath name to identify the file system.
cCharacter to test.
Returns:
Returns true if the character is a path separator on the file system containing the given path.
API Stability:
Stable.
See Also:
MprDirEntry, MprFile, MprPath, mprCopyPath, mprDeletePath, mprGetAbsPath, mprGetCurrentPath, mprGetFirstPathSeparator, mprGetNativePath, mprGetPathBase, mprGetPathDir, mprGetPathExt, mprGetPathFiles, mprGetPathLink, mprGetPathNewline, mprGetPathParent, mprGetPathSeparators, mprGetPortablePath, mprGetRelPath, mprGetTempPath, mprGetWinPath, mprJoinPath, mprJoinPathExt, mprMakeDir, mprMakeLink, mprMapSeparators, mprNormalizePath, mprPathExists, mprReplacePathExt, mprResolvePath, mprSamePath, mprSamePathCount, mprSearchPath, mprTransformPath, mprTrimPathExt
char * mprJoinPath (cchar *base, cchar *path)

Join paths.

Description:
Join a path to a base path. If path is absolute, it will be returned.
Parameters:
baseDirectory path name to use as the base.
pathOther path name to join to the base path.
Returns:
Allocated string containing the resolved path.
API Stability:
Stable.
See Also:
MprDirEntry, MprFile, MprPath, mprCopyPath, mprDeletePath, mprGetAbsPath, mprGetCurrentPath, mprGetFirstPathSeparator, mprGetNativePath, mprGetPathBase, mprGetPathDir, mprGetPathExt, mprGetPathFiles, mprGetPathLink, mprGetPathNewline, mprGetPathParent, mprGetPathSeparators, mprGetPortablePath, mprGetRelPath, mprGetTempPath, mprGetWinPath, mprJoinPathExt, mprMakeDir, mprMakeLink, mprMapSeparators, mprNormalizePath, mprPathExists, mprReplacePathExt, mprResolvePath, mprSamePath, mprSamePathCount, mprSearchPath, mprTransformPath, mprTrimPathExt
char * mprJoinPathExt (cchar *path, cchar *ext)

Join an extension to a path.

Description:
Add an extension to a path if it does not already have one.
Parameters:
pathPath name to use as a base. Path is not modified.
extExtension to add. Must should not have a period prefix.
Returns:
Allocated string containing the resolved path.
API Stability:
Stable.
See Also:
MprDirEntry, MprFile, MprPath, mprCopyPath, mprDeletePath, mprGetAbsPath, mprGetCurrentPath, mprGetFirstPathSeparator, mprGetNativePath, mprGetPathBase, mprGetPathDir, mprGetPathExt, mprGetPathFiles, mprGetPathLink, mprGetPathNewline, mprGetPathParent, mprGetPathSeparators, mprGetPortablePath, mprGetRelPath, mprGetTempPath, mprGetWinPath, mprJoinPath, mprMakeDir, mprMakeLink, mprMapSeparators, mprNormalizePath, mprPathExists, mprReplacePathExt, mprResolvePath, mprSamePath, mprSamePathCount, mprSearchPath, mprTransformPath, mprTrimPathExt
int mprMakeDir (cchar *path, int perms, int owner, int group, bool makeMissing)

Make a directory.

Description:
Make a directory using the supplied path. Intermediate directories are created as required.
Parameters:
pathString containing the directory pathname to create.
makeMissingIf true make all required intervening directory segments.
permsPosix style file permissions mask.
ownerUser to own the directory. Set to -1 not change the owner.
groupGroup to own the directory. Set to -1 not change the group.
Returns:
Returns zero if successful, otherwise a negative MPR error code is returned.
API Stability:
Stable.
See Also:
MprDirEntry, MprFile, MprPath, mprCopyPath, mprDeletePath, mprGetAbsPath, mprGetCurrentPath, mprGetFirstPathSeparator, mprGetNativePath, mprGetPathBase, mprGetPathDir, mprGetPathExt, mprGetPathFiles, mprGetPathLink, mprGetPathNewline, mprGetPathParent, mprGetPathSeparators, mprGetPortablePath, mprGetRelPath, mprGetTempPath, mprGetWinPath, mprJoinPath, mprJoinPathExt, mprMakeLink, mprMapSeparators, mprNormalizePath, mprPathExists, mprReplacePathExt, mprResolvePath, mprSamePath, mprSamePathCount, mprSearchPath, mprTransformPath, mprTrimPathExt
int mprMakeLink (cchar *path, cchar *target, bool hard)

Make a link.

Description:
Make a link at the target to the specified path. This will make symbolic or hard links depending on the value of the hard parameter.
Parameters:
pathString containing the path to link to.
targetString containing the new link path to be created.
hardIf true, make a hard link, otherwise make a soft link.
Returns:
Returns zero if successful, otherwise a negative MPR error code is returned.
API Stability:
Evolving.
See Also:
MprDirEntry, MprFile, MprPath, mprCopyPath, mprDeletePath, mprGetAbsPath, mprGetCurrentPath, mprGetFirstPathSeparator, mprGetNativePath, mprGetPathBase, mprGetPathDir, mprGetPathExt, mprGetPathFiles, mprGetPathLink, mprGetPathNewline, mprGetPathParent, mprGetPathSeparators, mprGetPortablePath, mprGetRelPath, mprGetTempPath, mprGetWinPath, mprJoinPath, mprJoinPathExt, mprMakeDir, mprMapSeparators, mprNormalizePath, mprPathExists, mprReplacePathExt, mprResolvePath, mprSamePath, mprSamePathCount, mprSearchPath, mprTransformPath, mprTrimPathExt
void mprMapSeparators (char *path, int separator)

Map the separators in a path.

Description:
Map the directory separators in a path to the specified separators. This is useful to change from backward to forward slashes when dealing with Windows paths.
Parameters:
pathPath name to examine.
separatorSeparator character to use.
Returns:
An allocated string containing the parent directory.
API Stability:
Stable.
See Also:
MprDirEntry, MprFile, MprPath, mprCopyPath, mprDeletePath, mprGetAbsPath, mprGetCurrentPath, mprGetFirstPathSeparator, mprGetNativePath, mprGetPathBase, mprGetPathDir, mprGetPathExt, mprGetPathFiles, mprGetPathLink, mprGetPathNewline, mprGetPathParent, mprGetPathSeparators, mprGetPortablePath, mprGetRelPath, mprGetTempPath, mprGetWinPath, mprJoinPath, mprJoinPathExt, mprMakeDir, mprMakeLink, mprNormalizePath, mprPathExists, mprReplacePathExt, mprResolvePath, mprSamePath, mprSamePathCount, mprSearchPath, mprTransformPath, mprTrimPathExt
char * mprNormalizePath (cchar *path)

Normalize a path.

Description:
A path is normalized by redundant segments such as "./" and "../dir" and duplicate path separators. Path separators are mapped. Paths are not converted to absolute paths.
Parameters:
pathFirst path to compare.
Returns:
A newly allocated, clean path.
API Stability:
Stable.
See Also:
MprDirEntry, MprFile, MprPath, mprCopyPath, mprDeletePath, mprGetAbsPath, mprGetCurrentPath, mprGetFirstPathSeparator, mprGetNativePath, mprGetPathBase, mprGetPathDir, mprGetPathExt, mprGetPathFiles, mprGetPathLink, mprGetPathNewline, mprGetPathParent, mprGetPathSeparators, mprGetPortablePath, mprGetRelPath, mprGetTempPath, mprGetWinPath, mprJoinPath, mprJoinPathExt, mprMakeDir, mprMakeLink, mprMapSeparators, mprPathExists, mprReplacePathExt, mprResolvePath, mprSamePath, mprSamePathCount, mprSearchPath, mprTransformPath, mprTrimPathExt
bool mprPathExists (cchar *path, int omode)

Determine if a file exists for a path name and can be accessed.

Description:
Test if a file can be accessed for a given mode.
Parameters:
pathPath name to test.
omodePosix style file open mode mask. See mprOpenFile for the various modes.
Returns:
True if the file exists and can be accessed.
API Stability:
Stable.
See Also:
MprDirEntry, MprFile, MprPath, mprCopyPath, mprDeletePath, mprGetAbsPath, mprGetCurrentPath, mprGetFirstPathSeparator, mprGetNativePath, mprGetPathBase, mprGetPathDir, mprGetPathExt, mprGetPathFiles, mprGetPathLink, mprGetPathNewline, mprGetPathParent, mprGetPathSeparators, mprGetPortablePath, mprGetRelPath, mprGetTempPath, mprGetWinPath, mprJoinPath, mprJoinPathExt, mprMakeDir, mprMakeLink, mprMapSeparators, mprNormalizePath, mprReplacePathExt, mprResolvePath, mprSamePath, mprSamePathCount, mprSearchPath, mprTransformPath, mprTrimPathExt
char * mprReplacePathExt (cchar *dir, cchar *ext)

Replace an extension to a path.

Description:
Remove any existing path extension and then add the given path extension.
Parameters:
dirDirectory path name to test use as the base/dir.
extExtension to add. The extension should not have a period prefix.
Returns:
Allocated string containing the resolved path.
API Stability:
Stable.
See Also:
MprDirEntry, MprFile, MprPath, mprCopyPath, mprDeletePath, mprGetAbsPath, mprGetCurrentPath, mprGetFirstPathSeparator, mprGetNativePath, mprGetPathBase, mprGetPathDir, mprGetPathExt, mprGetPathFiles, mprGetPathLink, mprGetPathNewline, mprGetPathParent, mprGetPathSeparators, mprGetPortablePath, mprGetRelPath, mprGetTempPath, mprGetWinPath, mprJoinPath, mprJoinPathExt, mprMakeDir, mprMakeLink, mprMapSeparators, mprNormalizePath, mprPathExists, mprResolvePath, mprSamePath, mprSamePathCount, mprSearchPath, mprTransformPath, mprTrimPathExt
char * mprResolvePath (cchar *base, cchar *path)

Resolve paths.

Description:
Resolve paths in the neighborhood of this path. Resolve operates like join, except that it joins the given paths to the directory portion of the current ("this") path. For example: Path("/usr/bin/ejs/bin").resolve("lib") will return "/usr/lib/ejs/lib". i.e. it will return the sibling directory "lib".
Resolve operates by determining a virtual current directory for this Path object. It then successively joins the given paths to the directory portion of the current result. If the next path is an absolute path, it is used unmodified. The effect is to find the given paths with a virtual current directory set to the directory containing the prior path Resolve is useful for creating paths in the region of the current path and gracefully handles both absolute and relative path segments Returns a joined (normalized) path. If path is absolute, then return path. If path is null, empty or "." then return path
Parameters:
baseBase path to use as the base.
pathPath name to resolve against base.
Returns:
Allocated string containing the resolved path.
API Stability:
Evolving.
See Also:
MprDirEntry, MprFile, MprPath, mprCopyPath, mprDeletePath, mprGetAbsPath, mprGetCurrentPath, mprGetFirstPathSeparator, mprGetNativePath, mprGetPathBase, mprGetPathDir, mprGetPathExt, mprGetPathFiles, mprGetPathLink, mprGetPathNewline, mprGetPathParent, mprGetPathSeparators, mprGetPortablePath, mprGetRelPath, mprGetTempPath, mprGetWinPath, mprJoinPath, mprJoinPathExt, mprMakeDir, mprMakeLink, mprMapSeparators, mprNormalizePath, mprPathExists, mprReplacePathExt, mprSamePath, mprSamePathCount, mprSearchPath, mprTransformPath, mprTrimPathExt
int mprSamePath (cchar *path1, cchar *path2)

Compare two paths if they are the same.

Description:
Compare two paths to see if they are equal. This normalizes the paths to absolute paths first before comparing. It does handle case sensitivity appropriately.
Parameters:
path1First path to compare.
path2Second path to compare.
Returns:
True if the file exists and can be accessed.
API Stability:
Stable.
See Also:
MprDirEntry, MprFile, MprPath, mprCopyPath, mprDeletePath, mprGetAbsPath, mprGetCurrentPath, mprGetFirstPathSeparator, mprGetNativePath, mprGetPathBase, mprGetPathDir, mprGetPathExt, mprGetPathFiles, mprGetPathLink, mprGetPathNewline, mprGetPathParent, mprGetPathSeparators, mprGetPortablePath, mprGetRelPath, mprGetTempPath, mprGetWinPath, mprJoinPath, mprJoinPathExt, mprMakeDir, mprMakeLink, mprMapSeparators, mprNormalizePath, mprPathExists, mprReplacePathExt, mprResolvePath, mprSamePathCount, mprSearchPath, mprTransformPath, mprTrimPathExt
int mprSamePathCount (cchar *path1, cchar *path2, ssize len)

Compare two paths if they are the same for a given length.

Description:
Compare two paths to see if they are equal. This normalizes the paths to absolute paths first before comparing. It does handle case sensitivity appropriately. The len parameter if non-zero, specifies how many characters of the paths to compare.
Parameters:
path1First path to compare.
path2Second path to compare.
lenHow many characters to compare.
Returns:
True if the file exists and can be accessed.
API Stability:
Evolving.
See Also:
MprDirEntry, MprFile, MprPath, mprCopyPath, mprDeletePath, mprGetAbsPath, mprGetCurrentPath, mprGetFirstPathSeparator, mprGetNativePath, mprGetPathBase, mprGetPathDir, mprGetPathExt, mprGetPathFiles, mprGetPathLink, mprGetPathNewline, mprGetPathParent, mprGetPathSeparators, mprGetPortablePath, mprGetRelPath, mprGetTempPath, mprGetWinPath, mprJoinPath, mprJoinPathExt, mprMakeDir, mprMakeLink, mprMapSeparators, mprNormalizePath, mprPathExists, mprReplacePathExt, mprResolvePath, mprSamePath, mprSearchPath, mprTransformPath, mprTrimPathExt
char * mprSearchPath (cchar *path, int flags, cchar *search, ...)

Search for a path.

Description:
Search for a file using a given set of search directories.
Parameters:
pathPath name to locate. Must be an existing file or directory.
flagsFlags.
searchVariable number of directories to search.
Returns:
Allocated string containing the full path name of the located file.
API Stability:
Stable.
See Also:
MprDirEntry, MprFile, MprPath, mprCopyPath, mprDeletePath, mprGetAbsPath, mprGetCurrentPath, mprGetFirstPathSeparator, mprGetNativePath, mprGetPathBase, mprGetPathDir, mprGetPathExt, mprGetPathFiles, mprGetPathLink, mprGetPathNewline, mprGetPathParent, mprGetPathSeparators, mprGetPortablePath, mprGetRelPath, mprGetTempPath, mprGetWinPath, mprJoinPath, mprJoinPathExt, mprMakeDir, mprMakeLink, mprMapSeparators, mprNormalizePath, mprPathExists, mprReplacePathExt, mprResolvePath, mprSamePath, mprSamePathCount, mprTransformPath, mprTrimPathExt
char * mprTransformPath (cchar *path, int flags)

Transform a path.

Description:
A path is transformed by cleaning and then transforming according to the flags.
Parameters:
pathFirst path to compare.
flagsFlags to modify the path representation.
Returns:
A newly allocated, clean path.
API Stability:
Stable.
See Also:
MprDirEntry, MprFile, MprPath, mprCopyPath, mprDeletePath, mprGetAbsPath, mprGetCurrentPath, mprGetFirstPathSeparator, mprGetNativePath, mprGetPathBase, mprGetPathDir, mprGetPathExt, mprGetPathFiles, mprGetPathLink, mprGetPathNewline, mprGetPathParent, mprGetPathSeparators, mprGetPortablePath, mprGetRelPath, mprGetTempPath, mprGetWinPath, mprJoinPath, mprJoinPathExt, mprMakeDir, mprMakeLink, mprMapSeparators, mprNormalizePath, mprPathExists, mprReplacePathExt, mprResolvePath, mprSamePath, mprSamePathCount, mprSearchPath, mprTrimPathExt
char * mprTrimPathDrive (cchar *path)

Trim the drive from a path.

Description:
Trim a drive specifier ("c:") from the start of a path.
Parameters:
pathPath to examine.
Returns:
An allocated string with the trimmed drive.
API Stability:
Stable.
See Also:
MprDirEntry, MprFile, MprPath, mprCopyPath, mprDeletePath, mprGetAbsPath, mprGetCurrentPath, mprGetFirstPathSeparator, mprGetNativePath, mprGetPathBase, mprGetPathDir, mprGetPathExt, mprGetPathFiles, mprGetPathLink, mprGetPathNewline, mprGetPathParent, mprGetPathSeparators, mprGetPortablePath, mprGetRelPath, mprGetTempPath, mprGetWinPath, mprJoinPath, mprJoinPathExt, mprMakeDir, mprMakeLink, mprMapSeparators, mprNormalizePath, mprPathExists, mprReplacePathExt, mprResolvePath, mprSamePath, mprSamePathCount, mprSearchPath, mprTransformPath, mprTrimPathExt
char * mprTrimPathExt (cchar *path)

Trim an extension from a path.

Description:
Trim a file extension (".ext") from a path name.
Parameters:
pathPath to examine.
Returns:
An allocated string with the trimmed path.
API Stability:
Stable.
See Also:
MprDirEntry, MprFile, MprPath, mprCopyPath, mprDeletePath, mprGetAbsPath, mprGetCurrentPath, mprGetFirstPathSeparator, mprGetNativePath, mprGetPathBase, mprGetPathDir, mprGetPathExt, mprGetPathFiles, mprGetPathLink, mprGetPathNewline, mprGetPathParent, mprGetPathSeparators, mprGetPortablePath, mprGetRelPath, mprGetTempPath, mprGetWinPath, mprJoinPath, mprJoinPathExt, mprMakeDir, mprMakeLink, mprMapSeparators, mprNormalizePath, mprPathExists, mprReplacePathExt, mprResolvePath, mprSamePath, mprSamePathCount, mprSearchPath, mprTransformPath
ssize mprWritePathContents (cchar *path, cchar *buf, ssize len, int mode)

Create a file and write contents.

Description:
The file is created, written and closed. If the file already exists, it is recreated.
Parameters:
pathFilename to create.
bufBuffer of data to write to the file.
lenSize of the buf parameter in bytes.
modeFile permissions with which to create the file. E.g. 0644.
Returns:
The number of bytes written. Should equal len. Otherwise return a negative MPR error code.
API Stability:
Stable.
See Also:
MprDirEntry, MprFile, MprPath, mprCopyPath, mprDeletePath, mprGetAbsPath, mprGetCurrentPath, mprGetFirstPathSeparator, mprGetNativePath, mprGetPathBase, mprGetPathDir, mprGetPathExt, mprGetPathFiles, mprGetPathLink, mprGetPathNewline, mprGetPathParent, mprGetPathSeparators, mprGetPortablePath, mprGetRelPath, mprGetTempPath, mprGetWinPath, mprJoinPath, mprJoinPathExt, mprMakeDir, mprMakeLink, mprMapSeparators, mprNormalizePath, mprPathExists, mprReplacePathExt, mprResolvePath, mprSamePath, mprSamePathCount, mprSearchPath, mprTransformPath, mprTrimPathExt

MprSignal

MprSignal

Signal control structure.

See Also:
MprSignalProc, MprSignalService, mprAddSignalHandler, mprAddStandardSignals
API Stability:
Internal.
Fields:
void *data Handler data.
MprDispatcher *dispatcher Dispatcher to service handler.
intflags Control flags.
MprSignalProchandler Signal handler (non-native).
struct MprSignal *next Chain of handlers on the same signo.
void(*sigaction)() Prior sigaction handler.
intsigno Signal number.
MprSignal * mprAddSignalHandler (int signo, void *handler, void *arg, MprDispatcher *dispatcher, int flags)

Add a signal handler.

The signal handling mechanism will trap the specified signal if issued and create an event on the given dispatcher. This will cause the handler function to be safely run by the dispatcher. Normally, signal handlers are difficult to write as the code must be Async-safe. This API permits the use of common, single-threaded code to be used for signal handlers without worrying about pre-emption by other signals or threads
Parameters:
signoSignal number to handle.
handlerCall back procedure to invoke. This has the signature MprSignalProc
argArgument to provide to the handler.
dispatcherEvent dispatcher on which to queue an event to run the handler.
flagsSet to either MPR_SIGNAL_BEFORE or MPR_SIGNAL_AFTER to run the handler before/after existing handlers.
API Stability:
Stable.
See Also:
MprSignalProc, MprSignalService, mprAddStandardSignals
void mprAddStandardSignals ()

Add standard trapping of system signals.

The trapped signals are SIGINT, SIGQUIT, SIGTERM, SIGPIPE and SIGXFSZ. SIGPIPE and SIGXFSZ are ignored. A graceful shutdown is initiated for SIGTERM whereas SIGINT and SIGQUIT will do an immediate exit
API Stability:
Stable.
See Also:
MprSignalProc, MprSignalService, mprAddSignalHandler

MprSocket

MprSocket

Socket Service.

Description:
The MPR Socket service provides IPv4 and IPv6 capabilities for both client and server endpoints. Datagrams, Broadcast and point to point services are supported. The APIs can be used in both blocking and non-blocking modes.

The socket service integrates with the MPR worker thread pool and eventing services. Socket connections can be handled by threads from the worker thread pool for scalable, multithreaded applications.
API Stability:
Stable.
See Also:
MprSocketPrebind, MprSocketProc, MprSocketProvider, MprSocketService, mprAddSocketHandler, mprCloneSsl, mprCloseSocket, mprConnectSocket, mprCreateSocket, mprCreateSsl, mprDisconnectSocket, mprEnableSocketEvents, mprFlushSocket, mprGetSocketBlockingMode, mprGetSocketError, mprGetSocketFd, mprGetSocketInfo, mprGetSocketPort, mprGetSocketState, mprHasSecureSockets, mprIsSocketEof, mprIsSocketSecure, mprListenOnSocket, mprLoadSsl, mprReadSocket, mprSetSocketBlockingMode, mprSetSocketEof, mprSetSocketNoDelay, mprSetSslCaFile, mprSetSslCaPath, mprSetSslCertFile, mprSetSslCiphers, mprSetSslKeyFile, mprSocketHandshaking, mprSocketHasBufferedRead, mprSocketHasBufferedWrite, mprUpgradeSocket, mprWriteSocket, mprWriteSocketString, mprWriteSocketVector
API Stability:
Internal.
Fields:
char *acceptIp Server addresss that accepted a new connection (actual interface).
intacceptPort Server port doing the listening.
char *errorMsg Connection related error messages.
Socketfd Actual socket file handle.
intflags Current state flags.
MprWaitHandler *handler Wait handler.
char *ip Server listen address or remote client address.
struct MprSocket *listenSock Listening socket.
MprMutex *mutex Multi-thread sync.
intport Port to listen or connect on.
MprSocketProvider *provider Socket implementation provider.
MprSocketService *service Socket service.
struct MprSsl *ssl SSL configuration.
void *sslSocket Extended SSL socket state.
MprSocket * mprAcceptSocket (MprSocket *listen)

Accept an incoming connection.

Parameters:
listenListening server socket.
Returns:
A new socket connection.
API Stability:
Stable.
See Also:
MprSocket, MprSocketPrebind, MprSocketProc, MprSocketProvider, MprSocketService, mprAddSocketHandler, mprCloneSsl, mprCloseSocket, mprConnectSocket, mprCreateSocket, mprCreateSsl, mprDisconnectSocket, mprEnableSocketEvents, mprFlushSocket, mprGetSocketBlockingMode, mprGetSocketError, mprGetSocketFd, mprGetSocketInfo, mprGetSocketPort, mprGetSocketState, mprHasSecureSockets, mprIsSocketEof, mprIsSocketSecure, mprListenOnSocket, mprLoadSsl, mprReadSocket, mprSetSocketBlockingMode, mprSetSocketEof, mprSetSocketNoDelay, mprSetSslCaFile, mprSetSslCaPath, mprSetSslCertFile, mprSetSslCiphers, mprSetSslKeyFile, mprSocketHandshaking, mprSocketHasBufferedRead, mprSocketHasBufferedWrite, mprUpgradeSocket, mprWriteSocket, mprWriteSocketString, mprWriteSocketVector
MprWaitHandler * mprAddSocketHandler (MprSocket *sp, int mask, MprDispatcher *dispatcher, void *proc, void *data, int flags)

Add a wait handler to a socket.

Description:
Create a wait handler that will be invoked when I/O of interest occurs on the specified socket. The wait handler is registered with the MPR event I/O mechanism.
Parameters:
spSocket object created via mprCreateSocket.
maskMask of events of interest. This is made by oring MPR_READABLE and MPR_WRITABLE.
dispatcherDispatcher object to use for scheduling the I/O event.
procCallback function to invoke when an I/O event of interest has occurred.
dataData item to pass to the callback.
flagsSocket handler flags.
Returns:
A new wait handler registered with the MPR event mechanism.
API Stability:
Stable.
See Also:
MprSocket, MprSocketPrebind, MprSocketProc, MprSocketProvider, MprSocketService, mprCloneSsl, mprCloseSocket, mprConnectSocket, mprCreateSocket, mprCreateSsl, mprDisconnectSocket, mprEnableSocketEvents, mprFlushSocket, mprGetSocketBlockingMode, mprGetSocketError, mprGetSocketFd, mprGetSocketInfo, mprGetSocketPort, mprGetSocketState, mprHasSecureSockets, mprIsSocketEof, mprIsSocketSecure, mprListenOnSocket, mprLoadSsl, mprReadSocket, mprSetSocketBlockingMode, mprSetSocketEof, mprSetSocketNoDelay, mprSetSslCaFile, mprSetSslCaPath, mprSetSslCertFile, mprSetSslCiphers, mprSetSslKeyFile, mprSocketHandshaking, mprSocketHasBufferedRead, mprSocketHasBufferedWrite, mprUpgradeSocket, mprWriteSocket, mprWriteSocketString, mprWriteSocketVector
void mprAddSocketProvider (cchar *name, MprSocketProvider *provider)

Add a secure socket provider for SSL communications.

Parameters:
nameName of the secure socket provider.
providerSocket provider object.
API Stability:
Stable.
See Also:
MprSocket, MprSocketPrebind, MprSocketProc, MprSocketProvider, MprSocketService, mprAddSocketHandler, mprCloneSsl, mprCloseSocket, mprConnectSocket, mprCreateSocket, mprCreateSsl, mprDisconnectSocket, mprEnableSocketEvents, mprFlushSocket, mprGetSocketBlockingMode, mprGetSocketError, mprGetSocketFd, mprGetSocketInfo, mprGetSocketPort, mprGetSocketState, mprHasSecureSockets, mprIsSocketEof, mprIsSocketSecure, mprListenOnSocket, mprLoadSsl, mprReadSocket, mprSetSocketBlockingMode, mprSetSocketEof, mprSetSocketNoDelay, mprSetSslCaFile, mprSetSslCaPath, mprSetSslCertFile, mprSetSslCiphers, mprSetSslKeyFile, mprSocketHandshaking, mprSocketHasBufferedRead, mprSocketHasBufferedWrite, mprUpgradeSocket, mprWriteSocket, mprWriteSocketString, mprWriteSocketVector
void mprCloseSocket (MprSocket *sp, bool graceful)

Close a socket.

Description:
Close a socket. If the graceful option is true, the socket will first wait for written data to drain before doing a graceful close.
Parameters:
spSocket object returned from mprCreateSocket
gracefulSet to true to do a graceful close. Otherwise, an abortive close will be performed.
API Stability:
Stable.
See Also:
MprSocket, MprSocketPrebind, MprSocketProc, MprSocketProvider, MprSocketService, mprAddSocketHandler, mprCloneSsl, mprConnectSocket, mprCreateSocket, mprCreateSsl, mprDisconnectSocket, mprEnableSocketEvents, mprFlushSocket, mprGetSocketBlockingMode, mprGetSocketError, mprGetSocketFd, mprGetSocketInfo, mprGetSocketPort, mprGetSocketState, mprHasSecureSockets, mprIsSocketEof, mprIsSocketSecure, mprListenOnSocket, mprLoadSsl, mprReadSocket, mprSetSocketBlockingMode, mprSetSocketEof, mprSetSocketNoDelay, mprSetSslCaFile, mprSetSslCaPath, mprSetSslCertFile, mprSetSslCiphers, mprSetSslKeyFile, mprSocketHandshaking, mprSocketHasBufferedRead, mprSocketHasBufferedWrite, mprUpgradeSocket, mprWriteSocket, mprWriteSocketString, mprWriteSocketVector
int mprConnectSocket (MprSocket *sp, cchar *ip, int port, int flags)

Connect a client socket.

Description:
Open a client connection.
Parameters:
spSocket object returned via mprCreateSocket
ipHost or IP address to connect to.
portTCP/IP port number to connect to.
flagsSocket flags may use the following flags ored together:
  • MPR_SOCKET_BLOCK - to use blocking I/O. The default is non-blocking.
  • MPR_SOCKET_BROADCAST - Use IPv4 broadcast
  • MPR_SOCKET_DATAGRAM - Use IPv4 datagrams
  • MPR_SOCKET_NOREUSE - Set NOREUSE flag on the socket
  • MPR_SOCKET_NODELAY - Set NODELAY on the socket
  • MPR_SOCKET_THREAD - Process callbacks on a separate thread.
Returns:
Zero if the connection is successful. Otherwise a negative MPR error code.
API Stability:
Stable.
See Also:
MprSocket, MprSocketPrebind, MprSocketProc, MprSocketProvider, MprSocketService, mprAddSocketHandler, mprCloneSsl, mprCloseSocket, mprCreateSocket, mprCreateSsl, mprDisconnectSocket, mprEnableSocketEvents, mprFlushSocket, mprGetSocketBlockingMode, mprGetSocketError, mprGetSocketFd, mprGetSocketInfo, mprGetSocketPort, mprGetSocketState, mprHasSecureSockets, mprIsSocketEof, mprIsSocketSecure, mprListenOnSocket, mprLoadSsl, mprReadSocket, mprSetSocketBlockingMode, mprSetSocketEof, mprSetSocketNoDelay, mprSetSslCaFile, mprSetSslCaPath, mprSetSslCertFile, mprSetSslCiphers, mprSetSslKeyFile, mprSocketHandshaking, mprSocketHasBufferedRead, mprSocketHasBufferedWrite, mprUpgradeSocket, mprWriteSocket, mprWriteSocketString, mprWriteSocketVector
MprSocket * mprCreateSocket ()

Create a socket.

Description:
Create a new socket.
Returns:
A new socket object.
API Stability:
Stable.
See Also:
MprSocket, MprSocketPrebind, MprSocketProc, MprSocketProvider, MprSocketService, mprAddSocketHandler, mprCloneSsl, mprCloseSocket, mprConnectSocket, mprCreateSsl, mprDisconnectSocket, mprEnableSocketEvents, mprFlushSocket, mprGetSocketBlockingMode, mprGetSocketError, mprGetSocketFd, mprGetSocketInfo, mprGetSocketPort, mprGetSocketState, mprHasSecureSockets, mprIsSocketEof, mprIsSocketSecure, mprListenOnSocket, mprLoadSsl, mprReadSocket, mprSetSocketBlockingMode, mprSetSocketEof, mprSetSocketNoDelay, mprSetSslCaFile, mprSetSslCaPath, mprSetSslCertFile, mprSetSslCiphers, mprSetSslKeyFile, mprSocketHandshaking, mprSocketHasBufferedRead, mprSocketHasBufferedWrite, mprUpgradeSocket, mprWriteSocket, mprWriteSocketString, mprWriteSocketVector
void mprDisconnectSocket (MprSocket *sp)

Disconnect a socket by closing its underlying file descriptor.

This is used to prevent further I/O wait events while still preserving the socket object
Parameters:
spSocket object.
API Stability:
Stable.
See Also:
MprSocket, MprSocketPrebind, MprSocketProc, MprSocketProvider, MprSocketService, mprAddSocketHandler, mprCloneSsl, mprCloseSocket, mprConnectSocket, mprCreateSocket, mprCreateSsl, mprEnableSocketEvents, mprFlushSocket, mprGetSocketBlockingMode, mprGetSocketError, mprGetSocketFd, mprGetSocketInfo, mprGetSocketPort, mprGetSocketState, mprHasSecureSockets, mprIsSocketEof, mprIsSocketSecure, mprListenOnSocket, mprLoadSsl, mprReadSocket, mprSetSocketBlockingMode, mprSetSocketEof, mprSetSocketNoDelay, mprSetSslCaFile, mprSetSslCaPath, mprSetSslCertFile, mprSetSslCiphers, mprSetSslKeyFile, mprSocketHandshaking, mprSocketHasBufferedRead, mprSocketHasBufferedWrite, mprUpgradeSocket, mprWriteSocket, mprWriteSocketString, mprWriteSocketVector
void mprEnableSocketEvents (MprSocket *sp, int mask)

Enable socket events for a socket callback.

Parameters:
spSocket object returned from mprCreateSocket
maskMask of events to enable.
API Stability:
Stable.
See Also:
MprSocket, MprSocketPrebind, MprSocketProc, MprSocketProvider, MprSocketService, mprAddSocketHandler, mprCloneSsl, mprCloseSocket, mprConnectSocket, mprCreateSocket, mprCreateSsl, mprDisconnectSocket, mprFlushSocket, mprGetSocketBlockingMode, mprGetSocketError, mprGetSocketFd, mprGetSocketInfo, mprGetSocketPort, mprGetSocketState, mprHasSecureSockets, mprIsSocketEof, mprIsSocketSecure, mprListenOnSocket, mprLoadSsl, mprReadSocket, mprSetSocketBlockingMode, mprSetSocketEof, mprSetSocketNoDelay, mprSetSslCaFile, mprSetSslCaPath, mprSetSslCertFile, mprSetSslCiphers, mprSetSslKeyFile, mprSocketHandshaking, mprSocketHasBufferedRead, mprSocketHasBufferedWrite, mprUpgradeSocket, mprWriteSocket, mprWriteSocketString, mprWriteSocketVector
ssize mprFlushSocket (MprSocket *sp)

Flush a socket.

Description:
Flush any buffered data in a socket. Standard sockets do not use buffering and this call will do nothing. SSL sockets do buffer and calling mprFlushSocket will write pending written data.
Parameters:
spSocket object returned from mprCreateSocket
Returns:
A count of bytes actually written. Return a negative MPR error code on errors.
API Stability:
Stable.
See Also:
MprSocket, MprSocketPrebind, MprSocketProc, MprSocketProvider, MprSocketService, mprAddSocketHandler, mprCloneSsl, mprCloseSocket, mprConnectSocket, mprCreateSocket, mprCreateSsl, mprDisconnectSocket, mprEnableSocketEvents, mprGetSocketBlockingMode, mprGetSocketError, mprGetSocketFd, mprGetSocketInfo, mprGetSocketPort, mprGetSocketState, mprHasSecureSockets, mprIsSocketEof, mprIsSocketSecure, mprListenOnSocket, mprLoadSsl, mprReadSocket, mprSetSocketBlockingMode, mprSetSocketEof, mprSetSocketNoDelay, mprSetSslCaFile, mprSetSslCaPath, mprSetSslCertFile, mprSetSslCiphers, mprSetSslKeyFile, mprSocketHandshaking, mprSocketHasBufferedRead, mprSocketHasBufferedWrite, mprUpgradeSocket, mprWriteSocket, mprWriteSocketString, mprWriteSocketVector
bool mprGetSocketBlockingMode (MprSocket *sp)

Get the socket blocking mode.

Description:
Return the current blocking mode setting.
Parameters:
spSocket object returned from mprCreateSocket
Returns:
True if the socket is in blocking mode. Otherwise false.
API Stability:
Stable.
See Also:
MprSocket, MprSocketPrebind, MprSocketProc, MprSocketProvider, MprSocketService, mprAddSocketHandler, mprCloneSsl, mprCloseSocket, mprConnectSocket, mprCreateSocket, mprCreateSsl, mprDisconnectSocket, mprEnableSocketEvents, mprFlushSocket, mprGetSocketError, mprGetSocketFd, mprGetSocketInfo, mprGetSocketPort, mprGetSocketState, mprHasSecureSockets, mprIsSocketEof, mprIsSocketSecure, mprListenOnSocket, mprLoadSsl, mprReadSocket, mprSetSocketBlockingMode, mprSetSocketEof, mprSetSocketNoDelay, mprSetSslCaFile, mprSetSslCaPath, mprSetSslCertFile, mprSetSslCiphers, mprSetSslKeyFile, mprSocketHandshaking, mprSocketHasBufferedRead, mprSocketHasBufferedWrite, mprUpgradeSocket, mprWriteSocket, mprWriteSocketString, mprWriteSocketVector
int mprGetSocketError (MprSocket *sp)

Get a socket error code.

Description:
This will map a Windows socket error code into a posix error code.
Parameters:
spSocket object returned from mprCreateSocket
Returns:
A posix error code.
API Stability:
Stable.
See Also:
MprSocket, MprSocketPrebind, MprSocketProc, MprSocketProvider, MprSocketService, mprAddSocketHandler, mprCloneSsl, mprCloseSocket, mprConnectSocket, mprCreateSocket, mprCreateSsl, mprDisconnectSocket, mprEnableSocketEvents, mprFlushSocket, mprGetSocketBlockingMode, mprGetSocketFd, mprGetSocketInfo, mprGetSocketPort, mprGetSocketState, mprHasSecureSockets, mprIsSocketEof, mprIsSocketSecure, mprListenOnSocket, mprLoadSsl, mprReadSocket, mprSetSocketBlockingMode, mprSetSocketEof, mprSetSocketNoDelay, mprSetSslCaFile, mprSetSslCaPath, mprSetSslCertFile, mprSetSslCiphers, mprSetSslKeyFile, mprSocketHandshaking, mprSocketHasBufferedRead, mprSocketHasBufferedWrite, mprUpgradeSocket, mprWriteSocket, mprWriteSocketString, mprWriteSocketVector
Socket mprGetSocketFd (MprSocket *sp)

Get the socket file descriptor.

Description:
Get the file descriptor associated with a socket.
Parameters:
spSocket object returned from mprCreateSocket
Returns:
The Socket file descriptor used by the O/S for the socket.
API Stability:
Stable.
See Also:
MprSocket, MprSocketPrebind, MprSocketProc, MprSocketProvider, MprSocketService, mprAddSocketHandler, mprCloneSsl, mprCloseSocket, mprConnectSocket, mprCreateSocket, mprCreateSsl, mprDisconnectSocket, mprEnableSocketEvents, mprFlushSocket, mprGetSocketBlockingMode, mprGetSocketError, mprGetSocketInfo, mprGetSocketPort, mprGetSocketState, mprHasSecureSockets, mprIsSocketEof, mprIsSocketSecure, mprListenOnSocket, mprLoadSsl, mprReadSocket, mprSetSocketBlockingMode, mprSetSocketEof, mprSetSocketNoDelay, mprSetSslCaFile, mprSetSslCaPath, mprSetSslCertFile, mprSetSslCiphers, mprSetSslKeyFile, mprSocketHandshaking, mprSocketHasBufferedRead, mprSocketHasBufferedWrite, mprUpgradeSocket, mprWriteSocket, mprWriteSocketString, mprWriteSocketVector
int mprGetSocketInfo (cchar *ip, int port, int *family, int *protocol, struct sockaddr **addr, Socklen *addrlen)

Get the socket for an IP:Port address.

Parameters:
ipIP address or hostname.
portPort number.
familyOutput parameter to contain the Internet protocol family.
protocolOutput parameter to contain the Internet TCP/IP protocol.
addrOutput parameter to contain the sockaddr description of the socket address.
addrlenOutput parameter to hold the length of the sockaddr object.
Returns:
Zero if the call is successful. Otherwise return a negative MPR error code.
API Stability:
Stable.
See Also:
MprSocket, MprSocketPrebind, MprSocketProc, MprSocketProvider, MprSocketService, mprAddSocketHandler, mprCloneSsl, mprCloseSocket, mprConnectSocket, mprCreateSocket, mprCreateSsl, mprDisconnectSocket, mprEnableSocketEvents, mprFlushSocket, mprGetSocketBlockingMode, mprGetSocketError, mprGetSocketFd, mprGetSocketPort, mprGetSocketState, mprHasSecureSockets, mprIsSocketEof, mprIsSocketSecure, mprListenOnSocket, mprLoadSsl, mprReadSocket, mprSetSocketBlockingMode, mprSetSocketEof, mprSetSocketNoDelay, mprSetSslCaFile, mprSetSslCaPath, mprSetSslCertFile, mprSetSslCiphers, mprSetSslKeyFile, mprSocketHandshaking, mprSocketHasBufferedRead, mprSocketHasBufferedWrite, mprUpgradeSocket, mprWriteSocket, mprWriteSocketString, mprWriteSocketVector
int mprGetSocketPort (MprSocket *sp)

Get the port used by a socket.

Description:
Get the TCP/IP port number used by the socket.
Parameters:
spSocket object returned from mprCreateSocket
Returns:
The integer TCP/IP port number used by the socket.
API Stability:
Stable.
See Also:
MprSocket, MprSocketPrebind, MprSocketProc, MprSocketProvider, MprSocketService, mprAddSocketHandler, mprCloneSsl, mprCloseSocket, mprConnectSocket, mprCreateSocket, mprCreateSsl, mprDisconnectSocket, mprEnableSocketEvents, mprFlushSocket, mprGetSocketBlockingMode, mprGetSocketError, mprGetSocketFd, mprGetSocketInfo, mprGetSocketState, mprHasSecureSockets, mprIsSocketEof, mprIsSocketSecure, mprListenOnSocket, mprLoadSsl, mprReadSocket, mprSetSocketBlockingMode, mprSetSocketEof, mprSetSocketNoDelay, mprSetSslCaFile, mprSetSslCaPath, mprSetSslCertFile, mprSetSslCiphers, mprSetSslKeyFile, mprSocketHandshaking, mprSocketHasBufferedRead, mprSocketHasBufferedWrite, mprUpgradeSocket, mprWriteSocket, mprWriteSocketString, mprWriteSocketVector
char * mprGetSocketState (MprSocket *sp)

Get the socket state.

Description:
Get the socket state as a parseable string description.
Parameters:
spSocket object returned from mprCreateSocket
Returns:
The an allocated string.
API Stability:
Stable.
See Also:
MprSocket, MprSocketPrebind, MprSocketProc, MprSocketProvider, MprSocketService, mprAddSocketHandler, mprCloneSsl, mprCloseSocket, mprConnectSocket, mprCreateSocket, mprCreateSsl, mprDisconnectSocket, mprEnableSocketEvents, mprFlushSocket, mprGetSocketBlockingMode, mprGetSocketError, mprGetSocketFd, mprGetSocketInfo, mprGetSocketPort, mprHasSecureSockets, mprIsSocketEof, mprIsSocketSecure, mprListenOnSocket, mprLoadSsl, mprReadSocket, mprSetSocketBlockingMode, mprSetSocketEof, mprSetSocketNoDelay, mprSetSslCaFile, mprSetSslCaPath, mprSetSslCertFile, mprSetSslCiphers, mprSetSslKeyFile, mprSocketHandshaking, mprSocketHasBufferedRead, mprSocketHasBufferedWrite, mprUpgradeSocket, mprWriteSocket, mprWriteSocketString, mprWriteSocketVector
bool mprHasDualNetworkStack ()

has the system got a dual IPv4 + IPv6 network stack.

Returns:
True if the network can listen on IPv4 and IPv6 on a single socket.
API Stability:
Stable.
See Also:
MprSocket, MprSocketPrebind, MprSocketProc, MprSocketProvider, MprSocketService, mprAddSocketHandler, mprCloneSsl, mprCloseSocket, mprConnectSocket, mprCreateSocket, mprCreateSsl, mprDisconnectSocket, mprEnableSocketEvents, mprFlushSocket, mprGetSocketBlockingMode, mprGetSocketError, mprGetSocketFd, mprGetSocketInfo, mprGetSocketPort, mprGetSocketState, mprHasSecureSockets, mprIsSocketEof, mprIsSocketSecure, mprListenOnSocket, mprLoadSsl, mprReadSocket, mprSetSocketBlockingMode, mprSetSocketEof, mprSetSocketNoDelay, mprSetSslCaFile, mprSetSslCaPath, mprSetSslCertFile, mprSetSslCiphers, mprSetSslKeyFile, mprSocketHandshaking, mprSocketHasBufferedRead, mprSocketHasBufferedWrite, mprUpgradeSocket, mprWriteSocket, mprWriteSocketString, mprWriteSocketVector
bool mprHasIPv6 ()

Determine if the system support IPv6.

Returns:
True if the address system supports IPv6 networking.
API Stability:
Stable.
See Also:
MprSocket, MprSocketPrebind, MprSocketProc, MprSocketProvider, MprSocketService, mprAddSocketHandler, mprCloneSsl, mprCloseSocket, mprConnectSocket, mprCreateSocket, mprCreateSsl, mprDisconnectSocket, mprEnableSocketEvents, mprFlushSocket, mprGetSocketBlockingMode, mprGetSocketError, mprGetSocketFd, mprGetSocketInfo, mprGetSocketPort, mprGetSocketState, mprHasSecureSockets, mprIsSocketEof, mprIsSocketSecure, mprListenOnSocket, mprLoadSsl, mprReadSocket, mprSetSocketBlockingMode, mprSetSocketEof, mprSetSocketNoDelay, mprSetSslCaFile, mprSetSslCaPath, mprSetSslCertFile, mprSetSslCiphers, mprSetSslKeyFile, mprSocketHandshaking, mprSocketHasBufferedRead, mprSocketHasBufferedWrite, mprUpgradeSocket, mprWriteSocket, mprWriteSocketString, mprWriteSocketVector
bool mprHasSecureSockets ()

Determine if SSL is available.

Returns:
True if SSL is available.
API Stability:
Stable.
See Also:
MprSocket, MprSocketPrebind, MprSocketProc, MprSocketProvider, MprSocketService, mprAddSocketHandler, mprCloneSsl, mprCloseSocket, mprConnectSocket, mprCreateSocket, mprCreateSsl, mprDisconnectSocket, mprEnableSocketEvents, mprFlushSocket, mprGetSocketBlockingMode, mprGetSocketError, mprGetSocketFd, mprGetSocketInfo, mprGetSocketPort, mprGetSocketState, mprIsSocketEof, mprIsSocketSecure, mprListenOnSocket, mprLoadSsl, mprReadSocket, mprSetSocketBlockingMode, mprSetSocketEof, mprSetSocketNoDelay, mprSetSslCaFile, mprSetSslCaPath, mprSetSslCertFile, mprSetSslCiphers, mprSetSslKeyFile, mprSocketHandshaking, mprSocketHasBufferedRead, mprSocketHasBufferedWrite, mprUpgradeSocket, mprWriteSocket, mprWriteSocketString, mprWriteSocketVector
bool mprIsIPv6 (cchar *ip)

Determine if the IP address is an IPv6 address.

Parameters:
ipIP address.
Returns:
True if the address is an IPv6 address, otherwise zero.
API Stability:
Stable.
See Also:
MprSocket, MprSocketPrebind, MprSocketProc, MprSocketProvider, MprSocketService, mprAddSocketHandler, mprCloneSsl, mprCloseSocket, mprConnectSocket, mprCreateSocket, mprCreateSsl, mprDisconnectSocket, mprEnableSocketEvents, mprFlushSocket, mprGetSocketBlockingMode, mprGetSocketError, mprGetSocketFd, mprGetSocketInfo, mprGetSocketPort, mprGetSocketState, mprHasSecureSockets, mprIsSocketEof, mprIsSocketSecure, mprListenOnSocket, mprLoadSsl, mprReadSocket, mprSetSocketBlockingMode, mprSetSocketEof, mprSetSocketNoDelay, mprSetSslCaFile, mprSetSslCaPath, mprSetSslCertFile, mprSetSslCiphers, mprSetSslKeyFile, mprSocketHandshaking, mprSocketHasBufferedRead, mprSocketHasBufferedWrite, mprUpgradeSocket, mprWriteSocket, mprWriteSocketString, mprWriteSocketVector
bool mprIsSocketEof (MprSocket *sp)

Test if the other end of the socket has been closed.

Description:
Determine if the other end of the socket has been closed and the socket is at end-of-file.
Parameters:
spSocket object returned from mprCreateSocket
Returns:
True if the socket is at end-of-file.
API Stability:
Stable.
See Also:
MprSocket, MprSocketPrebind, MprSocketProc, MprSocketProvider, MprSocketService, mprAddSocketHandler, mprCloneSsl, mprCloseSocket, mprConnectSocket, mprCreateSocket, mprCreateSsl, mprDisconnectSocket, mprEnableSocketEvents, mprFlushSocket, mprGetSocketBlockingMode, mprGetSocketError, mprGetSocketFd, mprGetSocketInfo, mprGetSocketPort, mprGetSocketState, mprHasSecureSockets, mprIsSocketSecure, mprListenOnSocket, mprLoadSsl, mprReadSocket, mprSetSocketBlockingMode, mprSetSocketEof, mprSetSocketNoDelay, mprSetSslCaFile, mprSetSslCaPath, mprSetSslCertFile, mprSetSslCiphers, mprSetSslKeyFile, mprSocketHandshaking, mprSocketHasBufferedRead, mprSocketHasBufferedWrite, mprUpgradeSocket, mprWriteSocket, mprWriteSocketString, mprWriteSocketVector
bool mprIsSocketSecure (MprSocket *sp)

Determine if the socket is secure.

Description:
Determine if the socket is using SSL to provide enhanced security.
Parameters:
spSocket object returned from mprCreateSocket
Returns:
True if the socket is using SSL, otherwise zero.
API Stability:
Stable.
See Also:
MprSocket, MprSocketPrebind, MprSocketProc, MprSocketProvider, MprSocketService, mprAddSocketHandler, mprCloneSsl, mprCloseSocket, mprConnectSocket, mprCreateSocket, mprCreateSsl, mprDisconnectSocket, mprEnableSocketEvents, mprFlushSocket, mprGetSocketBlockingMode, mprGetSocketError, mprGetSocketFd, mprGetSocketInfo, mprGetSocketPort, mprGetSocketState, mprHasSecureSockets, mprIsSocketEof, mprListenOnSocket, mprLoadSsl, mprReadSocket, mprSetSocketBlockingMode, mprSetSocketEof, mprSetSocketNoDelay, mprSetSslCaFile, mprSetSslCaPath, mprSetSslCertFile, mprSetSslCiphers, mprSetSslKeyFile, mprSocketHandshaking, mprSocketHasBufferedRead, mprSocketHasBufferedWrite, mprUpgradeSocket, mprWriteSocket, mprWriteSocketString, mprWriteSocketVector
Socket mprListenOnSocket (MprSocket *sp, cchar *ip, int port, int flags)

Listen on a server socket for incoming connections.

Description:
Open a server socket and listen for client connections. If ip is null, then this will listen on both IPv6 and IPv4.
Parameters:
spSocket object returned via mprCreateSocket
ipIP address to bind to. Set to 0.0.0.0 to bind to all possible addresses on a given port.
portTCP/IP port number to connect to.
flagsSocket flags may use the following flags ored together:
  • MPR_SOCKET_BLOCK - to use blocking I/O. The default is non-blocking.
  • MPR_SOCKET_BROADCAST - Use IPv4 broadcast
  • MPR_SOCKET_DATAGRAM - Use IPv4 datagrams
  • MPR_SOCKET_NOREUSE - Set NOREUSE flag on the socket
  • MPR_SOCKET_NODELAY - Set NODELAY on the socket
  • MPR_SOCKET_THREAD - Process callbacks on a separate thread.
Returns:
Zero if the connection is successful. Otherwise a negative MPR error code.
API Stability:
Stable.
See Also:
MprSocket, MprSocketPrebind, MprSocketProc, MprSocketProvider, MprSocketService, mprAddSocketHandler, mprCloneSsl, mprCloseSocket, mprConnectSocket, mprCreateSocket, mprCreateSsl, mprDisconnectSocket, mprEnableSocketEvents, mprFlushSocket, mprGetSocketBlockingMode, mprGetSocketError, mprGetSocketFd, mprGetSocketInfo, mprGetSocketPort, mprGetSocketState, mprHasSecureSockets, mprIsSocketEof, mprIsSocketSecure, mprLoadSsl, mprReadSocket, mprSetSocketBlockingMode, mprSetSocketEof, mprSetSocketNoDelay, mprSetSslCaFile, mprSetSslCaPath, mprSetSslCertFile, mprSetSslCiphers, mprSetSslKeyFile, mprSocketHandshaking, mprSocketHasBufferedRead, mprSocketHasBufferedWrite, mprUpgradeSocket, mprWriteSocket, mprWriteSocketString, mprWriteSocketVector
int mprParseSocketAddress (cchar *address, char **ip, int *port, int *secure, int defaultPort)

Parse an socket address IP address.

Description:
This parses a string containing an IP:PORT specification and returns the IP address and port components. Handles ipv4 and ipv6 addresses.
Parameters:
addressAn IP:PORT specification. The :PORT is optional. When an IP address contains an ipv6 port it should be written as aaaa:bbbb:cccc:dddd:eeee:ffff:gggg:hhhh:iiii or.
ipPointer to receive a dynamically allocated IP string.
portPointer to an integer to receive the port value.
securePointer to an integer to receive true if the address requires SSL.
defaultPortThe default port number to use if the address does not contain a port.
API Stability:
Stable.
See Also:
MprSocket, MprSocketPrebind, MprSocketProc, MprSocketProvider, MprSocketService, mprAddSocketHandler, mprCloneSsl, mprCloseSocket, mprConnectSocket, mprCreateSocket, mprCreateSsl, mprDisconnectSocket, mprEnableSocketEvents, mprFlushSocket, mprGetSocketBlockingMode, mprGetSocketError, mprGetSocketFd, mprGetSocketInfo, mprGetSocketPort, mprGetSocketState, mprHasSecureSockets, mprIsSocketEof, mprIsSocketSecure, mprListenOnSocket, mprLoadSsl, mprReadSocket, mprSetSocketBlockingMode, mprSetSocketEof, mprSetSocketNoDelay, mprSetSslCaFile, mprSetSslCaPath, mprSetSslCertFile, mprSetSslCiphers, mprSetSslKeyFile, mprSocketHandshaking, mprSocketHasBufferedRead, mprSocketHasBufferedWrite, mprUpgradeSocket, mprWriteSocket, mprWriteSocketString, mprWriteSocketVector
ssize mprReadSocket (MprSocket *sp, void *buf, ssize size)

Read from a socket.

Description:
Read data from a socket. The read will return with whatever bytes are available. If none and the socket is in blocking mode, it will block untill there is some data available or the socket is disconnected.
Parameters:
spSocket object returned from mprCreateSocket
bufPointer to a buffer to hold the read data.
sizeSize of the buffer.
Returns:
A count of bytes actually read. Return a negative MPR error code on errors. Return -1 for EOF and errors. On success, return the number of bytes read. Use mprIsSocketEof to distinguision between EOF and errors.
API Stability:
Stable.
See Also:
MprSocket, MprSocketPrebind, MprSocketProc, MprSocketProvider, MprSocketService, mprAddSocketHandler, mprCloneSsl, mprCloseSocket, mprConnectSocket, mprCreateSocket, mprCreateSsl, mprDisconnectSocket, mprEnableSocketEvents, mprFlushSocket, mprGetSocketBlockingMode, mprGetSocketError, mprGetSocketFd, mprGetSocketInfo, mprGetSocketPort, mprGetSocketState, mprHasSecureSockets, mprIsSocketEof, mprIsSocketSecure, mprListenOnSocket, mprLoadSsl, mprSetSocketBlockingMode, mprSetSocketEof, mprSetSocketNoDelay, mprSetSslCaFile, mprSetSslCaPath, mprSetSslCertFile, mprSetSslCiphers, mprSetSslKeyFile, mprSocketHandshaking, mprSocketHasBufferedRead, mprSocketHasBufferedWrite, mprUpgradeSocket, mprWriteSocket, mprWriteSocketString, mprWriteSocketVector
void mprRemoveSocketHandler (MprSocket *sp)

Remove a socket wait handler.

Description:
Removes the socket wait handler created via mprAddSocketHandler.
Parameters:
spSocket object created via mprCreateSocket.
API Stability:
Stable.
See Also:
MprSocket, MprSocketPrebind, MprSocketProc, MprSocketProvider, MprSocketService, mprAddSocketHandler, mprCloneSsl, mprCloseSocket, mprConnectSocket, mprCreateSocket, mprCreateSsl, mprDisconnectSocket, mprEnableSocketEvents, mprFlushSocket, mprGetSocketBlockingMode, mprGetSocketError, mprGetSocketFd, mprGetSocketInfo, mprGetSocketPort, mprGetSocketState, mprHasSecureSockets, mprIsSocketEof, mprIsSocketSecure, mprListenOnSocket, mprLoadSsl, mprReadSocket, mprSetSocketBlockingMode, mprSetSocketEof, mprSetSocketNoDelay, mprSetSslCaFile, mprSetSslCaPath, mprSetSslCertFile, mprSetSslCiphers, mprSetSslKeyFile, mprSocketHandshaking, mprSocketHasBufferedRead, mprSocketHasBufferedWrite, mprUpgradeSocket, mprWriteSocket, mprWriteSocketString, mprWriteSocketVector
int mprSetMaxSocketAccept (int max)

Set the maximum number of accepted client connections that are permissable.

Parameters:
maxNew maximum number of accepted client connections.
API Stability:
Stable.
See Also:
MprSocket, MprSocketPrebind, MprSocketProc, MprSocketProvider, MprSocketService, mprAddSocketHandler, mprCloneSsl, mprCloseSocket, mprConnectSocket, mprCreateSocket, mprCreateSsl, mprDisconnectSocket, mprEnableSocketEvents, mprFlushSocket, mprGetSocketBlockingMode, mprGetSocketError, mprGetSocketFd, mprGetSocketInfo, mprGetSocketPort, mprGetSocketState, mprHasSecureSockets, mprIsSocketEof, mprIsSocketSecure, mprListenOnSocket, mprLoadSsl, mprReadSocket, mprSetSocketBlockingMode, mprSetSocketEof, mprSetSocketNoDelay, mprSetSslCaFile, mprSetSslCaPath, mprSetSslCertFile, mprSetSslCiphers, mprSetSslKeyFile, mprSocketHandshaking, mprSocketHasBufferedRead, mprSocketHasBufferedWrite, mprUpgradeSocket, mprWriteSocket, mprWriteSocketString, mprWriteSocketVector
int mprSetSocketBlockingMode (MprSocket *sp, bool on)

Set the socket blocking mode.

Description:
Set the blocking mode for a socket. By default a socket is in non-blocking mode where read / write calls will not block.
Parameters:
spSocket object returned from mprCreateSocket
onSet to zero to put the socket into non-blocking mode. Set to non-zero to enable blocking mode.
Returns:
The old blocking mode if successful or a negative MPR error code.
API Stability:
Stable.
See Also:
MprSocket, MprSocketPrebind, MprSocketProc, MprSocketProvider, MprSocketService, mprAddSocketHandler, mprCloneSsl, mprCloseSocket, mprConnectSocket, mprCreateSocket, mprCreateSsl, mprDisconnectSocket, mprEnableSocketEvents, mprFlushSocket, mprGetSocketBlockingMode, mprGetSocketError, mprGetSocketFd, mprGetSocketInfo, mprGetSocketPort, mprGetSocketState, mprHasSecureSockets, mprIsSocketEof, mprIsSocketSecure, mprListenOnSocket, mprLoadSsl, mprReadSocket, mprSetSocketEof, mprSetSocketNoDelay, mprSetSslCaFile, mprSetSslCaPath, mprSetSslCertFile, mprSetSslCiphers, mprSetSslKeyFile, mprSocketHandshaking, mprSocketHasBufferedRead, mprSocketHasBufferedWrite, mprUpgradeSocket, mprWriteSocket, mprWriteSocketString, mprWriteSocketVector
void mprSetSocketEof (MprSocket *sp, bool eof)

Set an EOF condition on the socket.

Parameters:
spSocket object returned from mprCreateSocket
eofSet to true to set an EOF condition. Set to false to clear it.
API Stability:
Stable.
See Also:
MprSocket, MprSocketPrebind, MprSocketProc, MprSocketProvider, MprSocketService, mprAddSocketHandler, mprCloneSsl, mprCloseSocket, mprConnectSocket, mprCreateSocket, mprCreateSsl, mprDisconnectSocket, mprEnableSocketEvents, mprFlushSocket, mprGetSocketBlockingMode, mprGetSocketError, mprGetSocketFd, mprGetSocketInfo, mprGetSocketPort, mprGetSocketState, mprHasSecureSockets, mprIsSocketEof, mprIsSocketSecure, mprListenOnSocket, mprLoadSsl, mprReadSocket, mprSetSocketBlockingMode, mprSetSocketNoDelay, mprSetSslCaFile, mprSetSslCaPath, mprSetSslCertFile, mprSetSslCiphers, mprSetSslKeyFile, mprSocketHandshaking, mprSocketHasBufferedRead, mprSocketHasBufferedWrite, mprUpgradeSocket, mprWriteSocket, mprWriteSocketString, mprWriteSocketVector
int mprSetSocketNoDelay (MprSocket *sp, bool on)

Set the socket delay mode.

Description:
Set the socket delay behavior (nagle algorithm). By default a socket will partial packet writes a little to try to accumulate data and coalesce TCP/IP packages. Setting the delay mode to false may result in higher performance for interactive applications.
Parameters:
spSocket object returned from mprCreateSocket
onSet to non-zero to put the socket into no delay mode. Set to zero to enable the nagle algorithm.
Returns:
The old delay mode if successful or a negative MPR error code.
API Stability:
Stable.
See Also:
MprSocket, MprSocketPrebind, MprSocketProc, MprSocketProvider, MprSocketService, mprAddSocketHandler, mprCloneSsl, mprCloseSocket, mprConnectSocket, mprCreateSocket, mprCreateSsl, mprDisconnectSocket, mprEnableSocketEvents, mprFlushSocket, mprGetSocketBlockingMode, mprGetSocketError, mprGetSocketFd, mprGetSocketInfo, mprGetSocketPort, mprGetSocketState, mprHasSecureSockets, mprIsSocketEof, mprIsSocketSecure, mprListenOnSocket, mprLoadSsl, mprReadSocket, mprSetSocketBlockingMode, mprSetSocketEof, mprSetSslCaFile, mprSetSslCaPath, mprSetSslCertFile, mprSetSslCiphers, mprSetSslKeyFile, mprSocketHandshaking, mprSocketHasBufferedRead, mprSocketHasBufferedWrite, mprUpgradeSocket, mprWriteSocket, mprWriteSocketString, mprWriteSocketVector
bool mprSocketHandshaking (MprSocket *sp)

Test if the socket is doing an SSL handshake.

Parameters:
spSocket object returned from mprCreateSocket
Returns:
True if the SSL stack is handshaking.
API Stability:
Stable.
See Also:
MprSocket, MprSocketPrebind, MprSocketProc, MprSocketProvider, MprSocketService, mprAddSocketHandler, mprCloneSsl, mprCloseSocket, mprConnectSocket, mprCreateSocket, mprCreateSsl, mprDisconnectSocket, mprEnableSocketEvents, mprFlushSocket, mprGetSocketBlockingMode, mprGetSocketError, mprGetSocketFd, mprGetSocketInfo, mprGetSocketPort, mprGetSocketState, mprHasSecureSockets, mprIsSocketEof, mprIsSocketSecure, mprListenOnSocket, mprLoadSsl, mprReadSocket, mprSetSocketBlockingMode, mprSetSocketEof, mprSetSocketNoDelay, mprSetSslCaFile, mprSetSslCaPath, mprSetSslCertFile, mprSetSslCiphers, mprSetSslKeyFile, mprSocketHasBufferedRead, mprSocketHasBufferedWrite, mprUpgradeSocket, mprWriteSocket, mprWriteSocketString, mprWriteSocketVector
bool mprSocketHasBufferedRead (MprSocket *sp)

Test if the socket has buffered read data.

Description:
Use this function to avoid waiting for incoming I/O if data is already buffered.
Parameters:
spSocket object returned from mprCreateSocket
Returns:
True if the socket has pending read data.
API Stability:
Stable.
See Also:
MprSocket, MprSocketPrebind, MprSocketProc, MprSocketProvider, MprSocketService, mprAddSocketHandler, mprCloneSsl, mprCloseSocket, mprConnectSocket, mprCreateSocket, mprCreateSsl, mprDisconnectSocket, mprEnableSocketEvents, mprFlushSocket, mprGetSocketBlockingMode, mprGetSocketError, mprGetSocketFd, mprGetSocketInfo, mprGetSocketPort, mprGetSocketState, mprHasSecureSockets, mprIsSocketEof, mprIsSocketSecure, mprListenOnSocket, mprLoadSsl, mprReadSocket, mprSetSocketBlockingMode, mprSetSocketEof, mprSetSocketNoDelay, mprSetSslCaFile, mprSetSslCaPath, mprSetSslCertFile, mprSetSslCiphers, mprSetSslKeyFile, mprSocketHandshaking, mprSocketHasBufferedWrite, mprUpgradeSocket, mprWriteSocket, mprWriteSocketString, mprWriteSocketVector
bool mprSocketHasBufferedWrite (MprSocket *sp)

Test if the socket has buffered write data.

Description:
Use this function to detect that there is buffer data to write in a SSL stack.
Parameters:
spSocket object returned from mprCreateSocket
Returns:
True if the socket has pending write data.
API Stability:
Stable.
See Also:
MprSocket, MprSocketPrebind, MprSocketProc, MprSocketProvider, MprSocketService, mprAddSocketHandler, mprCloneSsl, mprCloseSocket, mprConnectSocket, mprCreateSocket, mprCreateSsl, mprDisconnectSocket, mprEnableSocketEvents, mprFlushSocket, mprGetSocketBlockingMode, mprGetSocketError, mprGetSocketFd, mprGetSocketInfo, mprGetSocketPort, mprGetSocketState, mprHasSecureSockets, mprIsSocketEof, mprIsSocketSecure, mprListenOnSocket, mprLoadSsl, mprReadSocket, mprSetSocketBlockingMode, mprSetSocketEof, mprSetSocketNoDelay, mprSetSslCaFile, mprSetSslCaPath, mprSetSslCertFile, mprSetSslCiphers, mprSetSslKeyFile, mprSocketHandshaking, mprSocketHasBufferedRead, mprUpgradeSocket, mprWriteSocket, mprWriteSocketString, mprWriteSocketVector
int mprUpgradeSocket (MprSocket *sp, struct MprSsl *ssl, cchar *peerName)

Upgrade a socket to use SSL/TLS.

Parameters:
spSocket to upgrade.
sslSSL configuration to use. Set to NULL to use the default.
peerNameRequired peer name in handshake with peer. Used by clients to verify the server hostname.
Returns:
Zero if successful, otherwise a negative MPR error code.
API Stability:
Stable.
See Also:
MprSocket, MprSocketPrebind, MprSocketProc, MprSocketProvider, MprSocketService, mprAddSocketHandler, mprCloneSsl, mprCloseSocket, mprConnectSocket, mprCreateSocket, mprCreateSsl, mprDisconnectSocket, mprEnableSocketEvents, mprFlushSocket, mprGetSocketBlockingMode, mprGetSocketError, mprGetSocketFd, mprGetSocketInfo, mprGetSocketPort, mprGetSocketState, mprHasSecureSockets, mprIsSocketEof, mprIsSocketSecure, mprListenOnSocket, mprLoadSsl, mprReadSocket, mprSetSocketBlockingMode, mprSetSocketEof, mprSetSocketNoDelay, mprSetSslCaFile, mprSetSslCaPath, mprSetSslCertFile, mprSetSslCiphers, mprSetSslKeyFile, mprSocketHandshaking, mprSocketHasBufferedRead, mprSocketHasBufferedWrite, mprWriteSocket, mprWriteSocketString, mprWriteSocketVector
ssize mprWriteSocket (MprSocket *sp, cvoid *buf, ssize len)

Write to a socket.

Description:
Write a block of data to a socket. If the socket is in non-blocking mode (the default), the write may return having written less than the required bytes.
Parameters:
spSocket object returned from mprCreateSocket
bufReference to a block to write to the socket.
lenLength of data to write. This may be less than the requested write length if the socket is in non-blocking mode. Will return a negative MPR error code on errors.
Returns:
A count of bytes actually written. Return a negative MPR error code on errors.
API Stability:
Stable.
See Also:
MprSocket, MprSocketPrebind, MprSocketProc, MprSocketProvider, MprSocketService, mprAddSocketHandler, mprCloneSsl, mprCloseSocket, mprConnectSocket, mprCreateSocket, mprCreateSsl, mprDisconnectSocket, mprEnableSocketEvents, mprFlushSocket, mprGetSocketBlockingMode, mprGetSocketError, mprGetSocketFd, mprGetSocketInfo, mprGetSocketPort, mprGetSocketState, mprHasSecureSockets, mprIsSocketEof, mprIsSocketSecure, mprListenOnSocket, mprLoadSsl, mprReadSocket, mprSetSocketBlockingMode, mprSetSocketEof, mprSetSocketNoDelay, mprSetSslCaFile, mprSetSslCaPath, mprSetSslCertFile, mprSetSslCiphers, mprSetSslKeyFile, mprSocketHandshaking, mprSocketHasBufferedRead, mprSocketHasBufferedWrite, mprUpgradeSocket, mprWriteSocketString, mprWriteSocketVector
ssize mprWriteSocketString (MprSocket *sp, cchar *str)

Write to a string to a socket.

Description:
Write a string to a socket. If the socket is in non-blocking mode (the default), the write may return having written less than the required bytes.
Parameters:
spSocket object returned from mprCreateSocket
strNull terminated string to write.
Returns:
A count of bytes actually written. Return a negative MPR error code on errors.
API Stability:
Stable.
See Also:
MprSocket, MprSocketPrebind, MprSocketProc, MprSocketProvider, MprSocketService, mprAddSocketHandler, mprCloneSsl, mprCloseSocket, mprConnectSocket, mprCreateSocket, mprCreateSsl, mprDisconnectSocket, mprEnableSocketEvents, mprFlushSocket, mprGetSocketBlockingMode, mprGetSocketError, mprGetSocketFd, mprGetSocketInfo, mprGetSocketPort, mprGetSocketState, mprHasSecureSockets, mprIsSocketEof, mprIsSocketSecure, mprListenOnSocket, mprLoadSsl, mprReadSocket, mprSetSocketBlockingMode, mprSetSocketEof, mprSetSocketNoDelay, mprSetSslCaFile, mprSetSslCaPath, mprSetSslCertFile, mprSetSslCiphers, mprSetSslKeyFile, mprSocketHandshaking, mprSocketHasBufferedRead, mprSocketHasBufferedWrite, mprUpgradeSocket, mprWriteSocket, mprWriteSocketVector
ssize mprWriteSocketVector (MprSocket *sp, MprIOVec *iovec, int count)

Write a vector to a socket.

Description:
Do scatter/gather I/O by writing a vector of buffers to a socket.
Parameters:
spSocket object returned from mprCreateSocket
iovecVector of data to write before the file contents.
countCount of entries in beforeVect.
Returns:
A count of bytes actually written. Return a negative MPR error code on errors.
API Stability:
Stable.
See Also:
MprSocket, MprSocketPrebind, MprSocketProc, MprSocketProvider, MprSocketService, mprAddSocketHandler, mprCloneSsl, mprCloseSocket, mprConnectSocket, mprCreateSocket, mprCreateSsl, mprDisconnectSocket, mprEnableSocketEvents, mprFlushSocket, mprGetSocketBlockingMode, mprGetSocketError, mprGetSocketFd, mprGetSocketInfo, mprGetSocketPort, mprGetSocketState, mprHasSecureSockets, mprIsSocketEof, mprIsSocketSecure, mprListenOnSocket, mprLoadSsl, mprReadSocket, mprSetSocketBlockingMode, mprSetSocketEof, mprSetSocketNoDelay, mprSetSslCaFile, mprSetSslCaPath, mprSetSslCertFile, mprSetSslCiphers, mprSetSslKeyFile, mprSocketHandshaking, mprSocketHasBufferedRead, mprSocketHasBufferedWrite, mprUpgradeSocket, mprWriteSocket, mprWriteSocketString

MprSsl

MprSsl

SSL control structure.

API Stability:
Internal.
Fields:
char *caFile Certificate verification cert file or bundle.
char *caPath Certificate verification cert directory (OpenSSL only).
char *certFile Alternatively, locate the cert in a file.
intchanged Set if there is a change in the SSL config. Reset by providers.
char *ciphers Candidate ciphers to use.
void *config Extended provider SSL configuration.
intconfigured Set if this SSL configuration has been processed.
char *key Key string.
char *keyFile Alternatively, locate the key in a file.
MprMutex *mutex Multithread sync.
intprotocols SSL protocols.
struct MprSocketProvider *provider Cached SSL provider to use.
char *providerName SSL provider to use - null if default.
intverifyDepth Set if the cert chain depth should be verified.
intverifyIssuer Set if the certificate issuer should be also verified.
intverifyPeer Verify the peer verificate.
void mprAddSslCiphers (struct MprSsl *ssl, cchar *ciphers)

Add the ciphers to use for SSL.

Parameters:
sslSSL instance returned from mprCreateSsl
ciphersCipher string to add to any existing ciphers.
API Stability:
Evolving.
See Also:
struct MprSsl * MprSsl* mprCloneSsl (MprSsl *src)

Create the a new SSL control structure based on an existing structure.

Parameters:
srcStructure to clone.
API Stability:
Stable.
See Also:
struct MprSsl * MprSsl* mprCreateSsl (int server)

Create the SSL control structure.

Parameters:
serverTrue if the SSL configuration will be used on the server side.
API Stability:
Stable.
See Also:
int mprGetSslCipherCode (cchar *cipher)

Lookup an SSL cipher by its IANA name and return the cipher IANA code.

Parameters:
cipherCipher IANA name.
Returns:
String cipher code. For example: given "TLS_RSA_WITH_AES_256_CBC_SHA" return 0x35.
API Stability:
Evolving.
See Also:
cchar * mprGetSslCipherName (int cipher)

Lookup an SSL cipher by its IANA code and return the string name.

Parameters:
cipherCipher IANA code.
Returns:
String cipher name. For example: given 0x35, return "TLS_RSA_WITH_AES_256_CBC_SHA".
API Stability:
Evolving.
See Also:
int mprLoadSsl ()

Load the SSL module.

API Stability:
Stable.
See Also:
void mprSetSslCaFile (struct MprSsl *ssl, cchar *caFile)

Set the client certificate file to use for SSL.

Parameters:
sslSSL instance returned from mprCreateSsl
caFilePath to the SSL client certificate file.
API Stability:
Stable.
See Also:
void mprSetSslCaPath (struct MprSsl *ssl, cchar *caPath)

Set the path for the client certificate directory.

Description:
This is supported for OpenSSL only.
Parameters:
sslSSL instance returned from mprCreateSsl
caPathPath to the SSL client certificate directory.
API Stability:
Deprecated.
See Also:
void mprSetSslCertFile (struct MprSsl *ssl, cchar *certFile)

Set certificate to use for SSL.

Parameters:
sslSSL instance returned from mprCreateSsl
certFilePath to the SSL certificate file.
API Stability:
Stable.
See Also:
void mprSetSslCiphers (MprSsl *ssl, cchar *ciphers)

Set the ciphers to use.

Parameters:
sslSSL instance returned from mprCreateSsl
ciphersString of suitable ciphers.
API Stability:
Evolving.
See Also:
void mprSetSslKeyFile (struct MprSsl *ssl, cchar *keyFile)

Set the key file to use for SSL.

Parameters:
sslSSL instance returned from mprCreateSsl
keyFilePath to the SSL key file.
API Stability:
Stable.
See Also:
void mprSetSslProtocols (struct MprSsl *ssl, int protocols)

Set the SSL protocol to use.

Parameters:
sslSSL instance returned from mprCreateSsl
protocolsSSL protocols mask.
API Stability:
Evolving.
See Also:
void mprSetSslProvider (MprSsl *ssl, cchar *provider)

Set the SSL provider to use.

Parameters:
sslSSL instance returned from mprCreateSsl
providerSSL provider name (openssl | matrixssl | est | nanossl).
API Stability:
Stable.
See Also:
void mprVerifySslDepth (struct MprSsl *ssl, int depth)

Control the depth of SSL SSL certificate verification.

Parameters:
sslSSL instance returned from mprCreateSsl
depthSet to the number of intermediate certificates to verify. Defaults to 1.
API Stability:
Evolving.
See Also:
void mprVerifySslIssuer (struct MprSsl *ssl, bool on)

Control the verification of SSL certificate issuers.

Parameters:
sslSSL instance returned from mprCreateSsl
onSet to true to enable SSL certificate issuer verification.
API Stability:
Evolving.
See Also:
void mprVerifySslPeer (struct MprSsl *ssl, bool on)

Require verification of peer certificates.

Parameters:
sslSSL instance returned from mprCreateSsl
onSet to true to enable peer SSL certificate verification.
API Stability:
Evolving.
See Also:

MprString

MprString

Safe String Module.

Description:
The MPR provides a suite of safe ascii string manipulation routines to help prevent buffer overflows and other potential security traps.
See Also:
fmt, fmtv, itos, itosbuf, itosradix, mprEprintf, mprFprintf, mprPrintf, scamel, scaselesscmp, scaselessmatch, schr, sclone, scmp, scontains, scopy, sends, sfmt, sfmtv, shash, shashlower, sjoin, sjoinv, slen, slower, smatch, sncaselesscmp, snclone, sncmp, sncontains, sncopy, spascal, spbrk, srchr, srejoin, srejoinv, sspn, sstarts, ssub, stemplate, stoi, stoiradix, stok, strim, supper
API Stability:
Internal.
Fields:
char * fmt (char *buf, ssize maxSize, cchar *fmt, ...)

Format a string into a static buffer.

Description:
This call format a string using printf style formatting arguments. A trailing null will always be appended. The call returns the size of the allocated string excluding the null.
Parameters:
bufPointer to the buffer.
maxSizeSize of the buffer.
fmtPrintf style format string.
...Variable arguments to format.
Returns:
The buffer.
API Stability:
Stable.
See Also:
MprString, fmtv, itos, itosbuf, itosradix, mprEprintf, mprFprintf, mprPrintf, scamel, scaselesscmp, scaselessmatch, schr, sclone, scmp, scontains, scopy, sends, sfmt, sfmtv, shash, shashlower, sjoin, sjoinv, slen, slower, smatch, sncaselesscmp, snclone, sncmp, sncontains, sncopy, spascal, spbrk, srchr, srejoin, srejoinv, sspn, sstarts, ssub, stemplate, stoi, stoiradix, stok, strim, supper
char * fmtv (char *buf, ssize maxSize, cchar *fmt, va_list args)

Format a string into a statically allocated buffer.

Description:
This call format a string using printf style formatting arguments. A trailing null will always be appended. The call returns the size of the allocated string excluding the null.
Parameters:
bufPointer to the buffer.
maxSizeSize of the buffer.
fmtPrintf style format string.
argsVarargs argument obtained from va_start.
Returns:
The buffer;.
API Stability:
Stable.
See Also:
MprString, fmt, itos, itosbuf, itosradix, mprEprintf, mprFprintf, mprPrintf, scamel, scaselesscmp, scaselessmatch, schr, sclone, scmp, scontains, scopy, sends, sfmt, sfmtv, shash, shashlower, sjoin, sjoinv, slen, slower, smatch, sncaselesscmp, snclone, sncmp, sncontains, sncopy, spascal, spbrk, srchr, srejoin, srejoinv, sspn, sstarts, ssub, stemplate, stoi, stoiradix, stok, strim, supper
char * itos (int64 value)

Convert an integer to a string.

Description:
This call converts the supplied 64 bit integer to a string using base 10.
Parameters:
valueInteger value to convert.
Returns:
An allocated string with the converted number.
API Stability:
Stable.
See Also:
MprString, fmt, fmtv, itosbuf, itosradix, mprEprintf, mprFprintf, mprPrintf, scamel, scaselesscmp, scaselessmatch, schr, sclone, scmp, scontains, scopy, sends, sfmt, sfmtv, shash, shashlower, sjoin, sjoinv, slen, slower, smatch, sncaselesscmp, snclone, sncmp, sncontains, sncopy, spascal, spbrk, srchr, srejoin, srejoinv, sspn, sstarts, ssub, stemplate, stoi, stoiradix, stok, strim, supper
char * itosbuf (char *buf, ssize size, int64 value, int radix)

Convert an integer to a string buffer.

Description:
This call converts the supplied 64 bit integer into a string formatted into the supplied buffer according to the specified radix.
Parameters:
bufPointer to the buffer that will hold the string.
sizeSize of the buffer.
valueInteger value to convert.
radixThe base radix to use when encoding the number.
Returns:
Returns a reference to the string.
API Stability:
Evolving.
See Also:
MprString, fmt, fmtv, itos, itosradix, mprEprintf, mprFprintf, mprPrintf, scamel, scaselesscmp, scaselessmatch, schr, sclone, scmp, scontains, scopy, sends, sfmt, sfmtv, shash, shashlower, sjoin, sjoinv, slen, slower, smatch, sncaselesscmp, snclone, sncmp, sncontains, sncopy, spascal, spbrk, srchr, srejoin, srejoinv, sspn, sstarts, ssub, stemplate, stoi, stoiradix, stok, strim, supper
char * itosradix (int64 value, int radix)

Convert an integer to a string.

Description:
This call converts the supplied 64 bit integer to a string according to the specified radix.
Parameters:
valueInteger value to convert.
radixThe base radix to use when encoding the number.
Returns:
An allocated string with the converted number.
API Stability:
Evolving.
See Also:
MprString, fmt, fmtv, itos, itosbuf, mprEprintf, mprFprintf, mprPrintf, scamel, scaselesscmp, scaselessmatch, schr, sclone, scmp, scontains, scopy, sends, sfmt, sfmtv, shash, shashlower, sjoin, sjoinv, slen, slower, smatch, sncaselesscmp, snclone, sncmp, sncontains, sncopy, spascal, spbrk, srchr, srejoin, srejoinv, sspn, sstarts, ssub, stemplate, stoi, stoiradix, stok, strim, supper
ssize mprEprintf (cchar *fmt, ...)

Print a formatted message to the standard error channel.

Description:
This is a secure replacement for fprintf(stderr).
Parameters:
fmtPrintf style format string.
...Variable arguments to format.
Returns:
The number of bytes written.
API Stability:
Evolving.
See Also:
MprString, fmt, fmtv, itos, itosbuf, itosradix, mprFprintf, mprPrintf, scamel, scaselesscmp, scaselessmatch, schr, sclone, scmp, scontains, scopy, sends, sfmt, sfmtv, shash, shashlower, sjoin, sjoinv, slen, slower, smatch, sncaselesscmp, snclone, sncmp, sncontains, sncopy, spascal, spbrk, srchr, srejoin, srejoinv, sspn, sstarts, ssub, stemplate, stoi, stoiradix, stok, strim, supper
ssize mprFprintf (struct MprFile *file, cchar *fmt, ...)

Print a formatted message to a file descriptor.

Description:
This is a replacement for fprintf as part of the safe string MPR library. It minimizes memory use and uses a file descriptor instead of a File pointer.
Parameters:
fileMprFile object returned via mprOpenFile
fmtPrintf style format string.
...Variable arguments to format.
Returns:
The number of bytes written.
API Stability:
Evolving.
See Also:
MprString, fmt, fmtv, itos, itosbuf, itosradix, mprEprintf, mprPrintf, scamel, scaselesscmp, scaselessmatch, schr, sclone, scmp, scontains, scopy, sends, sfmt, sfmtv, shash, shashlower, sjoin, sjoinv, slen, slower, smatch, sncaselesscmp, snclone, sncmp, sncontains, sncopy, spascal, spbrk, srchr, srejoin, srejoinv, sspn, sstarts, ssub, stemplate, stoi, stoiradix, stok, strim, supper
ssize mprPrintf (cchar *fmt, ...)

Formatted print.

This is a secure verion of printf that can handle null args
Description:
This is a secure replacement for printf. It can handle null arguments without crashes.
Parameters:
fmtPrintf style format string.
...Variable arguments to format.
Returns:
The number of bytes written.
API Stability:
Stable.
See Also:
MprString, fmt, fmtv, itos, itosbuf, itosradix, mprEprintf, mprFprintf, scamel, scaselesscmp, scaselessmatch, schr, sclone, scmp, scontains, scopy, sends, sfmt, sfmtv, shash, shashlower, sjoin, sjoinv, slen, slower, smatch, sncaselesscmp, snclone, sncmp, sncontains, sncopy, spascal, spbrk, srchr, srejoin, srejoinv, sspn, sstarts, ssub, stemplate, stoi, stoiradix, stok, strim, supper
char * mprPrintfCore (char *buf, ssize maxsize, cchar *fmt, va_list args)

Format a string into a buffer.

Description:
This routine will format the arguments into a result. If a buffer is supplied, it will be used. Otherwise if the buf argument is NULL, a buffer will be allocated. The arguments will be formatted up to the maximum size supplied by the maxsize argument. A trailing null will always be appended.
Parameters:
bufOptional buffer to contain the formatted result.
maxsizeMaximum size of the result.
fmtPrintf style format string.
argsVariable arguments to format.
Returns:
The number of characters in the string.
See Also:
MprString, fmt, fmtv, itos, itosbuf, itosradix, mprEprintf, mprFprintf, mprPrintf, scamel, scaselesscmp, scaselessmatch, schr, sclone, scmp, scontains, scopy, sends, sfmt, sfmtv, shash, shashlower, sjoin, sjoinv, slen, slower, smatch, sncaselesscmp, snclone, sncmp, sncontains, sncopy, spascal, spbrk, srchr, srejoin, srejoinv, sspn, sstarts, ssub, stemplate, stoi, stoiradix, stok, strim, supper
char * scamel (cchar *str)

Create a camel case version of the string.

Description:
Copy a string into a newly allocated block and make the first character lower case.
Parameters:
strPointer to the block to duplicate.
Returns:
Returns a newly allocated string.
API Stability:
Stable.
See Also:
MprString, fmt, fmtv, itos, itosbuf, itosradix, mprEprintf, mprFprintf, mprPrintf, scaselesscmp, scaselessmatch, schr, sclone, scmp, scontains, scopy, sends, sfmt, sfmtv, shash, shashlower, sjoin, sjoinv, slen, slower, smatch, sncaselesscmp, snclone, sncmp, sncontains, sncopy, spascal, spbrk, srchr, srejoin, srejoinv, sspn, sstarts, ssub, stemplate, stoi, stoiradix, stok, strim, supper
int scaselesscmp (cchar *s1, cchar *s2)

Compare strings ignoring case.

This is a safe replacement for strcasecmp. It can handle NULL args
Description:
Compare two strings ignoring case differences. This call operates similarly to strcmp.
Parameters:
s1First string to compare.
s2Second string to compare.
Returns:
Returns zero if the strings are equivalent, < 0 if s1 sorts lower than s2 in the collating sequence or > 0 if it sorts higher.
API Stability:
Evolving.
See Also:
MprString, fmt, fmtv, itos, itosbuf, itosradix, mprEprintf, mprFprintf, mprPrintf, scamel, scaselessmatch, schr, sclone, scmp, scontains, scopy, sends, sfmt, sfmtv, shash, shashlower, sjoin, sjoinv, slen, slower, smatch, sncaselesscmp, snclone, sncmp, sncontains, sncopy, spascal, spbrk, srchr, srejoin, srejoinv, sspn, sstarts, ssub, stemplate, stoi, stoiradix, stok, strim, supper
bool scaselessmatch (cchar *s1, cchar *s2)

Compare strings ignoring case.

This is similar to scaselesscmp but it returns a boolean
Description:
Compare two strings ignoring case differences.
Parameters:
s1First string to compare.
s2Second string to compare.
Returns:
Returns true if the strings are equivalent, otherwise false.
API Stability:
Evolving.
See Also:
MprString, fmt, fmtv, itos, itosbuf, itosradix, mprEprintf, mprFprintf, mprPrintf, scamel, scaselesscmp, schr, sclone, scmp, scontains, scopy, sends, sfmt, sfmtv, shash, shashlower, sjoin, sjoinv, slen, slower, smatch, sncaselesscmp, snclone, sncmp, sncontains, sncopy, spascal, spbrk, srchr, srejoin, srejoinv, sspn, sstarts, ssub, stemplate, stoi, stoiradix, stok, strim, supper
char * schr (cchar *str, int c)

Find a character in a string.

Description:
This is a safe replacement for strchr. It can handle NULL args.
Parameters:
strString to examine.
cCharacter to search for.
Returns:
If the character is found, the call returns a reference to the character position in the string. Otherwise, returns NULL.
API Stability:
Stable.
See Also:
MprString, fmt, fmtv, itos, itosbuf, itosradix, mprEprintf, mprFprintf, mprPrintf, scamel, scaselesscmp, scaselessmatch, sclone, scmp, scontains, scopy, sends, sfmt, sfmtv, shash, shashlower, sjoin, sjoinv, slen, slower, smatch, sncaselesscmp, snclone, sncmp, sncontains, sncopy, spascal, spbrk, srchr, srejoin, srejoinv, sspn, sstarts, ssub, stemplate, stoi, stoiradix, stok, strim, supper
char * sclone (cchar *str)

Clone a string.

Description:
Copy a string into a newly allocated block.
Parameters:
strPointer to the block to duplicate.
Returns:
Returns a newly allocated string.
API Stability:
Stable.
See Also:
MprString, fmt, fmtv, itos, itosbuf, itosradix, mprEprintf, mprFprintf, mprPrintf, scamel, scaselesscmp, scaselessmatch, schr, scmp, scontains, scopy, sends, sfmt, sfmtv, shash, shashlower, sjoin, sjoinv, slen, slower, smatch, sncaselesscmp, snclone, sncmp, sncontains, sncopy, spascal, spbrk, srchr, srejoin, srejoinv, sspn, sstarts, ssub, stemplate, stoi, stoiradix, stok, strim, supper
int scmp (cchar *s1, cchar *s2)

Compare strings.

Description:
Compare two strings. This is a safe replacement for strcmp. It can handle null args.
Parameters:
s1First string to compare.
s2Second string to compare.
Returns:
Returns zero if the strings are identical. Return -1 if the first string is less than the second. Return 1 if the first string is greater than the second.
API Stability:
Stable.
See Also:
MprString, fmt, fmtv, itos, itosbuf, itosradix, mprEprintf, mprFprintf, mprPrintf, scamel, scaselesscmp, scaselessmatch, schr, sclone, scontains, scopy, sends, sfmt, sfmtv, shash, shashlower, sjoin, sjoinv, slen, slower, smatch, sncaselesscmp, snclone, sncmp, sncontains, sncopy, spascal, spbrk, srchr, srejoin, srejoinv, sspn, sstarts, ssub, stemplate, stoi, stoiradix, stok, strim, supper
char * scontains (cchar *str, cchar *pattern)

Find a pattern in a string.

Description:
Locate the first occurrence of pattern in a string.
Parameters:
strPointer to the string to search.
patternString pattern to search for.
Returns:
Returns a reference to the start of the pattern in the string. If not found, returns NULL.
API Stability:
Stable.
See Also:
MprString, fmt, fmtv, itos, itosbuf, itosradix, mprEprintf, mprFprintf, mprPrintf, scamel, scaselesscmp, scaselessmatch, schr, sclone, scmp, scopy, sends, sfmt, sfmtv, shash, shashlower, sjoin, sjoinv, slen, slower, smatch, sncaselesscmp, snclone, sncmp, sncontains, sncopy, spascal, spbrk, srchr, srejoin, srejoinv, sspn, sstarts, ssub, stemplate, stoi, stoiradix, stok, strim, supper
ssize scopy (char *dest, ssize destMax, cchar *src)

Copy a string.

Description:
Safe replacement for strcpy. Copy a string and ensure the destination buffer is not overflowed. The call returns the length of the resultant string or an error code if it will not fit into the target string. This is similar to strcpy, but it will enforce a maximum size for the copied string and will ensure it is always terminated with a null.
Parameters:
destPointer to a pointer that will hold the address of the allocated block.
destMaxMaximum size of the target string in characters.
srcString to copy.
Returns:
The number of characters in the target string.
API Stability:
Stable.
See Also:
MprString, fmt, fmtv, itos, itosbuf, itosradix, mprEprintf, mprFprintf, mprPrintf, scamel, scaselesscmp, scaselessmatch, schr, sclone, scmp, scontains, sends, sfmt, sfmtv, shash, shashlower, sjoin, sjoinv, slen, slower, smatch, sncaselesscmp, snclone, sncmp, sncontains, sncopy, spascal, spbrk, srchr, srejoin, srejoinv, sspn, sstarts, ssub, stemplate, stoi, stoiradix, stok, strim, supper
bool sends (cchar *str, cchar *suffix)

Test if the string ends with a given pattern.

Parameters:
strString to examine.
suffixPattern to search for.
Returns:
Returns TRUE if the pattern was found. Otherwise returns zero.
API Stability:
Stable.
See Also:
MprString, fmt, fmtv, itos, itosbuf, itosradix, mprEprintf, mprFprintf, mprPrintf, scamel, scaselesscmp, scaselessmatch, schr, sclone, scmp, scontains, scopy, sfmt, sfmtv, shash, shashlower, sjoin, sjoinv, slen, slower, smatch, sncaselesscmp, snclone, sncmp, sncontains, sncopy, spascal, spbrk, srchr, srejoin, srejoinv, sspn, sstarts, ssub, stemplate, stoi, stoiradix, stok, strim, supper
char * sfmt (cchar *fmt, ...)

Format a string.

This is a secure verion of printf that can handle null args
Description:
Format the given arguments according to the printf style format. See mprPrintf for a full list of the format specifies. This is a secure replacement for sprintf, it can handle null arguments without crashes.
Parameters:
fmtPrintf style format string.
...Variable arguments for the format string.
Returns:
Returns a newly allocated string.
API Stability:
Stable.
See Also:
MprString, fmt, fmtv, itos, itosbuf, itosradix, mprEprintf, mprFprintf, mprPrintf, scamel, scaselesscmp, scaselessmatch, schr, sclone, scmp, scontains, scopy, sends, sfmtv, shash, shashlower, sjoin, sjoinv, slen, slower, smatch, sncaselesscmp, snclone, sncmp, sncontains, sncopy, spascal, spbrk, srchr, srejoin, srejoinv, sspn, sstarts, ssub, stemplate, stoi, stoiradix, stok, strim, supper
char * sfmtv (cchar *fmt, va_list args)

Format a string.

This is a secure verion of printf that can handle null args
Description:
Format the given arguments according to the printf style format. See mprPrintf for a full list of the format specifies. This is a secure replacement for sprintf, it can handle null arguments without crashes.
Parameters:
fmtPrintf style format string.
argsVarargs argument obtained from va_start.
Returns:
Returns a newly allocated string.
API Stability:
Stable.
See Also:
MprString, fmt, fmtv, itos, itosbuf, itosradix, mprEprintf, mprFprintf, mprPrintf, scamel, scaselesscmp, scaselessmatch, schr, sclone, scmp, scontains, scopy, sends, sfmt, shash, shashlower, sjoin, sjoinv, slen, slower, smatch, sncaselesscmp, snclone, sncmp, sncontains, sncopy, spascal, spbrk, srchr, srejoin, srejoinv, sspn, sstarts, ssub, stemplate, stoi, stoiradix, stok, strim, supper
uint shash (cchar *str, ssize len)

Compute a hash code for a string.

Parameters:
strString to examine.
lenLength in characters of the string to include in the hash code.
Returns:
Returns an unsigned integer hash code.
API Stability:
Stable.
See Also:
MprString, fmt, fmtv, itos, itosbuf, itosradix, mprEprintf, mprFprintf, mprPrintf, scamel, scaselesscmp, scaselessmatch, schr, sclone, scmp, scontains, scopy, sends, sfmt, sfmtv, shashlower, sjoin, sjoinv, slen, slower, smatch, sncaselesscmp, snclone, sncmp, sncontains, sncopy, spascal, spbrk, srchr, srejoin, srejoinv, sspn, sstarts, ssub, stemplate, stoi, stoiradix, stok, strim, supper
uint shashlower (cchar *str, ssize len)

Compute a caseless hash code for a string.

Description:
This computes a hash code for the string after converting it to lower case.
Parameters:
strString to examine.
lenLength in characters of the string to include in the hash code.
Returns:
Returns an unsigned integer hash code.
API Stability:
Stable.
See Also:
MprString, fmt, fmtv, itos, itosbuf, itosradix, mprEprintf, mprFprintf, mprPrintf, scamel, scaselesscmp, scaselessmatch, schr, sclone, scmp, scontains, scopy, sends, sfmt, sfmtv, shash, sjoin, sjoinv, slen, slower, smatch, sncaselesscmp, snclone, sncmp, sncontains, sncopy, spascal, spbrk, srchr, srejoin, srejoinv, sspn, sstarts, ssub, stemplate, stoi, stoiradix, stok, strim, supper
char * sjoin (cchar *str, ...)

Catenate strings.

Description:
This catenates strings together with an optional string separator. If the separator is NULL, not separator is used. This call accepts a variable list of strings to append, terminated by a null argument.
Parameters:
strFirst string to catentate.
...Variable number of string arguments to append. Terminate list with NULL.
Returns:
Returns an allocated string.
API Stability:
Stable.
See Also:
MprString, fmt, fmtv, itos, itosbuf, itosradix, mprEprintf, mprFprintf, mprPrintf, scamel, scaselesscmp, scaselessmatch, schr, sclone, scmp, scontains, scopy, sends, sfmt, sfmtv, shash, shashlower, sjoinv, slen, slower, smatch, sncaselesscmp, snclone, sncmp, sncontains, sncopy, spascal, spbrk, srchr, srejoin, srejoinv, sspn, sstarts, ssub, stemplate, stoi, stoiradix, stok, strim, supper
char * sjoinv (cchar *str, va_list args)

Catenate strings.

Description:
This catenates strings together with an optional string separator. If the separator is NULL, not separator is used. This call accepts a variable list of strings to append, terminated by a null argument.
Parameters:
strFirst string to catentate.
argsVarargs argument obtained from va_start.
Returns:
Returns an allocated string.
API Stability:
Stable.
See Also:
MprString, fmt, fmtv, itos, itosbuf, itosradix, mprEprintf, mprFprintf, mprPrintf, scamel, scaselesscmp, scaselessmatch, schr, sclone, scmp, scontains, scopy, sends, sfmt, sfmtv, shash, shashlower, sjoin, slen, slower, smatch, sncaselesscmp, snclone, sncmp, sncontains, sncopy, spascal, spbrk, srchr, srejoin, srejoinv, sspn, sstarts, ssub, stemplate, stoi, stoiradix, stok, strim, supper
ssize slen (cchar *str)

Return the length of a string.

Description:
Safe replacement for strlen. This call returns the length of a string and tests if the length is less than a given maximum. It will return zero for NULL args.
Parameters:
strString to measure.
Returns:
The length of the string.
API Stability:
Stable.
See Also:
MprString, fmt, fmtv, itos, itosbuf, itosradix, mprEprintf, mprFprintf, mprPrintf, scamel, scaselesscmp, scaselessmatch, schr, sclone, scmp, scontains, scopy, sends, sfmt, sfmtv, shash, shashlower, sjoin, sjoinv, slower, smatch, sncaselesscmp, snclone, sncmp, sncontains, sncopy, spascal, spbrk, srchr, srejoin, srejoinv, sspn, sstarts, ssub, stemplate, stoi, stoiradix, stok, strim, supper
char * slower (cchar *str)

Convert a string to lower case.

Description:
Convert a string to its lower case equivalent.
Parameters:
strString to convert.
API Stability:
Stable.
See Also:
MprString, fmt, fmtv, itos, itosbuf, itosradix, mprEprintf, mprFprintf, mprPrintf, scamel, scaselesscmp, scaselessmatch, schr, sclone, scmp, scontains, scopy, sends, sfmt, sfmtv, shash, shashlower, sjoin, sjoinv, slen, smatch, sncaselesscmp, snclone, sncmp, sncontains, sncopy, spascal, spbrk, srchr, srejoin, srejoinv, sspn, sstarts, ssub, stemplate, stoi, stoiradix, stok, strim, supper
bool smatch (cchar *s1, cchar *s2)

Compare strings.

Description:
Compare two strings. This is similar to scmp but it returns a boolean.
Parameters:
s1First string to compare.
s2Second string to compare.
Returns:
Returns true if the strings are equivalent, otherwise false.
API Stability:
Stable.
See Also:
MprString, fmt, fmtv, itos, itosbuf, itosradix, mprEprintf, mprFprintf, mprPrintf, scamel, scaselesscmp, scaselessmatch, schr, sclone, scmp, scontains, scopy, sends, sfmt, sfmtv, shash, shashlower, sjoin, sjoinv, slen, slower, sncaselesscmp, snclone, sncmp, sncontains, sncopy, spascal, spbrk, srchr, srejoin, srejoinv, sspn, sstarts, ssub, stemplate, stoi, stoiradix, stok, strim, supper
int sncaselesscmp (cchar *s1, cchar *s2, ssize len)

Compare strings ignoring case.

Description:
Compare two strings ignoring case differences for a given string length. This call operates similarly to strncasecmp.
Parameters:
s1First string to compare.
s2Second string to compare.
lenLength of characters to compare.
Returns:
Returns zero if the strings are equivalent, < 0 if s1 sorts lower than s2 in the collating sequence or > 0 if it sorts higher.
API Stability:
Stable.
See Also:
MprString, fmt, fmtv, itos, itosbuf, itosradix, mprEprintf, mprFprintf, mprPrintf, scamel, scaselesscmp, scaselessmatch, schr, sclone, scmp, scontains, scopy, sends, sfmt, sfmtv, shash, shashlower, sjoin, sjoinv, slen, slower, smatch, snclone, sncmp, sncontains, sncopy, spascal, spbrk, srchr, srejoin, srejoinv, sspn, sstarts, ssub, stemplate, stoi, stoiradix, stok, strim, supper
char * snclone (cchar *str, ssize len)

Clone a substring.

Description:
Copy a substring into a newly allocated block.
Parameters:
strPointer to the block to duplicate.
lenNumber of bytes to copy. The actual length copied is the minimum of the given length and the length of the supplied string. The result is null terminated.
Returns:
Returns a newly allocated string.
API Stability:
Stable.
See Also:
MprString, fmt, fmtv, itos, itosbuf, itosradix, mprEprintf, mprFprintf, mprPrintf, scamel, scaselesscmp, scaselessmatch, schr, sclone, scmp, scontains, scopy, sends, sfmt, sfmtv, shash, shashlower, sjoin, sjoinv, slen, slower, smatch, sncaselesscmp, sncmp, sncontains, sncopy, spascal, spbrk, srchr, srejoin, srejoinv, sspn, sstarts, ssub, stemplate, stoi, stoiradix, stok, strim, supper
int sncmp (cchar *s1, cchar *s2, ssize len)

Compare strings.

Description:
Compare two strings for a given string length. This call operates similarly to strncmp.
Parameters:
s1First string to compare.
s2Second string to compare.
lenLength of characters to compare.
Returns:
Returns zero if the strings are equivalent, < 0 if s1 sorts lower than s2 in the collating sequence or > 0 if it sorts higher.
API Stability:
Stable.
See Also:
MprString, fmt, fmtv, itos, itosbuf, itosradix, mprEprintf, mprFprintf, mprPrintf, scamel, scaselesscmp, scaselessmatch, schr, sclone, scmp, scontains, scopy, sends, sfmt, sfmtv, shash, shashlower, sjoin, sjoinv, slen, slower, smatch, sncaselesscmp, snclone, sncontains, sncopy, spascal, spbrk, srchr, srejoin, srejoinv, sspn, sstarts, ssub, stemplate, stoi, stoiradix, stok, strim, supper
char * sncontains (cchar *str, cchar *pattern, ssize limit)

Find a pattern in a string with a limit.

Description:
Locate the first occurrence of pattern in a string, but do not search more than the given character limit.
Parameters:
strPointer to the string to search.
patternString pattern to search for.
limitCount of characters in the string to search.
Returns:
Returns a reference to the start of the pattern in the string. If not found, returns NULL.
API Stability:
Stable.
See Also:
MprString, fmt, fmtv, itos, itosbuf, itosradix, mprEprintf, mprFprintf, mprPrintf, scamel, scaselesscmp, scaselessmatch, schr, sclone, scmp, scontains, scopy, sends, sfmt, sfmtv, shash, shashlower, sjoin, sjoinv, slen, slower, smatch, sncaselesscmp, snclone, sncmp, sncopy, spascal, spbrk, srchr, srejoin, srejoinv, sspn, sstarts, ssub, stemplate, stoi, stoiradix, stok, strim, supper
ssize sncopy (char *dest, ssize destMax, cchar *src, ssize len)

Copy characters from a string.

Description:
Safe replacement for strncpy. Copy bytes from a string and ensure the target string is not overflowed. The call returns the length of the resultant string or an error code if it will not fit into the target string. This is similar to strcpy, but it will enforce a maximum size for the copied string and will ensure it is terminated with a null.
Parameters:
destPointer to a pointer that will hold the address of the allocated block.
destMaxMaximum size of the target string in characters.
srcString to copy.
lenMaximum count of characters to copy.
Returns:
Returns a reference to the destination if successful or NULL if the string won't fit.
API Stability:
Stable.
See Also:
MprString, fmt, fmtv, itos, itosbuf, itosradix, mprEprintf, mprFprintf, mprPrintf, scamel, scaselesscmp, scaselessmatch, schr, sclone, scmp, scontains, scopy, sends, sfmt, sfmtv, shash, shashlower, sjoin, sjoinv, slen, slower, smatch, sncaselesscmp, snclone, sncmp, sncontains, spascal, spbrk, srchr, srejoin, srejoinv, sspn, sstarts, ssub, stemplate, stoi, stoiradix, stok, strim, supper
char * spascal (cchar *str)

Create a Pascal case version of the string.

Description:
Copy a string into a newly allocated block and make the first character upper case.
Parameters:
strPointer to the block to duplicate.
Returns:
Returns a newly allocated string.
API Stability:
Stable.
See Also:
MprString, fmt, fmtv, itos, itosbuf, itosradix, mprEprintf, mprFprintf, mprPrintf, scamel, scaselesscmp, scaselessmatch, schr, sclone, scmp, scontains, scopy, sends, sfmt, sfmtv, shash, shashlower, sjoin, sjoinv, slen, slower, smatch, sncaselesscmp, snclone, sncmp, sncontains, sncopy, spbrk, srchr, srejoin, srejoinv, sspn, sstarts, ssub, stemplate, stoi, stoiradix, stok, strim, supper
char * spbrk (cchar *str, cchar *set)

Locate the a character in a string.

Description:
This locates in the string the first occurence of any character from a given set of characters.
Parameters:
strString to examine.
setSet of characters to scan for.
Returns:
Returns a reference to the first character from the given set. Returns NULL if none found.
API Stability:
Stable.
See Also:
MprString, fmt, fmtv, itos, itosbuf, itosradix, mprEprintf, mprFprintf, mprPrintf, scamel, scaselesscmp, scaselessmatch, schr, sclone, scmp, scontains, scopy, sends, sfmt, sfmtv, shash, shashlower, sjoin, sjoinv, slen, slower, smatch, sncaselesscmp, snclone, sncmp, sncontains, sncopy, spascal, srchr, srejoin, srejoinv, sspn, sstarts, ssub, stemplate, stoi, stoiradix, stok, strim, supper
char * srchr (cchar *str, int c)

Find a character in a string by searching backwards.

Description:
This locates in the string the last occurence of a character.
Parameters:
strString to examine.
cCharacter to scan for.
Returns:
Returns a reference in the string to the requested character. Returns NULL if none found.
API Stability:
Stable.
See Also:
MprString, fmt, fmtv, itos, itosbuf, itosradix, mprEprintf, mprFprintf, mprPrintf, scamel, scaselesscmp, scaselessmatch, schr, sclone, scmp, scontains, scopy, sends, sfmt, sfmtv, shash, shashlower, sjoin, sjoinv, slen, slower, smatch, sncaselesscmp, snclone, sncmp, sncontains, sncopy, spascal, spbrk, srejoin, srejoinv, sspn, sstarts, ssub, stemplate, stoi, stoiradix, stok, strim, supper
char * srejoin (char *buf, ...)

Append strings to an existing string and reallocate as required.

Description:
Append a list of strings to an existing string. The list of strings is terminated by a null argument. The call returns the size of the allocated block.
Parameters:
bufExisting (allocated) string to reallocate. May be null. May not be a string literal.
...Variable number of string arguments to append. Terminate list with NULL.
Returns:
Returns an allocated string.
API Stability:
Stable.
See Also:
MprString, fmt, fmtv, itos, itosbuf, itosradix, mprEprintf, mprFprintf, mprPrintf, scamel, scaselesscmp, scaselessmatch, schr, sclone, scmp, scontains, scopy, sends, sfmt, sfmtv, shash, shashlower, sjoin, sjoinv, slen, slower, smatch, sncaselesscmp, snclone, sncmp, sncontains, sncopy, spascal, spbrk, srchr, srejoinv, sspn, sstarts, ssub, stemplate, stoi, stoiradix, stok, strim, supper
char * srejoinv (char *buf, va_list args)

Append strings to an existing string and reallocate as required.

Description:
Append a list of strings to an existing string. The list of strings is terminated by a null argument. The call returns the size of the allocated block.
Parameters:
bufExisting (allocated) string to reallocate. May be null. May not be a string literal.
argsVarargs argument obtained from va_start.
Returns:
Returns an allocated string.
API Stability:
Stable.
See Also:
MprString, fmt, fmtv, itos, itosbuf, itosradix, mprEprintf, mprFprintf, mprPrintf, scamel, scaselesscmp, scaselessmatch, schr, sclone, scmp, scontains, scopy, sends, sfmt, sfmtv, shash, shashlower, sjoin, sjoinv, slen, slower, smatch, sncaselesscmp, snclone, sncmp, sncontains, sncopy, spascal, spbrk, srchr, srejoin, sspn, sstarts, ssub, stemplate, stoi, stoiradix, stok, strim, supper
ssize sspn (cchar *str, cchar *set)

Find the end of a spanning prefix.

Description:
This scans the given string for characters from the set and returns a reference to the first character not in the set.
Parameters:
strString to examine.
setSet of characters to span.
Returns:
Returns a reference to the first character after the spanning set.
API Stability:
Stable.
See Also:
MprString, fmt, fmtv, itos, itosbuf, itosradix, mprEprintf, mprFprintf, mprPrintf, scamel, scaselesscmp, scaselessmatch, schr, sclone, scmp, scontains, scopy, sends, sfmt, sfmtv, shash, shashlower, sjoin, sjoinv, slen, slower, smatch, sncaselesscmp, snclone, sncmp, sncontains, sncopy, spascal, spbrk, srchr, srejoin, srejoinv, sstarts, ssub, stemplate, stoi, stoiradix, stok, strim, supper
bool sstarts (cchar *str, cchar *prefix)

Test if the string starts with a given pattern.

Parameters:
strString to examine.
prefixPattern to search for.
Returns:
Returns TRUE if the pattern was found. Otherwise returns zero.
API Stability:
Stable.
See Also:
MprString, fmt, fmtv, itos, itosbuf, itosradix, mprEprintf, mprFprintf, mprPrintf, scamel, scaselesscmp, scaselessmatch, schr, sclone, scmp, scontains, scopy, sends, sfmt, sfmtv, shash, shashlower, sjoin, sjoinv, slen, slower, smatch, sncaselesscmp, snclone, sncmp, sncontains, sncopy, spascal, spbrk, srchr, srejoin, srejoinv, sspn, ssub, stemplate, stoi, stoiradix, stok, strim, supper
char * ssub (cchar *str, ssize offset, ssize length)

Create a substring.

Parameters:
strString to examine.
offsetStarting offset within str for the beginning of the substring.
lengthLength of the substring in characters.
Returns:
Returns a newly allocated substring.
API Stability:
Stable.
See Also:
MprString, fmt, fmtv, itos, itosbuf, itosradix, mprEprintf, mprFprintf, mprPrintf, scamel, scaselesscmp, scaselessmatch, schr, sclone, scmp, scontains, scopy, sends, sfmt, sfmtv, shash, shashlower, sjoin, sjoinv, slen, slower, smatch, sncaselesscmp, snclone, sncmp, sncontains, sncopy, spascal, spbrk, srchr, srejoin, srejoinv, sspn, sstarts, stemplate, stoi, stoiradix, stok, strim, supper
char * stemplate (cchar *str, struct MprHash *tokens)

Replace template tokens in a string with values from a lookup table.

Tokens are ${variable} references
Parameters:
strString to expand.
tokensHash table of token values to use.
Returns:
An expanded string. May return the original string if no "$" references are present.
API Stability:
Stable.
See Also:
MprString, fmt, fmtv, itos, itosbuf, itosradix, mprEprintf, mprFprintf, mprPrintf, scamel, scaselesscmp, scaselessmatch, schr, sclone, scmp, scontains, scopy, sends, sfmt, sfmtv, shash, shashlower, sjoin, sjoinv, slen, slower, smatch, sncaselesscmp, snclone, sncmp, sncontains, sncopy, spascal, spbrk, srchr, srejoin, srejoinv, sspn, sstarts, ssub, stoi, stoiradix, stok, strim, supper
int64 stoi (cchar *str)

Convert a string to an integer.

Description:
This call converts the supplied string to an integer using base 10.
Parameters:
strPointer to the string to parse.
Returns:
The integer equivalent value of the string.
API Stability:
Stable.
See Also:
MprString, fmt, fmtv, itos, itosbuf, itosradix, mprEprintf, mprFprintf, mprPrintf, scamel, scaselesscmp, scaselessmatch, schr, sclone, scmp, scontains, scopy, sends, sfmt, sfmtv, shash, shashlower, sjoin, sjoinv, slen, slower, smatch, sncaselesscmp, snclone, sncmp, sncontains, sncopy, spascal, spbrk, srchr, srejoin, srejoinv, sspn, sstarts, ssub, stemplate, stoiradix, stok, strim, supper
int64 stoiradix (cchar *str, int radix, int *err)

Convert a string to an integer.

Description:
This call converts the supplied string to an integer using the specified radix (base).
Parameters:
strPointer to the string to parse.
radixBase to use when parsing the string.
errReturn error code. Set to 0 if successful.
Returns:
The integer equivalent value of the string.
See Also:
MprString, fmt, fmtv, itos, itosbuf, itosradix, mprEprintf, mprFprintf, mprPrintf, scamel, scaselesscmp, scaselessmatch, schr, sclone, scmp, scontains, scopy, sends, sfmt, sfmtv, shash, shashlower, sjoin, sjoinv, slen, slower, smatch, sncaselesscmp, snclone, sncmp, sncontains, sncopy, spascal, spbrk, srchr, srejoin, srejoinv, sspn, sstarts, ssub, stemplate, stoi, stok, strim, supper
char * stok (char *str, cchar *delim, char **last)

Tokenize a string.

Description:
Split a string into tokens.
Parameters:
strString to tokenize.
delimSet of characters that are used as token separators.
lastLast token pointer.
Returns:
Returns a pointer to the next token.
API Stability:
Stable.
See Also:
MprString, fmt, fmtv, itos, itosbuf, itosradix, mprEprintf, mprFprintf, mprPrintf, scamel, scaselesscmp, scaselessmatch, schr, sclone, scmp, scontains, scopy, sends, sfmt, sfmtv, shash, shashlower, sjoin, sjoinv, slen, slower, smatch, sncaselesscmp, snclone, sncmp, sncontains, sncopy, spascal, spbrk, srchr, srejoin, srejoinv, sspn, sstarts, ssub, stemplate, stoi, stoiradix, strim, supper
char * strim (cchar *str, cchar *set, int where)

Trim a string.

Description:
Trim leading and trailing characters off a string.
Parameters:
strString to trim.
setString of characters to remove.
whereFlags to indicate trim from the start, end or both. Use MPR_TRIM_START, MPR_TRIM_END, MPR_TRIM_BOTH.
Returns:
Returns a pointer to the trimmed string. May not equal str.
API Stability:
Stable.
See Also:
MprString, fmt, fmtv, itos, itosbuf, itosradix, mprEprintf, mprFprintf, mprPrintf, scamel, scaselesscmp, scaselessmatch, schr, sclone, scmp, scontains, scopy, sends, sfmt, sfmtv, shash, shashlower, sjoin, sjoinv, slen, slower, smatch, sncaselesscmp, snclone, sncmp, sncontains, sncopy, spascal, spbrk, srchr, srejoin, srejoinv, sspn, sstarts, ssub, stemplate, stoi, stoiradix, stok, supper
char * supper (cchar *str)

Convert a string to upper case.

Description:
Convert a string to its upper case equivalent.
Parameters:
strString to convert.
Returns:
Returns a pointer to the converted string. Will always equal str.
API Stability:
Stable.
See Also:
MprString, fmt, fmtv, itos, itosbuf, itosradix, mprEprintf, mprFprintf, mprPrintf, scamel, scaselesscmp, scaselessmatch, schr, sclone, scmp, scontains, scopy, sends, sfmt, sfmtv, shash, shashlower, sjoin, sjoinv, slen, slower, smatch, sncaselesscmp, snclone, sncmp, sncontains, sncopy, spascal, spbrk, srchr, srejoin, srejoinv, sspn, sstarts, ssub, stemplate, stoi, stoiradix, stok, strim

MprSynch

MprSynch

Multithreaded Synchronization Services.

See Also:
MprCond, MprMutex, MprSpin, mprAtomicAdd, mprAtomicAdd64, mprAtomicBarrier, mprAtomicCas, mprAtomicExchange, mprAtomicListInsert, mprCreateCond, mprCreateLock, mprCreateSpinLock, mprGlobalLock, mprGlobalUnlock, mprInitLock, mprInitSpinLock, mprLock, mprResetCond, mprSignalCond, mprSignalMultiCond, mprSpinLock, mprSpinUnlock, mprTryLock, mprTrySpinLock, mprUnlock, mprWaitForCond, mprWaitForMultiCond
API Stability:
Internal.
Fields:
void mprAtomicAdd (volatile int *target, int value)

Atomic Add.

This is a lock free function
Parameters:
targetAddress of the target word to add to.
valueValue to add to the target.
API Stability:
Evolving.
See Also:
MprCond, MprMutex, MprSpin, mprAtomicAdd64, mprAtomicBarrier, mprAtomicCas, mprAtomicExchange, mprAtomicListInsert, mprCreateCond, mprCreateLock, mprCreateSpinLock, mprGlobalLock, mprGlobalUnlock, mprInitLock, mprInitSpinLock, mprLock, mprResetCond, mprSignalCond, mprSignalMultiCond, mprSpinLock, mprSpinUnlock, mprTryLock, mprTrySpinLock, mprUnlock, mprWaitForCond, mprWaitForMultiCond
void mprAtomicAdd64 (volatile int64 *target, int value)

Atomic 64 bit Add.

This is a lock free function
Parameters:
targetAddress of the target word to add to.
valueValue to add to the target.
API Stability:
Evolving.
See Also:
MprCond, MprMutex, MprSpin, mprAtomicAdd, mprAtomicBarrier, mprAtomicCas, mprAtomicExchange, mprAtomicListInsert, mprCreateCond, mprCreateLock, mprCreateSpinLock, mprGlobalLock, mprGlobalUnlock, mprInitLock, mprInitSpinLock, mprLock, mprResetCond, mprSignalCond, mprSignalMultiCond, mprSpinLock, mprSpinUnlock, mprTryLock, mprTrySpinLock, mprUnlock, mprWaitForCond, mprWaitForMultiCond
void mprAtomicBarrier ()

Apply a full (read+write) memory barrier.

API Stability:
Evolving.
See Also:
MprCond, MprMutex, MprSpin, mprAtomicAdd, mprAtomicAdd64, mprAtomicCas, mprAtomicExchange, mprAtomicListInsert, mprCreateCond, mprCreateLock, mprCreateSpinLock, mprGlobalLock, mprGlobalUnlock, mprInitLock, mprInitSpinLock, mprLock, mprResetCond, mprSignalCond, mprSignalMultiCond, mprSpinLock, mprSpinUnlock, mprTryLock, mprTrySpinLock, mprUnlock, mprWaitForCond, mprWaitForMultiCond
int mprAtomicCas (void *volatile *target, void *expected, cvoid *value)

Atomic Compare and Swap.

This is a lock free function
Parameters:
targetAddress of the target word to swap.
expectedExpected value of the target.
valueNew value to store at the target.
Returns:
TRUE if the swap was successful.
API Stability:
Evolving.
See Also:
MprCond, MprMutex, MprSpin, mprAtomicAdd, mprAtomicAdd64, mprAtomicBarrier, mprAtomicExchange, mprAtomicListInsert, mprCreateCond, mprCreateLock, mprCreateSpinLock, mprGlobalLock, mprGlobalUnlock, mprInitLock, mprInitSpinLock, mprLock, mprResetCond, mprSignalCond, mprSignalMultiCond, mprSpinLock, mprSpinUnlock, mprTryLock, mprTrySpinLock, mprUnlock, mprWaitForCond, mprWaitForMultiCond
void * mprAtomicExchange (void *volatile *target, cvoid *value)

Exchange the target and a value.

Parameters:
targetAddress of the target word to exchange.
valueValue to store to the target.
API Stability:
Evolving.
See Also:
MprCond, MprMutex, MprSpin, mprAtomicAdd, mprAtomicAdd64, mprAtomicBarrier, mprAtomicCas, mprAtomicListInsert, mprCreateCond, mprCreateLock, mprCreateSpinLock, mprGlobalLock, mprGlobalUnlock, mprInitLock, mprInitSpinLock, mprLock, mprResetCond, mprSignalCond, mprSignalMultiCond, mprSpinLock, mprSpinUnlock, mprTryLock, mprTrySpinLock, mprUnlock, mprWaitForCond, mprWaitForMultiCond
void mprAtomicListInsert (void *volatile *head, volatile void **link, void *item)

Atomic list insertion.

Inserts "item" at the "head" of the list. The "link" field is the next field in item. This is a lock-free function
Parameters:
headlist head.
linkReference to the list head link field.
itemItem to insert.
API Stability:
Evolving.
See Also:
MprCond, MprMutex, MprSpin, mprAtomicAdd, mprAtomicAdd64, mprAtomicBarrier, mprAtomicCas, mprAtomicExchange, mprCreateCond, mprCreateLock, mprCreateSpinLock, mprGlobalLock, mprGlobalUnlock, mprInitLock, mprInitSpinLock, mprLock, mprResetCond, mprSignalCond, mprSignalMultiCond, mprSpinLock, mprSpinUnlock, mprTryLock, mprTrySpinLock, mprUnlock, mprWaitForCond, mprWaitForMultiCond
MprCond * mprCreateCond ()

Create a condition lock variable.

Description:
This call creates a condition variable object that can be used in mprWaitForCond and mprSignalCond calls.
API Stability:
Stable.
See Also:
MprCond, MprMutex, MprSpin, mprAtomicAdd, mprAtomicAdd64, mprAtomicBarrier, mprAtomicCas, mprAtomicExchange, mprAtomicListInsert, mprCreateLock, mprCreateSpinLock, mprGlobalLock, mprGlobalUnlock, mprInitLock, mprInitSpinLock, mprLock, mprResetCond, mprSignalCond, mprSignalMultiCond, mprSpinLock, mprSpinUnlock, mprTryLock, mprTrySpinLock, mprUnlock, mprWaitForCond, mprWaitForMultiCond
MprMutex * mprCreateLock ()

Create a Mutex lock object.

Description:
This call creates a Mutex lock object that can be used in mprLock, mprTryLock and mprUnlock calls.
API Stability:
Stable.
See Also:
MprCond, MprMutex, MprSpin, mprAtomicAdd, mprAtomicAdd64, mprAtomicBarrier, mprAtomicCas, mprAtomicExchange, mprAtomicListInsert, mprCreateCond, mprCreateSpinLock, mprGlobalLock, mprGlobalUnlock, mprInitLock, mprInitSpinLock, mprLock, mprResetCond, mprSignalCond, mprSignalMultiCond, mprSpinLock, mprSpinUnlock, mprTryLock, mprTrySpinLock, mprUnlock, mprWaitForCond, mprWaitForMultiCond
MprSpin * mprCreateSpinLock ()

Create a spin lock lock object.

Description:
This call creates a spinlock object that can be used in mprSpinLock, and mprSpinUnlock calls. Spin locks using MprSpin are much faster than MprMutex based locks on some systems.
API Stability:
Stable.
See Also:
MprCond, MprMutex, MprSpin, mprAtomicAdd, mprAtomicAdd64, mprAtomicBarrier, mprAtomicCas, mprAtomicExchange, mprAtomicListInsert, mprCreateCond, mprCreateLock, mprGlobalLock, mprGlobalUnlock, mprInitLock, mprInitSpinLock, mprLock, mprResetCond, mprSignalCond, mprSignalMultiCond, mprSpinLock, mprSpinUnlock, mprTryLock, mprTrySpinLock, mprUnlock, mprWaitForCond, mprWaitForMultiCond
void mprGlobalLock ()

Globally lock the application.

Description:
This call asserts the application global lock so that other threads calling mprGlobalLock will block until the current thread calls mprGlobalUnlock. WARNING: Use this API very sparingly.
API Stability:
Stable.
See Also:
MprCond, MprMutex, MprSpin, mprAtomicAdd, mprAtomicAdd64, mprAtomicBarrier, mprAtomicCas, mprAtomicExchange, mprAtomicListInsert, mprCreateCond, mprCreateLock, mprCreateSpinLock, mprGlobalUnlock, mprInitLock, mprInitSpinLock, mprLock, mprResetCond, mprSignalCond, mprSignalMultiCond, mprSpinLock, mprSpinUnlock, mprTryLock, mprTrySpinLock, mprUnlock, mprWaitForCond, mprWaitForMultiCond
void mprGlobalUnlock ()

Unlock the global mutex.

Description:
This call unlocks the global mutex previously locked via mprGlobalLock.
API Stability:
Stable.
See Also:
MprCond, MprMutex, MprSpin, mprAtomicAdd, mprAtomicAdd64, mprAtomicBarrier, mprAtomicCas, mprAtomicExchange, mprAtomicListInsert, mprCreateCond, mprCreateLock, mprCreateSpinLock, mprGlobalLock, mprInitLock, mprInitSpinLock, mprLock, mprResetCond, mprSignalCond, mprSignalMultiCond, mprSpinLock, mprSpinUnlock, mprTryLock, mprTrySpinLock, mprUnlock, mprWaitForCond, mprWaitForMultiCond
MprMutex * mprInitLock (MprMutex *mutex)

Initialize a statically allocated Mutex lock object.

Description:
This call initialized a Mutex lock object without allocation. The object can then be used used in mprLock, mprTryLock and mprUnlock calls.
Parameters:
mutexReference to an MprMutex structure to initialize.
Returns:
A reference to the supplied mutex. Returns null on errors.
API Stability:
Stable.
See Also:
MprCond, MprMutex, MprSpin, mprAtomicAdd, mprAtomicAdd64, mprAtomicBarrier, mprAtomicCas, mprAtomicExchange, mprAtomicListInsert, mprCreateCond, mprCreateLock, mprCreateSpinLock, mprGlobalLock, mprGlobalUnlock, mprInitSpinLock, mprLock, mprResetCond, mprSignalCond, mprSignalMultiCond, mprSpinLock, mprSpinUnlock, mprTryLock, mprTrySpinLock, mprUnlock, mprWaitForCond, mprWaitForMultiCond
MprSpin * mprInitSpinLock (MprSpin *lock)

Initialize a statically allocated spinlock object.

Description:
This call initialized a spinlock lock object without allocation. The object can then be used used in mprSpinLock and mprSpinUnlock calls.
Parameters:
lockReference to a static MprSpin object.
Returns:
A reference to the MprSpin object. Returns null on errors.
See Also:
MprCond, MprMutex, MprSpin, mprAtomicAdd, mprAtomicAdd64, mprAtomicBarrier, mprAtomicCas, mprAtomicExchange, mprAtomicListInsert, mprCreateCond, mprCreateLock, mprCreateSpinLock, mprGlobalLock, mprGlobalUnlock, mprInitLock, mprLock, mprResetCond, mprSignalCond, mprSignalMultiCond, mprSpinLock, mprSpinUnlock, mprTryLock, mprTrySpinLock, mprUnlock, mprWaitForCond, mprWaitForMultiCond
void mprLock (MprMutex *lock)

Lock access.

Description:
This call asserts a lock on the given lock mutex so that other threads calling mprLock will block until the current thread calls mprUnlock.
API Stability:
Stable.
See Also:
MprCond, MprMutex, MprSpin, mprAtomicAdd, mprAtomicAdd64, mprAtomicBarrier, mprAtomicCas, mprAtomicExchange, mprAtomicListInsert, mprCreateCond, mprCreateLock, mprCreateSpinLock, mprGlobalLock, mprGlobalUnlock, mprInitLock, mprInitSpinLock, mprResetCond, mprSignalCond, mprSignalMultiCond, mprSpinLock, mprSpinUnlock, mprTryLock, mprTrySpinLock, mprUnlock, mprWaitForCond, mprWaitForMultiCond
void mprResetCond (MprCond *cond)

Reset a condition variable.

This sets the condition variable to the unsignalled condition
Parameters:
condCondition variable object created via mprCreateCond
API Stability:
Stable.
See Also:
MprCond, MprMutex, MprSpin, mprAtomicAdd, mprAtomicAdd64, mprAtomicBarrier, mprAtomicCas, mprAtomicExchange, mprAtomicListInsert, mprCreateCond, mprCreateLock, mprCreateSpinLock, mprGlobalLock, mprGlobalUnlock, mprInitLock, mprInitSpinLock, mprLock, mprSignalCond, mprSignalMultiCond, mprSpinLock, mprSpinUnlock, mprTryLock, mprTrySpinLock, mprUnlock, mprWaitForCond, mprWaitForMultiCond
void mprSignalCond (MprCond *cond)

Signal a condition lock variable.

Description:
Signal a condition variable and set it to the triggered status. Existing or future caller of mprWaitForCond will be awakened. The condition variable will be automatically reset when the waiter awakes. Should only be used for single waiters. Use mprSignalMultiCond for use with multiple waiters.
Parameters:
condCondition variable object created via mprCreateCond
API Stability:
Stable.
See Also:
MprCond, MprMutex, MprSpin, mprAtomicAdd, mprAtomicAdd64, mprAtomicBarrier, mprAtomicCas, mprAtomicExchange, mprAtomicListInsert, mprCreateCond, mprCreateLock, mprCreateSpinLock, mprGlobalLock, mprGlobalUnlock, mprInitLock, mprInitSpinLock, mprLock, mprResetCond, mprSignalMultiCond, mprSpinLock, mprSpinUnlock, mprTryLock, mprTrySpinLock, mprUnlock, mprWaitForCond, mprWaitForMultiCond
void mprSignalMultiCond (MprCond *cond)

Signal a condition lock variable for use with multiple waiters.

Description:
Signal a condition variable and set it to the triggered status. Existing or future callers of mprWaitForCond will be awakened. The conditional variable will not be automatically reset and must be reset manually via mprResetCond.
Parameters:
condCondition variable object created via mprCreateCond
API Stability:
Stable.
See Also:
MprCond, MprMutex, MprSpin, mprAtomicAdd, mprAtomicAdd64, mprAtomicBarrier, mprAtomicCas, mprAtomicExchange, mprAtomicListInsert, mprCreateCond, mprCreateLock, mprCreateSpinLock, mprGlobalLock, mprGlobalUnlock, mprInitLock, mprInitSpinLock, mprLock, mprResetCond, mprSignalCond, mprSpinLock, mprSpinUnlock, mprTryLock, mprTrySpinLock, mprUnlock, mprWaitForCond, mprWaitForMultiCond
void mprSpinLock (MprSpin *lock)

Lock a spinlock.

Description:
This call asserts a lock on the given spinlock so that other threads calling mprSpinLock will block until the curren thread calls mprSpinUnlock.
API Stability:
Stable.
See Also:
MprCond, MprMutex, MprSpin, mprAtomicAdd, mprAtomicAdd64, mprAtomicBarrier, mprAtomicCas, mprAtomicExchange, mprAtomicListInsert, mprCreateCond, mprCreateLock, mprCreateSpinLock, mprGlobalLock, mprGlobalUnlock, mprInitLock, mprInitSpinLock, mprLock, mprResetCond, mprSignalCond, mprSignalMultiCond, mprSpinUnlock, mprTryLock, mprTrySpinLock, mprUnlock, mprWaitForCond, mprWaitForMultiCond
void mprSpinUnlock (MprSpin *lock)

Unlock a spinlock.

Description:
This call unlocks a spinlock previously locked via mprSpinLock or mprTrySpinLock.
API Stability:
Stable.
See Also:
MprCond, MprMutex, MprSpin, mprAtomicAdd, mprAtomicAdd64, mprAtomicBarrier, mprAtomicCas, mprAtomicExchange, mprAtomicListInsert, mprCreateCond, mprCreateLock, mprCreateSpinLock, mprGlobalLock, mprGlobalUnlock, mprInitLock, mprInitSpinLock, mprLock, mprResetCond, mprSignalCond, mprSignalMultiCond, mprSpinLock, mprTryLock, mprTrySpinLock, mprUnlock, mprWaitForCond, mprWaitForMultiCond
bool mprTryLock (MprMutex *lock)

Attempt to lock access.

Description:
This call attempts to assert a lock on the given lock mutex so that other threads calling mprLock or mprTryLock will block until the current thread calls mprUnlock.
Returns:
Returns zero if the successful in locking the mutex. Returns a negative MPR error code if unsuccessful.
API Stability:
Stable.
See Also:
MprCond, MprMutex, MprSpin, mprAtomicAdd, mprAtomicAdd64, mprAtomicBarrier, mprAtomicCas, mprAtomicExchange, mprAtomicListInsert, mprCreateCond, mprCreateLock, mprCreateSpinLock, mprGlobalLock, mprGlobalUnlock, mprInitLock, mprInitSpinLock, mprLock, mprResetCond, mprSignalCond, mprSignalMultiCond, mprSpinLock, mprSpinUnlock, mprTrySpinLock, mprUnlock, mprWaitForCond, mprWaitForMultiCond
bool mprTrySpinLock (MprSpin *lock)

Attempt to lock access on a spin lock.

Description:
This call attempts to assert a lock on the given spin lock so that other threads calling mprSpinLock or mprTrySpinLock will block until the current thread calls mprSpinUnlock.
Returns:
Returns zero if the successful in locking the spinlock. Returns a negative MPR error code if unsuccessful.
API Stability:
Stable.
See Also:
MprCond, MprMutex, MprSpin, mprAtomicAdd, mprAtomicAdd64, mprAtomicBarrier, mprAtomicCas, mprAtomicExchange, mprAtomicListInsert, mprCreateCond, mprCreateLock, mprCreateSpinLock, mprGlobalLock, mprGlobalUnlock, mprInitLock, mprInitSpinLock, mprLock, mprResetCond, mprSignalCond, mprSignalMultiCond, mprSpinLock, mprSpinUnlock, mprTryLock, mprUnlock, mprWaitForCond, mprWaitForMultiCond
void mprUnlock (MprMutex *lock)

Unlock a mutex.

Description:
This call unlocks a mutex previously locked via mprLock or mprTryLock.
API Stability:
Stable.
See Also:
MprCond, MprMutex, MprSpin, mprAtomicAdd, mprAtomicAdd64, mprAtomicBarrier, mprAtomicCas, mprAtomicExchange, mprAtomicListInsert, mprCreateCond, mprCreateLock, mprCreateSpinLock, mprGlobalLock, mprGlobalUnlock, mprInitLock, mprInitSpinLock, mprLock, mprResetCond, mprSignalCond, mprSignalMultiCond, mprSpinLock, mprSpinUnlock, mprTryLock, mprTrySpinLock, mprWaitForCond, mprWaitForMultiCond
int mprWaitForCond (MprCond *cond, MprTicks timeout)

Wait for a condition lock variable.

Description:
Wait for a condition lock variable to be signaled. If the condition is signaled before the timeout expires, this call will reset the condition variable and return. This way, it automatically resets the variable for future waiters.
Parameters:
condCondition variable object created via mprCreateCond
timeoutTime in milliseconds to wait for the condition variable to be signaled.
Returns:
Zero if the event was signalled. Returns < 0 for a timeout.
API Stability:
Stable.
See Also:
MprCond, MprMutex, MprSpin, mprAtomicAdd, mprAtomicAdd64, mprAtomicBarrier, mprAtomicCas, mprAtomicExchange, mprAtomicListInsert, mprCreateCond, mprCreateLock, mprCreateSpinLock, mprGlobalLock, mprGlobalUnlock, mprInitLock, mprInitSpinLock, mprLock, mprResetCond, mprSignalCond, mprSignalMultiCond, mprSpinLock, mprSpinUnlock, mprTryLock, mprTrySpinLock, mprUnlock, mprWaitForMultiCond
int mprWaitForMultiCond (MprCond *cond, MprTicks timeout)

Wait for a condition lock variable for use with multiple waiters.

Description:
Wait for a condition lock variable to be signaled. Multiple waiters are supported and the condition variable must be manually reset via mprResetCond. The condition may signaled before calling mprWaitForMultiCond.
Parameters:
condCondition variable object created via mprCreateCond
timeoutTime in milliseconds to wait for the condition variable to be signaled.
Returns:
Zero if the event was signalled. Returns < 0 for a timeout.
API Stability:
Stable.
See Also:
MprCond, MprMutex, MprSpin, mprAtomicAdd, mprAtomicAdd64, mprAtomicBarrier, mprAtomicCas, mprAtomicExchange, mprAtomicListInsert, mprCreateCond, mprCreateLock, mprCreateSpinLock, mprGlobalLock, mprGlobalUnlock, mprInitLock, mprInitSpinLock, mprLock, mprResetCond, mprSignalCond, mprSignalMultiCond, mprSpinLock, mprSpinUnlock, mprTryLock, mprTrySpinLock, mprUnlock, mprWaitForCond

MprTestService

MprTestService

Test service facility.

API Stability:
Internal.
Fields:
intactiveThreadCount Currently active test threads.
intargc Count of arguments.
char **argv Arguments for test (not alloced).
boolcontinueOnFailures Keep testing on failures.
booldebugOnFailures Break to the debugger.
intechoCmdLine Echo the command line.
intfirstArg Count of arguments.
MprList *groups Master list of test groups.
intiterations Times to run the test.
MprMutex *mutex Multi-thread sync.
cchar *name Name for entire test.
intnumThreads Number of test threads.
boolsingleStep Pause between tests.
MprTimestart When testing began.
inttestDepth Depth of entire test.
MprList *testFilter Test groups to run.
MprList *threadData Per thread objects.
inttotalFailedCount Total count of failing tests.
inttotalTestCount Total count of all tests.
intverbose Output activity trace.
intworkers Count of worker threads.
bool assertTrue (MprTestGroup *gp, cchar *loc, bool success, cchar *msg)

Test assert.

Description:
This is the primary assertion test routine for unit tests. This is typically invoked by using the assert macro.
Parameters:
gpTest group reference.
locProgram location string including filename and line number.
successBoolean indicating whether the test passed or failed.
msgMessage to display if the test failed.
API Stability:
Internal.
See Also:
MprTestGroup * mprAddTestGroup (MprTestService *ts, MprTestDef *def)

Add a test group to the test service.

Parameters:
tsTest service object returned from mprCreateTestService
defTest group definition to add.
Returns:
MprTestGroup record for the test group.
API Stability:
Internal.
See Also:
MprTestService * mprCreateTestService ()

Create the test service.

Returns:
An MprTestService control object.
API Stability:
Internal.
See Also:
int mprParseTestArgs (MprTestService *ts, int argc, char **argv, MprTestParser extraParser)

Parse test command arguments.

Parameters:
tsTest service object returned from mprCreateTestService
argcCount of arguments in argv.
argvArgument array.
extraParserCallback function to invoke to parse non-standard arguments.
Returns:
Zero if the command have been successfully parsed. Otherwise return a negative MPR error code.
API Stability:
Internal.
See Also:
void mprReportTestResults (MprTestService *ts)

Report the test results.

Description:
Test results are written to stdout.
Parameters:
tsTest service object returned from mprCreateTestService
API Stability:
Internal.
See Also:
void mprResetTestGroup (MprTestGroup *gp)

Reset a test group.

Description:
This resets the success/fail flag for the group.
Parameters:
gpTest group reference.
API Stability:
Internal.
See Also:
int mprRunTests (MprTestService *ts)

Run the define unit tests.

Parameters:
tsTest service object returned from mprCreateTestService
API Stability:
Internal.
See Also:
void mprSignalTest2Complete (MprTestGroup *gp)

Signal a test is complete.

Description:
This awakens a thread that has called mprWaitForTest2ToComplete.
Parameters:
gpTest group reference.
API Stability:
Internal.
See Also:
void mprSignalTestComplete (MprTestGroup *gp)

Signal a test is complete.

Description:
This awakens a thread that has called mprWaitForTestToComplete.
Parameters:
gpTest group reference.
API Stability:
Internal.
See Also:
bool mprWaitForTest2ToComplete (MprTestGroup *gp, MprTicks timeout)

Wait for a test to complete.

Description:
This blocks a thread until a test has completed and is signalled by another thread calling mprSignalTest2Complete
Parameters:
gpTest group reference.
timeoutTimeout in milliseconds to block waiting for the test to complete.
Returns:
True if the test was completed within the timeout.
API Stability:
Internal.
See Also:
bool mprWaitForTestToComplete (MprTestGroup *gp, MprTicks timeout)

Wait for a test to complete.

Description:
This blocks a thread until a test has completed and is signalled by another thread calling mprSignalTestComplete
Parameters:
gpTest group reference.
timeoutTimeout in milliseconds to block waiting for the test to complete.
Returns:
True if the test was completed within the timeout.
API Stability:
Internal.
See Also:

MprThread

MprThread

Thread Service.

Description:
The MPR provides a cross-platform thread abstraction above O/S native threads. It supports arbitrary thread creation, thread priorities, thread management and thread local storage. By using these thread primitives with the locking and synchronization primitives offered by MprMutex, MprSpin and MprCond - you can create cross platform multi-threaded applications.
See Also:
MprThreadProc, MprThreadService, mprCreateThread, mprGetCurrentOsThread, mprGetCurrentThread, mprGetCurrentThreadName, mprGetThreadName, mprGetThreadPriority, mprResetYield, mprSetCurrentThreadPriority, mprSetThreadPriority, mprStartThread, mprYield
API Stability:
Internal.
Fields:
MprCond *cond Multi-thread synchronization.
void *data Data argument.
MprThreadProcentry Users thread entry point.
intisMain Is the main thread.
MprMutex *mutex Multi-thread locking.
char *name Name of thead for trace.
MprOsThreadosThread O/S thread id.
ulongpid Owning process id.
intpriority Current priority.
ssizestackSize Only VxWorks implements.
intstickyYield Yielded does not auto-clear after GC.
intyielded Thread has yielded to GC.
MprThread * mprCreateThread (cchar *name, void *proc, void *data, ssize stackSize)

Create a new thread.

Description:
MPR threads are usually real O/S threads and can be used with the various locking services (MprMutex, MprCond, MprSpin) to enable scalable multithreaded applications.
Parameters:
nameUnique name to give the thread.
procEntry point function for the thread. mprStartThread will invoke this function to start the thread.
dataThread private data stored in MprThread.data.
stackSizeStack size to use for the thread. On VM based systems, increasing this value, does not necessarily incurr a real memory (working-set) increase. Set to zero for a default stack size.
Returns:
A MprThread object.
API Stability:
Stable.
See Also:
MprThread, MprThreadProc, MprThreadService, mprGetCurrentOsThread, mprGetCurrentThread, mprGetCurrentThreadName, mprGetThreadName, mprGetThreadPriority, mprResetYield, mprSetCurrentThreadPriority, mprSetThreadPriority, mprStartThread, mprYield
MprOsThread mprGetCurrentOsThread ()

Get the O/S thread.

Description:
Get the O/S thread ID for the currently executing thread.
Returns:
Returns a platform specific O/S thread ID. On Unix, this is a pthread reference. On other systems it is a thread integer value.
API Stability:
Stable.
See Also:
MprThread, MprThreadProc, MprThreadService, mprCreateThread, mprGetCurrentThread, mprGetCurrentThreadName, mprGetThreadName, mprGetThreadPriority, mprResetYield, mprSetCurrentThreadPriority, mprSetThreadPriority, mprStartThread, mprYield
MprThread * mprGetCurrentThread ()

Get the currently executing thread.

Description:
Get the thread object for the currently executing O/S thread.
Returns:
Returns a thread object representing the current O/S thread.
API Stability:
Stable.
See Also:
MprThread, MprThreadProc, MprThreadService, mprCreateThread, mprGetCurrentOsThread, mprGetCurrentThreadName, mprGetThreadName, mprGetThreadPriority, mprResetYield, mprSetCurrentThreadPriority, mprSetThreadPriority, mprStartThread, mprYield
cchar * mprGetThreadName (MprThread *thread)

Get the thread name.

Description:
MPR threads are usually real O/S threads and can be used with the various locking services (MprMutex, MprCond, MprSpin) to enable scalable multithreaded applications.
Parameters:
threadThread object returned from mprCreateThread
Returns:
Returns a string name for the thread.
API Stability:
Stable.
See Also:
MprThread, MprThreadProc, MprThreadService, mprCreateThread, mprGetCurrentOsThread, mprGetCurrentThread, mprGetCurrentThreadName, mprGetThreadPriority, mprResetYield, mprSetCurrentThreadPriority, mprSetThreadPriority, mprStartThread, mprYield
int mprGetThreadPriority (MprThread *thread)

Get the thread priroity.

Description:
Get the current priority for the specified thread.
Parameters:
threadThread object returned by mprCreateThread
Returns:
An integer MPR thread priority between 0 and 100 inclusive.
API Stability:
Stable.
See Also:
MprThread, MprThreadProc, MprThreadService, mprCreateThread, mprGetCurrentOsThread, mprGetCurrentThread, mprGetCurrentThreadName, mprGetThreadName, mprResetYield, mprSetCurrentThreadPriority, mprSetThreadPriority, mprStartThread, mprYield
void mprSetCurrentThreadPriority (int priority)

Set the thread priroity for the current thread.

Description:
Set the current priority for the specified thread.
Parameters:
priorityPriority to associate with the thread. Mpr thread priorities are are integer values between 0 and 100 inclusive with 50 being a normal priority. The MPR maps these priorities in a linear fashion onto native O/S priorites. Useful constants are:
  • MPR_LOW_PRIORITY
  • MPR_NORMAL_PRIORITY
  • MPR_HIGH_PRIORITY
API Stability:
Stable.
See Also:
MprThread, MprThreadProc, MprThreadService, mprCreateThread, mprGetCurrentOsThread, mprGetCurrentThread, mprGetCurrentThreadName, mprGetThreadName, mprGetThreadPriority, mprResetYield, mprSetThreadPriority, mprStartThread, mprYield
void mprSetThreadPriority (MprThread *thread, int priority)

Set the thread priroity.

Description:
Set the current priority for the specified thread.
Parameters:
threadThread object returned by mprCreateThread
priorityPriority to associate with the thread. Mpr thread priorities are are integer values between 0 and 100 inclusive with 50 being a normal priority. The MPR maps these priorities in a linear fashion onto native O/S priorites. Useful constants are:
  • MPR_LOW_PRIORITY
  • MPR_NORMAL_PRIORITY
  • MPR_HIGH_PRIORITY
API Stability:
Stable.
See Also:
MprThread, MprThreadProc, MprThreadService, mprCreateThread, mprGetCurrentOsThread, mprGetCurrentThread, mprGetCurrentThreadName, mprGetThreadName, mprGetThreadPriority, mprResetYield, mprSetCurrentThreadPriority, mprStartThread, mprYield
int mprStartThread (MprThread *thread)

Start a thread.

Description:
Start a thread previously created via mprCreateThread. The thread will begin at the entry function defined in mprCreateThread
Parameters:
threadThread object returned from mprCreateThread
Returns:
Returns zero if successful, otherwise a negative MPR error code.
API Stability:
Stable.
See Also:
MprThread, MprThreadProc, MprThreadService, mprCreateThread, mprGetCurrentOsThread, mprGetCurrentThread, mprGetCurrentThreadName, mprGetThreadName, mprGetThreadPriority, mprResetYield, mprSetCurrentThreadPriority, mprSetThreadPriority, mprYield

MprTime

MprTime

Date and Time Service.

API Stability:
Stable.
See Also:
mprCompareTime, mprCreateTimeService, mprDecodeLocalTime, mprDecodeUniversalTime, mprFormatLocalTime, mprFormatTm, mprGetDate, mprGetElapsedTicks, mprGetHiResTicks, mprGetRemainingTicks, mprGetTimeZoneOffset
Fields:
int mprCompareTime (MprTime t1, MprTime t2)

Compare two times.

Description:
Compare two times and return a code indicating which is greater, less or equal.
Parameters:
t1First time.
t2Second time.
Returns:
Zero if equal, -1 if t1 is less than t2 otherwise one.
API Stability:
Stable.
See Also:
MprTime, mprCreateTimeService, mprDecodeLocalTime, mprDecodeUniversalTime, mprFormatLocalTime, mprFormatTm, mprGetDate, mprGetElapsedTicks, mprGetHiResTicks, mprGetRemainingTicks, mprGetTimeZoneOffset
int mprCreateTimeService ()

Mpr time structure.

Description:
MprTime is the cross platform time abstraction structure. Time is stored as milliseconds since the epoch: 00:00:00 UTC Jan 1 1970. MprTime is typically a 64 bit quantity.
API Stability:
Internal.
See Also:
MprTime, mprCompareTime, mprDecodeLocalTime, mprDecodeUniversalTime, mprFormatLocalTime, mprFormatTm, mprGetDate, mprGetElapsedTicks, mprGetHiResTicks, mprGetRemainingTicks, mprGetTimeZoneOffset
void mprDecodeLocalTime (struct tm *timep, MprTime time)

Decode a time value into a tokenized local time value.

Description:
Safe replacement for localtime. This call converts the time value to local time and formats the as a struct tm.
Parameters:
timepPointer to a tm structure to hold the result.
timeTime to format.
API Stability:
Stable.
See Also:
MprTime, mprCompareTime, mprCreateTimeService, mprDecodeUniversalTime, mprFormatLocalTime, mprFormatTm, mprGetDate, mprGetElapsedTicks, mprGetHiResTicks, mprGetRemainingTicks, mprGetTimeZoneOffset
void mprDecodeUniversalTime (struct tm *timep, MprTime time)

Decode a time value into a tokenized UTC time structure.

Description:
Safe replacement for gmtime. This call converts the supplied time value to UTC time and parses the result into a tm structure.
Parameters:
timepPointer to a tm structure to hold the result.
timeThe time to format.
API Stability:
Stable.
See Also:
MprTime, mprCompareTime, mprCreateTimeService, mprDecodeLocalTime, mprFormatLocalTime, mprFormatTm, mprGetDate, mprGetElapsedTicks, mprGetHiResTicks, mprGetRemainingTicks, mprGetTimeZoneOffset
char * mprFormatLocalTime (cchar *fmt, MprTime time)

Convert a time value to local time and format as a string.

Description:
Safe replacement for ctime.
Parameters:
fmtTime format string.
timeTime to format. Use mprGetTime to retrieve the current time.
Returns:
The formatting time string.
API Stability:
Stable.
See Also:
MprTime, mprCompareTime, mprCreateTimeService, mprDecodeLocalTime, mprDecodeUniversalTime, mprFormatTm, mprGetDate, mprGetElapsedTicks, mprGetHiResTicks, mprGetRemainingTicks, mprGetTimeZoneOffset
char * mprFormatTm (cchar *fmt, struct tm *timep)

Format a time value as a local time.

Description:
This call formats the time value supplied via timep.
Parameters:
fmtThe time format to use.
timepThe time value to format.
Returns:
The formatting time string.
API Stability:
Stable.
See Also:
MprTime, mprCompareTime, mprCreateTimeService, mprDecodeLocalTime, mprDecodeUniversalTime, mprFormatLocalTime, mprGetDate, mprGetElapsedTicks, mprGetHiResTicks, mprGetRemainingTicks, mprGetTimeZoneOffset
char * mprFormatUniversalTime (cchar *fmt, MprTime time)

Convert a time value to universal time and format as a string.

Description:
Safe replacement for ctime.
Parameters:
fmtTime format string.
timeTime to format. Use mprGetTime to retrieve the current time.
Returns:
The formatting time string.
API Stability:
Stable.
See Also:
MprTime, mprCompareTime, mprCreateTimeService, mprDecodeLocalTime, mprDecodeUniversalTime, mprFormatLocalTime, mprFormatTm, mprGetDate, mprGetElapsedTicks, mprGetHiResTicks, mprGetRemainingTicks, mprGetTimeZoneOffset
char * mprGetDate (char *fmt)

Get a string representation of the current date/time.

Description:
Get the current date/time as a string according to the given format.
Parameters:
fmtDate formatting string. See strftime for acceptable date format specifiers. If null, then this routine uses the MPR_DEFAULT_DATE format.
Returns:
An allocated date string.
API Stability:
Stable.
See Also:
MprTime, mprCompareTime, mprCreateTimeService, mprDecodeLocalTime, mprDecodeUniversalTime, mprFormatLocalTime, mprFormatTm, mprGetElapsedTicks, mprGetHiResTicks, mprGetRemainingTicks, mprGetTimeZoneOffset
MprTicks mprGetElapsedTicks (MprTicks mark)

Get the elapsed time since a ticks mark.

Create the ticks mark with mprGetTicks()
Parameters:
markStarting time stamp.
Returns:
The time elapsed since the mark was taken.
API Stability:
Stable.
See Also:
MprTime, mprCompareTime, mprCreateTimeService, mprDecodeLocalTime, mprDecodeUniversalTime, mprFormatLocalTime, mprFormatTm, mprGetDate, mprGetHiResTicks, mprGetRemainingTicks, mprGetTimeZoneOffset
MprTime mprGetElapsedTime (MprTime mark)

Get the elapsed time since a starting time mark.

Parameters:
markStarting time created via mprGetTime()
Returns:
The time elapsed since the mark was taken.
API Stability:
Stable.
See Also:
MprTime, mprCompareTime, mprCreateTimeService, mprDecodeLocalTime, mprDecodeUniversalTime, mprFormatLocalTime, mprFormatTm, mprGetDate, mprGetElapsedTicks, mprGetHiResTicks, mprGetRemainingTicks, mprGetTimeZoneOffset
MprTicks mprGetRemainingTicks (MprTicks mark, MprTicks timeout)

Return the time remaining until a timeout has elapsed.

Parameters:
markStarting time stamp.
timeoutTime in milliseconds.
Returns:
Time in milliseconds until the timeout elapses.
API Stability:
Stable.
See Also:
MprTime, mprCompareTime, mprCreateTimeService, mprDecodeLocalTime, mprDecodeUniversalTime, mprFormatLocalTime, mprFormatTm, mprGetDate, mprGetElapsedTicks, mprGetHiResTicks, mprGetTimeZoneOffset
MprTicks mprGetTicks ()

Get the system time.

Description:
Get the system time in milliseconds. This is a monotonically increasing time counter. It does not represent wall-clock time.
Returns:
The system time in milliseconds.
API Stability:
Stable.
See Also:
MprTime, mprCompareTime, mprCreateTimeService, mprDecodeLocalTime, mprDecodeUniversalTime, mprFormatLocalTime, mprFormatTm, mprGetDate, mprGetElapsedTicks, mprGetHiResTicks, mprGetRemainingTicks, mprGetTimeZoneOffset
MprTime mprGetTime ()

Get the time.

Description:
Get the date/time in milliseconds since Jan 1 1970.
Returns:
The time in milliseconds since Jan 1 1970.
API Stability:
Stable.
See Also:
MprTime, mprCompareTime, mprCreateTimeService, mprDecodeLocalTime, mprDecodeUniversalTime, mprFormatLocalTime, mprFormatTm, mprGetDate, mprGetElapsedTicks, mprGetHiResTicks, mprGetRemainingTicks, mprGetTimeZoneOffset
int mprGetTimeZoneOffset (MprTime when)

Get the current timezone offset for a given time.

Description:
Calculate the current timezone (including DST).
Parameters:
whenTime to examine to extract the timezone.
Returns:
Returns a timezone offset in msec. Local time == (UTC + offset).
API Stability:
Stable.
See Also:
MprTime, mprCompareTime, mprCreateTimeService, mprDecodeLocalTime, mprDecodeUniversalTime, mprFormatLocalTime, mprFormatTm, mprGetDate, mprGetElapsedTicks, mprGetHiResTicks, mprGetRemainingTicks

MprWaitHandler

MprWaitHandler

Wait Handler Service.

Description:
Wait handlers provide callbacks for when I/O events occur. They provide a wait to service many I/O file descriptors without requiring a thread per descriptor.
See Also:
MprEvent, mprCreateWaitHandler, mprQueueIOEvent, mprRecallWaitHandler, mprRecallWaitHandlerByFd, mprRemoveWaitHandler, mprWaitOn
API Stability:
Internal.
Fields:
MprCond *callbackComplete Signalled when a callback is complete.
intdesiredMask Mask of desired events.
MprDispatcher *dispatcher Event dispatcher to use for I/O events.
MprEvent *event Event object to process I/O events.
intfd O/S File descriptor (sp->sock).
intflags Control flags.
void *handlerData Argument to pass to proc.
struct MprWaitHandler *next List linkage.
intnotifierIndex Index for notifier.
intpresentMask Mask of current events.
MprEventProcproc Callback event procedure.
struct MprWorker *requiredWorker Designate the required worker thread to run the callback.
MprWaitService *service Wait service pointer.
struct MprThread *thread Thread executing the callback, set even if worker is null.
int mprCreateNotifierService (MprWaitService *ws)

Internal.

API Stability:
Internal.
See Also:
MprEvent, MprWaitHandler, mprCreateWaitHandler, mprQueueIOEvent, mprRecallWaitHandler, mprRecallWaitHandlerByFd, mprRemoveWaitHandler, mprWaitOn
MprWaitHandler * mprCreateWaitHandler (int fd, int mask, MprDispatcher *dispatcher, void *proc, void *data, int flags)

Create a wait handler.

Description:
Create a wait handler that will be invoked when I/O of interest occurs on the specified file handle The wait handler is registered with the MPR event I/O mechanism.
Parameters:
fdFile descriptor.
maskMask of events of interest. This is made by oring MPR_READABLE and MPR_WRITABLE.
dispatcherDispatcher object to use for scheduling the I/O event.
procCallback function to invoke when an I/O event of interest has occurred.
dataData item to pass to the callback.
flagsWait handler flags. Use MPR_WAIT_NEW_DISPATCHER to auto-create a new dispatcher for each I/O event.
Returns:
A new wait handler registered with the MPR event mechanism.
API Stability:
Stable.
See Also:
MprEvent, MprWaitHandler, mprQueueIOEvent, mprRecallWaitHandler, mprRecallWaitHandlerByFd, mprRemoveWaitHandler, mprWaitOn
void mprRecallWaitHandler (MprWaitHandler *wp)

Recall a wait handler.

Description:
Signal that a wait handler should be recalled at the earliest opportunity. This is useful when a protocol stack has buffered data that must be processed regardless of whether more I/O occurs.
Parameters:
wpWait handler to recall.
API Stability:
Stable.
See Also:
MprEvent, MprWaitHandler, mprCreateWaitHandler, mprQueueIOEvent, mprRecallWaitHandlerByFd, mprRemoveWaitHandler, mprWaitOn
void mprRecallWaitHandlerByFd (int fd)

Recall a wait handler by fd.

Description:
Signal that a wait handler should be recalled at the earliest opportunity. This is useful when a protocol stack has buffered data that must be processed regardless of whether more I/O occurs.
Parameters:
fdFile descriptor that matches that of a wait handler to recall.
API Stability:
Stable.
See Also:
MprEvent, MprWaitHandler, mprCreateWaitHandler, mprQueueIOEvent, mprRecallWaitHandler, mprRemoveWaitHandler, mprWaitOn
void mprRemoveWaitHandler (MprWaitHandler *wp)

Disconnect a wait handler from its underlying file descriptor.

This is used to prevent further I/O wait events while still preserving the wait handler
Parameters:
wpWait handler object.
API Stability:
Stable.
See Also:
MprEvent, MprWaitHandler, mprCreateWaitHandler, mprQueueIOEvent, mprRecallWaitHandler, mprRecallWaitHandlerByFd, mprWaitOn
void mprWaitForIO (MprWaitService *ws, MprTicks timeout)

Wait for I/O.

This call waits for any I/O events on wait handlers until the given timeout expires
Parameters:
wsWait service object.
timeoutTimeout in milliseconds to wait for an event.
API Stability:
Stable.
See Also:
MprEvent, MprWaitHandler, mprCreateWaitHandler, mprQueueIOEvent, mprRecallWaitHandler, mprRecallWaitHandlerByFd, mprRemoveWaitHandler, mprWaitOn
int mprWaitForSingleIO (int fd, int mask, MprTicks timeout)

Wait for I/O on a file descriptor.

No processing of the I/O event is done
Parameters:
fdFile descriptor to examine.
maskMask of events of interest (MPR_READABLE | MPR_WRITABLE).
timeoutTimeout in milliseconds to wait for an event.
Returns:
A count of events received.
API Stability:
Stable.
See Also:
MprEvent, MprWaitHandler, mprCreateWaitHandler, mprQueueIOEvent, mprRecallWaitHandler, mprRecallWaitHandlerByFd, mprRemoveWaitHandler, mprWaitOn
void mprWaitOn (MprWaitHandler *wp, int desiredMask)

Subscribe for desired wait events.

Description:
Subscribe to the desired wait events for a given wait handler.
Parameters:
wpWait handler created via mprCreateWaitHandler
desiredMaskMask of desired events (MPR_READABLE | MPR_WRITABLE).
API Stability:
Stable.
See Also:
MprEvent, MprWaitHandler, mprCreateWaitHandler, mprQueueIOEvent, mprRecallWaitHandler, mprRecallWaitHandlerByFd, mprRemoveWaitHandler

MprWorker

MprWorker

Worker thread structure.

See Also:
MprWorkerService, MprWorkerStats, mprDedicateWorker, mprGetMaxWorkers, mprReleaseWorker, mprSetMaxWorkers, mprSetMinWorkers, mprSetWorkerStackSize, mprStartWorker
API Stability:
Internal.
Fields:
MprWorkerProccleanup Procedure to cleanup after run before sleeping.
void *data User per-worker data.
MprCond *idleCond Used to wait for work.
MprTickslastActivity When the worker was last used.
MprWorkerProcproc Procedure to run.
intrunning Worker running a job.
intstate Worker state.
MprThread *thread Thread associated with this worker.
MprWorkerService *workerService Worker service.
int mprAvailableWorkers ()

Get the count of available worker threads Return the count of free threads in the worker thread pool.

Returns:
An integer count of worker threads.
API Stability:
Stable.
See Also:
MprWorkerService, MprWorkerStats, mprDedicateWorker, mprGetMaxWorkers, mprReleaseWorker, mprSetMaxWorkers, mprSetMinWorkers, mprSetWorkerStackSize, mprStartWorker
void mprDedicateWorker (MprWorker *worker)

Dedicate a worker thread to a current real thread.

This implements thread affinity and is required on some platforms where some APIs (waitpid on uClibc) cannot be called on a different thread
Parameters:
workerWorker object.
workerWorker thread reference.
API Stability:
Internal.
See Also:
MprWorkerService, MprWorkerStats, mprGetMaxWorkers, mprReleaseWorker, mprSetMaxWorkers, mprSetMinWorkers, mprSetWorkerStackSize, mprStartWorker
int mprGetMaxWorkers ()

Get the maximum count of worker pool threads Get the maximum limit of worker pool threads.

Returns:
The maximum count of worker pool threads.
API Stability:
Stable.
See Also:
MprWorkerService, MprWorkerStats, mprDedicateWorker, mprReleaseWorker, mprSetMaxWorkers, mprSetMinWorkers, mprSetWorkerStackSize, mprStartWorker
void mprGetWorkerStats (MprWorkerStats *stats)

Get the Worker service statistics.

Parameters:
statsReference to stats object to receive the stats.
API Stability:
Internal.
See Also:
MprWorkerService, MprWorkerStats, mprDedicateWorker, mprGetMaxWorkers, mprReleaseWorker, mprSetMaxWorkers, mprSetMinWorkers, mprSetWorkerStackSize, mprStartWorker
void mprSetMaxWorkers (int count)

Set the maximum count of worker threads Set the maximum number of worker pool threads for the MPR.

If this number if less than the current number of threads, excess threads will be gracefully pruned as they exit
Parameters:
countMaximum limit of threads to define.
API Stability:
Stable.
See Also:
MprWorkerService, MprWorkerStats, mprDedicateWorker, mprGetMaxWorkers, mprReleaseWorker, mprSetMinWorkers, mprSetWorkerStackSize, mprStartWorker
void mprSetMinWorkers (int count)

Set the minimum count of worker threads Set the count of threads the worker pool will have.

This will cause the worker pool to pre-create at least this many threads
Parameters:
countMinimum count of threads to use.
API Stability:
Stable.
See Also:
MprWorkerService, MprWorkerStats, mprDedicateWorker, mprGetMaxWorkers, mprReleaseWorker, mprSetMaxWorkers, mprSetWorkerStackSize, mprStartWorker
void mprSetWorkerStackSize (int size)

Set the default worker stack size.

Parameters:
sizeStack size in bytes.
API Stability:
Stable.
See Also:
MprWorkerService, MprWorkerStats, mprDedicateWorker, mprGetMaxWorkers, mprReleaseWorker, mprSetMaxWorkers, mprSetMinWorkers, mprStartWorker

MprXml

MprXml

Per XML session structure.

See Also:
MprXmlHandler, MprXmlInputStream, mprXmlGetErrorMsg, mprXmlGetLineNumber, mprXmlGetParseArg, mprXmlOpen, mprXmlParse, mprXmlSetParseArg
API Stability:
Internal.
Fields:
char *errMsg Error message text.
MprXmlHandlerhandler Callback function.
MprBuf *inBuf Input data queue.
void *inputArg Arg for mprXmlSetInputStream()
intlineNumber Current line no for debug.
void *parseArg Arg passed to mprXmlParse()
intquoteChar XdbAtt quote char.
MprXmlInputStreamreadFn Read data function.
MprBuf *tokBuf Parsed token buffer.
cchar * mprXmlGetErrorMsg (MprXml *xp)

Get the XML error message if mprXmlParse fails.

Parameters:
xpXML parser instance returned from mprXmlOpen.
Returns:
A descriptive null-terminated string.
API Stability:
Stable.
See Also:
MprXml, MprXmlHandler, MprXmlInputStream, mprXmlGetLineNumber, mprXmlGetParseArg, mprXmlOpen, mprXmlParse, mprXmlSetParseArg
int mprXmlGetLineNumber (MprXml *xp)

Get the source XML line number.

Description:
This call can be used from within the parser callback or when mprXmlParse fails.
Parameters:
xpXML parser instance returned from mprXmlOpen.
Returns:
The line number for the current token or error.
API Stability:
Stable.
See Also:
MprXml, MprXmlHandler, MprXmlInputStream, mprXmlGetErrorMsg, mprXmlGetParseArg, mprXmlOpen, mprXmlParse, mprXmlSetParseArg
void * mprXmlGetParseArg (MprXml *xp)

Get the XML callback argument.

Parameters:
xpXML parser instance returned from mprXmlOpen.
Returns:
Argument defined to use for the callback.
API Stability:
Stable.
See Also:
MprXml, MprXmlHandler, MprXmlInputStream, mprXmlGetErrorMsg, mprXmlGetLineNumber, mprXmlOpen, mprXmlParse, mprXmlSetParseArg
MprXml * mprXmlOpen (ssize initialSize, ssize maxSize)

Open an XML parser instance.

Parameters:
initialSizeInitialize size of XML in-memory token buffer.
maxSizeMaximum size of XML in-memory token buffer. Set to -1 unlimited.
Returns:
An XML parser instance.
API Stability:
Stable.
See Also:
MprXml, MprXmlHandler, MprXmlInputStream, mprXmlGetErrorMsg, mprXmlGetLineNumber, mprXmlGetParseArg, mprXmlParse, mprXmlSetParseArg
int mprXmlParse (MprXml *xp)

Run the XML parser.

Parameters:
xpXML parser instance returned from mprXmlOpen.
Returns:
Zero if successful. Otherwise returns a negative MPR error code.
API Stability:
Stable.
See Also:
MprXml, MprXmlHandler, MprXmlInputStream, mprXmlGetErrorMsg, mprXmlGetLineNumber, mprXmlGetParseArg, mprXmlOpen, mprXmlSetParseArg
void mprXmlSetInputStream (MprXml *xp, MprXmlInputStream fn, void *arg)

Define the XML parser input stream.

This
Parameters:
xpXML parser instance returned from mprXmlOpen.
fnCallback function to provide data to the XML parser. The callback is invoked with the signature: ssize callbac(MprXml *xp, void *arg, char *buf, ssize size);.
argCallback argument to pass to the.
API Stability:
Stable.
See Also:
MprXml, MprXmlHandler, MprXmlInputStream, mprXmlGetErrorMsg, mprXmlGetLineNumber, mprXmlGetParseArg, mprXmlOpen, mprXmlParse, mprXmlSetParseArg
void mprXmlSetParseArg (MprXml *xp, void *parseArg)

Set the XML callback argument.

Parameters:
xpXML parser instance returned from mprXmlOpen.
parseArgArgument to use for the callback.
API Stability:
Stable.
See Also:
MprXml, MprXmlHandler, MprXmlInputStream, mprXmlGetErrorMsg, mprXmlGetLineNumber, mprXmlGetParseArg, mprXmlOpen, mprXmlParse
void mprXmlSetParserHandler (MprXml *xp, MprXmlHandler h)

Set the XML parser data handle.

Parameters:
xpXML parser instance returned from mprXmlOpen.
hArbitrary data to associate with the parser.
API Stability:
Stable.
See Also:
MprXml, MprXmlHandler, MprXmlInputStream, mprXmlGetErrorMsg, mprXmlGetLineNumber, mprXmlGetParseArg, mprXmlOpen, mprXmlParse, mprXmlSetParseArg

Functions

MprBuf * mprCloneBuf (MprBuf *orig)

Clone a buffer.

Description:
Copy the buffer and contents into a newly allocated buffer.
Parameters:
origOriginal buffer to copy.
Returns:
Returns a newly allocated buffer.
API Stability:
Stable.
MprModuleService * mprCreateModuleService ()

Create and initialize the module service.

Returns:
MprModuleService object.
API Stability:
Internal.
void mprDestroy (int how)

Destroy the MPR.

Parameters:
howExit strategy to use when exiting. Set to MPR_EXIT_DEFAULT to use the existing exit strategy. Set to MPR_EXIT_IMMEDIATE for an immediate abortive shutdown. Finalizers will not be run. Use MPR_EXIT_NORMAL to allow garbage collection and finalizers to run. Use MPR_EXIT_GRACEFUL to allow all current requests and commands to complete before exiting.
cchar * mprGetCurrentThreadName ()

Return the name of the current thread.

Returns:
A static thread name.
API Stability:
Stable.
uint64 mprGetHiResTicks ()

Get the CPU tick count.

Description:
Get the current CPU tick count. This is a system dependant high resolution timer. On some systems, this returns time in nanosecond resolution.
Returns:
The CPU time in ticks. Will return the system time if CPU ticks are not available.
API Stability:
Internal.
void mprHiddenSocketData (MprSocket *sp, ssize len, int dir)

Indicate that the application layer has buffered data for the socket.

Description:
This is used by SSL and other network stacks that buffer pending data.
Parameters:
spSocket object returned from mprCreateSocket
lenLength of buffered data in bytes.
dirBuffer direction. Set to MPR_READABLE for buffered read data and MPR_WRITABLE for buffered write data.
int mprIsCmdComplete (MprCmd *cmd)

Test if a command is complete.

A command is complete when the child has exited and all command output and error output has been received
Parameters:
cmdMprCmd object created via mprCreateCmd.
bool mprIsSocketV6 (MprSocket *sp)

Determine if the socket is using IPv6 Currently only works for server side addresses.

Parameters:
spSocket object returned from mprCreateSocket
Returns:
True if the socket is using IPv6, otherwise zero.
void mprMark (void *ptr)

Mark a memory block as in-use.

Description:
To prevent a memory block being freed by the garbage collector, it must be marked as "active".
Parameters:
ptrReference to managed memory block. This must be managed memory allocated by the MPR. Do not call mprMark on memory allocated via malloc(), strdup() or other non-MPR allocation routines. It is safe pass a NULL pointer to mprMark and this will have no effect. This is a convenient pattern where manager functions can call mprMark() without testing if the element reference is null or not.
int mprNotifyOn (MprWaitService *ws, MprWaitHandler *wp, int mask)

Begin I/O notification services on a wait handler.

Parameters:
wsWait Service object.
wpWait handler associated with the file descriptor.
maskMask of events of interest. This is made by oring MPR_READABLE and MPR_WRITABLE.
Returns:
Zero if successful, otherwise a negative MPR error code.
API Stability:
Internal.
void mprQueueIOEvent (MprWaitHandler *wp)

Queue an IO event for dispatch on the wait handler dispatcher.

Parameters:
wpWait handler created via mprCreateWaitHandler
API Stability:
Stable.
void mprRelayEvent (MprDispatcher *dispatcher, void *proc, void *data, MprEvent *event)

Relay an event to a dispatcher.

This invokes the callback proc as though it was invoked from the given dispatcher
Parameters:
dispatcherDispatcher object created via mprCreateDispatcher
procProcedure to invoke.
dataArgument to proc.
eventEvent object.
void mprReleaseWorker (MprWorker *worker)

Release a worker thread.

This releases a worker thread to be assignable to any real thread
Parameters:
workerWorker object.
workerWorker thread reference.
API Stability:
Internal.
void mprResetYield ()

Reset a sticky yield.

Description:
This call resets a sticky yield established with mprYield
API Stability:
Stable.
void mprSetLogFile (struct MprFile *file)

Set a file to be used for logging.

Parameters:
fileMprFile object instance.
API Stability:
Evolving.
void mprSetLogHandler (MprLogHandler handler)

Set an MPR debug log handler.

Description:
Defines a callback handler for MPR debug and error log messages. When output is sent to the debug channel, the log handler will be invoked to accept the output message.
Parameters:
handlerCallback handler.
API Stability:
Stable.
int mprStartModuleService ()

Start the module service.

Description:
This calls the start entry point for all registered modules.
Returns:
Zero if successful, otherwise a negative MPR error code.
API Stability:
Internal.
int mprStartWorker (MprWorkerProc proc, void *data)

Start a worker thread.

Description:
Start a worker thread executing the given worker procedure callback.
Parameters:
procWorker procedure callback.
dataData parameter to the callback.
Returns:
Zero if successful, otherwise a negative MPR error code.
API Stability:
Internal.
void mprStopModuleService ()

Stop the module service.

Description:
This calls the stop entry point for all registered modules.
Returns:
Zero if successful, otherwise a negative MPR error code.
API Stability:
Internal.
void mprYield (int flags)

Yield a thread to allow garbage collection.

Description:
Long running threads should regularly call mprYield to allow the garbage collector to run. All transient memory must have references from "managed" objects (see mprAlloc) to ensure required memory is retained.
Parameters:
flagsSet to MPR_YIELD_BLOCK to wait until the garbage collection is complete. This is not normally required. Set to MPR_YIELD_STICKY to remain in the yielded state. This is useful when sleeping or blocking waiting for I/O. mprResetYield must be called after setting a sticky yield.
API Stability:
Stable.

Typedefs

typedef uint(* MprHashProc)(cvoid *name, ssize len).

Hashing function to use for the table.

Parameters:
nameName to hash.
lenLength of the name to hash.
Returns:
An integer hash index.
typedef void MprObj.

Object container for JSON parse trees.

typedef Offset MprOff.

Signed file offset data type.

Supports large files greater than 4GB in size on all systems
typedef Ticks MprTicks.

Elapsed time data type.

Stores time in milliseconds from some arbitrary start epoch
typedef ssize(* MprXmlInputStream)(struct MprXml *xp, void *arg, char *buf, ssize size).

XML input stream function.

Parameters:
xpXML instance reference.
argto input stream.
bufBuffer into which to read data.
sizeSize of buf.
API Stability:
Stable.
typedef int(* MprBufProc)(struct MprBuf *bp, void *arg).

Buffer refill callback function.

Description:
Function to call when the buffer is depleted and needs more data.
Parameters:
bufInstance of an MprBuf.
argData argument supplied to mprSetBufRefillProc
Returns:
The callback should return 0 if successful, otherwise a negative error code.
API Stability:
Stable.
See Also:
MprBuf, mprAddNullToBuf, mprAdjustBufEnd, mprAdjustBufStart, mprBufToString, mprCloneBuf, mprCompactBuf, mprCreateBuf, mprFlushBuf, mprGetBlockFromBuf, mprGetBufEnd, mprGetBufLength, mprGetBufRefillProc, mprGetBufSize, mprGetBufSpace, mprGetBufStart, mprGetCharFromBuf, mprGrowBuf, mprInsertCharToBuf, mprLookAtLastCharInBuf, mprLookAtNextCharInBuf, mprPutBlockToBuf, mprPutCharToBuf, mprPutIntToBuf, mprPutPadToBuf, mprPutStringToBuf, mprPutSubStringToBuf, mprRefillBuf, mprResetBufIfEmpty, mprSetBufMax, mprSetBufRefillProc, mprSetBufSize
typedef void(* MprForkCallback)(void *arg).

Callback function before doing a fork().

API Stability:
Stable.
See Also:
mprCloseCmdFd, mprCreateCmd, mprDestroyCmd, mprDisableCmdEvents, mprDisconnectCmd, mprEnableCmdEvents, mprFinalizeCmd, mprGetCmdBuf, mprGetCmdExitStatus, mprGetCmdFd, mprIsCmdComplete, mprIsCmdRunning, mprReadCmd, mprReapCmd, mprRunCmd, mprRunCmdV, mprSetCmdCallback, mprSetCmdDir, mprSetCmdEnv, mprSetCmdSearchPath, mprStartCmd, mprStopCmd, mprWaitForCmd, mprWriteCmd, mprWriteCmdBlock
typedef void(* MprEventProc)(void *data, struct MprEvent *event).

Event callback function.

Returns:
Return non-zero if the dispatcher is deleted. Otherwise return 0.
API Stability:
Stable.
See Also:
MprDispatcher, MprEvent, mprCreateDispatcher, mprCreateEvent, mprCreateEventOutside, mprCreateTimerEvent, mprEnableContinuousEvent, mprEnableDispatcher, mprGetDispatcher, mprRemoveEvent, mprRescheduleEvent, mprRestartContinuousEvent, mprServiceEvents, mprSignalDispatcher, mprStopContinuousEvent, mprWaitForEvent
typedef int(* MprListCompareProc)(cvoid *arg1, cvoid *arg2).

List comparison procedure for sorting.

Description:
Callback function signature used by mprSortList
Parameters:
arg1First list item to compare.
arg2Second list item to compare.
Returns:
Return zero if the items are equal. Return -1 if the first arg is less than the second. Otherwise return 1.
API Stability:
Stable.
See Also:
MprList, mprAddItem, mprAddNullItem, mprAppendList, mprClearList, mprCloneList, mprCreateKeyPair, mprCreateList, mprGetFirstItem, mprGetItem, mprGetLastItem, mprGetListCapacity, mprGetListLength, mprGetNextItem, mprGetPrevItem, mprInitList, mprInsertItemAtPos, mprLookupItem, mprLookupStringItem, mprPopItem, mprPushItem, mprRemoveItem, mprRemoveItemAtPos, mprRemoveRangeOfItems, mprRemoveStringItem, mprSetItem, mprSetListLimits, mprSortList
typedef int(* MprSortProc)(cvoid *p1, cvoid *p2, void *ctx).

Quicksort callback function.

Description:
This is a quicksort callback with a context argument.
Parameters:
p1Pointer to first element.
p2Pointer to second element.
ctxContext argument to provide to comparison function.
Returns:
-1, 0, or 1, depending on if the elements are p1 < p2, p1 == p2 or p1 > p2.
API Stability:
Stable.
See Also:
MprList, MprListCompareProc, mprAddItem, mprAddNullItem, mprAppendList, mprClearList, mprCloneList, mprCreateKeyPair, mprCreateList, mprGetFirstItem, mprGetItem, mprGetLastItem, mprGetListCapacity, mprGetListLength, mprGetNextItem, mprGetPrevItem, mprInitList, mprInsertItemAtPos, mprLookupItem, mprLookupStringItem, mprPopItem, mprPushItem, mprRemoveItem, mprRemoveItemAtPos, mprRemoveRangeOfItems, mprRemoveStringItem, mprSetItem, mprSetListLimits, mprSortList
typedef void(* MprLogHandler)(int flags, int level, cchar *msg).

Log handler callback type.

Description:
Callback prototype for the log handler. Used by mprSetLogHandler to define a message logging handler to process log and error messages.
Parameters:
fileSource filename. Derived by using FILE
lineSource line number. Derived by using LINE
flagsError flags.
levelMessage logging level. Levels are 0-9 with zero being the most verbose.
msgMessage being logged.
API Stability:
Stable.
See Also:
mprAssert, mprError, mprGetLogFile, mprGetLogHandler, mprInfo, mprLog, mprRawLog, mprSetLogFile, mprSetLogHandler, mprSetLogLevel, mprTrace, mprUsingDefaultLogHandler, mprWarn
typedef void(* MprManager)(void *ptr, int flags).

Mpr memory block manager prototype.

Parameters:
ptrAny memory context allocated by the MPR.
API Stability:
Stable.
See Also:
MprFreeMem, MprHeap, MprMemNotifier, MprRegion, mprAddRoot, mprAlloc, mprAllocMem, mprAllocObj, mprAllocZeroed, mprCreateMemService, mprDestroyMemService, mprEnableGC, mprGetBlockSize, mprGetMem, mprGetMemStats, mprGetMpr, mprGetPageSize, mprHasMemError, mprHold, mprIsValid, mprMark, mprMemcmp, mprMemcpy, mprMemdup, mprPrintMem, mprRealloc, mprRelease, mprRemoveRoot, mprRequestGC, mprResetMemError, mprSetManager, mprSetMemError, mprSetMemLimits, mprSetMemNotifier, mprSetMemPolicy, mprValidateBlock, mprVerifyMem, mprVirtAlloc, mprVirtFree
typedef void(* MprMemNotifier)(int cause, int policy, ssize size, ssize total).

Memory allocation error callback.

Notifiers are called if a low memory condition exists
Parameters:
policyMemory depletion policy. Set to one of MPR_ALLOC_POLICY_NOTHING, MPR_ALLOC_POLICY_PRUNE, MPR_ALLOC_POLICY_RESTART or MPR_ALLOC_POLICY_EXIT.
causeCause of the memory allocation condition. If flags is set to MPR_MEM_LOW, the memory pool is low, but the allocation succeeded. If flags contain MPR_MEM_DEPLETED, the allocation failed.
sizeSize of the allocation that triggered the low memory condition.
totalTotal memory currently in use.
API Stability:
Stable.
See Also:
MprFreeMem, MprHeap, MprManager, MprRegion, mprAddRoot, mprAlloc, mprAllocMem, mprAllocObj, mprAllocZeroed, mprCreateMemService, mprDestroyMemService, mprEnableGC, mprGetBlockSize, mprGetMem, mprGetMemStats, mprGetMpr, mprGetPageSize, mprHasMemError, mprHold, mprIsValid, mprMark, mprMemcmp, mprMemcpy, mprMemdup, mprPrintMem, mprRealloc, mprRelease, mprRemoveRoot, mprRequestGC, mprResetMemError, mprSetManager, mprSetMemError, mprSetMemLimits, mprSetMemNotifier, mprSetMemPolicy, mprValidateBlock, mprVerifyMem, mprVirtAlloc, mprVirtFree
typedef int(* MprModuleEntry)(void *data, MprModule *mp).

Loadable module entry point signature.

Description:
Loadable modules can have an entry point that is invoked automatically when a module is loaded.
Parameters:
dataData passed to mprCreateModule.
mpModule object reference returned from mprCreateModule
Returns:
A new MprModule structure for the module. Return NULL if the module can't be initialized.
API Stability:
Stable.
See Also:
MprModule, MprModuleProc, mprCreateModule, mprGetModuleSearchPath, mprLoadModule, mprLoadNativeModule, mprLookupModule, mprLookupModuleData, mprSearchForModule, mprSetModuleFinalizer, mprSetModuleSearchPath, mprSetModuleTimeout, mprStartModule, mprStopModule, mprUnloadModule, mprUnloadNativeModule
typedef int(* MprModuleProc)(struct MprModule *mp).

Module start/stop point function signature.

Parameters:
mpModule object reference returned from mprCreateModule
Returns:
Zero if successful, otherwise return a negative MPR error code.
API Stability:
Stable.
See Also:
MprModule, MprModuleEntry, mprCreateModule, mprGetModuleSearchPath, mprLoadModule, mprLoadNativeModule, mprLookupModule, mprLookupModuleData, mprSearchForModule, mprSetModuleFinalizer, mprSetModuleSearchPath, mprSetModuleTimeout, mprStartModule, mprStopModule, mprUnloadModule, mprUnloadNativeModule
typedef void(* MprSignalProc)(void *arg, struct MprSignal *sp).

Signal callback procedure.

API Stability:
Stable.
See Also:
MprSignalService, mprAddSignalHandler, mprAddStandardSignals
typedef int(* MprSocketPrebind)(struct MprSocket *sock).

Callback before binding a socket.

API Stability:
Stable.
See Also:
MprSocket, MprSocketProc, MprSocketProvider, MprSocketService, mprAddSocketHandler, mprCloneSsl, mprCloseSocket, mprConnectSocket, mprCreateSocket, mprCreateSsl, mprDisconnectSocket, mprEnableSocketEvents, mprFlushSocket, mprGetSocketBlockingMode, mprGetSocketError, mprGetSocketFd, mprGetSocketInfo, mprGetSocketPort, mprGetSocketState, mprHasSecureSockets, mprIsSocketEof, mprIsSocketSecure, mprListenOnSocket, mprLoadSsl, mprReadSocket, mprSetSocketBlockingMode, mprSetSocketEof, mprSetSocketNoDelay, mprSetSslCaFile, mprSetSslCaPath, mprSetSslCertFile, mprSetSslCiphers, mprSetSslKeyFile, mprSocketHandshaking, mprSocketHasBufferedRead, mprSocketHasBufferedWrite, mprUpgradeSocket, mprWriteSocket, mprWriteSocketString, mprWriteSocketVector
typedef int(* MprSocketProc)(void *data, int mask).

Socket I/O callback procedure.

Proc returns non-zero if the socket has been deleted
API Stability:
Stable.
See Also:
MprSocket, MprSocketPrebind, MprSocketProvider, MprSocketService, mprAddSocketHandler, mprCloneSsl, mprCloseSocket, mprConnectSocket, mprCreateSocket, mprCreateSsl, mprDisconnectSocket, mprEnableSocketEvents, mprFlushSocket, mprGetSocketBlockingMode, mprGetSocketError, mprGetSocketFd, mprGetSocketInfo, mprGetSocketPort, mprGetSocketState, mprHasSecureSockets, mprIsSocketEof, mprIsSocketSecure, mprListenOnSocket, mprLoadSsl, mprReadSocket, mprSetSocketBlockingMode, mprSetSocketEof, mprSetSocketNoDelay, mprSetSslCaFile, mprSetSslCaPath, mprSetSslCertFile, mprSetSslCiphers, mprSetSslKeyFile, mprSocketHandshaking, mprSocketHasBufferedRead, mprSocketHasBufferedWrite, mprUpgradeSocket, mprWriteSocket, mprWriteSocketString, mprWriteSocketVector
typedef int(* MprTestParser)(int argc, char **argv).

Callback parser for non-standard command line arguments.

API Stability:
Internal.
See Also:
typedef void(* MprTestProc)(struct MprTestGroup *tp).

Unit test callback procedure.

API Stability:
Internal.
See Also:
typedef void(* MprThreadProc)(void *arg, struct MprThread *tp).

Thread main procedure.

Parameters:
argArgument to the thread main.
tpThread instance reference.
API Stability:
Stable.
See Also:
MprThread, MprThreadService, mprCreateThread, mprGetCurrentOsThread, mprGetCurrentThread, mprGetCurrentThreadName, mprGetThreadName, mprGetThreadPriority, mprResetYield, mprSetCurrentThreadPriority, mprSetThreadPriority, mprStartThread, mprYield
typedef void(* MprWorkerProc)(void *data, struct MprWorker *worker).

Worker thread callback signature.

Parameters:
dataworker callback data. Set via mprStartWorker or mprActivateWorker.
workerReference to the worker thread object.
API Stability:
Stable.
See Also:
MprWorkerService, MprWorkerStats, mprDedicateWorker, mprGetMaxWorkers, mprReleaseWorker, mprSetMaxWorkers, mprSetMinWorkers, mprSetWorkerStackSize, mprStartWorker
typedef int(* MprXmlHandler)(struct MprXml *xp, int state, cchar *tagName, cchar *attName, cchar *value).

XML callback handler.

Parameters:
xpXML instance reference.
stateXML state.
tagNameCurrent XML tag.
attNameCurrent XML attribute.
valueCurrent XML element value.
API Stability:
Stable.
See Also:
MprXml, MprXmlInputStream, mprXmlGetErrorMsg, mprXmlGetLineNumber, mprXmlGetParseArg, mprXmlOpen, mprXmlParse, mprXmlSetParseArg
MprCmdChild

Child status structure.

API Stability:
Internal.
Fields:
MprCmdService

Command execution service.

API Stability:
Internal.
Fields:
MprCond

Condition variable for single and multi-thread synchronization.

API Stability:
Internal.
Fields:
pthread_cond_tcv Unix pthreads condition variable.
struct MprMutex *mutex Thread synchronization mutex.
inttriggered Value of the condition.
MprDirEntry

Directory entry description.

Description:
The MprGetDirList will create a list of directory entries.
Fields:
boolisDir True if the file is a directory.
boolisLink True if the file is a symbolic link.
MprTimelastModified Time the file was last modified.
char *name Name of the file.
MprOffsize Size of the file.
API Stability:
Internal.
MprFreeMem

Block structure when on a free list.

API Stability:
Internal.
Fields:
uintcount Number of blocks on the queue.
intminSize Min size of block in queue.
struct MprFreeMem *next Next free block.
struct MprFreeMem *prev Previous free block.
MprHash

Hash table control structure.

See Also:
Fields:
MprKey **buckets Hash collision bucket table.
intflags Hash control flags.
MprHashProcfn Hash function.
intlength Number of symbols in the table.
MprMutex *mutex GC marker sync.
intsize Size of the buckets array.
API Stability:
Internal.
MprHeap

Memory allocator heap.

API Stability:
Internal.
Fields:
intactive Active generation for new and active blocks.
intallocPolicy Memory allocation depletion policy.
intchunkSize O/S memory allocation chunk size.
intcollecting Manual GC is running.
intdead Dead generation (blocks about to be freed).
intdestroying Destroying the heap.
intearlyYieldQuota Quota of new allocations before yielding threads early to cleanup.
intenabled GC is enabled.
inteternal Eternal generation (permanent and dead blocks).
intflags GC operational control flags.
intfrom Eligible mprCollectGarbage flags.
intgcRequested GC has been requested.
inthasError Memory allocation error.
inthasSweeper Has dedicated sweeper thread.
MprSpinheapLock Heap allocation lock.
intiteration GC iteration counter (debug only).
struct MprThread *marker Marker thread.
MprCond *markerCond Marker sleep cond var.
intmarking Actually marking objects now.
intmustYield Threads must yield for GC which is due.
MprMutex *mutex Locking for state changes.
intnewCount Count of new gen allocations.
intnewQuota Quota of new allocations before idle GC worthwhile.
intnextSeqno Next sequence number.
MprMemNotifiernotifier Memory allocation failure callback.
intpageSize System page size.
intpauseGC Pause GC (short).
ssizepriorFree Last sweep free memory.
intpriorNewCount Last sweep new count.
MprRegion *regions List of memory regions.
introotIndex Marker root scan index.
MprSpinrootLock Root locking.
struct MprList *roots List of GC root objects.
intscribble Scribble over freed memory (slow).
intstale Stale generation for blocks that may have no references.
struct MprThread *sweeper Optional sweeper thread.
intsweeping Actually sweeping objects now.
inttrack Track memory allocations.
intverify Verify memory contents (very slow).
MprIOVec

Vectored write array.

API Stability:
Internal.
Fields:
ssizelen Length of block to write.
char *start Start of block to write.
MprJsonCallback

JSON callbacks.

API Stability:
Internal.
Fields:
int(*checkState)(struct MprJson *jp, cchar *name) Check state callback for JSON deserialization. This function is called at the conclusion of object levels when a "}" or "]" is encountered in the input stream. It is also invoked after each "name:" is parsed.
MprObj *(*makeObj)(struct MprJson *jp, bool list) MakeObject callback for JSON deserialization. This function is called to construct an object for each level in the object tree. Objects will be either arrays or objects.
void(*parseError)(struct MprJson *jp, cchar *msg) Handle a parse error. This function is called from mprJsonParseError to handle error reporting.
int(*setValue)(struct MprJson *jp, MprObj *obj, int index, cchar *name, cchar *value, int valueType) SetValue callback for JSON deserialization. This function is called to a property value in an object.
MprKeyValue

Key value pairs for use with MprList or MprKey.

API Stability:
Stable.
Fields:
void *key Key string.
void *value Associated value for the key.
MprMemStats

Memory allocator statistics.

API Stability:
Internal.
Fields:
ssizebytesAllocated Bytes currently allocated.
ssizebytesFree Bytes currently free.
uinterrors Allocation errors.
ssizefreed Bytes freed in last sweep.
intinMemException Recursive protect.
ssizemaxMemory Max memory that can be allocated.
uintnumCpu Number of CPUs.
uintpageSize System page size.
uint64ram System RAM size in bytes.
ssizeredLine Warn if allocation exceeds this level.
intregions Number of allocated regions.
ssizerss OS calculated resident stack size in bytes.
uint64user System user RAM size in bytes (excludes kernel).
MprMutex

Multithreading lock control structure.

Description:
MprMutex is used for multithread locking in multithreaded applications.
Fields:
API Stability:
Internal.
MprRegion

Memmory regions allocated from the O/S.

API Stability:
Internal.
Fields:
intfreeable Set to true when completely unused.
MprSpinlock Region multithread lock.
struct MprRegion *next Next region.
ssizesize Size of region including region header.
MprMem *start Start of region data.
MprRomInode

A RomInode is created for each file in the Rom file system.

API Stability:
Internal.
Fields:
uchar *data Pointer to file data.
intnum Inode number.
char *path File path.
intsize Size of file.
MprSignalInfo

Per signal structure.

API Stability:
Internal.
Fields:
inttriggered Set to true when triggered.
MprSignalService

Signal service control.

API Stability:
Internal.
Fields:
inthasSignals Signal sent to process.
MprSignalInfoinfo[MPR_MAX_SIGNALS] Actual signal info and arg.
MprMutex *mutex Multithread sync.
struct sigactionprior[MPR_MAX_SIGNALS] Prior sigaction handler before hooking.
MprSignal **signals Signal handlers.
MprList *standard Standard signal handlers.
MprSocketProvider

Socket service provider interface.

API Stability:
Internal.
Fields:
MprSocketService

Mpr socket service class.

API Stability:
Internal.
Fields:
char *defaultProvider Default secure provider for SSL connections.
inthasIPv6 System has supoprt for IPv6.
intmaxAccept Maximum number of accepted client socket connections.
MprMutex *mutex Multithread locking.
intnumAccept Count of client socket connections.
MprSocketPrebindprebind Prebind callback.
MprHash *providers Secure socket providers.
MprList *secureSockets List of secured (matrixssl) sockets.
MprSocketProvider *standardProvider Socket provider for non-SSL connections.
MprSpin

Multithreading spin lock control structure.

Description:
MprSpin is used for multithread locking in multithreaded applications.
Fields:
API Stability:
Internal.
MprTestCase

Test case structure.

API Stability:
Internal.
Fields:
MprTestDef

Test case definition.

API Stability:
Internal.
Fields:
MprTestFailure

Test failure record.

API Stability:
Internal.
Fields:
char *loc Program location of the failure.
char *message Failure message typically the assertion program text.
MprTestGroup

A test group is a group of tests to cover a unit of functionality.

API Stability:
Internal.
Fields:
MprList *cases List of tests in this group.
struct HttpConn *conn Http connection for this group.
char *content Cached response content.
void *data Test specific data.
MprTestDef *def Test definition ref.
MprDispatcher *dispatcher Per group thread dispatcher.
intfailedCount Total failures of this test.
MprList *failures List of all failures.
char *fullName Fully qualified name of test.
MprList *groups List of groups.
inthasInternet Convenience flag for internet available for use.
inthasIPv6 Convenience flag for IPv6 service.
struct Http *http Http service.
MprMutex *mutex Multi-thread sync.
char *name Name of test.
struct MprTestGroup *parent Parent test group.
struct MprTestGroup *root Top level test group parent.
MprTestService *service Reference to the service.
boolskip Skip this test.
boolskipWarned Warned that test will be skipped.
boolsuccess Result of last run.
inttestComplete Test complete signal.
inttestCount Count of tests.
inttestDepth Depth at which test should run.
MprThreadLocal

Thread local data storage.

API Stability:
Internal.
Fields:
pthread_key_tkey Data key.
MprThreadService

Thread service.

API Stability:
Internal.
Fields:
MprCond *cond Multi-thread sync.
struct MprThread *mainThread Main application Mpr thread id.
ssizestackSize Default thread stack size.
MprList *threads List of all threads.
MprWaitService

Wait Service.

API Stability:
Internal.
Fields:
MprWorkerService

Worker Thread Service.

Description:
The MPR provides a worker thread pool for rapid starting and assignment of threads to tasks.
Fields:
MprList *busyThreads List of threads to service tasks.
MprList *idleThreads List of threads to service tasks.
intmaxThreads Max # threads in worker pool.
intmaxUsedThreads Max threads ever used.
intminThreads Max # threads in worker pool.
MprMutex *mutex Per task synchronization.
intnextThreadNum Unique next thread number.
intnumThreads Current number of threads in worker pool.
struct MprEvent *pruneTimer Timer for excess threads pruner.
ssizestackSize Stack size for worker threads.
MprWorkerProcstartWorker Worker thread startup hook.
API Stability:
Internal.
MprWorkerStats

Statistics for Workers.

API Stability:
Internal.
Fields:
intbusy Number of busy workers.
intidle Number of idle workers.
intmax Configured max number of workers.
intmaxUsed Max number of workers ever used used.
intmin Configured minimum number of workers.
intyielded Number of busy workers yielded for GC.