net.c File Reference

#include <sys/types.h>
#include <sys/ioctl.h>
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <signal.h>
#include <net/netlib.h>
#include <net/hton.h>
#include <net/gen/netdb.h>
#include <net/gen/in.h>
#include <net/gen/inet.h>
#include <net/gen/tcp.h>
#include <net/gen/tcp_io.h>
#include <net/gen/udp.h>
#include <net/gen/udp_io.h>
#include <net/gen/udp_hdr.h>
#include "talk.h"
#include "net.h"

Include dependency graph for net.c:

Go to the source code of this file.

Functions

 _PROTOTYPE (void TimeOut,(int sig))
int NetInit ()
int getreply (struct talk_reply *reply, int timeout)
int sendrequest (struct talk_request *request, int here)
void TimeOut (int sig)
int NetConnect (u16_t port)
int NetListen (int timeout)

Variables

static unsigned char buffer [8192]
static int udp_ctl
int tcp_fd
static udpport_t ntalk_port
char luser [USER_SIZE+1]
char ruser [USER_SIZE+1]
char lhost [HOST_SIZE+1]
char rhost [HOST_SIZE+1]
char ltty [TTY_SIZE+1]
char rtty [TTY_SIZE+1]
udpport_t ctlport
tcpport_t dataport
ipaddr_t laddr
ipaddr_t raddr


Function Documentation

_PROTOTYPE void  TimeOut,
(int sig
 

int getreply struct talk_reply reply,
int  timeout
 

Definition at line 126 of file net.c.

References alarm, EINTR, errno, memcpy(), perror(), read, s, SIGALRM, and signal().

Referenced by TalkTrans().

int NetConnect u16_t  port  ) 
 

Definition at line 203 of file net.c.

References ECONNREFUSED, errno, ioctl, NWIOGTCPCONF, NWIOSTCPCONF, NWIOTCPCONN, nwio_tcpconf::nwtc_flags, nwio_tcpconf::nwtc_locport, NWTC_LP_SET, NWTC_NOFLAGS, nwio_tcpconf::nwtc_remaddr, nwio_tcpconf::nwtc_remport, NWTC_SET_RA, NWTC_SET_RP, nwio_tcpcl::nwtcl_flags, perror(), and s.

Referenced by TalkInit().

int NetInit  ) 
 

Definition at line 42 of file net.c.

References close, errno, fprintf(), getenv(), getservbyname(), ioctl, NULL, NWIOGTCPCONF, NWIOGUDPOPT, NWIOSTCPCONF, NWIOSUDPOPT, nwio_tcpconf::nwtc_flags, nwio_tcpconf::nwtc_locport, NWTC_LP_SEL, NWTC_NOFLAGS, nwio_tcpconf::nwtc_remaddr, NWTC_SET_RA, NWTC_UNSET_RP, NWUO_COPY, NWUO_DI_BROAD, NWUO_DI_IPOPT, NWUO_EN_LOC, nwio_udpopt::nwuo_flags, nwio_udpopt::nwuo_locaddr, nwio_udpopt::nwuo_locport, NWUO_LP_SEL, NWUO_NOFLAGS, NWUO_RA_SET, nwio_udpopt::nwuo_remaddr, nwio_udpopt::nwuo_remport, NWUO_RP_SET, NWUO_RWDATONLY, O_RDWR, open, perror(), s, stderr, strerror(), TCP_DEVICE, tcp_device, UDP_DEVICE, and udp_device.

Referenced by main().

int NetListen int  timeout  ) 
 

Definition at line 241 of file net.c.

References alarm, EINTR, errno, ioctl, NWIOTCPLISTEN, nwio_tcpcl::nwtcl_flags, perror(), s, SIGALRM, and signal().

Referenced by TalkInit().

int sendrequest struct talk_request request,
int  here
 

Definition at line 153 of file net.c.

References fprintf(), ioctl, NWIOGUDPOPT, NWIOSUDPOPT, NWUO_COPY, NWUO_DI_BROAD, NWUO_DI_IPOPT, NWUO_EN_LOC, nwio_udpopt::nwuo_flags, nwio_udpopt::nwuo_locport, NWUO_LP_SET, NWUO_NOFLAGS, NWUO_RA_SET, nwio_udpopt::nwuo_remaddr, nwio_udpopt::nwuo_remport, NWUO_RP_SET, NWUO_RWDATONLY, perror(), s, stderr, and write.

Referenced by TalkTrans().

void TimeOut int  sig  ) 
 

Definition at line 198 of file net.c.


Variable Documentation

unsigned char buffer[8192] [static]
 

Definition at line 28 of file net.c.

udpport_t ctlport
 

Definition at line 38 of file net.c.

Referenced by TalkTrans().

tcpport_t dataport
 

Definition at line 39 of file net.c.

ipaddr_t laddr
 

Definition at line 40 of file net.c.

Referenced by TalkTrans().

char lhost[HOST_SIZE+1]
 

Definition at line 36 of file net.c.

Referenced by main().

char ltty[TTY_SIZE+1]
 

Definition at line 37 of file net.c.

Referenced by main().

char luser[USER_SIZE+1]
 

Definition at line 35 of file net.c.

Referenced by main(), and TalkTrans().

udpport_t ntalk_port [static]
 

Definition at line 33 of file net.c.

Referenced by NetInit(), and sendreply().

ipaddr_t raddr
 

Definition at line 40 of file net.c.

Referenced by main().

char rhost[HOST_SIZE+1]
 

Definition at line 36 of file net.c.

Referenced by __ivaliduser(), DoTalk(), and main().

char rtty[TTY_SIZE+1]
 

Definition at line 37 of file net.c.

Referenced by main(), and TalkTrans().

char ruser[USER_SIZE+1]
 

Definition at line 35 of file net.c.

Referenced by DoTalk(), main(), and TalkTrans().

int tcp_fd
 

Definition at line 31 of file net.c.

Referenced by is_unused_port(), tcp_cancel(), tcp_close(), tcp_close_connection(), tcp_fd_read(), tcp_fd_write(), tcp_init(), tcp_ioctl(), tcp_main(), tcp_print_conn(), tcp_read(), tcp_release_retrans(), tcp_restart_connect(), tcp_rsel_read(), tcp_rsel_write(), tcp_sel_read(), tcp_sel_write(), tcp_select(), and tcp_write().

int udp_ctl [static]
 

Definition at line 30 of file net.c.


Generated on Fri Apr 14 23:03:24 2006 for minix by  doxygen 1.4.6