if(nodeinfo.nodetype == NT_HOST)
(void)CNET_set_handler(EV_APPLICATIONREADY, appl_ready, 0);
| CnetNodeType | meaning |
|---|---|
| NT_HOST | this node is a host with an Application Layer and keyboard |
| NT_ROUTER | this node is a router without an Application Layer or keyboard |
| CnetEvent | meaning |
|---|---|
| EV_NULL | this event is never raised |
| EV_REBOOT | raised as reboot_node(EV_REBOOT, ... , ...) |
| EV_SHUTDOWN | raised before cnet is (cleanly) terminated |
| EV_APPLICATIONREADY | raised when there is a message ready for delivery |
| EV_PHYSICALREADY | raised when a frame arrives at one of the links |
| EV_KEYBOARDREADY | raised when a line entered from the keyboard |
| EV_LINKSTATE | raised when a link changes state (up or down) |
| EV_DEBUG1..EV_DEBUG5 | raised when one of the debug buttons (under X-windows) is pressed |
| EV_TIMER1..EV_TIMER10 | raised when a timer on any of the 10 timer queues expires |
if(CNET_write_application(msgbuffer, &msglength) != 0) {
/* an error has occured */
if(cnet_errno == ER_BADSESSION) {
/* handle this special case */
....
}
else {
cnet_perror("writing to application");
}
}
| CnetError | meaning |
|---|---|
| ER_OK | No error |
| ER_BADARG | Invalid argument passed to a function |
| ER_BADEVENT | Invalid event passed to a function |
| ER_BADLINK | Invalid link number passed to a function |
| ER_BADNODE | Invalid node passed to a function |
| ER_BADSENDER | Application Layer given message from an unknown node |
| ER_BADSESSION | Application Layer given message from incorrect session |
| ER_BADSIZE | Indicated length is of incorrect size |
| ER_BADTIMER | Invalid CnetTimer passed to a function |
| ER_CORRUPTDATA | Attempt to transfer corrupt data |
| ER_LINKDOWN | Attempt to transmit on a link which is down |
| ER_NOTFORME | Application Layer given a message for another node |
| ER_NOTREADY | Function called when service not available |
| ER_NOTSUPPORTED | Invalid operation for this node type |
| ER_OUTOFSEQ | Application Layer given message out of sequence |
| ER_TOOBUSY | link is too busy/congested to handle request |
cnet was written and is maintained by Chris McDonald
(chris@cs.uwa.edu.au)