LocalQueueManager.hpp
Go to the documentation of this file.
1 /*----------------------------------------------------------------------------*/
2 /* */
3 /* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */
4 /* Copyright (c) 2005-2009 Rexx Language Association. All rights reserved. */
5 /* */
6 /* This program and the accompanying materials are made available under */
7 /* the terms of the Common Public License v1.0 which accompanies this */
8 /* distribution. A copy is also available at the following address: */
9 /* http://www.ibm.com/developerworks/oss/CPLv1.0.htm */
10 /* */
11 /* Redistribution and use in source and binary forms, with or */
12 /* without modification, are permitted provided that the following */
13 /* conditions are met: */
14 /* */
15 /* Redistributions of source code must retain the above copyright */
16 /* notice, this list of conditions and the following disclaimer. */
17 /* Redistributions in binary form must reproduce the above copyright */
18 /* notice, this list of conditions and the following disclaimer in */
19 /* the documentation and/or other materials provided with the distribution. */
20 /* */
21 /* Neither the name of Rexx Language Association nor the names */
22 /* of its contributors may be used to endorse or promote products */
23 /* derived from this software without specific prior written permission. */
24 /* */
25 /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
26 /* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
27 /* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS */
28 /* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */
29 /* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */
30 /* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED */
31 /* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, */
32 /* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY */
33 /* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING */
34 /* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS */
35 /* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
36 /* */
37 /*----------------------------------------------------------------------------*/
38 
39 #ifndef LocalQueueManager_HPP_INCLUDED
40 #define LocalQueueManager_HPP_INCLUDED
41 
42 #include "LocalAPISubsystem.hpp"
43 #include "rexx.h"
44 #include "Rxstring.hpp"
45 #include "ServiceMessage.hpp"
46 #include "Utilities.hpp"
47 
48 typedef uintptr_t QueueHandle; // type for returned queue handles
49 
50 // local instance of the queue API...this is a proxy that communicates with the
51 // server that manages the queues.
53 {
54 public:
55 
57 
59 
60  inline bool isSessionQueue(const char *name)
61  {
62  return name == NULL || Utilities::strCaselessCompare(name, "SESSION") == 0;
63  }
64 
65  bool validateQueueName(const char *username);
67  virtual void terminateProcess();
70  RexxReturnCode createNamedQueue(const char *name, size_t size, char *createdName, size_t *dup);
71  RexxReturnCode openNamedQueue(const char *name, size_t *dup);
72  RexxReturnCode queryNamedQueue(const char *name);
74  RexxReturnCode deleteNamedQueue(const char * name);
76  RexxReturnCode clearNamedQueue(const char * name);
78  RexxReturnCode getQueueCount(const char *name, size_t &);
79  RexxReturnCode addToNamedQueue(const char *name, CONSTRXSTRING &data, size_t lifoFifo);
80  RexxReturnCode addToSessionQueue(CONSTRXSTRING &data, size_t lifoFifo);
81  RexxReturnCode pullFromQueue(const char *name, RXSTRING &data, size_t waitFlag, RexxQueueTime *timeStamp);
85 
86 protected:
87  LocalAPIManager *localManager; // our local manager instance
88  QueueHandle sessionQueue; // our resolved session queue
89  SessionID sessionID; // the working session id
90  static bool createdSessionQueue; // remember if we created the session queue
91 };
92 
93 #endif
uintptr_t QueueHandle
uintptr_t SessionID
virtual RexxReturnCode processServiceException(ServiceException *e)
RexxReturnCode clearSessionQueue()
QueueHandle createSessionQueue(SessionID session)
QueueHandle initializeSessionQueue(SessionID s)
RexxReturnCode mapReturnResult(ServiceMessage &m)
RexxReturnCode deleteNamedQueue(const char *name)
RexxReturnCode deleteSessionQueue()
RexxReturnCode getSessionQueueCount(size_t &)
RexxReturnCode getQueueCount(const char *name, size_t &)
RexxReturnCode openNamedQueue(const char *name, size_t *dup)
bool validateQueueName(const char *username)
RexxReturnCode addToSessionQueue(CONSTRXSTRING &data, size_t lifoFifo)
RexxReturnCode pullFromQueue(const char *name, RXSTRING &data, size_t waitFlag, RexxQueueTime *timeStamp)
RexxReturnCode queryNamedQueue(const char *name)
RexxReturnCode clearNamedQueue(const char *name)
RexxReturnCode createNamedQueue(const char *name, size_t size, char *createdName, size_t *dup)
bool isSessionQueue(const char *name)
void initializeLocal(LocalAPIManager *a)
RexxReturnCode addToNamedQueue(const char *name, CONSTRXSTRING &data, size_t lifoFifo)
static bool createdSessionQueue
QueueHandle nestSessionQueue(SessionID s, QueueHandle q)
virtual void terminateProcess()
LocalAPIManager * localManager
static int strCaselessCompare(const char *opt1, const char *opt2)
Definition: Utilities.cpp:82
int RexxReturnCode
Definition: rexx.h:73
UINT_PTR uintptr_t