#include "ipmi_task.h"

Ipmi_Task::Ipmi_Task()
{
  cout<<"Calling the Ipmi_Task constructor"<<endl; 
  this->msg_queue()->high_water_mark(1000000);
  this->msg_queue()->low_water_mark(1000000);
}

int Ipmi_Task::open()
{
 cout<<"Calling the Ipmi_Task::open()"<<endl;                                                                                                                       
 os_hnd = ipmi_posix_setup_os_handler();
                                                                                                                             
 if(!os_hnd)
   {
    printf("Error:Unable to allocate to OS handler\n");
    exit(0);
   }
                                                                                                                             
  //OpenIPMI init
 ipmi_init(os_hnd);                                                                                                               
 
 ACE_Thread_Manager::instance()->spawn_n (1, ACE_THR_FUNC (worker),
                                 ACE_reinterpret_cast (void *, NULL),
                                 THR_NEW_LWP | THR_JOINABLE);
                                                                                                                             

  return this->activate(THR_JOINABLE, 1);
}


int Ipmi_Task::svc()
{

 cout<<"Calling the svc"<<endl;

 while(1)
 {    
    ACE_Message_Block *bb;
   // cout<<"before getq"<<endl;
    ACE_DEBUG ((LM_DEBUG , "(%D | %t) before getq\n"));
    this->getq(bb);
   // cout<<"after getq"<<endl;   
    ACE_DEBUG ((LM_DEBUG , "(%D | %t) after getq\n")); 
    string reqStr = (string) (bb->rd_ptr());
    bb->release();
   // cout<<"Req:"<<reqStr<<endl; 
    ACE_DEBUG ((LM_DEBUG , "(%D | %t) Req:%s\n",reqStr.c_str()));
    ipmi_main obj1;
    int status; 
    status = obj1.main1(reqStr);     
 } 
 return 0; 
}


os_handler_t *Ipmi_Task::os_hnd=0;

void * Ipmi_Task::worker()
{

 cout<<"Calling the worker\n";
 os_hnd->operation_loop(os_hnd); 

}

os_handler_t* Ipmi_Task::fetch_handler()
{
  return os_hnd;
}


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Openipmi-developer mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openipmi-developer

Reply via email to