root/juggler/branches/2.2/modules/gadgeteer/cluster/Packets/SyncAck.h

Revision 19729, 3.3 kB (checked in by patrick, 2 years ago)

Copyright update.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 /*************** <auto-copyright.pl BEGIN do not edit this line> **************
2  *
3  * VR Juggler is (C) Copyright 1998-2007 by Iowa State University
4  *
5  * Original Authors:
6  *   Allen Bierbaum, Christopher Just,
7  *   Patrick Hartling, Kevin Meinert,
8  *   Carolina Cruz-Neira, Albert Baker
9  *
10  * This library is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU Library General Public
12  * License as published by the Free Software Foundation; either
13  * version 2 of the License, or (at your option) any later version.
14  *
15  * This library is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18  * Library General Public License for more details.
19  *
20  * You should have received a copy of the GNU Library General Public
21  * License along with this library; if not, write to the
22  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23  * Boston, MA 02111-1307, USA.
24  *
25  *************** <auto-copyright.pl END do not edit this line> ***************/
26
27 #ifndef _GADGET_RIM_SYNC_ACK_H
28 #define _GADGET_RIM_SYNC_ACK_H
29
30 #include <gadget/gadgetConfig.h>
31
32 #include <vpr/vprTypes.h>
33 #include <vpr/IO/BufferObjectReader.h>
34 #include <vpr/IO/BufferObjectWriter.h>
35 #include <vpr/IO/Socket/SocketStream.h>
36
37 #include <cluster/Packets/Header.h>
38 #include <cluster/Packets/Packet.h>
39
40 namespace cluster
41 {
42
43 /** \class SyncAck SyncAck.h cluster/Packets/SyncAck.h
44  *
45  * Synchronization acknowledgement packet.
46  */
47 class GADGET_CLASS_API SyncAck : public Packet
48 {
49 public:
50    SyncAck()
51    {;}
52
53    /**
54     * Create a ApplicationDataAck packet to acknowledge a
55     * ApplicationDataRequest.
56     *
57     * @param host_name The hostname of the node acknowledging the SyncRequest.
58     * @param port      The port of the node acknowledging the SyncRequest.
59     * @param ack       Boolean determining if this is a positive (ACK) or a
60     *                  negative (NACK) responce.
61     */
62    SyncAck(const std::string& host_name, const vpr::Uint16& port,
63            const bool ack);
64
65    /**
66     * Serializes member variables into a data stream.
67     */
68    void serialize();
69
70    /**
71     * Parses the data stream into the local member variables.
72     */
73    virtual void parse(vpr::BufferObjectReader* reader);
74
75    /**
76     * Print the data to the screen in a readable form.
77     */
78    virtual void printData(int debug_level);
79
80    /**
81     * Return the type of this packet.
82     */
83    static vpr::Uint16 getPacketFactoryType()
84    {
85       return(Header::RIM_SYNC_ACK);
86    }
87
88    /**
89     * Returns the hostname of the node acknowledging the SyncRequest.
90     */
91    std::string getHostname()
92    {
93       return mHostname;
94    }
95
96    /**
97     * Returns the port of the node acknowledging the SyncRequest.
98     */
99    vpr::Uint16 getPort()
100    {
101       return mPort;
102    }
103
104    /**
105     * Returns a boolean determining if this is a positive(ACK) or a
106     * negative(NACK) responce.
107     */
108    bool getAck()
109    {
110       return mAck;
111    }
112
113 private:
114    std::string mHostname;  /**< Hostname of the node acknowledging the SyncRequest. */
115    vpr::Uint16 mPort;      /**< Listening port of the node acknowledging the SyncRequest. */
116    bool        mAck;       /**< Boolean determining if this is a positive(ACK) or a negative(NACK) responce. */
117 };
118
119 }
120
121
122 #endif
Note: See TracBrowser for help on using the browser.