Michael's Portable Runtime (MPR) is a portable runtime core 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. It is correctly handles null arguments without crashing. The MPR is a library and a C API that can be used in both C and C++ programs.
The MPR uses by convention a set extended typedefs for common types. These include: bool, cchar, cvoid, uchar, short, ushort, int, uint, long, ulong, int64, uint64, float, and double. The cchar type is a const char, cvoid is const void, and several types have "u" prefixes to denote unsigned qualifiers.
The MPR includes a memory manager to minimize memory leaks and maximize allocation efficiency. It utilizes a heap and slab allocators with tree links. All memory allocated is connected to a parent memory block thus forming a tree. When any block is freed, all child blocks are also freed. Most MPR APIs take a memory parent context as the first parameter.
Many of these APIs are not thread-safe. If utilizing multithreaded programming on a supporting operating system, be careful if you modify or delete the underlying data while accessing the resource from another thread.
Mpr | Primary MPR application control structure. |
MprBuf | Dynamic Buffer Module. |
MprDate | Date and Time Service. |
MprEvent | Event object. |
MprFile | File I/O Module. |
MprHash | Hash table entry structure. |
MprList | List Module. |
MprLog | Logging Services. |
MprMem | Memory Allocation Service. |
MprModule | Loadable Module Service. |
MprPath | Path (filename) Services Module. |
MprPoolService | Thread Pool Service. |
MprSocket | Socket Service. |
MprSynch | Multithreaded Synchronization Services. |
MprThread | Thread Service. |
MprUri | URI management. |
MprWaitHandler | Wait Handler Service. |
char* | mprAsprintf(MprCtx ctx, int maxSize, cchar *fmt, ...) |
Format a string into an allocated buffer. | |
int | mprAtoi(cchar *str, int radix) |
Convert a string to an integer. | |
MprFile* | mprAttachFd(MprCtx ctx, int fd, cchar *name, int omode) |
Attach to an existing file descriptor. | |
int | mprAvailablePoolThreads(MprCtx ctx) |
Get the count of available pool threads Return the count of free threads in the thread pool. | |
void | mprBreakpoint() |
Trigger a breakpoint. | |
void | mprClearList(MprList *list) |
Clears the list of all items. | |
void | mprCloseSocket(MprSocket *sp, bool graceful) |
Close a socket. | |
void | mprCompactBuf(MprBuf *buf) |
Compact the buffer contents. | |
MprHashTable* | mprCopyHash(MprCtx ctx, MprHashTable *table) |
Copy a hash table. | |
int | mprCopyList(MprList *dest, MprList *src) |
Copy a list. | |
int | mprCopyPath(MprCtx ctx, cchar *from, cchar *to, int omode) |
Copy a file. | |
Mpr* | mprCreate(int argc, char **argv, MprAllocNotifier cback) |
Create an instance of the MPR. | |
MprBuf* | mprCreateBuf(MprCtx ctx, int initialSize, int maxSize) |
Create a new buffer. | |
MprCond* | mprCreateCond(MprCtx ctx) |
Create a condition lock variable. | |
MprEvent* | mprCreateEvent(MprCtx ctx, MprEventProc proc, int period, int priority, void *data, int flags) |
Create a new event. | |
Mpr* | mprCreateEx(int argc, char **argv, MprAllocNotifier cback, void *shell) |
Create an instance of the MPR. | |
MprHashTable* | mprCreateHash(MprCtx ctx, int hashSize) |
Create a hash table. | |
MprKeyValue* | mprCreateKeyPair(MprCtx ctx, cchar *key, cchar *value) |
Create a key / value pair. | |
MprList* | mprCreateList(MprCtx ctx) |
Create a list. | |
MprMutex* | mprCreateLock(MprCtx ctx) |
Create a Mutex lock object. | |
MprModule* | mprCreateModule(MprCtx ctx, cchar *name, cchar *version, void *moduleData, MprModuleProc start, MprModuleProc stop) |
Create a module. | |
MprSocket* | mprCreateSocket(MprCtx ctx, struct MprSsl *ssl) |
Create a socket. | |
MprSpin* | mprCreateSpinLock(MprCtx ctx) |
Create a spin lock lock object. | |
MprThread* | mprCreateThread(MprCtx ctx, cchar *name, MprThreadProc proc, void *data, int priority, int stackSize) |
Create a new thread. | |
MprEvent* | mprCreateTimerEvent(MprCtx ctx, MprEventProc proc, int period, int priority, void *data, int flags) |
Create a timer event. | |
MprWaitHandler* | mprCreateWaitHandler(MprCtx ctx, int fd, int mask, MprWaitProc proc, void *data, int priority, int flags) |
Create a wait handler. | |
int | mprCtime(MprCtx ctx, char *buf, int bufsize, MprTime time) |
Convert time to local time and format as a string. | |
int | mprDeletePath(MprCtx ctx, cchar *path) |
Delete a file. | |
void | mprDisableFileBuffering(MprFile *file) |
Disable file buffering. | |
void | mprDisableWaitEvents(MprWaitHandler *wp, bool wakeup) |
Disable wait events. | |
MprList* | mprDupList(MprCtx ctx, MprList *src) |
Duplicate a list. | |
int | mprEnableFileBuffering(MprFile *file, int size, int maxSize) |
Enable file buffering. | |
void | mprEnableWaitEvents(MprWaitHandler *wp, bool wakeup) |
Enable wait events. | |
void | mprError(MprCtx ctx, cchar *fmt, ...) |
Log an error message. | |
char* | mprEscapeCmd(MprCtx ctx, cchar *cmd, int escChar) |
Encode a string escaping typical command (shell) characters. | |
char* | mprEscapeHtml(MprCtx ctx, cchar *html) |
Encode a string by escaping typical HTML characters. | |
void | mprFatalError(MprCtx ctx, cchar *fmt, ...) |
Log a fatal error message and exit. | |
int | mprFlush(MprFile *file) |
Flush any buffered write data. | |
void | mprFlushBuf(MprBuf *buf) |
Flush the buffer contents. | |
int | mprFlushSocket(MprSocket *sp) |
Flush a socket. | |
char* | mprFormatUri(MprCtx ctx, cchar *protocol, cchar *host, int port, cchar *path, cchar *query) |
Format a URI. | |
int | mprFprintf(struct MprFile *file, cchar *fmt, ...) |
Print a formatted message to a file descriptor. | |
int | mprFree(void *ptr) |
Free a block of memory. | |
char* | mprGetAbsPath(MprCtx ctx, cchar *path) |
Convert a path to an absolute path. | |
int | mprGetBlockFromBuf(MprBuf *buf, uchar *blk, int count) |
Get a block of data from the buffer. | |
char* | mprGetBufEnd(MprBuf *buf) |
Get a reference to the end of the buffer contents. | |
int | mprGetBufLength(MprBuf *buf) |
Get the buffer content length. | |
char* | mprGetBufOrigin(MprBuf *buf) |
Get the origin of the buffer content storage. | |
MprBufProc | mprGetBufRefillProc(MprBuf *buf) |
Get the buffer refill procedure. | |
int | mprGetBufSize(MprBuf *buf) |
Get the current size of the buffer content storage. | |
int | mprGetBufSpace(MprBuf *buf) |
Get the space available to store content. | |
char* | mprGetBufStart(MprBuf *buf) |
Get the start of the buffer contents. | |
int | mprGetc(MprFile *file) |
Read a character from the file. | |
int | mprGetCharFromBuf(MprBuf *buf) |
Get a character from the buffer. | |
MprOsThread | mprGetCurrentOsThread() |
Get the O/S thread. | |
char* | mprGetCurrentPath(MprCtx ctx) |
Return the current working directory. | |
MprThread* | mprGetCurrentThread(MprCtx ctx) |
Get the currently executing thread. | |
bool | mprGetDebugMode(MprCtx ctx) |
Get the debug mode. | |
MprOffset | mprGetFilePosition(MprFile *file) |
Return the current file position. | |
MprOffset | mprGetFileSize(MprFile *file) |
Get the size of the file. | |
MprHash* | mprGetFirstHash(MprHashTable *table) |
Return the first symbol in a symbol entry. | |
void* | mprGetFirstItem(MprList *list) |
Get the first item in the list. | |
int | mprGetHashCount(MprHashTable *table) |
Return the count of symbols in a symbol entry. | |
cchar* | mprGetHttpCodeString(MprCtx ctx, int code) |
Get the Http reponse code as a string. | |
void* | mprGetItem(MprList *list, int index) |
Get an list item. | |
void* | mprGetLastItem(MprList *list) |
Get the last item in the list. | |
int | mprGetListCapacity(MprList *list) |
Get the current capacity of the list. | |
int | mprGetListCount(MprList *list) |
Get the number of items in the list. | |
MprLogHandler | mprGetLogHandler(MprCtx ctx) |
Get the current MPR debug log handler. | |
int | mprGetMaxPoolThreads(MprCtx ctx) |
Get the maximum count of pool threads Get the maximum limit of pool threads. | |
cchar* | mprGetModuleSearchPath(MprCtx ctx) |
Get the module search path. | |
char* | mprGetNativePath(MprCtx ctx, cchar *path) |
Get a path formatted according to the native O/S conventions. | |
MprHash* | mprGetNextHash(MprHashTable *table, MprHash *last) |
Return the next symbol in a symbol entry. | |
void* | mprGetNextItem(MprList *list, int *lastIndex) |
Get the next item in the list. | |
char* | mprGetNormalizedPath(MprCtx ctx, cchar *path) |
Normalize a path. | |
int | mprGetOsError() |
Return the O/S error code. | |
void* | mprGetParent(MprCtx ctx) |
Get the memory parent of a block. | |
char* | mprGetPathBase(MprCtx ctx, cchar *path) |
Get the base portion of a path. | |
char* | mprGetPathDir(MprCtx ctx, cchar *path) |
Get the directory portion of a path. | |
cchar* | mprGetPathExtension(MprCtx ctx, cchar *path) |
Get the file extension portion of a path. | |
MprList* | mprGetPathFiles(MprCtx ctx, cchar *dir, bool enumDirs) |
Create a directory list of files. | |
int | mprGetPathInfo(MprCtx ctx, cchar *path, MprPath *info) |
Return information about a file represented by a path. | |
cchar* | mprGetPathNewline(MprCtx ctx, cchar *path) |
Get the file newline character string for a given path. | |
char* | mprGetPathParent(MprCtx ctx, cchar *path) |
Get the parent directory of a path. | |
cchar* | mprGetPathSeparators(MprCtx ctx, cchar *path) |
Get the path directory separator. | |
char* | mprGetPortablePath(MprCtx ctx, cchar *path) |
Get a portable path. | |
void* | mprGetPrevItem(MprList *list, int *lastIndex) |
Get the previous item in the list. | |
char* | mprGetRelPath(MprCtx ctx, cchar *path) |
Get a relative path. | |
char* | mprGets(MprFile *file, char *buf, uint size) |
Read a line from the file. | |
bool | mprGetSocketBlockingMode(MprSocket *sp) |
Get the socket blocking mode. | |
bool | mprGetSocketEof(MprSocket *sp) |
Test if the other end of the socket has been closed. | |
int | mprGetSocketError(MprSocket *sp) |
Get a socket error code. | |
int | mprGetSocketFd(MprSocket *sp) |
Get the socket file descriptor. | |
int | mprGetSocketPort(MprSocket *sp) |
Get the port used by a socket. | |
char* | mprGetTempPath(MprCtx ctx, cchar *tmpDir) |
Make a temporary file. | |
cchar* | mprGetThreadName(MprThread *thread) |
Get the thread name. | |
int | mprGetThreadPriority(MprThread *thread) |
Get the thread priroity. | |
MprTime | mprGetTime(MprCtx ctx) |
Get the system time. | |
char* | mprGetTransformedPath(MprCtx ctx, cchar *path, int flags) |
Transform a path. | |
char* | mprGetWordTok(char *buf, int bufsize, cchar *str, cchar *delim, cchar **tok) |
Get the next word token. | |
void | mprGlobalLock(MprCtx ctx) |
Globally lock the application. | |
void | mprGlobalUnlock(MprCtx ctx) |
Unlock the global mutex. | |
struct tm* | mprGmtime(MprCtx ctx, struct tm *timep, MprTime time) |
Convert time to UTC and parse into a time structure. | |
int | mprGrowBuf(MprBuf *buf, int count) |
Grow the buffer. | |
void | mprInitList(MprList *list) |
Initialize a list structure. | |
MprMutex* | mprInitLock(MprCtx ctx, MprMutex *mutex) |
Initialize a statically allocated Mutex lock object. | |
MprSpin* | mprInitSpinLock(MprCtx ctx, MprSpin *lock) |
Initialize a statically allocated spinlock object. | |
int | mprInsertCharToBuf(MprBuf *buf, int c) |
Insert a character into the buffer. | |
int | mprInsertItemAtPos(MprList *list, int index, cvoid *item) |
Insert an item into a list at a specific position. | |
bool | mprIsAbsPath(MprCtx ctx, cchar *path) |
Determine if a path is absolute. | |
bool | mprIsExiting(MprCtx ctx) |
Determine if the MPR should exit. | |
bool | mprIsRelPath(MprCtx ctx, cchar *path) |
Determine if a path is relative. | |
char* | mprItoa(char *buf, int size, int value, int radix) |
Convert an integer to a string. | |
char* | mprJoinPath(MprCtx ctx, cchar *dir, cchar *other) |
Join paths. | |
char* | mprJoinPathExt(MprCtx ctx, cchar *dir, cchar *ext) |
Join an extension to a path. | |
MprModule* | mprLoadModule(MprCtx ctx, cchar *filename, cchar *entryPoint) |
Load a module. | |
struct tm* | mprLocaltime(MprCtx ctx, struct tm *timep, MprTime time) |
Convert time to local representation. | |
void | mprLock(MprMutex *lock) |
Lock access. | |
void | mprLog(MprCtx ctx, int level, cchar *fmt, ...) |
Write a message to the diagnostic log file. | |
int | mprLookAtLastCharInBuf(MprBuf *buf) |
Peek at the last character in the buffer. | |
int | mprLookAtNextCharInBuf(MprBuf *buf) |
Peek at the next character in the buffer. | |
cvoid* | mprLookupHash(MprHashTable *table, cchar *key) |
Lookup a symbol in the hash table. | |
MprHash* | mprLookupHashEntry(MprHashTable *table, cchar *key) |
Lookup a symbol in the hash table and return the hash entry. | |
int | mprLookupItem(MprList *list, cvoid *item) |
Find an item and return its index. | |
MprModule* | mprLookupModule(MprCtx ctx, cchar *name) |
Lookup a module. | |
int | mprMakeDir(MprCtx ctx, cchar *path, int perms, bool makeMissing) |
Make a directory. | |
void | mprMapSeparators(MprCtx ctx, char *path, int separator) |
Map the separators in a path. | |
int | mprMemcmp(cvoid *b1, int b1Len, cvoid *b2, int b2Len) |
Compare two byte strings. | |
int | mprMemcpy(void *dest, int destMax, cvoid *src, int nbytes) |
Safe copy for a block of data. | |
void* | mprMemdup(MprCtx ctx, cvoid *ptr, uint size) |
Duplicate a block of memory. | |
void | mprMemoryError(MprCtx ctx, cchar *fmt, ...) |
Log a memory error message. | |
MprFile* | mprOpen(MprCtx ctx, cchar *filename, int omode, int perms) |
Open a file. | |
int | mprOpenClientSocket(MprSocket *sp, cchar *hostName, int port, int flags) |
Open a client socket. | |
int | mprOpenServerSocket(MprSocket *sp, cchar *ipAddr, int port, MprSocketAcceptProc acceptFn, void *data, int flags) |
Open a server socket. | |
MprUri* | mprParseUri(MprCtx ctx, cchar *uri) |
Parse a URI. | |
bool | mprPathExists(MprCtx ctx, cchar *path, int omode) |
Determine if a file exists for a path name and can be accessed. | |
int | mprPeekc(MprFile *file) |
Non-destructively read a character from the file. | |
int | mprPrintf(MprCtx ctx, cchar *fmt, ...) |
Formatted print. | |
int | mprPrintfError(MprCtx ctx, cchar *fmt, ...) |
Print a formatted message to the standard error channel. | |
int | mprPutBlockToBuf(MprBuf *buf, cchar *ptr, int size) |
Put a block to the buffer. | |
int | mprPutc(MprFile *file, int c) |
Write a character to the file. | |
int | mprPutCharToBuf(MprBuf *buf, int c) |
Put a character to the buffer. | |
int | mprPutFmtToBuf(MprBuf *buf, cchar *fmt, ...) |
Put a formatted string to the buffer. | |
int | mprPutIntToBuf(MprBuf *buf, int i) |
Put an integer to the buffer. | |
int | mprPuts(MprFile *file, cchar *buf, uint size) |
Write a line to the file. | |
int | mprPutStringToBuf(MprBuf *buf, cchar *str) |
Put a string to the buffer. | |
void | mprRawLog(MprCtx ctx, int level, cchar *fmt, ...) |
Write a raw log message to the diagnostic log file. | |
int | mprRead(MprFile *file, void *buf, uint size) |
Read data from a file. | |
int | mprReadSocket(MprSocket *sp, void *buf, int size) |
Read from a socket. | |
void* | mprRealloc(MprCtx ctx, void *ptr, uint size) |
Reallocate a block. | |
char* | mprReallocStrcat(MprCtx ctx, int max, char *buf, cchar *src, ...) |
Append strings to an existing string and reallocate as required. | |
void | mprRecallWaitHandler(MprWaitHandler *wp) |
Recall a wait handler. | |
int | mprRefillBuf(MprBuf *buf) |
Refill the buffer with data. | |
void | mprRemoveEvent(MprEvent *event) |
Remove an event. | |
int | mprRemoveHash(MprHashTable *table, cchar *key) |
Remove a symbol entry from the hash table. | |
int | mprRemoveItem(MprList *list, void *item) |
Remove an item from the list. | |
int | mprRemoveItemAtPos(MprList *list, int index) |
Remove an item from the list. | |
int | mprRemoveLastItem(MprList *list) |
Remove the last item from the list. | |
int | mprRemoveRangeOfItems(MprList *list, int start, int end) |
Remove a range of items from the list. | |
void | mprRescheduleEvent(MprEvent *event, int period) |
Reschedule an event. | |
void | mprResetAllocError(MprCtx ctx) |
Reset the memory allocation error flag. | |
void | mprResetBufIfEmpty(MprBuf *buf) |
Reset the buffer. | |
void | mprRestartContinuousEvent(MprEvent *event) |
Restart an event. | |
int | mprRfctime(MprCtx ctx, char *buf, int bufsize, const struct tm *timep) |
Format time according to RFC822. | |
int | mprSamePath(MprCtx ctx, cchar *path1, cchar *path2) |
Compare two paths if they are the same. | |
int | mprSamePathCount(MprCtx ctx, cchar *path1, cchar *path2, int len) |
Compare two paths if they are the same for a given length. | |
char* | mprSearchPath(MprCtx ctx, cchar *path, int flags, cchar *search, ...) |
Search for a path. | |
long | mprSeek(MprFile *file, int seekType, long distance) |
Seek the I/O pointer to a new location in the file. | |
MprOffset | mprSendFileToSocket(MprFile *file, MprSocket *sock, MprOffset offset, int bytes, MprIOVec *beforeVec, int beforeCount, MprIOVec *afterVec, int afterCount) |
Send a file to a socket. | |
int | mprServiceEvents(MprCtx ctx, int delay, int flags) |
Service events. | |
void | mprSetAllocLimits(MprCtx ctx, uint redline, uint maxMemory) |
Configure the application memory limits. | |
void | mprSetBufMax(MprBuf *buf, int maxSize) |
Set the maximum buffer size. | |
void | mprSetBufRefillProc(MprBuf *buf, MprBufProc fn, void *arg) |
Set the buffer refill procedure. | |
int | mprSetBufSize(MprBuf *buf, int size, int maxSize) |
Set the buffer size. | |
void | mprSetCurrentThreadPriority(MprCtx ctx, int priority) |
Set the thread priroity for the current thread. | |
void | mprSetDebugMode(MprCtx ctx, bool on) |
Turn on debug mode. | |
void | mprSetDestructor(void *ptr, MprDestructor destructor) |
Update the destructor for a block of memory. | |
void* | mprSetItem(MprList *list, int index, cvoid *item) |
Set a list item. | |
int | mprSetListLimits(MprList *list, int initialSize, int maxSize) |
Define the list size limits. | |
void | mprSetLogHandler(MprCtx ctx, MprLogHandler handler, void *handlerData) |
Set an MPR debug log handler. | |
void | mprSetLogLevel(MprCtx ctx, int level) |
Set the current logging level. | |
void | mprSetMaxPoolThreads(MprCtx ctx, int count) |
Set the maximum count of pool threads Set the maximum number of pool threads for the MPR. | |
void | mprSetMinPoolThreads(MprCtx ctx, int count) |
Set the minimum count of pool threads Set the count of threads the pool will have. | |
void | mprSetModuleSearchPath(MprCtx ctx, char *searchPath) |
Set the module search path. | |
int | mprSetSocketBlockingMode(MprSocket *sp, bool on) |
Set the socket blocking mode. | |
void | mprSetSocketCallback(MprSocket *sp, MprSocketProc fn, void *data, void *data2, int mask, int priority) |
Set the socket callback. | |
void | mprSetSocketEventMask(MprSocket *sp, int mask) |
Define the events of interest for a socket. | |
int | mprSetSocketNoDelay(MprSocket *sp, bool on) |
Set the socket delay mode. | |
void | mprSetThreadPriority(MprThread *thread, int priority) |
Set the thread priroity. | |
void | mprSetWaitCallback(MprWaitHandler *wp, MprWaitProc proc, int mask) |
Define the wait handler callback. | |
void | mprSetWaitInterest(MprWaitHandler *wp, int mask) |
Define the events of interest for a wait handler. | |
void | mprSignalCond(MprCond *cond) |
Signal a condition lock variable. | |
void | mprSignalExit(MprCtx ctx) |
Signal the MPR to exit gracefully. | |
bool | mprSocketIsSecure(MprSocket *sp) |
Determine if the socket is secure. | |
void | mprSortList(MprList *list, MprListCompareProc compare) |
Sort a list. | |
void | mprSpinLock(MprSpin *lock) |
Lock a spinlock. | |
void | mprSpinUnlock(MprSpin *lock) |
Unlock a spinlock. | |
char* | mprSprintf(char *buf, int maxSize, cchar *fmt, ...) |
Format a string into a statically allocated buffer. | |
int | mprStartThread(MprThread *thread) |
Start a thread. | |
void | mprStaticAssert(cchar *loc, cchar *msg) |
Output an assertion failed message. | |
void | mprStaticError(MprCtx ctx, cchar *fmt, ...) |
Write a message to the diagnostic log file without allocating any memory. | |
int | mprStaticPrintf(MprCtx ctx, cchar *fmt, ...) |
Print a message to the applications standard output without allocating memory. | |
int | mprStaticPrintfError(MprCtx ctx, cchar *fmt, ...) |
Print a message to the standard error channel without allocating memory. | |
char* | mprStealBuf(MprCtx ctx, MprBuf *buf) |
Steal the buffer memory from a buffer. | |
void | mprStopContinuousEvent(MprEvent *event) |
Stop an event. | |
char* | mprStrcat(MprCtx ctx, int max, cchar *src, ...) |
Catenate strings. | |
int | mprStrcmp(cchar *str1, cchar *str2) |
Compare strings. | |
int | mprStrcmpAnyCase(cchar *str1, cchar *str2) |
Compare strings ignoring case. | |
int | mprStrcmpAnyCaseCount(cchar *str1, cchar *str2, int len) |
Compare strings ignoring case. | |
int | mprStrcpy(char *dest, int destMax, cchar *src) |
Copy a string. | |
int | mprStrcpyCount(char *dest, int destMax, cchar *src, int count) |
Copy characters from a string. | |
char* | mprStrdup(MprCtx ctx, cchar *str) |
Safe replacement for strdup. | |
int | mprStrlen(cchar *src, int max) |
Return the length of a string. | |
char* | mprStrLower(char *str) |
Convert a string to lower case. | |
char* | mprStrndup(MprCtx ctx, cchar *str, uint size) |
Duplicate a string. | |
char* | mprStrnstr(cchar *str, cchar *pattern, int len) |
Find a substring. | |
char* | mprStrTok(char *str, cchar *delim, char **last) |
Tokenize a string. | |
char* | mprStrTrim(char *str, cchar *set) |
Trim a string. | |
char* | mprStrUpper(char *str) |
Convert a string to upper case. | |
void | mprTerminate(MprCtx ctx, bool graceful) |
Terminate the MPR. | |
char* | mprTrimPathExtension(MprCtx ctx, cchar *path) |
Trim an extension from a path. | |
int | mprTruncatePath(MprCtx ctx, cchar *path, int size) |
Truncate a path. | |
bool | mprTryLock(MprMutex *lock) |
Attempt to lock access. | |
bool | mprTrySpinLock(MprSpin *lock) |
Attempt to lock access on a spin lock. | |
void | mprUnloadModule(MprModule *mp) |
Unload a module. | |
void | mprUnlock(MprMutex *lock) |
Unlock a mutex. | |
char* | mprUrlDecode(MprCtx ctx, cchar *url) |
Decode a URL string by de-scaping URL characters. | |
char* | mprUrlEncode(MprCtx ctx, cchar *url) |
Encode a string by escaping URL characters. | |
void | mprUserError(MprCtx ctx, cchar *fmt, ...) |
Display an error message to the user. | |
char* | mprValidateUrl(MprCtx ctx, char *url) |
Validate a URL. | |
char* | mprVasprintf(MprCtx ctx, int maxSize, cchar *fmt, va_list arg) |
Allocate a buffer of sufficient length to hold the formatted string. | |
char* | mprVsprintf(char *buf, int maxSize, cchar *fmt, va_list args) |
Format a string into a statically allocated buffer. | |
int | mprWaitForCond(MprCond *cond, int timeout) |
Wait for a condition lock variable. | |
int | mprWaitForSingleIO(MprWaitHandler *wp, int fd, int mask, int timeout) |
Wait for I/O on an event handler. | |
int | mprWrite(MprFile *file, cvoid *buf, uint count) |
Write data to a file. | |
int | mprWriteFormat(MprFile *file, cchar *fmt, ...) |
Write formatted data to a file. | |
int | mprWriteSocket(MprSocket *sp, void *buf, int len) |
Write to a socket. | |
int | mprWriteSocketString(MprSocket *sp, cchar *str) |
Write to a string to a socket. | |
int | mprWriteSocketVector(MprSocket *sp, MprIOVec *iovec, int count) |
Write a vector to a socket. | |
int | mprWriteString(MprFile *file, cchar *str) |
Write a string to a file. | |
void | mprBreakpoint() |
Trigger a breakpoint. | |
Mpr* | mprCreate(int argc, char **argv, MprAllocNotifier cback) |
Create an instance of the MPR. | |
Mpr* | mprCreateEx(int argc, char **argv, MprAllocNotifier cback, void *shell) |
Create an instance of the MPR. | |
bool | mprGetDebugMode(MprCtx ctx) |
Get the debug mode. | |
int | mprGetOsError() |
Return the O/S error code. | |
bool | mprIsExiting(MprCtx ctx) |
Determine if the MPR should exit. | |
void | mprSignalExit(MprCtx ctx) |
Signal the MPR to exit gracefully. | |
void | mprTerminate(MprCtx ctx, bool graceful) |
Terminate the MPR. | |
void | mprAddNullToBuf(MprBuf *buf) |
Add a null character to the buffer contents. | |
void | mprAdjustBufEnd(MprBuf *buf, int count) |
Adjust the buffer end position. | |
void | mprAdjustBufStart(MprBuf *buf, int count) |
Adjust the buffer start position. | |
void | mprCompactBuf(MprBuf *buf) |
Compact the buffer contents. | |
MprBuf* | mprCreateBuf(MprCtx ctx, int initialSize, int maxSize) |
Create a new buffer. | |
void | mprFlushBuf(MprBuf *buf) |
Flush the buffer contents. | |
int | mprGetBlockFromBuf(MprBuf *buf, uchar *blk, int count) |
Get a block of data from the buffer. | |
char* | mprGetBufEnd(MprBuf *buf) |
Get a reference to the end of the buffer contents. | |
int | mprGetBufLength(MprBuf *buf) |
Get the buffer content length. | |
char* | mprGetBufOrigin(MprBuf *buf) |
Get the origin of the buffer content storage. | |
MprBufProc | mprGetBufRefillProc(MprBuf *buf) |
Get the buffer refill procedure. | |
int | mprGetBufSize(MprBuf *buf) |
Get the current size of the buffer content storage. | |
int | mprGetBufSpace(MprBuf *buf) |
Get the space available to store content. | |
char* | mprGetBufStart(MprBuf *buf) |
Get the start of the buffer contents. | |
int | mprGetCharFromBuf(MprBuf *buf) |
Get a character from the buffer. | |
int | mprGrowBuf(MprBuf *buf, int count) |
Grow the buffer. | |
int | mprInsertCharToBuf(MprBuf *buf, int c) |
Insert a character into the buffer. | |
int | mprLookAtLastCharInBuf(MprBuf *buf) |
Peek at the last character in the buffer. | |
int | mprLookAtNextCharInBuf(MprBuf *buf) |
Peek at the next character in the buffer. | |
int | mprPutBlockToBuf(MprBuf *buf, cchar *ptr, int size) |
Put a block to the buffer. | |
int | mprPutCharToBuf(MprBuf *buf, int c) |
Put a character to the buffer. | |
int | mprPutFmtToBuf(MprBuf *buf, cchar *fmt, ...) |
Put a formatted string to the buffer. | |
int | mprPutIntToBuf(MprBuf *buf, int i) |
Put an integer to the buffer. | |
int | mprPutStringToBuf(MprBuf *buf, cchar *str) |
Put a string to the buffer. | |
int | mprRefillBuf(MprBuf *buf) |
Refill the buffer with data. | |
void | mprResetBufIfEmpty(MprBuf *buf) |
Reset the buffer. | |
void | mprSetBufMax(MprBuf *buf, int maxSize) |
Set the maximum buffer size. | |
void | mprSetBufRefillProc(MprBuf *buf, MprBufProc fn, void *arg) |
Set the buffer refill procedure. | |
int | mprSetBufSize(MprBuf *buf, int size, int maxSize) |
Set the buffer size. | |
char* | mprStealBuf(MprCtx ctx, MprBuf *buf) |
Steal the buffer memory from a buffer. | |
int | mprAsctime(MprCtx ctx, char *buf, int bufsize, const struct tm *timeptr) |
Format time as a string. | |
int | mprCtime(MprCtx ctx, char *buf, int bufsize, MprTime time) |
Convert time to local time and format as a string. | |
MprTime | mprGetTime(MprCtx ctx) |
Get the system time. | |
struct tm* | mprGmtime(MprCtx ctx, struct tm *timep, MprTime time) |
Convert time to UTC and parse into a time structure. | |
struct tm* | mprLocaltime(MprCtx ctx, struct tm *timep, MprTime time) |
Convert time to local representation. | |
MprEvent* | mprCreateEvent(MprCtx ctx, MprEventProc proc, int period, int priority, void *data, int flags) |
Create a new event. | |
MprEvent* | mprCreateTimerEvent(MprCtx ctx, MprEventProc proc, int period, int priority, void *data, int flags) |
Create a timer event. | |
void | mprRemoveEvent(MprEvent *event) |
Remove an event. | |
void | mprRescheduleEvent(MprEvent *event, int period) |
Reschedule an event. | |
void | mprRestartContinuousEvent(MprEvent *event) |
Restart an event. | |
int | mprServiceEvents(MprCtx ctx, int delay, int flags) |
Service events. | |
void | mprStopContinuousEvent(MprEvent *event) |
Stop an event. | |
MprFile* | mprAttachFd(MprCtx ctx, int fd, cchar *name, int omode) |
Attach to an existing file descriptor. | |
void | mprDisableFileBuffering(MprFile *file) |
Disable file buffering. | |
int | mprEnableFileBuffering(MprFile *file, int size, int maxSize) |
Enable file buffering. | |
int | mprFlush(MprFile *file) |
Flush any buffered write data. | |
int | mprGetc(MprFile *file) |
Read a character from the file. | |
MprOffset | mprGetFilePosition(MprFile *file) |
Return the current file position. | |
MprOffset | mprGetFileSize(MprFile *file) |
Get the size of the file. | |
char* | mprGets(MprFile *file, char *buf, uint size) |
Read a line from the file. | |
MprFile* | mprOpen(MprCtx ctx, cchar *filename, int omode, int perms) |
Open a file. | |
int | mprPeekc(MprFile *file) |
Non-destructively read a character from the file. | |
int | mprPutc(MprFile *file, int c) |
Write a character to the file. | |
int | mprPuts(MprFile *file, cchar *buf, uint size) |
Write a line to the file. | |
int | mprRead(MprFile *file, void *buf, uint size) |
Read data from a file. | |
long | mprSeek(MprFile *file, int seekType, long distance) |
Seek the I/O pointer to a new location in the file. | |
int | mprWrite(MprFile *file, cvoid *buf, uint count) |
Write data to a file. | |
int | mprWriteFormat(MprFile *file, cchar *fmt, ...) |
Write formatted data to a file. | |
int | mprWriteString(MprFile *file, cchar *str) |
Write a string to a file. | |
MprHash* | mprAddDuplicateHash(MprHashTable *table, cchar *key, cvoid *ptr) |
Add a duplicate symbol value into the hash table. | |
MprHash* | mprAddHash(MprHashTable *table, cchar *key, cvoid *ptr) |
Add a symbol value into the hash table. | |
MprHashTable* | mprCopyHash(MprCtx ctx, MprHashTable *table) |
Copy a hash table. | |
MprHashTable* | mprCreateHash(MprCtx ctx, int hashSize) |
Create a hash table. | |
MprHash* | mprGetFirstHash(MprHashTable *table) |
Return the first symbol in a symbol entry. | |
int | mprGetHashCount(MprHashTable *table) |
Return the count of symbols in a symbol entry. | |
MprHash* | mprGetNextHash(MprHashTable *table, MprHash *last) |
Return the next symbol in a symbol entry. | |
cvoid* | mprLookupHash(MprHashTable *table, cchar *key) |
Lookup a symbol in the hash table. | |
MprHash* | mprLookupHashEntry(MprHashTable *table, cchar *key) |
Lookup a symbol in the hash table and return the hash entry. | |
int | mprRemoveHash(MprHashTable *table, cchar *key) |
Remove a symbol entry from the hash table. | |
int | mprAddItem(MprList *list, cvoid *item) |
Add an item to a list. | |
MprList* | mprAppendList(MprList *list, MprList *add) |
Append a list. | |
void | mprClearList(MprList *list) |
Clears the list of all items. | |
int | mprCopyList(MprList *dest, MprList *src) |
Copy a list. | |
MprKeyValue* | mprCreateKeyPair(MprCtx ctx, cchar *key, cchar *value) |
Create a key / value pair. | |
MprList* | mprCreateList(MprCtx ctx) |
Create a list. | |
MprList* | mprDupList(MprCtx ctx, MprList *src) |
Duplicate a list. | |
void* | mprGetFirstItem(MprList *list) |
Get the first item in the list. | |
void* | mprGetItem(MprList *list, int index) |
Get an list item. | |
void* | mprGetLastItem(MprList *list) |
Get the last item in the list. | |
int | mprGetListCapacity(MprList *list) |
Get the current capacity of the list. | |
int | mprGetListCount(MprList *list) |
Get the number of items in the list. | |
void* | mprGetNextItem(MprList *list, int *lastIndex) |
Get the next item in the list. | |
void* | mprGetPrevItem(MprList *list, int *lastIndex) |
Get the previous item in the list. | |
void | mprInitList(MprList *list) |
Initialize a list structure. | |
int | mprInsertItemAtPos(MprList *list, int index, cvoid *item) |
Insert an item into a list at a specific position. | |
int | mprLookupItem(MprList *list, cvoid *item) |
Find an item and return its index. | |
int | mprRemoveItem(MprList *list, void *item) |
Remove an item from the list. | |
int | mprRemoveItemAtPos(MprList *list, int index) |
Remove an item from the list. | |
int | mprRemoveLastItem(MprList *list) |
Remove the last item from the list. | |
int | mprRemoveRangeOfItems(MprList *list, int start, int end) |
Remove a range of items from the list. | |
void* | mprSetItem(MprList *list, int index, cvoid *item) |
Set a list item. | |
int | mprSetListLimits(MprList *list, int initialSize, int maxSize) |
Define the list size limits. | |
void | mprSortList(MprList *list, MprListCompareProc compare) |
Sort a list. | |
void | mprError(MprCtx ctx, cchar *fmt, ...) |
Log an error message. | |
void | mprFatalError(MprCtx ctx, cchar *fmt, ...) |
Log a fatal error message and exit. | |
MprLogHandler | mprGetLogHandler(MprCtx ctx) |
Get the current MPR debug log handler. | |
void | mprLog(MprCtx ctx, int level, cchar *fmt, ...) |
Write a message to the diagnostic log file. | |
void | mprMemoryError(MprCtx ctx, cchar *fmt, ...) |
Log a memory error message. | |
void | mprRawLog(MprCtx ctx, int level, cchar *fmt, ...) |
Write a raw log message to the diagnostic log file. | |
void | mprSetLogHandler(MprCtx ctx, MprLogHandler handler, void *handlerData) |
Set an MPR debug log handler. | |
void | mprSetLogLevel(MprCtx ctx, int level) |
Set the current logging level. | |
void | mprStaticAssert(cchar *loc, cchar *msg) |
Output an assertion failed message. | |
void | mprStaticError(MprCtx ctx, cchar *fmt, ...) |
Write a message to the diagnostic log file without allocating any memory. | |
void | mprUserError(MprCtx ctx, cchar *fmt, ...) |
Display an error message to the user. | |
void* | mprAlloc(MprCtx ctx, uint size) |
Allocate a block of memory. | |
void* | mprAllocObj(MprCtx ctx, Type type) |
Allocate an object of a given type. | |
void* | mprAllocObjWithDestructor(MprCtx ctx, Type type, MprDestructor destructor) void *mprAllocObjWithDestructorZeroed(MprCtx ctx |
Allocate an object of a given type with a destructor. | |
void* | mprAllocObjZeroed(MprCtx ctx, Type type) |
Allocate a zeroed object of a given type. | |
void* | mprAllocWithDestructor(MprCtx ctx, uint size, MprDestructor destructor) |
Allocate an object block of memory. | |
void* | mprAllocWithDestructorZeroed(MprCtx ctx, uint size, MprDestructor destructor) |
Allocate an object block of memory and zero it. | |
void* | mprAllocZeroed(MprCtx ctx, uint size) |
Allocate a zeroed block of memory. | |
int | mprFree(void *ptr) |
Free a block of memory. | |
void* | mprGetParent(MprCtx ctx) |
Get the memory parent of a block. | |
void* | mprMemdup(MprCtx ctx, cvoid *ptr, uint size) |
Duplicate a block of memory. | |
void* | mprRealloc(MprCtx ctx, void *ptr, uint size) |
Reallocate a block. | |
void | mprResetAllocError(MprCtx ctx) |
Reset the memory allocation error flag. | |
void | mprSetAllocLimits(MprCtx ctx, uint redline, uint maxMemory) |
Configure the application memory limits. | |
void | mprSetDestructor(void *ptr, MprDestructor destructor) |
Update the destructor for a block of memory. | |
char* | mprStrdup(MprCtx ctx, cchar *str) |
Safe replacement for strdup. | |
char* | mprStrndup(MprCtx ctx, cchar *str, uint size) |
Duplicate a string. | |
MprModule* | mprCreateModule(MprCtx ctx, cchar *name, cchar *version, void *moduleData, MprModuleProc start, MprModuleProc stop) |
Create a module. | |
cchar* | mprGetModuleSearchPath(MprCtx ctx) |
Get the module search path. | |
MprModule* | mprLoadModule(MprCtx ctx, cchar *filename, cchar *entryPoint) |
Load a module. | |
MprModule* | mprLookupModule(MprCtx ctx, cchar *name) |
Lookup a module. | |
void | mprSetModuleSearchPath(MprCtx ctx, char *searchPath) |
Set the module search path. | |
void | mprUnloadModule(MprModule *mp) |
Unload a module. | |
int | mprCopyPath(MprCtx ctx, cchar *from, cchar *to, int omode) |
Copy a file. | |
int | mprDeletePath(MprCtx ctx, cchar *path) |
Delete a file. | |
char* | mprGetAbsPath(MprCtx ctx, cchar *path) |
Convert a path to an absolute path. | |
char* | mprGetNativePath(MprCtx ctx, cchar *path) |
Get a path formatted according to the native O/S conventions. | |
char* | mprGetNormalizedPath(MprCtx ctx, cchar *path) |
Normalize a path. | |
char* | mprGetPathBase(MprCtx ctx, cchar *path) |
Get the base portion of a path. | |
char* | mprGetPathDir(MprCtx ctx, cchar *path) |
Get the directory portion of a path. | |
cchar* | mprGetPathExtension(MprCtx ctx, cchar *path) |
Get the file extension portion of a path. | |
MprList* | mprGetPathFiles(MprCtx ctx, cchar *dir, bool enumDirs) |
Create a directory list of files. | |
int | mprGetPathInfo(MprCtx ctx, cchar *path, MprPath *info) |
Return information about a file represented by a path. | |
cchar* | mprGetPathNewline(MprCtx ctx, cchar *path) |
Get the file newline character string for a given path. | |
char* | mprGetPathParent(MprCtx ctx, cchar *path) |
Get the parent directory of a path. | |
cchar* | mprGetPathSeparators(MprCtx ctx, cchar *path) |
Get the path directory separator. | |
char* | mprGetPortablePath(MprCtx ctx, cchar *path) |
Get a portable path. | |
char* | mprGetRelPath(MprCtx ctx, cchar *path) |
Get a relative path. | |
char* | mprGetTempPath(MprCtx ctx, cchar *tmpDir) |
Make a temporary file. | |
char* | mprGetTransformedPath(MprCtx ctx, cchar *path, int flags) |
Transform a path. | |
bool | mprIsAbsPath(MprCtx ctx, cchar *path) |
Determine if a path is absolute. | |
bool | mprIsRelPath(MprCtx ctx, cchar *path) |
Determine if a path is relative. | |
char* | mprJoinPath(MprCtx ctx, cchar *dir, cchar *other) |
Join paths. | |
char* | mprJoinPathExt(MprCtx ctx, cchar *dir, cchar *ext) |
Join an extension to a path. | |
int | mprMakeDir(MprCtx ctx, cchar *path, int perms, bool makeMissing) |
Make a directory. | |
void | mprMapSeparators(MprCtx ctx, char *path, int separator) |
Map the separators in a path. | |
bool | mprPathExists(MprCtx ctx, cchar *path, int omode) |
Determine if a file exists for a path name and can be accessed. | |
int | mprSamePath(MprCtx ctx, cchar *path1, cchar *path2) |
Compare two paths if they are the same. | |
int | mprSamePathCount(MprCtx ctx, cchar *path1, cchar *path2, int len) |
Compare two paths if they are the same for a given length. | |
char* | mprSearchPath(MprCtx ctx, cchar *path, int flags, cchar *search, ...) |
Search for a path. | |
char* | mprTrimPathExtension(MprCtx ctx, cchar *path) |
Trim an extension from a path. | |
int | mprTruncatePath(MprCtx ctx, cchar *path, int size) |
Truncate a path. | |
int | mprAvailablePoolThreads(MprCtx ctx) |
Get the count of available pool threads Return the count of free threads in the thread pool. | |
int | mprGetMaxPoolThreads(MprCtx ctx) |
Get the maximum count of pool threads Get the maximum limit of pool threads. | |
void | mprSetMaxPoolThreads(MprCtx ctx, int count) |
Set the maximum count of pool threads Set the maximum number of pool threads for the MPR. | |
void | mprSetMinPoolThreads(MprCtx ctx, int count) |
Set the minimum count of pool threads Set the count of threads the pool will have. | |
void | mprCloseSocket(MprSocket *sp, bool graceful) |
Close a socket. | |
MprSocket* | mprCreateSocket(MprCtx ctx, struct MprSsl *ssl) |
Create a socket. | |
int | mprFlushSocket(MprSocket *sp) |
Flush a socket. | |
bool | mprGetSocketBlockingMode(MprSocket *sp) |
Get the socket blocking mode. | |
bool | mprGetSocketEof(MprSocket *sp) |
Test if the other end of the socket has been closed. | |
int | mprGetSocketError(MprSocket *sp) |
Get a socket error code. | |
int | mprGetSocketFd(MprSocket *sp) |
Get the socket file descriptor. | |
int | mprGetSocketPort(MprSocket *sp) |
Get the port used by a socket. | |
int | mprOpenClientSocket(MprSocket *sp, cchar *hostName, int port, int flags) |
Open a client socket. | |
int | mprOpenServerSocket(MprSocket *sp, cchar *ipAddr, int port, MprSocketAcceptProc acceptFn, void *data, int flags) |
Open a server socket. | |
int | mprReadSocket(MprSocket *sp, void *buf, int size) |
Read from a socket. | |
MprOffset | mprSendFileToSocket(MprFile *file, MprSocket *sock, MprOffset offset, int bytes, MprIOVec *beforeVec, int beforeCount, MprIOVec *afterVec, int afterCount) |
Send a file to a socket. | |
int | mprSetSocketBlockingMode(MprSocket *sp, bool on) |
Set the socket blocking mode. | |
void | mprSetSocketCallback(MprSocket *sp, MprSocketProc fn, void *data, void *data2, int mask, int priority) |
Set the socket callback. | |
void | mprSetSocketEventMask(MprSocket *sp, int mask) |
Define the events of interest for a socket. | |
int | mprSetSocketNoDelay(MprSocket *sp, bool on) |
Set the socket delay mode. | |
bool | mprSocketIsSecure(MprSocket *sp) |
Determine if the socket is secure. | |
int | mprWriteSocket(MprSocket *sp, void *buf, int len) |
Write to a socket. | |
int | mprWriteSocketString(MprSocket *sp, cchar *str) |
Write to a string to a socket. | |
int | mprWriteSocketVector(MprSocket *sp, MprIOVec *iovec, int count) |
Write a vector to a socket. | |
MprCond* | mprCreateCond(MprCtx ctx) |
Create a condition lock variable. | |
MprMutex* | mprCreateLock(MprCtx ctx) |
Create a Mutex lock object. | |
MprSpin* | mprCreateSpinLock(MprCtx ctx) |
Create a spin lock lock object. | |
void | mprGlobalLock(MprCtx ctx) |
Globally lock the application. | |
void | mprGlobalUnlock(MprCtx ctx) |
Unlock the global mutex. | |
MprMutex* | mprInitLock(MprCtx ctx, MprMutex *mutex) |
Initialize a statically allocated Mutex lock object. | |
MprSpin* | mprInitSpinLock(MprCtx ctx, MprSpin *lock) |
Initialize a statically allocated spinlock object. | |
void | mprLock(MprMutex *lock) |
Lock access. | |
void | mprSignalCond(MprCond *cond) |
Signal a condition lock variable. | |
void | mprSpinLock(MprSpin *lock) |
Lock a spinlock. | |
void | mprSpinUnlock(MprSpin *lock) |
Unlock a spinlock. | |
bool | mprTryLock(MprMutex *lock) |
Attempt to lock access. | |
bool | mprTrySpinLock(MprSpin *lock) |
Attempt to lock access on a spin lock. | |
void | mprUnlock(MprMutex *lock) |
Unlock a mutex. | |
int | mprWaitForCond(MprCond *cond, int timeout) |
Wait for a condition lock variable. | |
MprThread* | mprCreateThread(MprCtx ctx, cchar *name, MprThreadProc proc, void *data, int priority, int stackSize) |
Create a new thread. | |
MprOsThread | mprGetCurrentOsThread() |
Get the O/S thread. | |
MprThread* | mprGetCurrentThread(MprCtx ctx) |
Get the currently executing thread. | |
cchar* | mprGetThreadName(MprThread *thread) |
Get the thread name. | |
int | mprGetThreadPriority(MprThread *thread) |
Get the thread priroity. | |
void | mprSetCurrentThreadPriority(MprCtx ctx, int priority) |
Set the thread priroity for the current thread. | |
void | mprSetThreadPriority(MprThread *thread, int priority) |
Set the thread priroity. | |
int | mprStartThread(MprThread *thread) |
Start a thread. | |
char* | mprEscapeCmd(MprCtx ctx, cchar *cmd, int escChar) |
Encode a string escaping typical command (shell) characters. | |
char* | mprEscapeHtml(MprCtx ctx, cchar *html) |
Encode a string by escaping typical HTML characters. | |
char* | mprFormatUri(MprCtx ctx, cchar *protocol, cchar *host, int port, cchar *path, cchar *query) |
Format a URI. | |
MprUri* | mprParseUri(MprCtx ctx, cchar *uri) |
Parse a URI. | |
char* | mprUrlDecode(MprCtx ctx, cchar *url) |
Decode a URL string by de-scaping URL characters. | |
char* | mprUrlEncode(MprCtx ctx, cchar *url) |
Encode a string by escaping URL characters. | |
char* | mprValidateUrl(MprCtx ctx, char *url) |
Validate a URL. | |
MprWaitHandler* | mprCreateWaitHandler(MprCtx ctx, int fd, int mask, MprWaitProc proc, void *data, int priority, int flags) |
Create a wait handler. | |
void | mprDisableWaitEvents(MprWaitHandler *wp, bool wakeup) |
Disable wait events. | |
void | mprEnableWaitEvents(MprWaitHandler *wp, bool wakeup) |
Enable wait events. | |
void | mprRecallWaitHandler(MprWaitHandler *wp) |
Recall a wait handler. | |
void | mprSetWaitCallback(MprWaitHandler *wp, MprWaitProc proc, int mask) |
Define the wait handler callback. | |
void | mprSetWaitInterest(MprWaitHandler *wp, int mask) |
Define the events of interest for a wait handler. | |
int | mprWaitForSingleIO(MprWaitHandler *wp, int fd, int mask, int timeout) |
Wait for I/O on an event handler. |
MprAllocNotifier | Memory allocation error callback. |
MprBufProc | Buffer refill callback function. |
MprCtx | Memory context type. |
MprDestructor | Mpr memory block destructors prototype. |
MprEventProc | Event callback function. |
MprListCompareProc | List comparison procedure for sorting. |
MprLogHandler | Log handler callback type. |
MprModuleEntry | Loadable module entry point signature. |
MprModuleProc | Module start/stop point function signature. |
MprSocketAcceptProc | Socket connection acceptance callback procedure. |
MprSocketProc | Socket I/O callback procedure. |
MprTime | Mpr time structure. |
MprBufProc | Buffer refill callback function. |
MprTime | Mpr time structure. |
MprEventProc | Event callback function. |
MprListCompareProc | List comparison procedure for sorting. |
MprLogHandler | Log handler callback type. |
MprAllocNotifier | Memory allocation error callback. |
MprCtx | Memory context type. |
MprDestructor | Mpr memory block destructors prototype. |
MprModuleEntry | Loadable module entry point signature. |
MprBlk | Memory Allocation Block Header. |
MprCond | Condition variable for multi-thread synchronization. |
MprDirEntry | Directory entry description. |
MprFileSystem | File system service. |
MprHashTable | Hash table control structure. |
MprKeyValue | Key value pairs for use with MprList or MprHash. |
MprMutex | Multithreading lock control structure. |
MprPath | Path information structure. |
MprSpin | Multithreading spin lock control structure. |
MprString | Safe String Module. |
MprThreadLocal | Thread local data storage. |
#define | MPR_BACKGROUND_PRIORITY 15 |
May only get CPU if idle. | |
#define | MPR_BUF_INCR 1024 |
Default buffer growth inc. | |
#define | MPR_BUFSIZE 1024 |
Reasonable size for buffers. | |
#define | MPR_CRITICAL_PRIORITY 99 |
May not yield. | |
#define | MPR_DEFAULT_ALLOC 64 |
Default small alloc size. | |
#define | MPR_DEFAULT_HASH_SIZE 23 |
Default size of hash table. | |
#define | MPR_DEFAULT_MAX_THREADS 10 |
Default max threads (10). | |
#define | MPR_DEFAULT_MIN_THREADS 0 |
Default min threads (0). | |
#define | MPR_DEFAULT_STACK 32768 |
Default stack size (32K). | |
#define | MPR_ERR -1 |
Default error code. | |
#define | MPR_ERR_ABORTED -2 |
Action aborted. | |
#define | MPR_ERR_ALREADY_EXISTS -3 |
Item already exists. | |
#define | MPR_ERR_BAD_ARGS -4 |
Bad arguments or paramaeters. | |
#define | MPR_ERR_BAD_FORMAT -5 |
Bad input format. | |
#define | MPR_ERR_BAD_STATE -7 |
Module is in a bad state. | |
#define | MPR_ERR_BAD_SYNTAX -8 |
Input has bad syntax. | |
#define | MPR_ERR_CANT_ACCESS -12 |
Can't access the file or resource. | |
#define | MPR_ERR_CANT_CREATE -14 |
Can't create the file or resource. | |
#define | MPR_ERR_CANT_OPEN -16 |
Can't open the file or resource. | |
#define | MPR_ERR_CANT_READ -17 |
Can't read from the file or resource. | |
#define | MPR_ERR_CANT_WRITE -18 |
Can't write to the file or resource. | |
#define | MPR_ERR_GENERAL -1 |
General error. | |
#define | MPR_ERR_NO_MEMORY -30 |
Memory allocation error. | |
#define | MPR_ERR_NOT_INITIALIZED -22 |
Module or resource is not initialized. | |
#define | MPR_ERR_OK 0 |
Standard MPR return and error codes. | |
#define | MPR_ERR_READ_ONLY -24 |
The operation timed out. | |
#define | MPR_ERROR 1 |
Standard logging trace levels are 0 to 9 with 0 being the most verbose. | |
#define | MPR_EVENT_CONTINUOUS 0x1 |
Auto reschedule the event. | |
#define | MPR_EVENT_PRIORITY 75 |
Run service event thread at higher priority. | |
#define | MPR_EVENT_RUNNING 0x4 |
Event currently executing. | |
#define | MPR_EVENT_THREAD 0x2 |
Run proc using pool thread. | |
#define | MPR_HTTP_BUFSIZE 2048 |
HTTP buffer size. | |
#define | MPR_HTTP_MAX_PASS 64 |
Size of password. | |
#define | MPR_HTTP_MAX_SECRET 32 |
Random bytes to use. | |
#define | MPR_HTTP_MAX_USER 64 |
Size of user name. | |
#define | MPR_HTTP_TIMEOUT 60000 |
HTTP Request timeout (60 sec). | |
#define | MPR_LIST_INCR 8 |
Default list growth inc. | |
#define | MPR_MAX_ARGC 128 |
Reasonable max of args. | |
#define | MPR_MAX_BUF 4194304 |
Max buffer size. | |
#define | MPR_MAX_FNAME 128 |
Reasonable filename size. | |
#define | MPR_MAX_LOG_STRING 512 |
Maximum log message. | |
#define | MPR_MAX_PATH 256 |
Reasonable path name size. | |
#define | MPR_MAX_STRING 1024 |
Maximum (stack) string size. | |
#define | MPR_NORMAL_PRIORITY 50 |
Normal (default) priority. | |
#define | MPR_POOL_PRIORITY 60 |
Slightly elevated priority. | |
#define | MPR_REQUEST_PRIORITY 50 |
Normal priority. | |
#define | MPR_SECURE_CLIENT ((struct MprSsl*) 1) |
Flag for mprCreateSocket to use the default SSL provider. | |
#define | MPR_SERVICE_ONE_THING 0x1 |
Wait for one event or one I/O. | |
#define | MPR_SOCKET_BLOCK 0x1 |
Use blocking I/O. | |
#define | MPR_SOCKET_BROADCAST 0x2 |
Broadcast mode. | |
#define | MPR_SOCKET_CLIENT 0x800 |
Socket is a client. | |
#define | MPR_SOCKET_CLOSED 0x4 |
MprSocket has been closed. | |
#define | MPR_SOCKET_CONNECTING 0x8 |
MprSocket has been closed. | |
#define | MPR_SOCKET_DATAGRAM 0x10 |
Use datagrams. | |
#define | MPR_SOCKET_EOF 0x20 |
Seen end of file. | |
#define | MPR_SOCKET_LISTENER 0x40 |
MprSocket is server listener. | |
#define | MPR_SOCKET_NODELAY 0x100 |
Disable Nagle algorithm. | |
#define | MPR_SOCKET_NOREUSE 0x80 |
Dont set SO_REUSEADDR option. | |
#define | MPR_SOCKET_THREAD 0x400 |
Process callbacks on a pool thread. | |
#define | MPR_SSL_BUFSIZE 2048 |
SSL has 16K max. | |
#define | MPR_TICKS_PER_SEC 1000 |
Time ticks per second. | |
#define | MPR_TIMEOUT_LINGER 2000 |
Close socket linger timeout. | |
#define | MPR_TIMEOUT_LOG_STAMP 3600000 |
Time between log time stamps (1 hr). | |
#define | MPR_TIMEOUT_PRUNER 600000 |
Time between pruner runs (10 min). | |
#define | MPR_TIMEOUT_START_TASK 2000 |
Time to start tasks running. | |
#define | MPR_TIMEOUT_STOP 5000 |
Wait when stopping resources. | |
#define | MPR_TIMEOUT_STOP_TASK 10000 |
Time to stop running tasks. | |
#define | MPR_TIMEOUT_STOP_THREAD 10000 |
Time to stop running threads. | |
#define | MPR_XML_BUFSIZE 512 |
XML read buffer size. |
Primary MPR application control structure.
long | appInstance | Application instance (windows). | |
int | argc | Count of command line args. | |
char * | args | Command line args. | |
char ** | argv | Application command line args. | |
uint | classId | Brew class ID. | |
struct MprCmdService * | cmdService | Command service object. | |
bool | debugMode | Run in debug mode (no timers). | |
IDisplay * | display | Brew display object. | |
int | displayHeight | Display height. | |
int | displayWidth | Display width. | |
char * | domainName | Domain portion. | |
struct MprEventService * | eventService | Event service object. | |
struct MprFileSystem * | fileSystem | File system service object. | |
int | flags | Processing state. | |
int | hasEventsThread | Running an events thread. Service pointers. | |
MprHeap | heap | Top level memory pool. | |
char * | hostName | Host name (fully qualified name). | |
struct MprHttpService * | httpService | HTTP service object. | |
char * | ipAddr | Public IP Address. | |
MprLogHandler | logHandler | Current log handler callback. | |
void * | logHandlerData | Handle data for log handler. | |
int | logLevel | Log trace level. | |
struct MprModuleService * | moduleService | Module service object. | |
MprMutex * | mutex | Thread synchronization. | |
char * | name | Product name. | |
struct MprOsService * | osService | O/S service object. | |
MprHeap | pageHeap | Heap for arenas and slabs. Always page oriented. | |
struct MprPoolService * | poolService | Pool service object. | |
char * | serverName | Server name portion (no domain). | |
IShell * | shell | Brew shell object. | |
struct MprSocketService * | socketService | Socket service object. | |
MprSpin * | spin | Quick thread synchronization. | |
ITAPI * | tapi | TAPI object. | |
struct MprThreadService * | threadService | Thread service object. | |
MprHashTable * | timeTokens | Date/Time parsing tokens. | |
int | timezone | Minutes west of Greenwich. | |
char * | title | Product title. | |
char * | version | Product version. | |
struct MprWaitService * | waitService | IO Waiting service object. |
Trigger a breakpoint.
Create an instance of the MPR.
argc | Count of command line args. |
argv | Command line arguments for the application. Arguments may be passed into the Mpr for retrieval by the unit test framework. |
cback | Memory allocation failure notification callback. |
Create an instance of the MPR.
argc | Count of arguments supplied in argv. |
argv | Program arguments. The MPR can store the program arguments for retrieval by other parts of the program. |
cback | Callback function to be invoked on memory allocation errors. Set to null if not required. |
shell | Optional reference to an O/S implementation dependent shell object. Used by Brew. |
Get the debug mode.
ctx | Any memory context allocated by the MPR. |
Return the O/S error code.
Determine if the MPR should exit.
ctx | Any memory context allocated by the MPR. |
Signal the MPR to exit gracefully.
ctx | Any memory context allocated by the MPR. |
Terminate the MPR.
ctx | Any memory context object returned by mprAlloc. |
graceful | Shutdown gracefully waiting for all events to drain. Otherise exit immediately without waiting for any threads or events to complete. |
Dynamic Buffer Module.
int | buflen | Current size of buffer. | |
uchar * | data | Actual buffer for data. | |
uchar * | end | Pointer one past the last data chr. | |
uchar * | endbuf | Pointer one past the end of buffer. | |
int | growBy | Next growth increment to use. | |
int | maxsize | Max size the buffer can ever grow. | |
void * | refillArg | Refill arg. | |
MprBufProc | refillProc | Auto-refill procedure. | |
uchar * | start | Pointer to next data char. |
Add a null character to the buffer contents.
buf | Buffer created via mprCreateBuf. |
Adjust the buffer end position.
buf | Buffer created via mprCreateBuf. |
count | Positive or negative count of bytes to adjust the start position. |
Adjust the buffer start position.
buf | Buffer created via mprCreateBuf. |
count | Positive or negative count of bytes to adjust the start position. |
Compact the buffer contents.
buf | Buffer created via mprCreateBuf. |
Create a new buffer.
ctx | Any memory context allocated by the MPR. |
initialSize | Initial size of the buffer. |
maxSize | Maximum size the buffer can grow to. |
Flush the buffer contents.
buf | Buffer created via mprCreateBuf. |
Get a block of data from the buffer.
buf | Buffer created via mprCreateBuf. |
blk | Destination block for the read data. |
count | Count of bytes to read from the buffer. |
Get a reference to the end of the buffer contents.
buf | Buffer created via mprCreateBuf. |
Get the buffer content length.
buf | Buffer created via mprCreateBuf. |
Get the origin of the buffer content storage.
buf | Buffer created via mprCreateBuf. |
Get the buffer refill procedure.
buf | Buffer created via mprCreateBuf. |
Get the current size of the buffer content storage.
buf | Buffer created via mprCreateBuf. |
Get the space available to store content.
buf | Buffer created via mprCreateBuf. |
Get the start of the buffer contents.
buf | Buffer created via mprCreateBuf. |
Get a character from the buffer.
buf | Buffer created via mprCreateBuf. |
Grow the buffer.
buf | Buffer created via mprCreateBuf. |
count | Count of bytes by which to grow the buffer content size. |
Insert a character into the buffer.
buf | Buffer created via mprCreateBuf. |
c | Character to append. |
Peek at the last character in the buffer.
buf | Buffer created via mprCreateBuf. |
Peek at the next character in the buffer.
buf | Buffer created via mprCreateBuf. |
Put a block to the buffer.
buf | Buffer created via mprCreateBuf. |
ptr | Block to append. |
size | Size of block to append. |
Put a character to the buffer.
buf | Buffer created via mprCreateBuf. |
c | Character to append. |
Put a formatted string to the buffer.
buf | Buffer created via mprCreateBuf. |
fmt | Printf style format string. |
... | Variable arguments for the format string. |
Put an integer to the buffer.
buf | Buffer created via mprCreateBuf. |
i | Integer to append to the buffer. |
Put a string to the buffer.
buf | Buffer created via mprCreateBuf. |
str | String to append. |
Refill the buffer with data.
buf | Buffer created via mprCreateBuf. |
Reset the buffer.
buf | Buffer created via mprCreateBuf. |
Set the maximum buffer size.
buf | Buffer created via mprCreateBuf. |
maxSize | New maximum size the buffer can grow to. |
Set the buffer refill procedure.
buf | Buffer created via mprCreateBuf. |
fn | Callback function to store. |
arg | Callback data argument. |
Set the buffer size.
buf | Buffer created via mprCreateBuf. |
size | Size 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. |
maxSize | Maximum size the buffer contents can grow to. |
Steal the buffer memory from a buffer.
ctx | Memory context to won the memory for the buffer. |
buf | Buffer created via mprCreateBuf. |
Date and Time Service.
Format time as a string.
ctx | Any memory context allocated by mprAlloc or mprCreate. |
timeptr | Time to format. |
buf | Buffer to hold the formatted string. |
bufsize | Maximum length for the string. |
Convert time to local time and format as a string.
ctx | Any memory context allocated by mprAlloc or mprCreate. |
buf | Buffer to hold the formatted string. |
bufsize | Maximum length for the string. |
time | Time to format. Use mprGetTime to retrieve the current time. |
Get the system time.
ctx | Any memory context allocated by mprAlloc or mprCreate. |
Convert time to UTC and parse into a time structure.
ctx | Any memory context allocated by mprAlloc or mprCreate. |
timep | Pointer to a tm structure to hold the result. |
time | The time to format. |
Convert time to local representation.
ctx | Any memory context allocated by mprAlloc or mprCreate. |
timep | Pointer to a tm structure to hold the result. |
time | Time to format. |
Event object.
void * | data | Event private data. | |
MprTime | due | When is the event due. | |
int | flags | Event flags. | |
struct MprEvent * | next | Next event linkage. | |
int | period | Reschedule period. | |
struct MprEvent * | prev | Previous event linkage. | |
int | priority | Priority 0-99. 99 is highest. | |
MprEventProc | proc | Callback procedure. | |
MprTime | timestamp | When was the event created. |
Create a new event.
ctx | Any memory context allocated by mprAlloc or mprCreate. |
proc | Function to invoke when the event is run. |
period | Time in milliseconds used by continuous events between firing of the event. |
priority | Priority to associate with the event. Priorities are integer values between 0 and 100 inclusive with 50 being a normal priority. Useful constants are:
|
data | Data to associate with the event and stored in event->data. |
flags | Flags 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. |
Create a timer event.
ctx | Any memory context allocated by mprAlloc or mprCreate. |
proc | Function to invoke when the event is run. |
period | Time in milliseconds used by continuous events between firing of the event. |
priority | Priority to associate with the event. Priorities are integer values between 0 and 100 inclusive with 50 being a normal priority. Useful constants are:
|
data | Data to associate with the event and stored in event->data. |
flags | Not used. |
Remove an event.
event | Event object returned from mprCreateEvent. |
Reschedule an event.
event | Event object returned from mprCreateEvent. |
period | Time in milliseconds used by continuous events between firing of the event. |
Restart an event.
event | Event object returned from mprCreateEvent. |
Service events.
ctx | Any memory context allocated by mprAlloc or mprCreate. |
delay | Time in milliseconds to block until an event occurs. |
flags | If set to MPR_SERVICE_ONE_THING, this call will service at most one event. Otherwise set to zero. |
Stop an event.
event | Event object returned from mprCreateEvent. |
File I/O Module.
MprBuf * | buf | Buffer for I/O if buffered. | |
MprFileSystem * | fileSystem | File system owning this file. | |
MprRomInode * | inode | Reference to ROM file. | |
int | mode | File open mode. | |
int | perms | File permissions. | |
MprOffset | pos | Current read position. | |
MprOffset | size | Current file size. |
Attach to an existing file descriptor.
ctx | Any memory context allocated by the MPR. |
fd | File descriptor to attach to. |
name | Descriptive name for the file. |
omode | Posix style file open mode mask. The open mode may contain the following mask values ored together:
|
Disable file buffering.
file | File instance returned from mprOpen. |
Enable file buffering.
file | File instance returned from mprOpen. |
size | Size to allocate for the buffer. |
maxSize | Maximum size the data buffer can grow to. |
Flush any buffered write data.
file | Pointer to an MprFile object returned via MprOpen. |
Read a character from the file.
file | Pointer to an MprFile object returned via MprOpen. |
Return the current file position.
file | A file object returned from mprOpen. |
Get the size of the file.
file | A file object returned from mprOpen. |
Read a line from the file.
file | Pointer to an MprFile object returned via MprOpen. |
buf | Pre-allocated buffer to contain the line of data. |
size | Size of buf. |
Open a file.
ctx | Any memory context allocated by the MPR. |
filename | String containing the filename to open or create. |
omode | Posix style file open mode mask. The open mode may contain the following mask values ored together:
|
perms | Posix style file permissions mask. |
Non-destructively read a character from the file.
file | Pointer to an MprFile object returned via MprOpen. |
Write a character to the file.
file | Pointer to an MprFile object returned via MprOpen. |
c | Character to write. |
Write a line to the file.
file | Pointer to an MprFile object returned via MprOpen. |
buf | Buffer containing the line to write. |
size | Size of buf in characters to write. |
Read data from a file.
file | Pointer to an MprFile object returned via MprOpen. |
buf | Buffer to contain the read data. |
size | Size of buf in characters. |
Seek the I/O pointer to a new location in the file.
file | Pointer to an MprFile object returned via MprOpen. |
seekType | Seek type may be one of the following three values:
|
distance | A positive or negative byte offset. |
Write data to a file.
file | Pointer to an MprFile object returned via MprOpen. |
buf | Buffer containing the data to write. |
count | Cound of characters in buf to write. |
Write formatted data to a file.
file | Pointer to an MprFile object returned via MprOpen. |
fmt | Format string. |
Write a string to a file.
file | Pointer to an MprFile object returned via MprOpen. |
str | String to write. |
Hash table entry structure.
int | bucket | Hash bucket index. | |
cvoid * | data | Pointer to symbol data. | |
char * | key | Hash key. | |
struct MprHash * | next | Next symbol in hash chain. |
Add a duplicate symbol value into the hash table.
table | Symbol table returned via mprCreateSymbolTable. |
key | String key of the symbole entry to delete. |
ptr | Arbitrary pointer to associate with the key in the table. |
Add a symbol value into the hash table.
table | Symbol table returned via mprCreateSymbolTable. |
key | String key of the symbole entry to delete. |
ptr | Arbitrary pointer to associate with the key in the table. |
Copy a hash table.
ctx | Any memory context allocated by the MPR. |
table | Symbol table returned via mprCreateSymbolTable. |
Create a hash table.
ctx | Any memory context allocated by the MPR. |
hashSize | Size of the hash table for the symbol table. Should be a prime number. |
Return the first symbol in a symbol entry.
table | Symbol table returned via mprCreateSymbolTable. |
Return the count of symbols in a symbol entry.
table | Symbol table returned via mprCreateSymbolTable. |
Return the next symbol in a symbol entry.
table | Symbol table returned via mprCreateSymbolTable. |
last | Symbol table entry returned via mprGetFirstSymbol or mprGetNextSymbol. |
Lookup a symbol in the hash table.
table | Symbol table returned via mprCreateSymbolTable. |
key | String key of the symbole entry to delete. |
Lookup a symbol in the hash table and return the hash entry.
table | Symbol table returned via mprCreateSymbolTable. |
key | String key of the symbole entry to delete. |
Remove a symbol entry from the hash table.
table | Symbol table returned via mprCreateSymbolTable. |
key | String key of the symbole entry to delete. |
List Module.
int | capacity | Current list size. | |
void ** | items | List item data. | |
int | length | Current length of the list contents. | |
int | maxSize | Maximum capacity. |
Add an item to a list.
list | List pointer returned from mprCreateList. |
item | Pointer to item to store. |
Append a list.
list | List pointer returned from mprCreateList. |
add | List whose contents are added. |
Clears the list of all items.
list | List pointer returned from mprCreateList. |
Copy a list.
dest | Destination list for the copy. |
src | Source list. |
Create a key / value pair.
ctx | Any memory context allocated by the MPR. |
key | Key string. |
value | Key value string. |
Create a list.
ctx | Any memory context allocated by the MPR. |
Duplicate a list.
ctx | Memory context from which to allocate the list. See mprAlloc. |
src | Source list to copy. |
Get the first item in the list.
list | List pointer returned from mprCreateList. |
Get an list item.
list | List pointer returned from mprCreateList. |
index | Item index into the list. Indexes have a range from zero to the lenghth of the list - 1. |
Get the last item in the list.
list | List pointer returned from mprCreateList. |
Get the current capacity of the list.
list | List pointer returned from mprCreateList. |
Get the number of items in the list.
list | List pointer returned from mprCreateList. |
Get the next item in the list.
list | List pointer returned from mprCreateList. |
lastIndex | Pointer to an integer that will hold the last index retrieved. |
Get the previous item in the list.
list | List pointer returned from mprCreateList. |
lastIndex | Pointer to an integer that will hold the last index retrieved. |
Initialize a list structure.
list | Reference to the MprList struct. |
Insert an item into a list at a specific position.
list | List pointer returned from mprCreateList. |
index | Location at which to store the item. The previous item at this index is moved up to make room. |
item | Pointer to item to store. |
Find an item and return its index.
list | List pointer returned from mprCreateList. |
item | Pointer to value stored in the list. |
Remove an item from the list.
list | List pointer returned from mprCreateList. |
item | Item pointer to remove. |
Remove an item from the list.
Remove the last item from the list.
list | List pointer returned from mprCreateList. |
Remove a range of items from the list.
list | List pointer returned from mprCreateList. |
start | Starting item index to remove (inclusive). |
end | Ending item index to remove (inclusive). |
Set a list item.
list | List pointer returned from mprCreateList. |
index | Location to update. |
item | Pointer to item to store. |
Define the list size limits.
list | List pointer returned from mprCreateList. |
initialSize | Initial size for the list. This call will allocate space for at least this number of items. |
maxSize | Set the maximum limit the list can grow to become. |
Sort a list.
list | List pointer returned from mprCreateList. |
compare | Comparison function. If null, then a default string comparison is used. |
Logging Services.
Log an error message.
ctx | Any memory context allocated by the MPR. |
fmt | Printf style format string. Variable number of arguments to. |
... | Variable number of arguments for printf data. |
Log a fatal error message and exit.
ctx | Any memory context allocated by the MPR. |
fmt | Printf style format string. Variable number of arguments to. |
... | Variable number of arguments for printf data. |
Get the current MPR debug log handler.
ctx | Any memory context allocated by the MPR. |
Write a message to the diagnostic log file.
level | Logging level for this message. The level is 0-9 with zero being the most verbose. |
ctx | Any memory context allocated by the MPR. |
fmt | Printf style format string. Variable number of arguments to. |
... | Variable number of arguments for printf data. |
Log a memory error message.
ctx | Any memory context allocated by the MPR. |
fmt | Printf style format string. Variable number of arguments to. |
... | Variable number of arguments for printf data. |
Write a raw log message to the diagnostic log file.
level | Logging level for this message. The level is 0-9 with zero being the most verbose. |
ctx | Any memory context allocated by the MPR. |
fmt | Printf style format string. Variable number of arguments to. |
... | Variable number of arguments for printf data. |
Set an MPR debug log handler.
ctx | Any memory context allocated by the MPR. |
handler | Callback handler. |
handlerData | Callback handler data. |
Set the current logging level.
ctx | Any memory context allocated by the MPR. |
level | New logging level. Must be 0-9 inclusive. |
Output an assertion failed message.
loc | Source code location string. Use MPR_LOC to define a file name and line number string suitable for this parameter. |
msg | Simple string message to output. |
Write a message to the diagnostic log file without allocating any memory.
Useful for log messages from within the memory allocatorctx | Any memory context allocated by the MPR. |
fmt | Printf style format string. Variable number of arguments to. |
... | Variable number of arguments for printf data. |
Display an error message to the user.
ctx | Any memory context allocated by the MPR. |
fmt | Printf style format string. Variable number of arguments to. |
... | Variable number of arguments for printf data. |
Memory Allocation Service.
Allocate a block of memory.
ctx | Any memory context allocated by mprAlloc or mprCreate. |
size | Size of the memory block to allocate. |
Allocate an object of a given type.
ctx | Any memory context allocated by mprAlloc or mprCreate. |
type | Type of the object to allocate. |
Allocate an object of a given type with a destructor.
ctx | Any memory context allocated by mprAlloc or mprCreate. |
type | Type of the object to allocate. |
destructor | Destructor function to invoke when the allocation is freed via mprFree. |
ctx | Any memory context allocated by mprAlloc or mprCreate. |
type | Type of the object to allocate. |
destructor | Destructor function to invoke when the allocation is freed via mprFree. |
Allocate a zeroed object of a given type.
ctx | Any memory context allocated by mprAlloc or mprCreate. |
type | Type of the object to allocate. |
Allocate an object block of memory.
ctx | Any memory context allocated by mprAlloc or mprCreate. |
size | Size of the memory block to allocate. |
destructor | Destructor function to invoke when the allocation is freed via mprFree. |
Allocate an object block of memory and zero it.
ctx | Any memory context allocated by mprAlloc or mprCreate. |
size | Size of the memory block to allocate. |
destructor | Destructor function to invoke when the allocation is freed via mprFree. |
Allocate a zeroed block of memory.
ctx | Any memory context allocated by mprAlloc or mprCreate. |
size | Size of the memory block to allocate. |
Free a block of memory.
ptr | Memory to free. If NULL, take no action. |
Get the memory parent of a block.
ctx | Any memory context allocated by mprAlloc or mprCreate. |
Duplicate a block of memory.
ctx | Any memory context allocated by mprAlloc or mprCreate. |
ptr | Pointer to the block to duplicate. |
size | Size of the block to copy. |
Reallocate a block.
ctx | Any memory context allocated by mprAlloc or mprCreate. |
ptr | Memory to reallocate. If NULL, call malloc. |
size | New size of the required memory block. |
Reset the memory allocation error flag.
ctx | Any memory context allocated by the MPR. |
Configure the application memory limits.
ctx | Any memory context allocated by mprAlloc or mprCreate. |
redline | Soft memory limit. If exceeded, the request will be granted, but the memory handler will be invoked. |
maxMemory | Hard memory limit. If exceeded, the request will not be granted, and the memory handler will be invoked. |
Update the destructor for a block of memory.
ptr | Memory to free. If NULL, take no action. |
destructor | Destructor function to invoke when mprFree is called. |
Safe replacement for strdup.
ctx | Any memory context allocated by mprAlloc or mprCreate. |
str | Pointer to string to duplicate. If str is NULL, allocate a new string containing only a trailing NULL character. |
Duplicate a string.
ctx | Any memory context allocated by mprAlloc or mprCreate. |
str | Pointer to the block to duplicate. |
size | Requested minimum size of the allocated block holding the duplicated string. |
Loadable Module Service.
void * | handle | O/S shared library load handle. | |
void * | moduleData | Module specific data. | |
char * | name | Unique module name. | |
MprModuleProc | start | Start the module service. | |
MprModuleProc | stop | Stop the module service. | |
char * | version | Module version. |
Create a module.
ctx | Any memory context allocated by the MPR. |
name | Name of the module. |
version | Version string of the form: Major.Minor.patch. |
moduleData | to associate with this module. |
start | Start function to invoke to start module services. |
stop | Stop function to invoke to stop module services. |
Get the module search path.
ctx | Any memory context allocated by the MPR. |
Load a module.
ctx | Any memory context allocated by the MPR. |
filename | Name of the module to load. The module 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. |
entryPoint | Name of function to invoke after loading the module. |
Lookup a module.
ctx | Any memory context allocated by the MPR. |
name | Name of the module specified to mprCreateModule. |
Set the module search path.
ctx | Any memory context allocated by the MPR. |
searchPath | Colon separated set of directories. |
Unload a module.
mp | Module object returned via mprLookupModule. |
Path (filename) Services Module.
Copy a file.
ctx | Any memory context allocated by the MPR. |
from | Path of the existing file to copy. |
to | Name of the new file copy. |
omode | Posix style file open mode mask. See mprOpen for the various modes. |
Delete a file.
ctx | Any memory context allocated by the MPR. |
path | String containing the path to delete. |
Convert a path to an absolute path.
ctx | Any memory context allocated by the MPR. |
path | Path to examine. |
Get a path formatted according to the native O/S conventions.
ctx | Any memory context allocated by the MPR. |
path | Path name to examine. |
Normalize a path.
ctx | Any memory context allocated by the MPR. |
path | First path to compare. |
Get the base portion of a path.
ctx | Any memory context allocated by the MPR. |
path | Path name to examine. |
Get the directory portion of a path.
ctx | Any memory context allocated by the MPR. |
path | Path name to examine. |
Get the file extension portion of a path.
ctx | Any memory context allocated by the MPR. |
path | Path name to examine. |
Create a directory list of files.
ctx | Any memory context allocated by the MPR. |
dir | Directory to list. |
enumDirs | Set to true to enumerate directory entries as well as regular paths. |
Return information about a file represented by a path.
ctx | Any memory context allocated by the MPR. |
path | String containing the path to query. |
info | Pointer to a pre-allocated MprPath structure. |
Get the file newline character string for a given path.
Return the character string used to delimit new lines in text filesctx | Any memory context allocated by the MPR. |
path | Use this path to specify either the root of the file system or a file on the file system. |
Get the parent directory of a path.
ctx | Any memory context allocated by the MPR. |
path | Path name to examine. |
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 separatorctx | Any memory context allocated by the MPR. |
path | Use this path to specify either the root of the file system or a file on the file system. |
Get a portable path.
ctx | Any memory context allocated by the MPR. |
path | Path name to examine. |
Get a relative path.
ctx | Any memory context allocated by the MPR. |
path | Path name to examine. |
Make a temporary file.
ctx | Any memory context allocated by the MPR. |
tmpDir | Base directory in which the temp file will be allocated. |
Transform a path.
ctx | Any memory context allocated by the MPR. |
path | First path to compare. |
flags | Flags to modify the path representation. |
Determine if a path is absolute.
ctx | Any memory context allocated by the MPR. |
path | Path name to examine. |
Determine if a path is relative.
ctx | Any memory context allocated by the MPR. |
path | Path name to examine. |
Join paths.
ctx | Any memory context allocated by the MPR. |
dir | Directory path name to test use as the base/dir. |
other | Other path name to resolve against path. |
Join an extension to a path.
ctx | Any memory context allocated by the MPR. |
dir | Directory path name to test use as the base/dir. |
ext | Extension to add. Must have period prefix. |
Make a directory.
ctx | Any memory context allocated by the MPR. |
path | String containing the directory pathname to create. |
makeMissing | If true make all required intervening directory segments. |
perms | Posix style file permissions mask. |
Map the separators in a path.
ctx | Any memory context allocated by the MPR. |
path | Path name to examine. |
separator | Separator character to use. |
Determine if a file exists for a path name and can be accessed.
ctx | Any memory context allocated by the MPR. |
path | Path name to test. |
omode | Posix style file open mode mask. See mprOpen for the various modes. |
Compare two paths if they are the same.
ctx | Any memory context allocated by the MPR. |
path1 | First path to compare. |
path2 | Second path to compare. |
Compare two paths if they are the same for a given length.
ctx | Any memory context allocated by the MPR. |
path1 | First path to compare. |
path2 | Second path to compare. |
len | How many characters to compare. |
Search for a path.
ctx | Any memory context allocated by the MPR. |
path | Path name to locate. Must be an existing file or directory. |
flags | Flags. |
search | Variable number of directories to search. |
Trim an extension from a path.
ctx | Any memory context allocated by the MPR. |
path | First path to compare. |
Truncate a path.
ctx | Any memory context allocated by the MPR. |
path | First path to compare. |
size | New maximum size for the file. |
Thread Pool Service.
Get the count of available pool threads Return the count of free threads in the thread pool.
ctx | Any memory allocation context created by MprAlloc. |
Get the maximum count of pool threads Get the maximum limit of pool threads.
ctx | Any memory allocation context created by MprAlloc. |
Set the maximum count of pool threads Set the maximum number of pool threads for the MPR.
If this number if less than the current number of threads, excess threads will be gracefully pruned as they exitctx | Any memory allocation context created by MprAlloc. |
count | Maximum limit of threads to define. |
Set the minimum count of pool threads Set the count of threads the pool will have.
This will cause the pool to pre-create at least this many threadsctx | Any memory allocation context created by MprAlloc. |
count | Minimum count of threads to use. |
Socket Service.
MprSocketAcceptProc | acceptCallback | Accept callback. | |
void * | acceptData | User accept callback data. | |
char * | clientIpAddr | Client side ip address. | |
int | currentEvents | Mask of ready events (FD_x). | |
int | error | Last error. | |
int | fd | Actual socket file handle. | |
int | flags | Current state flags. | |
MprWaitHandler * | handler | Wait handler. | |
int | handlerMask | Handler events of interest. | |
int | handlerPriority | Handler priority. | |
int | interestEvents | Mask of events to watch for. | |
MprSocketProc | ioCallback | User I/O callback. | |
void * | ioData | User io callback data. | |
void * | ioData2 | Secondary user io callback data. | |
char * | ipAddr | Server side ip address. | |
struct MprSocket * | listenSock | Listening socket. | |
MprMutex * | mutex | Multi-thread sync. | |
int | port | Port to listen on. | |
MprSocketProvider * | provider | Socket implementation provider. | |
MprSocketService * | service | Socket service. | |
struct MprSsl * | ssl | SSL configuration. | |
struct MprSslSocket * | sslSocket | Extended ssl socket state. If set, then using ssl. | |
int | waitForEvents | Events being waited on. |
Close a socket.
sp | Socket object returned from mprCreateSocket. |
graceful | Set to true to do a graceful close. Otherwise, an abortive close will be performed. |
Create a socket.
ctx | Any memory allocation context created by MprAlloc. |
ssl | An optional SSL context if the socket is to support SSL. Use the MPR_SECURE_CLIENT define to specify that mprCreateSocket should use the default SSL provider. |
Flush a socket.
sp | Socket object returned from mprCreateSocket. |
Get the socket blocking mode.
sp | Socket object returned from mprCreateSocket. |
Test if the other end of the socket has been closed.
sp | Socket object returned from mprCreateSocket. |
Get a socket error code.
sp | Socket object returned from mprCreateSocket. |
Get the socket file descriptor.
sp | Socket object returned from mprCreateSocket. |
Get the port used by a socket.
sp | Socket object returned from mprCreateSocket. |
Open a client socket.
sp | Socket object returned via mprCreateSocket. |
hostName | Host or IP address to connect to. |
port | TCP/IP port number to connect to. |
flags | Socket flags may use the following flags ored together:
|
Open a server socket.
sp | Socket object returned via mprCreateSocket. |
ipAddr | IP address to bind to. Set to 0.0.0.0 to bind to all possible addresses on a given port. |
port | TCP/IP port number to connect to. |
acceptFn | Callback function to invoke to accept incoming client connections. |
data | Opaque data reference to pass to the accept function. |
flags | Socket flags may use the following flags ored together:
|
Read from a socket.
sp | Socket object returned from mprCreateSocket. |
buf | Pointer to a buffer to hold the read data. |
size | Size of the buffer. |
Send a file to a socket.
file | File to write to the socket. |
sock | Socket object returned from mprCreateSocket. |
offset | offset within the file from which to read data. |
bytes | Length of file data to write. |
beforeVec | Vector of data to write before the file contents. |
beforeCount | Count of entries in beforeVect. |
afterVec | Vector of data to write after the file contents. |
afterCount | Count of entries in afterCount. |
Set the socket blocking mode.
sp | Socket object returned from mprCreateSocket. |
on | Set to zero to put the socket into non-blocking mode. Set to non-zero to enable blocking mode. |
Set the socket callback.
sp | Socket object returned from mprCreateSocket. |
fn | Callback function. |
data | Data to pass with the callback. |
data2 | More data to pass with the callback. |
mask | Bit mask of events of interest. Set to MPR_READABLE and/or MPR_WRITABLE. |
priority | Priority to associate with the event. Priorities are integer values between 0 and 100 inclusive with 50 being a normal priority. (See MPR_NORMAL_PRIORITY). |
Define the events of interest for a socket.
sp | Socket object returned from mprCreateSocket. |
mask | Set to true to do a graceful close. Otherwise, an abortive close will be performed. |
Set the socket delay mode.
sp | Socket object returned from mprCreateSocket. |
on | Set to non-zero to put the socket into no delay mode. Set to zero to enable the nagle algorithm. |
Determine if the socket is secure.
sp | Socket object returned from mprCreateSocket. |
Write to a socket.
sp | Socket object returned from mprCreateSocket. |
buf | Reference to a block to write to the socket. |
len | Length 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. |
Write to a string to a socket.
sp | Socket object returned from mprCreateSocket. |
str | Null terminated string to write. |
Write a vector to a socket.
sp | Socket object returned from mprCreateSocket. |
iovec | Vector of data to write before the file contents. |
count | Count of entries in beforeVect. |
Multithreaded Synchronization Services.
Create a condition lock variable.
ctx | Any memory context allocated by mprAlloc or mprCreate. |
Create a Mutex lock object.
ctx | Any memory context allocated by mprAlloc or mprCreate. |
Create a spin lock lock object.
ctx | Any memory context allocated by mprAlloc or mprCreate. |
Globally lock the application.
ctx | Any memory context allocated by mprAlloc or mprCreate. |
Unlock the global mutex.
ctx | Any memory context allocated by mprAlloc or mprCreate. |
Initialize a statically allocated Mutex lock object.
ctx | Any memory context allocated by mprAlloc or mprCreate. |
mutex | Reference to an MprMutex structure to initialize. |
Initialize a statically allocated spinlock object.
ctx | Any memory context allocated by mprAlloc or mprCreate. |
lock | Reference to a static MprSpin object. |
Lock access.
Signal a condition lock variable.
cond | Condition variable object created via mprCreateCond. |
Lock a spinlock.
Unlock a spinlock.
Attempt to lock access.
Attempt to lock access on a spin lock.
Unlock a mutex.
Wait for a condition lock variable.
cond | Condition variable object created via mprCreateCond. |
timeout | Time in milliseconds to wait for the condition variable to be signaled. |
Thread Service.
void * | data | Data argument. | |
MprThreadProc | entry | Users thread entry point. | |
MprMutex * | mutex | Multi-thread synchronization. | |
char * | name | Name of thead for trace. | |
MprOsThread | osThreadID | O/S thread id. | |
ulong | pid | Owning process id. | |
int | priority | Current priority. | |
int | stackSize | Only VxWorks implements. | |
handle | threadHandle | Threads OS handle for WIN. |
Create a new thread.
ctx | Any memory context allocated by mprAlloc or mprCreate. |
name | Unique name to give the thread. |
proc | Entry point function for the thread. mprStartThread will invoke this function to start the thread. |
data | Thread private data stored in MprThread.data. |
priority | Priority 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:
|
stackSize | Stack 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. |
Get the O/S thread.
Get the currently executing thread.
ctx | Any memory context allocated by the MPR. |
Get the thread name.
thread | Thread object returned from mprCreateThread. |
Get the thread priroity.
thread | Thread object returned by mprCreateThread. |
Set the thread priroity for the current thread.
ctx | Any memory context allocated by the MPR. |
priority | Priority 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:
|
Set the thread priroity.
thread | Thread object returned by mprCreateThread. |
priority | Priority 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:
|
Start a thread.
thread | Thread object returned from mprCreateThread. |
URI management.
char * | ext | Document extension. | |
char * | host | Url host name. | |
char * | originalUri | Original URI. | |
char * | parsedUriBuf | Allocated storage for parsed uri. | |
int | port | Port number. | |
char * | query | Query string. | |
char * | scheme | URI scheme (http|https|. ). | |
bool | secure | Using https. | |
char * | url | Url path name (without scheme, host, query or fragements). |
Encode a string escaping typical command (shell) characters.
ctx | Any memory allocation context created by MprAlloc. |
cmd | Command string to encode. |
escChar | Escape character to use when encoding the command. |
Encode a string by escaping typical HTML characters.
ctx | Any memory allocation context created by MprAlloc. |
html | HTML content to encode. |
Format a URI.
ctx | Any memory allocation context created by MprAlloc. |
protocol | Protocol string for the uri. Example: "http". |
host | Host or IP address. |
port | TCP/IP port number. |
path | URL path. |
query | Additiona query parameters. |
Parse a URI.
ctx | Any memory allocation context created by MprAlloc. |
uri | Uri string to parse. |
Decode a URL string by de-scaping URL characters.
ctx | Any memory allocation context created by MprAlloc. |
url | URL to decode. |
Encode a string by escaping URL characters.
ctx | Any memory allocation context created by MprAlloc. |
url | URL to encode. |
Validate a URL.
ctx | Any memory allocation context created by MprAlloc. |
url | Url string to validate. |
Wait Handler Service.
int | desiredMask | Mask of desired events. | |
int | disableMask | Mask of disabled events. | |
int | fd | O/S File descriptor (sp->sock). | |
int | flags | Control flags. | |
void * | handlerData | Argument to pass to proc. | |
struct MprWaitHandler * | next | List linkage. | |
int | presentMask | Mask of current events. | |
int | priority | Thread priority. | |
MprWaitProc | proc | Wait handler procedure. | |
struct MprEvent * | threadEvent | Event reference. | |
MprWaitService * | waitService | Wait service pointer. |
Create a wait handler.
ctx | Any memory allocation context created by MprAlloc. |
fd | File descriptor. |
mask | Mask of events of interest. This is made by oring MPR_READABLE and MPR_WRITEABLE. |
proc | Callback function to invoke when an I/O event of interest has occurred. |
data | Data item to pass to the callback. |
priority | MPR priority to associate with the callback. This is only used if the MPR_WAIT_THREAD is specified in the flags and the MPR is build multithreaded. |
flags | Flags may be set to MPR_WAIT_THREAD if the callback function should be invoked using a thread from the thread pool. |
Disable wait events.
wp | Wait handler created vai mprCreateWaitHandler. |
wakeup | Set to true if it should wakeup the MPR service thread. |
Enable wait events.
wp | Wait handler created vai mprCreateWaitHandler. |
wakeup | Set to true if it should wakeup the MPR service thread. This should normally be set to true. |
Recall a wait handler.
wp | Wait handler created vai mprCreateWaitHandler. |
Define the wait handler callback.
wp | Wait handler created vai mprCreateWaitHandler. |
proc | Callback function to invoke when an I/O event of interest has occurred. |
mask | Mask of MPR_READABLE and MPR_WRITEABLE. |
Define the events of interest for a wait handler.
wp | Wait handler created vai mprCreateWaitHandler. |
mask | Mask of MPR_READABLE and MPR_WRITEABLE. |
Wait for I/O on an event handler.
wp | Wait handler created vai mprCreateWaitHandler. |
fd | File descriptor to wait on. |
mask | Mask of MPR_READABLE and MPR_WRITEABLE. |
timeout | Time in milliseconds to block. |
Format a string into an allocated buffer.
ctx | Any memory context allocated by the MPR. |
maxSize | Maximum size to allocate for the buffer including the trailing null. |
fmt | Printf style format string. |
Convert a string to an integer.
str | Pointer to the string to parse. |
radix | Base to use when parsing the string. |
Print a formatted message to a file descriptor.
file | MprFile object returned via mprOpen. |
fmt | Printf style format string. |
Return the current working directory.
ctx | Any memory context allocated by the MPR. |
Get the Http reponse code as a string.
ctx | Any memory allocation context created by MprAlloc. |
code | Http status code. |
Get the next word token.
buf | Buffer to use to hold the word token. |
bufsize | Size of the buffer. |
str | Input string to tokenize. Note this cannot be a const string. It will be written. |
delim | String of separator characters to use when tokenizing. |
tok | Pointer to a word to hold a pointer to the next token in the original string. |
Convert an integer to a string.
buf | Pointer to the buffer that will hold the string. |
size | Size of the buffer. |
value | Integer value to convert. |
radix | The base radix to use when encoding the number. |
Compare two byte strings.
b1 | Pointer to the first byte string. |
b1Len | Length of the first byte string. |
b2 | Pointer to the second byte string. |
b2Len | Length of the second byte string. |
Safe copy for a block of data.
dest | Pointer to the destination block. |
destMax | Maximum size of the destination block. |
src | Block to copy. |
nbytes | Size of the source block. |
Formatted print.
This is a secure verion of printf that can handle null argsctx | Any memory context allocated by the MPR. |
fmt | Printf style format string. |
Print a formatted message to the standard error channel.
ctx | Any memory context allocated by the MPR. |
fmt | Printf style format string. |
Append strings to an existing string and reallocate as required.
ctx | Any memory context allocated by the MPR. |
max | Maximum size of the result string. |
buf | Existing string to reallocate. May be null. |
src | Variable list of strings to append. The final string argument must be null. |
Format time according to RFC822.
ctx | Any memory context allocated by mprAlloc or mprCreate. |
buf | Time to format. |
bufsize | Size of buf. |
timep | Input pointer to a tm structure holding the time to format. |
Turn on debug mode.
ctx | Any memory context allocated by the MPR. |
on | Set to true to enable debugging mode. |
Format a string into a statically allocated buffer.
buf | Pointer to the buffer. |
maxSize | Size of the buffer. |
fmt | Printf style format string. |
Print a message to the applications standard output without allocating memory.
ctx | Any memory context allocated by the MPR. This is used to locate the standard output channel and not to allocate memory. |
fmt | Printf style format string. |
Print a message to the standard error channel without allocating memory.
ctx | Any memory context allocated by the MPR. This is used to locate the standard output channel and not to allocate memory. |
fmt | Printf style format string. |
Catenate strings.
ctx | Any memory context allocated by mprAlloc or mprCreate. |
max | Maximum size of the new block. |
src | Variable list of strings to append. The final string argument must be null. |
Compare strings.
str1 | First string to compare. |
str2 | Second string to compare. |
Compare strings ignoring case.
str1 | First string to compare. |
str2 | Second string to compare. |
Compare strings ignoring case.
str1 | First string to compare. |
str2 | Second string to compare. |
len | Length of characters to compare. |
Copy a string.
dest | Pointer to a pointer that will hold the address of the allocated block. |
destMax | Maximum size of the target string. |
src | String to copy. |
Copy characters from a string.
dest | Pointer to a pointer that will hold the address of the allocated block. |
destMax | Maximum size of the target string. |
src | String to copy. |
count | Maximum count of characters to copy. |
Return the length of a string.
src | String to measure. |
max | Maximum length for the string. |
Convert a string to lower case.
str | String to convert. |
Find a substring.
str | Pointer to the string to search. |
pattern | String pattern to search for. |
len | Count of characters in the pattern to actually search for. |
Tokenize a string.
str | String to tokenize. |
delim | String of characters to use as token separators. |
last | Last token pointer. |
Trim a string.
str | String to trim. |
set | String of characters to remove. |
Convert a string to upper case.
str | String to convert. |
Allocate a buffer of sufficient length to hold the formatted string.
ctx | Any memory context allocated by the MPR. |
maxSize | Maximum size to allocate for the buffer including the trailing null. |
fmt | Printf style format string. |
arg | Varargs argument obtained from va_start. |
Format a string into a statically allocated buffer.
buf | Pointer to the buffer. |
maxSize | Size of the buffer. |
fmt | Printf style format string. |
args | Varargs argument obtained from va_start. |
Module start/stop point function signature.
mp | Module object reference returned from mprCreateModule. |
Socket connection acceptance callback procedure.
Socket I/O callback procedure.
Buffer refill callback function.
buf | Instance of an MprBuf. |
arg | Data argument supplied to mprSetBufRefillProc. |
Mpr time structure.
Event callback function.
List comparison procedure for sorting.
arg1 | First list item to compare. |
arg2 | Second list item to compare. |
Log handler callback type.
file | Source filename. Derived by using __FILE__. |
line | Source line number. Derived by using __LINE__. |
flags | Error flags. |
level | Message logging level. Levels are 0-9 with zero being the most verbose. |
msg | Message being logged. |
Memory allocation error callback.
Notifiers are called if mprSetNotifier has been called on a context and a memory allocation fails. All notifiers up the parent context chain are called in orderctx | Any memory context allocated by the MPR. |
size | Size of memory allocation request that failed. |
total | Total memory allocations so far. |
granted | Set to true if the request was actually granted, but the application is now exceeding its redline memory limit. |
Memory context type.
Mpr memory block destructors prototype.
ctx | Any memory context allocated by the MPR. |
Loadable module entry point signature.
ctx | Any memory context allocated by the MPR. |
path | Actual path to the module. |
Memory Allocation Block Header.
Condition variable for multi-thread synchronization.
pthread_cond_t | cv | Unix pthreads condition variable. | |
MprMutex * | mutex | Thread synchronization mutex. | |
int | triggered | Value of the condition. |
Directory entry description.
bool | isDir | True if the file is a directory. | |
MprTime | lastModified | Time the file was last modified. | |
char * | name | Name of the file. | |
MprOffset | size | Size of the file. |
File system service.
MprAccessFileProc | accessPath | Virtual access file routine. | |
bool | caseSensitive | Path comparisons are case sensitive. | |
MprCloseFileProc | closeFile | Virtual close file routine. | |
char * | cygdrive | Cygwin drive root. | |
MprDeleteFileProc | deletePath | Virtual delete file routine. | |
MprGetPathInfoProc | getPathInfo | Virtual get file information routine. | |
bool | hasDriveSpecs | Paths can have drive specifications. | |
MprMakeDirProc | makeDir | Virtual make directory routine. | |
char * | newline | Newline for text files. | |
MprOpenFileProc | openFile | Virtual open file routine. | |
char * | portSeparators | Portable path separators. Typically "/\\". | |
MprReadFileProc | readFile | Virtual read file routine. | |
cchar * | root | Root file path. | |
MprSeekFileProc | seekFile | Virtual seek file routine. | |
char * | separators | Filename path separators. First separator is the preferred separator. | |
MprSetBufferedProc | setBuffered | Virtual set buffered I/O routine. | |
struct MprFile * | stdError | Standard error file. | |
struct MprFile * | stdInput | Standard input file. | |
struct MprFile * | stdOutput | Standard output file. | |
MprWriteFileProc | writeFile | Virtual write file routine. |
Hash table control structure.
MprHash ** | buckets | Hash collision bucket table. | |
int | count | Number of symbols in the table. | |
int | hashSize | Size of the buckets array. |
Key value pairs for use with MprList or MprHash.
char * | key | Key string. | |
char * | value | Associated value for the key. |
Multithreading lock control structure.
CRITICAL_SECTION | cs | Internal mutex critical section. |
Path information structure.
Multithreading spin lock control structure.
CRITICAL_SECTION | cs | Internal mutex critical section. |
Safe String Module.
Thread local data storage.
pthread_key_t | key | Data key. |