[Tipxd-devel] Last Major Data Structure information
Status: Beta
Brought to you by:
thomash
From: Thomas H. <nor...@ya...> - 2000-03-15 02:48:12
|
Last night I added the last of the major DS's to include/main.h in the repository. This data structure, selectinfo_t, will be used to list the currently open file descriptors for processing with the select() syscall. It is my intent to have a single linked-list of these, one for each file descriptor, and each one having pointers to the appropriate operations for reading, writing, and processing errors on it. Then the structure of main will look similar to this: --- [SNIP] --- [SNIP] --- for( ; ; ) selectinfo_t *info; FD_SET read_fds, err_fds; for(info = selectinfo; info != NULL; info = info->next ) { FD_ADD( &read_fds, info->fd ); FD_ADD( &err_fds, info->fd ); } retval = select( &read_fds, NULL, &err_fds, &timeout ); for(info = selectinfo; info != NULL; info = info->next ) { if(FD_ISSET( &read_fds, info->fd ) ) retval = info->read_op( info ); if(FD_ISSET( &err_fds, info->fd ) ) retval = info->err_op( info ); } } --- [SNIP] --- [SNIP] --- This is a little more than psuedo-code, but I'm not really compiling the code above. Hopefully from this, though, you get the general idea we're going for. The trick is coding the read, write, and error operations for the socket types that we are going to have: UDP Data TCP Data TCP Control UDP Control TCP Admin UDP Admin More on this when I get back to coding. Probably going to be Wednesday night for at least a little while. --tom __________________________________________________ Do You Yahoo!? Talk to your friends online with Yahoo! Messenger. http://im.yahoo.com |