Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

ipmi_discover.h

00001 /*
00002  *
00003  * Copyright (c) 2004 by FORCE Computers
00004  *
00005  * This program is distributed in the hope that it will be useful,
00006  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00007  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  This
00008  * file and program are licensed under a BSD style license.  See
00009  * the Copying file included with the OpenHPI distribution for
00010  * full licensing terms.
00011  *
00012  * Authors:
00013  *     Thomas Kanngieser <thomas.kanngieser@fci.com>
00014  */
00015 
00016 #ifndef dIpmiDiscover_h
00017 #define dIpmiDiscover_h
00018 
00019 
00020 class cIpmiDomain;
00021 class cIpmiMcThread;
00022 class cIpmiMcTask;
00023 
00024 
00025 // cIpmiMcThread::m_properties
00026 #define dIpmiMcThreadInitialDiscover 1 // discover at startup
00027 #define dIpmiMcThreadPollAliveMc     2 // poll mc if found
00028 #define dIpmiMcThreadPollDeadMc      4 // poll mc if not found
00029 #define dIpmiMcThreadCreateM0        8 // create hotswap state M0
00030 
00031 
00032 typedef void (cIpmiMcThread::*tIpmiMcTask)( void *userdata );
00033 
00034 class cIpmiMcThread : public cThread
00035 {
00036 private:
00037   cIpmiDomain  *m_domain;
00038 
00039   void WriteLock();
00040   void WriteUnlock();
00041 
00042   unsigned char m_addr;
00043   cIpmiMc      *m_mc;
00044 
00045   // properties
00046   unsigned int m_properties; // dIpmiMcThreadXXXX
00047 
00048 public:
00049   cIpmiMc     *Mc()   { return m_mc; }
00050 
00051 protected:
00052   virtual void *Run();
00053 
00054 public:
00055   // signal to MC thread to exit
00056   bool m_exit;
00057 
00058   cIpmiMcThread( cIpmiDomain  *domain,
00059                  unsigned char addr,
00060                  unsigned int  properties );
00061 
00062   ~cIpmiMcThread();
00063 
00064 protected:
00065   cIpmiMcTask *m_tasks;
00066 
00067 public:
00068   // add a task to MC thread
00069   void AddMcTask( tIpmiMcTask task, const cTime &timeout,
00070                   void *userdata );
00071 
00072   // add a task to MC thread
00073   void AddMcTask( tIpmiMcTask task, unsigned int diff_ms,
00074                   void *userdata );
00075 
00076   // remove MC task from list
00077   bool RemMcTask( void *userdata );
00078 
00079   // clear the MC task list
00080   void ClearMcTaskList();
00081 
00082 protected:
00083   // discover MC
00084   void Discover( cIpmiMsg *get_device_id_rsp = 0 );
00085 
00086   // poll mc task
00087   void PollAddr( void *userdata );
00088 
00089   cIpmiSel *m_sel;
00090 
00091   // read SEL task
00092   void ReadSel( void *userdata );
00093 
00094   GList *m_events;
00095   cThreadLock m_events_lock;
00096 
00097   void HandleEvents();
00098 
00099   void HandleEvent( cIpmiEvent *event );
00100   void HandleHotswapEvent( cIpmiSensorHotswap *sensor, cIpmiEvent *event );
00101 
00102 public:
00103   void AddEvent( cIpmiEvent *event );
00104 };
00105 
00106 
00107 #endif

Generated on Thu Mar 4 19:33:14 2010 for New Simulator by  doxygen 1.4.4