~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Open Mash Cross Reference
mash/atobj/atobj-sm.h

Component: ~ [ mash ] ~ [ apps ] ~ [ gsm ] ~ [ lib ] ~ [ otcl ] ~ [ srm ] ~ [ tcl8.3 ] ~ [ tclcl ] ~ [ tk8.3 ] ~ [ tutorials ] ~

  1 /*
  2  * atobj-sm.h --
  3  *
  4  *      this is a simple animator session manager
  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-sm.h,v 1.7 2002/02/03 03:10:21 lim Exp $
 34  */
 35 
 36 #ifndef ATOBJ_MGR_H
 37 #define ATOBJ_MGR_H
 38 
 39 #include <srm/session-srm.h>
 40 #include "atobj-rreq.h"
 41 #include "atobj-rcvr.h"
 42 
 43 /* this is a simple animator session manager */
 44 class AtobjSM : public SRM_AppMgr {
 45 public:
 46     AtobjSM();
 47 
 48     virtual ~AtobjSM();
 49 
 50     virtual int command(int argc, const char*const* argv);
 51 
 52     /* returns time of day, in hundreths of seconds. */
 53     n_long currTime() const {
 54         struct timeval tv;
 55         gettimeofday(&tv, 0);
 56         return (100 * tv.tv_sec + (tv.tv_usec / 10000));
 57     }
 58     AtobjRcvr* get_rcvr(const SrcId& srcId);
 59     AtobjRcvr* define_rcvr(const SrcId& srcId);
 60 
 61     /* caller tells manager that it has len bytes ready to be sent*/
 62     RetCode begin_xmit(int len) {
 63         if (len) return pSession_->begin_xmit(len);
 64         return FALSE;
 65     }
 66 
 67     /* virtual SRM_AppMgr functions*/
 68     virtual int next_ADU(Byte *pb, int len, srm_src& /*addr*/,
 69                          int &type, int& next) {
 70         next=0;
 71         type = APP_DATA;
 72         /* TODO: should poll all receivers or preq as well*/
 73         int outlen=(pLocalRcvr_->next_ADU(pb, len));
 74         Trace(VERYVERBOSE,("S %d b",outlen));
 75         return outlen;
 76     }
 77 
 78     virtual SRM_PacketHandler *new_source(const srm_src &sid, int islocal);
 79     virtual void handle_request(const SrcId& sidRqtSrc, Byte *pb, int len);
 80     virtual void handle_reply(const SrcId& sidRpySrc, Byte *pb, int len);
 81 
 82     void schedRequest(Atobj_request* pRequest, const SrcId& sid ) {
 83         pSession_->sched_request(pRequest, sid);
 84     }
 85     void schedReply(Atobj_reply* pReply, const SrcId& sid) {
 86         pSession_->sched_reply(pReply, sid);
 87     }
 88 
 89     /* REVIEW: srm should change to u_int */
 90     virtual void handle_SA(const SrcId& sid, Byte *pb, int len);
 91 
 92     virtual int periodic_update(Byte *pb);
 93 
 94     void setSession(SRM_Session *pSession) { pSession_ = pSession; }
 95 
 96     /* returns the size of the maximum packet len*/
 97     u_short getMTU() {
 98         /* REVIEW: this should be from SRM*/
 99         return SRM_MTU;
100     }
101     u_short getMaxCmdSz() {
102         /* note: need to subtract from Pkt_Reply because we have to be */
103         /* able to send it out the command as a reply...*/
104         return SRM_MTU-sizeof(Pkt_PageHdr)-sizeof(Pkt_reply);
105     }
106 
107 #ifdef MB_DEBUG
108     void Dump(int dumptype);
109 #endif
110 
111  private:
112     AtobjRcvr* pLocalRcvr_;
113     SRM_Session* pSession_;
114     Tcl_HashTable *phtRcvrs_;
115 };
116 
117 #endif /* #ifdef ATOBJ_MGR_H */
118 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.