X hits on this document

PDF document

February 10, 2006 - page 35 / 238

888 views

0 shares

0 downloads

0 comments

35 / 238

2.4. STARTING UP OPENIPMI

23

2.4

Starting Up OpenIPMI

Starting up OpenIPMI is relatively easy. You must allocate an OS handler and initialize the library with it. Then you are free to set up connections. The following code shows this for a non-threaded POSIX program:

o s _ h n d = i p m i _ p o s i x _ s e t u p _ o s _ h a n d l e r ( ) if (!os_hnd) { ;

p r i n t f ( " i p m i _ s m i _ s e t u p _ c o n : U n a b l e t o a l l o c a t e o s h a n d l e r \ n " exit(1); ) ;

}

/* Initialize the OpenIPMI library. */ ipmi_init(os_hnd);

The ipmi_init function should be done once when your program starts up. Generally, you only have one OS handler, but you are free to have more if they interwork properly and you have some special need.

2.5

Creating OpenIPMI Domains

If you want to talk to an IPMI BMC, you must create a connection to it. The connection method depends on the type of connection; these are described in Chapter 3. Once you have a connection, you can open a domain with it. You do this like so:

_ _ ipmi con t

cons[N];

int

num_cons, rv;

ipmi_domain_id_t id;

/* Set up connection(s) here */

r v = i p m i _ o p e n _ d o m a i n ( c o n s , n u m _ c o n s , c o n _ c h a n g e , u s e r _ d a t a domain_fully_up, user_data2, , o p t i o n s , n u m _ o p t i o n s , & d o m a i n _ i d ) ;

2.5.1

Domain

Connections

Up to two connections to a single domain are currently supported. A connection is an independent MC in the same domain; if two MCs have external connections, they can both be used for fault-tolerance. This generally requires some special support for the particular domain type, see the appendices on specific domain types for more detail. The con_change function is called whenever the connection changes states (a connection is established or lost). The connection change callback looks like:

int

err,

unsigned int

_ conn num,

unsigned int

_ port num,

static void

c o n _ c h a n g e ( i p m i _ d o m a i n

_

t *domain,

Document info
Document views888
Page views888
Page last viewedSat Dec 10 17:11:53 UTC 2016
Pages238
Paragraphs8090
Words85809

Comments