Qsmtp  0.30dev
netio.h
Go to the documentation of this file.
1 
4 #ifndef NETIO_H
5 #define NETIO_H
6 
7 #include "sstring.h"
8 
9 #include <string.h>
10 #include <sys/types.h>
11 #include <time.h>
12 
13 extern struct string linein;
14 
15 extern int net_read(const int fatal);
16 extern int net_writen(const char *const *) __attribute__ ((nonnull (1)));
17 extern int net_write_multiline(const char *const *) __attribute__ ((nonnull (1)));
18 static inline int netwrite(const char *) __attribute__ ((nonnull (1)));
19 extern int netnwrite(const char *, const size_t) __attribute__ ((nonnull (1)));
20 extern size_t net_readbin(size_t, char *) __attribute__ ((nonnull (2)));
21 extern size_t net_readline(size_t, char *) __attribute__ ((nonnull (2)));
22 extern int data_pending(void);
23 
24 extern time_t timeout;
25 extern int socketd;
26 
30 };
31 
45 extern void net_conn_shutdown(const enum conn_shutdown_type sd_type) __attribute__ ((noreturn));
46 
47 #ifdef DEBUG_IO
48 extern int do_debug_io;
49 extern int in_data;
50 #endif
51 
52 static inline int
53 netwrite(const char *s)
54 {
55  return netnwrite(s, strlen(s));
56 }
57 
58 #endif
Definition: netio.h:28
int net_write_multiline(const char *const *)
Definition: netio.c:551
int data_pending(void)
check if there is data ready to be read without blocking
Definition: netio.c:763
char * s
Definition: sstring.h:16
conn_shutdown_type
Definition: netio.h:27
int socketd
Definition: qremote.c:37
int net_read(const int fatal)
read one line from the network
Definition: netio.c:304
int net_writen(const char *const *)
Definition: netio.c:472
size_t net_readbin(size_t, char *)
Definition: netio.c:598
record of a string
Definition: sstring.h:15
definition of string record and headers of corresponding helper functions
void net_conn_shutdown(const enum conn_shutdown_type sd_type)
shutdown the connection and end the program
Definition: qremote.c:77
size_t net_readline(size_t, char *)
Definition: netio.c:640
int netnwrite(const char *, const size_t)
Definition: netio.c:411
Definition: netio.h:29
time_t timeout
Definition: netio.c:32