Qsmtp  0.23svn
include/netio.h
Go to the documentation of this file.
00001 
00004 #ifndef NETIO_H
00005 #define NETIO_H
00006 
00007 #include <sys/types.h>
00008 #include <time.h>
00009 
00010 extern char linein[];
00011 extern size_t linelen;
00012 
00013 extern int net_read(void);
00014 extern int net_writen(const char *const *) __attribute__ ((nonnull (1)));
00015 extern int net_write_multiline(const char *const *) __attribute__ ((nonnull (1)));
00016 extern int netwrite(const char *) __attribute__ ((nonnull (1)));
00017 extern int netnwrite(const char *, const size_t) __attribute__ ((nonnull (1)));
00018 extern size_t net_readbin(size_t, char *) __attribute__ ((nonnull (2)));
00019 extern size_t net_readline(size_t, char *) __attribute__ ((nonnull (2)));
00020 extern int data_pending(void);
00021 
00022 static inline int __attribute__ ((nonnull (1)))
00023 net_write(const char *s)
00024 {
00025         const char *msg[] = {s, "\r\n", NULL};
00026         return net_writen(msg);
00027 }
00028 
00029 extern time_t timeout;
00030 extern int socketd;
00031 
00032 enum conn_shutdown_type {
00033         shutdown_clean,         
00034         shutdown_abort          
00035 };
00036 
00050 extern void net_conn_shutdown(const enum conn_shutdown_type sd_type) __attribute__ ((noreturn));
00051 
00052 #ifdef DEBUG_IO
00053 extern int do_debug_io;
00054 extern int in_data;
00055 #endif
00056 
00057 #endif