NetBurner 3.1
iosys.h File Reference

NetBurner I/O System Library API. More...

#include <constants.h>
#include <stdio.h>
#include <basictypes.h>

Go to the source code of this file.

Macros

#define IOCTL_TX_CHANGE_CRLF   (1)
 When set, transmitted char \n gets converted to \r\n.
 
#define IOCTL_RX_CHANGE_CRLF   (2)
 When set, received \r\n get turned into \n.
 
#define IOCTL_RX_PROCESS_EDITS   (4)
 When set, process backspace and do simple line editing.
 
#define IOCTL_RX_ECHO   (8)
 When set, echo chars received to tx.
 
#define IOCTL_TX_NO_BLOCK   (32)
 When set, stdout and stderr will drop output instead of blocking.
 
#define IOCTL_ALL_OPTIONS   (15)
 When set, turns on all options.
 
#define IOCTL_SET   (0x4000)
 Used to set an option.
 
#define IOCTL_CLR   (0x2000)
 Used to clear an option.
 

Typedefs

typedef void FDCallBack(int fd, FDChangeType change, void *pData)
 This defines the funciton signature for FD notifcation callbacks. More...
 

Enumerations

enum  FDChangeType
 This enum lists the notificatiosn that a registered FD monitor can recieve.
 

Functions

int close (int fd)
 This function closes the resources associated with a file descriptor (fd). This can be a TCP socket or a Serial I/O port. More...
 
int read (int fd, char *buf, int nbytes)
 This function reads data from a file descriptor (fd), and will block forever until at least one byte is available to be read (as opposed to the ReadWithTimeout() function which reads data from a file descriptor with a specified time-out value). This function can be used to read from stdio, TCP sockets, or Serial ports. More...
 
int peek (int fd, char *c)
 This function peeks at data from a file descriptor (fd), and will block forever until at least one byte is available to be read (as opposed to the ReadWithTimeout() function which reads data from a file descriptor with a specified time-out value). This function can be used to peek from stdio, TCP sockets, or Serial ports. More...
 
int write (int fd, const char *buf, int nbytes)
 This function writes data to the stream associated with a file descriptor (fd). More...
 
int writestring (int fd, const char *str)
 This function writes null terminated string data to the stream associated with a file descriptor (fd). This function can be used to write data to stdio, a TCP socket, or a Serial port. More...
 
int writeall (int fd, const char *buf, int nbytes)
 This function writes data to the stream associated with a file descriptor (fd). More...
 
int ReadWithTimeout (int fd, char *buf, int nbytes, unsigned long timeout)
 This function reads data from a file descriptor (fd), with a specified time-out value (as opposed to the read function which will block forever until at least one byte is available to be read). More...
 
int ReadAllWithTimeout (int fd, char *buf, int nbytes, unsigned long timeout)
 This function reads data from a file descriptor (fd), with a specified time-out value (as opposed to the read function which will block forever until at least one byte is available to be read). More...
 
int readall (int fd, char *buf, int nbytes)
 This function reads data from a file descriptor (fd), with a specified time-out value (as opposed to the read function which will block forever until at least one byte is available to be read). More...
 
int PeekWithTimeout (int fd, char *c, unsigned long timeout)
 This function peeks at data from a file descriptor (fd), with a specified time-out value (as opposed to the peek function which will block forever until at least one byte is available to be read). This function can be used to peek from stdio, TCP sockets, or Serial ports. More...
 
int dataavail (int fd)
 This function checks to see if data is available for read. More...
 
int writeavail (int fd)
 Check to see if a file descriptor is available for write. More...
 
int haserror (int fd)
 Check to see if a file descriptor has an error. More...
 
int charavail ()
 This function checks to see if data is available for read on stdin. More...
 
void RegisterFDCallBack (int fd, FDCallBack *fp, void *pData)
 Register a call back function to recieve notifcation when an FD state changes. Register a NULL pf to remove the notifcation. More...
 
void FD_ZERO (fd_set *pfds)
 This function zero's an fd_set (file descriptor set) so that it has no file descriptors (fds) selected. More...
 
void FD_CLR (int fd, fd_set *pfds)
 An fd_set (file descriptor set) holds a set of file descriptors (fds). This function clears or removes a specific file descriptor in an fd_set. More...
 
void FD_SET (int fd, fd_set *pfds)
 An fd_set (file descriptor set) holds a set of file descriptors (fds). This function sets or adds a specific file descriptor to an fd_set. More...
 
int FD_ISSET (int fd, fd_set *pfds)
 An fd_set (file descriptor set) holds a set of file descriptors (fds). This function indicates whether (or not) a specific fd is in a specific fd_set. More...
 
int select (int nfds, fd_set *readfds, fd_set *writefds, fd_set *errorfds, unsigned long timeout)
 This function waits for events to occur on one or more I/O resources associated with a set of file descriptors (fds). More...
 
int ZeroWaitSelect (int nfds, fd_set *readfds, fd_set *writefds, fd_set *errorfds)
 This function returns whether events have occurred on one or more I/O resources associated with a set of file descriptors (fds). More...
 
int ioctl (int fd, int cmd)
 This function controls the selection of input/output control options for stdio: stdin = 0, stdout = 1 and stderr = 2. More...
 
int ReplaceStdio (int stdio_fd, int new_fd)
 This function allows you to map stdio to any file descriptor (fd). More...
 
int CurrentStdioFD (int stdio_fd)
 Determine the current file descriptor mapped to stdio file. More...
 
void IrqStdio ()
 Automatically open the system default serial port in interrupt mode using the system default baud rate and assign this serial port to stdin, stdout and stderr.
 

Detailed Description

NetBurner I/O System Library API.