00001 /* 00002 Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. 00003 00004 Redistribution and use in source and binary forms, with or without 00005 modification, are permitted provided that the following conditions are met: 00006 00007 * Redistributions of source code must retain the above copyright notice, this 00008 list of conditions and the following disclaimer. 00009 * Redistributions in binary form must reproduce the above copyright notice, 00010 this list of conditions and the following disclaimer in the documentation 00011 and/or other materials provided with the distribution. 00012 * Neither the name of Nokia Corporation nor the names of its contributors 00013 may be used to endorse or promote products derived from this software 00014 without specific prior written permission. 00015 00016 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00017 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00018 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00019 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 00020 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00021 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 00022 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00023 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 00024 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00025 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00026 00027 Description: 00028 */ 00029 00030 #ifndef MSGQLIB_H 00031 #define MSGQLIB_H 00032 00033 #include <_ansi.h> 00034 00035 #ifdef __cplusplus 00036 extern "C" { 00037 #endif 00038 00039 /* MsgQLib sizes */ 00040 #define MAX_MSG_LEN 2048 00041 00042 /* hash table parameters - table size must be a prime number */ 00043 #define MSGQ_TBL_SZ 101 00044 00045 /* message send states */ 00046 #define MSG_Q_READY 0 00047 #define MSG_Q_CLEANING 1 00048 00049 00050 #define NO_WAIT 0 00051 #define WAIT_FOREVER 0xFFFF 00052 00053 #ifndef NULL 00054 #define NULL 0 00055 #endif /* NULL */ 00056 00057 /* errors */ 00058 #define KMsgQLibErr 0x100 00059 #define KMsgQLibNoMemoryErr (KMsgQLibErr | 1) /* out of memory */ 00060 #define KMsgQLibQIdErr (KMsgQLibErr | 2) /* queue already in use or invalid */ 00061 #define KMsgQLibParamErr (KMsgQLibErr | 3) /* illegal parm(s)/val(s) */ 00062 #define KMsgQLibQFlushErr (KMsgQLibErr | 4) /* queue being flushed */ 00063 #define KMsgQLibQShortErr (KMsgQLibErr | 5) /* internal error: inconsistency between #of msgs*/ 00064 00065 #define MSG_Q_FIFO 1 00066 #define MSG_Q_PRIORITY 2 00067 #define MSG_PRI_NORMAL 3 00068 #define MSG_PRI_URGENT 4 00069 #define SEM_Q_FIFO 5 00070 #define SEM_Q_PRIORITY 6 00071 00072 #define OK 0 00073 #define ERROR -1 00074 00075 typedef unsigned long ULONG ; 00076 typedef unsigned short ushort_t; 00077 00091 IMPORT_C int MsgQCreate (ULONG qName, ULONG maxMsgs, ULONG qOptions, int* err); 00092 00102 IMPORT_C int MsgQDelete (ULONG qName, int* err); 00103 00118 IMPORT_C int MsgQSend (ULONG qName, char* msg, ULONG nBytes, ULONG priority, int timeout, int* err); 00119 00133 IMPORT_C int MsgQReceive (ULONG qName, char* msg, ULONG maxNBytes, int timeout, int* err); 00134 00144 IMPORT_C int MsgQCheck (ULONG qName, int* err); 00145 00154 IMPORT_C int MsgQMaxCheck (ULONG qName, int* err); 00155 00165 IMPORT_C int MsgQClean (ULONG qName, int* err); 00166 00167 #ifdef __cplusplus 00168 } 00169 #endif 00170 00171 #endif /* MSGQLIB_H */