reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
SelectInterruptor.hxx
Go to the documentation of this file.
1#ifndef RESIP_SelectInterruptor_HXX
2#define RESIP_SelectInterruptor_HXX
3
5#include "rutil/FdPoll.hxx"
6#include "rutil/Socket.hxx"
7
8namespace resip
9{
10
15{
16 public:
18 virtual ~SelectInterruptor();
19
24 virtual void handleProcessNotification();
25
29 void interrupt();
30
36 void buildFdSet(FdSet& fdset);
37
41 void process(FdSet& fdset);
42
43 virtual void processPollEvent(FdPollEventMask mask);
44
45 /* Get fd of read-side, for use within PollInterruptor,
46 * Declared as Socket for easier cross-platform even though pipe fd
47 * under linux.
48 */
49 Socket getReadSocket() const { return mReadThing; }
50
51 protected:
52
53 /* Cleanup the read side of the interruptor
54 * If fdset is provided, it will only try cleaning up if our pipe
55 * is ready in fdset. If NULL, it will unconditionally try reading.
56 * This last feature is for use within PollInterruptor.
57 */
58 void processCleanup();
59 private:
60#ifndef WIN32
61 int mPipe[2];
62#else
63 Socket mSocket;
64 sockaddr mWakeupAddr;
65#endif
66 // either mPipe[0] or mSocket
67 Socket mReadThing;
68};
69
70}
71
72#endif
73
74/* ====================================================================
75 * The Vovida Software License, Version 1.0
76 *
77 * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
78 *
79 * Redistribution and use in source and binary forms, with or without
80 * modification, are permitted provided that the following conditions
81 * are met:
82 *
83 * 1. Redistributions of source code must retain the above copyright
84 * notice, this list of conditions and the following disclaimer.
85 *
86 * 2. Redistributions in binary form must reproduce the above copyright
87 * notice, this list of conditions and the following disclaimer in
88 * the documentation and/or other materials provided with the
89 * distribution.
90 *
91 * 3. The names "VOCAL", "Vovida Open Communication Application Library",
92 * and "Vovida Open Communication Application Library (VOCAL)" must
93 * not be used to endorse or promote products derived from this
94 * software without prior written permission. For written
95 * permission, please contact vocal@vovida.org.
96 *
97 * 4. Products derived from this software may not be called "VOCAL", nor
98 * may "VOCAL" appear in their name, without prior written
99 * permission of Vovida Networks, Inc.
100 *
101 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
102 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
103 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
104 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
105 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
106 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
107 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
108 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
109 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
110 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
111 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
112 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
113 * DAMAGE.
114 *
115 * ====================================================================
116 *
117 * This software consists of voluntary contributions made by Vovida
118 * Networks, Inc. and many individuals on behalf of Vovida Networks,
119 * Inc. For more information on Vovida Networks, Inc., please see
120 * <http://www.vovida.org/>.
121 *
122 * vi: set shiftwidth=3 expandtab:
123 */
Handles cross-platform sockets compatibility.
Object-oriented wrapper for your platform's file-descriptor set.
Definition Socket.hxx:162
Used to 'artificially' interrupt a select call.
virtual void processPollEvent(FdPollEventMask mask)
Called by PollGrp when activity is possible.
void process(FdSet &fdset)
cleanup signalled fd
void interrupt()
cause the 'artificial' fd to signal
virtual void handleProcessNotification()
Called by the stack when messages are posted to it.
void buildFdSet(FdSet &fdset)
Used to add the 'artificial' fd to the fdset that will be responsible for interrupting a subsequent s...
dcm! – add UnusedChecking(_enum) below;
unsigned short FdPollEventMask
Definition FdPoll.hxx:28
int Socket
Definition Socket.hxx:94