Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
mq.h
Package: h323.zip [view]
Upload User: hnnddl
Upload Date: 2007-01-06
Package Size: 3580k
Code Size: 3k
Category:
VOIP program
Development Platform:
WINDOWS
- /*
- * $Revision: 1.4 $
- * $Date: 1998/05/19 18:16:23 $
- */
- ////////////////////////////////////////////////////////////////
- // Copyright (c) 1996,97 Lucent Technologies //
- // All Rights Reserved //
- // //
- // THIS IS UNPUBLISHED //
- // PROPRIETARY SOURCE //
- // CODE OF Lucent Technologies //
- // AND elemedia //
- // //
- ////////////////////////////////////////////////////////////////
- //
- ////////////////////////////////////////////////////////////////
- // Example programs are provided soley to demonstrate one //
- // possible use of the stack libraries and are included for //
- // instructional purposes only. You are free to use, modify //
- // and/or redistribute any portion of code in the example //
- // programs. However, such examples are not intended to //
- // represent production quality code. //
- // //
- // THE COPYRIGHT HOLDERS PROVIDE THESE EXAMPLE PROGRAMS //
- // "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED //
- // OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED //
- // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A //
- // PARTICULAR PURPOSE. //
- ////////////////////////////////////////////////////////////////
- #if !defined(__MQ_H__)
- #define __MQ_H__
- #if (defined(WIN32))
- #include <windows.h>
- #elif defined(VXWORKS)
- #include "vxWorks.h"
- #include "taskLib.h"
- #include "semLib.h"
- #include "selectLib.h"
- #include "fcntl.h"
- #include "sockLib.h"
- #include "inetLib.h"
- #include "msgQLib.h"
- #else
- #if (defined(__hpux))
- #include <pthread.h>
- #else
- #include <thread.h>
- #include <synch.h>
- #endif
- #endif
- #if (defined(WIN32))
- #include <windows.h>
- #endif
- struct USER_MESSAGE
- {
- int message;
- int wParam;
- int lParam;
- };
- class MessageQueue
- {
- public:
- MessageQueue(char *name, int mqlen, unsigned long param);
- virtual ~MessageQueue();
- void QueueMessage(USER_MESSAGE *msg);
- int DequeueMessage(USER_MESSAGE *msg);
- // Start listener thread.
- int Start();
- // Stop listener thread.
- void Stop();
- virtual void NotifyMessage(USER_MESSAGE&) = 0;
- protected:
- void wait_for_message();
- struct mqueue_node
- {
- USER_MESSAGE msg;
- mqueue_node *next;
- } *mqueue_head, *mqueue_tail;
- int q_len;
- char q_name[80];
- #if defined(WIN32)
- unsigned long thread_id;
- HANDLE thread_handle;
- static unsigned __stdcall _boot(void *context);
- #elif defined(VXWORKS)
- MSG_Q_ID mqueue_id;
- int thread_id;
- SEM_ID thread_exited_flag;
- static int _boot(void *context);
- #elif (defined(__hpux))
- pthread_mutex_t mutex;
- pthread_cond_t mqueue_not_empty;
- pthread_t thread_id;
- static void *_boot(void *context);
- #else
- mutex_t mutex;
- cond_t mqueue_not_empty;
- thread_t thread_id;
- static void *_boot(void *context);
- #endif
- };
- #if (defined(WIN32))
- #define USER_MESSAGE_ID (WM_USER + 1001)
- #else
- #define WM_USER 100
- #endif
- #define MQ_INTERNAL_ID WM_USER + 100
- #endif