You've seen that your code is responsible for providing the main message receiving loop:
while (1) {
// wait here for a message
if ((ctp = dispatch_block (ctp)) == NULL) {
perror ("Unable to dispatch_block");
exit (EXIT_FAILURE);
}
// handle the message
dispatch_handler (ctp);
}
This is very convenient, for it lets you place breakpoints on the receiving function and to intercept messages (perhaps with a debugger) during operation.
The library implements the "magic" inside of the dispatch_handler() function, because that's where the message is analyzed and disposed of through the connect and I/O functions tables we mentioned earlier.
In reality, the library consists of two cooperating layers: a base layer that provides "raw" resource manager functionality, and a POSIX layer that provides POSIX helper and default functions. We'll briefly define the two layers, and then in "Resource manager structure," below, we'll pick up the details.