43#include <netinet/in.h> 
   44#include <netinet/tcp.h> 
   49#include <sys/socket.h> 
   59#define SIGNAL_PORT 8418 
   60#define COMMAND_PORT 8417 
   61#define SEND_ENVIORNMENT  
   71#define WINBUF_NUM 2400  
   86void read_full(
int file, 
char* buffer, 
int num); 
 
   87int read_some(
int file, 
char* buffer, 
int size); 
 
   89void write_buf(
int file, 
char* buffer, 
int num); 
 
   90int write_amap(
int file, 
char* buffer, 
int num); 
 
  123        perror(
"signal socket");
 
  131        perror(
"command socket");
 
 
  166        #ifdef SEND_ENVIORNMENT 
  171        if(feof(stdin) || 
buf[0]==
'\n')
 
 
  206        count=read(file,buffer+pos,num);
 
  207        if(count==0 || (count<0 && 
errno!=EAGAIN))
 
 
  220    struct hostent* host_entity;
 
  223    struct sockaddr_in host;
 
  227    if(!strcmp(
name,
"localhost"))
 
  238                fprintf(stderr,
"EAGI proxy: Wrong address!\n"); 
 
  241            address=*((
int*)host_entity->h_addr);
 
  245    desc=socket(AF_INET,SOCK_STREAM,IPPROTO_TCP);
 
  248        fprintf(stderr,
"EAGI proxy: Cannot create socket!\n");
 
  252    memset((
void*)&host,0,
sizeof(
struct sockaddr_in));
 
  254    host.sin_family=AF_INET;
 
  255    host.sin_port=htons(port);
 
  258    res=connect(
desc,(
struct sockaddr*)&host,
sizeof(host));
 
  261        fprintf(stderr,
"EAGI proxy: Cannot connect!\n");
 
  266    opts = fcntl(
desc,F_GETFL);
 
  268        perror(
"fcntl(F_GETFL)");
 
  271    opts = (opts | O_NONBLOCK);
 
  272    if (fcntl(
desc,F_SETFL,opts) < 0) {
 
  273        perror(
"fcntl(F_SETFL)");
 
 
  293                perror(
"Error reading");
 
 
  369                fprintf(stderr,
"Buffer overflow!\n");
 
 
  390            perror(
"Error writing");
 
 
  406    opts = fcntl(
desc,F_GETFL);
 
  409        perror(
"fcntl(F_GETFL)");
 
  413    opts = (opts | O_NONBLOCK );
 
  414    if(fcntl(
desc,F_SETFL,opts) < 0)
 
  416        perror(
"fcntl(F_SETFL)");
 
 
int connect_to_host(char *host, int port)
void * readSignal(void *ptr)
void read_full(int file, char *buffer, int num)
void setnonblocking(int desc)
void write_buf(int file, char *buffer, int num)
pthread_mutex_t command_mutex
int read_some(int file, char *buffer, int size)
int write_amap(int file, char *buffer, int num)
void * readStdin(void *ptr)
#define pthread_mutex_lock
#define pthread_mutex_unlock
#define pthread_mutex_init
Time-related functions and macros.