1 /*
2 * atobj-rcvr.h --
3 *
4 * class AtobjRcvr (see below)
5 *
6 * Copyright (c) 1997-2002 The Regents of the University of California.
7 * All rights reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions are met:
11 *
12 * A. Redistributions of source code must retain the above copyright notice,
13 * this list of conditions and the following disclaimer.
14 * B. Redistributions in binary form must reproduce the above copyright notice,
15 * this list of conditions and the following disclaimer in the documentation
16 * and/or other materials provided with the distribution.
17 * C. Neither the names of the copyright holders nor the names of its
18 * contributors may be used to endorse or promote products derived from this
19 * software without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
22 * IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
23 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
25 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 * POSSIBILITY OF SUCH DAMAGE.
32 *
33 * $Header: /usr/mash/src/repository/mash/mash-1/atobj/atobj-rcvr.h,v 1.7 2002/02/03 03:10:21 lim Exp $
34 */
35
36 #ifndef ATOBJ_RCVR_H
37 #define ATOBJ_RCVR_H
38
39 #include "atobj-pkt.h"
40 #include "srm/source-srm.h"
41
42 class AtobjSM;
43 class Atobj_request;
44 class Atobj_reply;
45
46 /*
47 *-------------------------------------------------------------------------
48 *
49 * class AtobjRcvr --
50 *
51 * An active object receiver is the class that handles the
52 * active objects streams from a end host (i.e. SRM_Source).
53 * It handles the demultiplexing of streams into each active object.
54 *
55 *-------------------------------------------------------------------------
56 */
57
58 class AtobjRcvr : public SRM_PacketHandler {
59 public:
60 AtobjRcvr(AtobjSM *pSM, const SrcId& srcId);
61 virtual ~AtobjRcvr();
62 virtual int command(int argc, const char*const* argv);
63
64 virtual void recv(Byte *pb, u_int len);
65 /* REVIEW: SRM should use unsigned... */
66 virtual void recv(Byte *pb, int len) { recv(pb, (u_int)len); }
67
68 /* create a new animation if it does not exist */
69 /* returns: created? */
70 int define_animation(const AnimationId& anmId);
71
72 /* creates a new animation (will create the tcl classes... */
73 char* create_animation(const AnimationId& anmId);
74
75 /* returns the (tcl) name of an animation given anmId */
76 const char* get_animation(const AnimationId& anmId);
77
78 /* Adds a new animation given its name, this is appropriate for local
79 * receivers */
80 void add_animation(const char* szAnim, const AnimationId& anmId);
81
82 virtual int next_ADU(Byte *pb, int len);
83
84 void handleRequest(AtoPkt_request *pPkt);
85 void handleReply(AtoPkt_reply* pPkt);
86
87 Atobj_request* schedRequest(const AnimationId& anmId);
88
89 // returns true if request is still needed, false otherwise
90 int updateRequest(Atobj_request* pRequest,
91 const AnimationId& anmId);
92
93 u_int fillRequest(Atobj_request* pRequest,
94 const AnimationId& anmId, Byte* pb, int len);
95
96 /* returns false if invalid id's, true o.w. */
97 int cancelRequest(Atobj_request* pRequest, const AnimationId& anmId,
98 int wantCallback);
99
100 Atobj_reply* schedReply(const AnimationId& anmId);
101
102 /* returns false if invalid id's, true o.w. */
103 int cancelReply(Atobj_reply* pReply, const AnimationId& anmId);
104
105 // returns total len of reply
106 u_int fillReply(Atobj_reply* pRequest,
107 const AnimationId& anmId, Byte* pb, int len);
108
109 u_int fillSA(Byte* pb);
110 void handleSA(AtoPkt_SA* pSA);
111
112 // accessor functions
113 const SrcId& srcId() {return srcId_;}
114 private:
115 u_int nextAnmId_;
116 SrcId srcId_;
117 AtobjSM *pMgr_;
118 Tcl_HashTable *phtAnimations_;
119 Tcl_HashTable *phtRequests_;
120 Tcl_HashTable *phtReplies_;
121 };
122
123 #endif /* #ifdef ATOBJ_RCVR_H */
124
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.