/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 1990-2011 AT&T Intellectual Property *
* and is licensed under the *
* Eclipse Public License, Version 1.0 *
* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
* *
* Information and Software Systems Research *
* AT&T Research *
* Florham Park NJ *
* *
* Glenn Fowler <gsf@research.att.com> *
* *
***********************************************************************/
/*
* File: ifs_network.c
*/
#include "ifs_agent.h"
#include <cs.h>
#include <error.h>
/*
*name: NetFillCache
* read data from network to cache buffer
* rtn: -1 if timeout
* 0 if end-of-file or IfsAbort
* size if read successful
*/
int
int timeout;
{
if( IfsAbortFlag ) {
return 0;
}
/* move the cache data to the beginning of netbuf */
}
while( 1 ) {
if( rtn >= 0 ) break;
/* error occured in select call */
logit( "NetRead: select error\n" );
break;
}
if( IfsAbortFlag == 1 ) {
return 0;
}
logit( "NetRead: bypass signal\n" );
}
if( rtn == 0 ) {
/* select timeout */
if( timeout > 0 )
logit( "NetRead: timeout\n" );
return -1;
if( num > 0 )
}
}
/*
*name: NetDataReady
* check if data ready in the cache or network buffer
* try read from network if the cache buffer is empty
*/
int
{
NetFillCache( nFile, 0 );
}
/*
*name: NetEOF
* check if the network is closed
*/
int
{
return 0;
}
/* read successful & no data ready */
return 1;
}
return 0;
}
/*
*name: NetRead
* read a block of memory from NetFile.
* read to nFile->buf in NetFile if buf is NULL
*/
int
char *buf;
int bufsize;
{
int readlen;
int len;
return -1;
readlen = 0;
while( 1 ) {
/* read data from cache buf */
return readlen; /* buffer full */
}
}
}
}
/*
*name: NetGets
* read a string (end with '\n') from NetFile.
*/
char*
char *buf;
int bufsize;
{
char *ptr;
return NULL;
bufsize--;
if( *ptr++ == '\n' )
break;
}
*ptr = '\0';
}
/*
*name: NetWrite
* write a block of memory to Netfile
*/
int
char *buf;
int bufsize;
{
return -1;
writelen = 0;
while( bufsize > 0 ) {
if( len <= 0 ) {
break;
}
}
return writelen;
}
/*
*name: NetClose
* close a network file opened by NetConnect
*/
int
{
int rtn;
return -1;
return rtn;
}
/*
*name: NetConnect
* make a socket connection to host:port.
* connect to proxy hosts if proxy flag is on.
*/
NetFile *
struct server_info *srv;
char *host;
int port;
{
unsigned long addr;
int fd;
return NULL;
logit( "proxy reply: " );
return nFile;
}
return NULL;
}
if (!addr) {
return NULL;
}
return NULL;
return NULL;
return nFile;
}