#include <fcntl.h>
#include "main.h"
#include <limits.h>
#include <string.h>
#include <netdb.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <errno.h>
#include <setjmp.h>
Go to the source code of this file.
Defines | |
#define | getdtablesize() 200 |
#define | PROXY_SOCKS 1 |
#define | PROXY_SUN 2 |
Functions | |
char ((char *)(global[114]))[121] | |
char ((char *)(global[116]))[21] | |
IP ((IP(*)(char *)) global[90])(char *s) | |
int | expmem_net () |
IP ((IP(*)(void)) global[77])() | |
void ((void(*)(char *)) global[78])(char *s) | |
int ((int(*)(int, int, int)) global[269])(int sock | |
Variables | |
struct dcc_t *struct | global [92] = 0 |
int | backgrd |
int | use_stderr |
int | resolve_timeout |
unsigned long | otraffic_irc_today |
unsigned long | otraffic_bn_today |
unsigned long | otraffic_dcc_today |
unsigned long | otraffic_filesys_today |
unsigned long | otraffic_trans_today |
unsigned long | otraffic_unknown_today |
char | myip [121] = "" |
char | firewall [121] = "" |
int | firewallport = 1080 |
int | dcc_sanitycheck = 0 |
sigjmp_buf | alarmret |
int | operation |
char | ( | (char *)(global[116]) | ) |
char | ( | (char *)(global[114]) | ) |
int expmem_net | ( | ) |
Definition at line 90 of file net.c.
References threaddata::MAXSOCKS, NULL, SOCK_TCL, SOCK_UNUSED, and threaddata().
Referenced by debug_mem_to_dcc(), and expected_memory().
00091 { 00092 int i, tot = 0; 00093 struct threaddata *td = threaddata(); 00094 00095 for (i = 0; i < td->MAXSOCKS; i++) { 00096 if (!(td->socklist[i].flags & (SOCK_UNUSED | SOCK_TCL))) { 00097 if (td->socklist[i].handler.sock.inbuf != NULL) 00098 tot += strlen(td->socklist[i].handler.sock.inbuf) + 1; 00099 if (td->socklist[i].handler.sock.outbuf != NULL) 00100 tot += td->socklist[i].handler.sock.outbuflen; 00101 } 00102 } 00103 return tot; 00104 }
int | ( | (int(*)(int, int, int)) | global[269] | ) |
IP | ( | (IP(*)(void)) | global[77] | ) |
Definition at line 108 of file net.c.
References fatal, hostname, myip, and NULL.
00109 { 00110 struct hostent *hp; 00111 char s[121]; 00112 IP ip; 00113 struct in_addr *in; 00114 if (myip[0]) { 00115 if ((myip[strlen(myip) - 1] >= '0') && (myip[strlen(myip) - 1] <= '9')) 00116 return (IP) inet_addr(myip); 00117 } 00118 /* Also could be pre-defined */ 00119 if (hostname[0]) 00120 hp = gethostbyname(hostname); 00121 else { 00122 gethostname(s, 120); 00123 hp = gethostbyname(s); 00124 } 00125 if (hp == NULL) 00126 fatal("Hostname self-lookup failed. Please set 'my-ip' in the config " 00127 "file.", 0); 00128 in = (struct in_addr *) (hp->h_addr_list[0]); 00129 ip = (IP) (in->s_addr); 00130 return ip; 00131 }
IP | ( | (IP(*)(char *)) | global[90] | ) |
void | ( | (void(*)(char *)) | global[78] | ) |
Definition at line 133 of file net.c.
00134 { 00135 switch (errno) { 00136 case EADDRINUSE: 00137 strcpy(s, "Address already in use"); 00138 break; 00139 case EADDRNOTAVAIL: 00140 strcpy(s, "Cannot assign requested address"); 00141 break; 00142 case EAFNOSUPPORT: 00143 strcpy(s, "Address family not supported"); 00144 break; 00145 case EALREADY: 00146 strcpy(s, "Socket already in use"); 00147 break; 00148 case EBADF: 00149 strcpy(s, "Socket descriptor is bad"); 00150 break; 00151 case ECONNREFUSED: 00152 strcpy(s, "Connection refused"); 00153 break; 00154 case EFAULT: 00155 strcpy(s, "Bad address"); 00156 break; 00157 case EINPROGRESS: 00158 strcpy(s, "Operation in progress"); 00159 break; 00160 case EINTR: 00161 strcpy(s, "Timeout"); 00162 break; 00163 case EINVAL: 00164 strcpy(s, "Invalid argument"); 00165 break; 00166 case EISCONN: 00167 strcpy(s, "Socket already connected"); 00168 break; 00169 case ENETUNREACH: 00170 strcpy(s, "Network unreachable"); 00171 break; 00172 case ENOTSOCK: 00173 strcpy(s, "Socket operation on non-socket"); 00174 break; 00175 case ETIMEDOUT: 00176 strcpy(s, "Connection timed out"); 00177 break; 00178 case ENOTCONN: 00179 strcpy(s, "Socket is not connected"); 00180 break; 00181 case EHOSTUNREACH: 00182 strcpy(s, "No route to host"); 00183 break; 00184 case EPIPE: 00185 strcpy(s, "Broken pipe"); 00186 break; 00187 #ifdef ECONNRESET 00188 case ECONNRESET: 00189 strcpy(s, "Connection reset by peer"); 00190 break; 00191 #endif 00192 #ifdef EACCES 00193 case EACCES: 00194 strcpy(s, "Permission denied"); 00195 break; 00196 #endif 00197 #ifdef EMFILE 00198 case EMFILE: 00199 strcpy(s, "Too many open files"); 00200 break; 00201 #endif 00202 case 0: 00203 strcpy(s, "Error 0"); 00204 break; 00205 default: 00206 sprintf(s, "Unforseen error %d", errno); 00207 break; 00208 } 00209 }
sigjmp_buf alarmret |
Definition at line 69 of file net.c.
Referenced by block_dns_hostbyip(), block_dns_ipbyhost(), and got_alarm().
int dcc_sanitycheck = 0 |
int firewallport = 1080 |
Definition at line 64 of file net.c.
Referenced by tcl_eggstr(), and tell_settings().
unsigned long otraffic_bn_today |
unsigned long otraffic_dcc_today |
unsigned long otraffic_filesys_today |
unsigned long otraffic_irc_today |
unsigned long otraffic_trans_today |
unsigned long otraffic_unknown_today |
int resolve_timeout |
int use_stderr |