home *** CD-ROM | disk | FTP | other *** search
- *** apps/makefile Tue Nov 09 00:51:06 1993
- --- apps/makefile Wed Nov 10 02:31:48 1993
- ***************
- *** 13,22 ****
- #
-
- !if '$(DEBUG)'=='E'
- ! IDEBUG=-v
- TEXTDEBUG=enabled
- !elif '$(DEBUG)'=='D'
- ! IDEBUG=-v-
- TEXTDEBUG=disabled
- #!else
- #!error DEBUG must be set to either E or D
- --- 13,22 ----
- #
-
- !if '$(DEBUG)'=='E'
- ! IDEBUG=-v -DMULTICAST
- TEXTDEBUG=enabled
- !elif '$(DEBUG)'=='D'
- ! IDEBUG=-v- -DMULTICAST
- TEXTDEBUG=disabled
- #!else
- #!error DEBUG must be set to either E or D
- ***************
- *** 49,55 ****
-
- exes.arc: ping.exe daytime.exe finger.exe lpr.exe lpq.exe \
- tcpport.exe rexec.exe ntime.exe tcpinfo.exe cookie.exe \
- ! popdump.exe ph.exe tcptalk.exe
- # host.exe
- echo done $(TEXTMODEL) make with debugging $(TEXTDEBUG)
-
- --- 49,55 ----
-
- exes.arc: ping.exe daytime.exe finger.exe lpr.exe lpq.exe \
- tcpport.exe rexec.exe ntime.exe tcpinfo.exe cookie.exe \
- ! popdump.exe ph.exe tcptalk.exe lister.exe blather.exe
- # host.exe
- echo done $(TEXTMODEL) make with debugging $(TEXTDEBUG)
-
- ***************
- *** 92,97 ****
- --- 92,103 ----
-
- tcptalk.exe: tcptalk.c
- $(CC) tcptalk.c $(CLIB)
- +
- + lister.exe: lister.c
- + $(CC) lister.c $(CLIB)
- +
- + blather.exe: blather.c
- + $(CC) blather.c $(CLIB)
-
- host.exe: host.c
- $(CC) host.c $(CLIB)
- *** include/tcp.h Thu Aug 05 10:13:58 1993
- --- include/tcp.h Tue Nov 09 23:26:36 1993
- ***************
- *** 281,284 ****
- --- 281,293 ----
- extern int addwattcpd( void (*p)() );
- extern int delwattcpd( void (*p)() );
- extern int tap_add( void *socket, void *userid );
- +
- + #if defined(MULTICAST)
- + /* Stuff for Multicast Support - JRM 6/7/93 */
- +
- + extern int udp_SetTTL(udp_Socket *, byte );
- + extern int join_mcast_group( longword );
- + extern int leave_mcast_group( longword );
- + #endif /* MULTICAST */
- +
- #endif /* WTCP_VER */
- *** include/wattcp.h Thu Jul 15 11:16:48 1993
- --- include/wattcp.h Tue Nov 09 23:38:10 1993
- ***************
- *** 17,22 ****
- --- 17,26 ----
-
- #include <stdio.h>
- #include <elib.h>
- + #if defined(MULTICAST)
- + #include <stdlib.h>
- + #include <time.h>
- + #endif /* MULTICAST */
-
- #define set_mstimeout( x ) (set_timeout(0)+ (x / 55))
-
- ***************
- *** 45,50 ****
- --- 49,57 ----
- #define UDP_PROTO 0x11
- #define TCP_PROTO 0x06
- #define ICMP_PROTO 0x01
- + #if defined(MULTICAST)
- + #define IGMP_PROTO 0x02
- + #endif /* MULTICAST */
-
- #define TCP_MODE_BINARY 0 /* default mode */
- #define TCP_MODE_ASCII 1
- ***************
- *** 74,79 ****
- --- 81,90 ----
-
- extern word sock_inactive; /* in pcbootp.c */
- extern word _pktdevclass;
- + #if defined(MULTICAST)
- + extern byte _pktdevlevel;
- + extern byte pkterror;
- + #endif /* MULTICAST */
- extern word _mss;
- extern word _bootptimeout; /* in pcbootp.c */
- extern longword _bootphost; /* in pcbootp.c */
- ***************
- *** 102,107 ****
- --- 113,132 ----
- longword destination;
- } in_Header;
-
- + #if defined(MULTICAST)
- + /* The Internet Group Management Protocol (IGMP) Packet */
- + typedef struct {
- + unsigned type : 4;
- + unsigned version : 4;
- + byte mbz;
- + word checksum;
- + longword address;
- + } IGMP_packet;
- +
- + #define IGMP_Version 1
- + #define IGMP_Query 1
- + #define IGMP_Report 2
- + #endif /* MULTICAST */
-
- #define in_GetVersion(ip) ( (ip)->ver )
- #define in_GetHdrlen(ip) ( (ip)->hdrlen ) /* 32 bit word size */
- ***************
- *** 179,184 ****
- --- 204,212 ----
- typedef struct _udp_socket {
- struct _udp_socket *next;
- word ip_type; /* always set to UDP_PROTO */
- + #if defined(MULTICAST)
- + byte ttl; /* mainly for use with multicast */
- + #endif /* MULTICAST */
- char *err_msg; /* null when all is ok */
- char *usr_name;
- void (*usr_yield)();
- ***************
- *** 425,427 ****
- --- 453,508 ----
- extern int tcp_listen(tcp_Socket *s, word lport, longword ina, word port, procref datahandler, word timeout);
- extern int sock_gets(sock_type *, byte *, int );
- extern int sock_close(sock_type * );
- +
- + #if defined(MULTICAST)
- + /* Stuff for Multicast Support - JRM 6/7/93 */
- +
- + extern int udp_SetTTL(udp_Socket *, byte );
- + extern int join_mcast_group( longword );
- + extern int leave_mcast_group( longword );
- + extern int _eth_join_mcast_group( int );
- + extern int _eth_leave_mcast_group( int );
- + extern int is_multicast( longword );
- + extern int multi_to_eth( longword , eth_address );
- + extern void igmp_handler( in_Header * );
- + extern int igmp_report( longword );
- + extern int _pkt_set_rcv_mode( int , int );
- + extern int _pkt_get_rcv_mode( int );
- + extern int _pkt_get_multicast_list( byte , eth_address * );
- + extern int _pkt_set_multicast_list( byte , eth_address * );
- + extern int _pkt_get_ip_rcv_mode( );
- + extern int _pkt_set_ip_rcv_mode( int );
- +
- + #define CLASS_D_MASK 0xE0000000 /* the mask that defines IP Class D */
- + #define IPMULTI_MASK 0x007FFFFF /* to get the low-order 23 bits */
- + #define ETH_MULTI 0x01005E /* high order bits of multi eth addr */
- + #define IPMULTI_SIZE 20 /* the size of the ipmulti table */
- + #define ALL_SYSTEMS 0xE0000001 /* the default mcast addr 224.0.0.1 */
- +
- + typedef struct {
- + longword ina; /* IP address of group */
- + eth_address ethaddr; /* Ethernet address of group */
- + byte processes; /* number of interested processes */
- + time_t replytime; /* IGMP query reply timer */
- + byte active; /* is this an active entry */
- + } multicast;
- + extern multicast _ipmulti[IPMULTI_SIZE];
- +
- + /* PD Error Returns */
- + #define BASIC_DVR 0
- + #define BAD_HANDLE 1
- + #define NO_CLASS 2
- + #define NO_TYPE 3
- + #define NO_NUMBER 4
- + #define BAD_TYPE 5
- + #define NO_MULTICAST 6
- + #define CANT_TERMINATE 7
- + #define BAD_MODE 8
- + #define NO_SPACE 9
- + #define TYPE_INUSE 10
- + #define BAD_COMMAND 11
- + #define CANT_SEND 12
- + #define CANT_SET 13
- + #define BAD_ADDRESS 14
- +
- + #endif /* MULTICAST */
- *** src/makefile Tue Nov 09 00:51:34 1993
- --- src/makefile Tue Nov 09 23:42:34 1993
- ***************
- *** 7,13 ****
- # TRACE - turn on tracing/debugging code
- #
- #
- ! DEBUGS= -v
-
- CFLAGS= $(DEBUGS) -DMSDOS -Ic:\borlandc\include -I..\include -g200
- MODELS=-ms
- --- 7,13 ----
- # TRACE - turn on tracing/debugging code
- #
- #
- ! DEBUGS= -v -DMULTICAST
-
- CFLAGS= $(DEBUGS) -DMSDOS -Ic:\borlandc\include -I..\include -g200
- MODELS=-ms
- ***************
- *** 37,44 ****
- sock_prn.obj sock_ini.obj pcbsd.obj pcrecv.obj \
- udp_nds.obj udp_dom.obj pcconfig.obj pc_cbrk.obj pcbuf.obj \
- pcbootp.obj sock_dbu.obj pcdbug.obj test.obj pcintr.obj pcstat.obj \
- ! bsdname.obj fragment.obj \
- ! netback.obj select.obj
-
- ..\lib\wattcpsm.lib: $(objs)
- echo done
- --- 37,44 ----
- sock_prn.obj sock_ini.obj pcbsd.obj pcrecv.obj \
- udp_nds.obj udp_dom.obj pcconfig.obj pc_cbrk.obj pcbuf.obj \
- pcbootp.obj sock_dbu.obj pcdbug.obj test.obj pcintr.obj pcstat.obj \
- ! bsdname.obj fragment.obj netback.obj select.obj \
- ! pcigmp.obj pcmulti.obj
-
- ..\lib\wattcpsm.lib: $(objs)
- echo done
- ***************
- *** 70,75 ****
- --- 70,78 ----
- pcstat.obj: pcstat.c ..\include\wattcp.h
- netback.obj: netback.c ..\include\elib.h ..\include\tcp.h
- bsdname.obj: bsdname.c ..\include\wattcp.h
- + pcigmp.obj: pcigmp.c ..\include\wattcp.h
- + pcmulti.obj: pcmulti.c ..\include\wattcp.h
- +
-
-
-
- *** src/pcpkt.c Wed Aug 04 11:14:30 1993
- --- src/pcpkt.c Tue Nov 09 23:43:48 1993
- ***************
- *** 22,32 ****
- --- 22,45 ----
-
- #define INT_FIRST 0x60
- #define INT_LAST 0x80
- +
- + /* Basic PD Functions */
- #define PD_DRIVER_INFO 0x1ff
- #define PD_ACCESS 0x200
- #define PD_RELEASE 0x300
- #define PD_SEND 0x400
- + #define PD_TERMINATE 0x500
- #define PD_GET_ADDRESS 0x600
- + #define PD_RESET 0x700
- +
- + /* Extended PD Functions */
- + #define PD_SET_RCV 0x1400
- + #define PD_GET_RCV 0x1500
- + #define PD_SET_MULTI 0x1600
- + #define PD_GET_MULTI 0x1700
- + #define PD_GET_STATS 0x1800
- + #define PD_SET_ADDR 0x1900
- +
- #define CARRY 1 /* carry bit in flags register */
-
- word _pktipofs = 0; /* offset from header to start of pkt */
- ***************
- *** 102,107 ****
- --- 115,123 ----
- }
- } else {
- pd_type = regs.r_dx;
- + #if defined(MULTICAST)
- + _pktdevlevel = (regs.r_ax & 0xff);
- + #endif /* MULTICAST */
- switch ( _pktdevclass = (regs.r_cx >> 8)) {
- case PD_ETHER : _pktipofs = 14;
-
- ***************
- *** 158,163 ****
- --- 174,184 ----
- return( 1 );
- }
-
- + #if defined(MULTICAST)
- + /* set recieve mode for IP */
- + _pkt_set_ip_rcv_mode( 4 );
- + #endif /* MULTICAST */
- +
- return( 0 );
- }
- void pkt_release()
- ***************
- *** 269,273 ****
- --- 290,507 ----
- return( eth_addr );
- }
-
- + #if defined(MULTICAST)
- + /*
- + * _pkt_set_rcv_mode - sets the recieve mode of the interface
- + *
- + * int _pkt_set_rcv_mode( int handle, int mode )
- + * Where:
- + * handle is the handle returned by access_type
- + * mode is one of the following modes:
- + * 1 turn off reciever
- + * 2 recieve only packets sent to this interface
- + * 3 mode 2 plus broadcast packets <default>
- + * 4 mode 3 plus limited multicast packets
- + * 5 mode 3 plus all multicast packets
- + * 6 all packets (AKA promiscuous mode )
- + * Returns:
- + * -1 upon error - pkterror is set
- + * 0 if the mode was set successfully
- + */
- +
- + int _pkt_set_rcv_mode( handle, mode )
- + int handle;
- + int mode;
- + {
- + struct REGPACK regs;
- +
- + /* This needs an Extended driver */
- + if ( _pktdevlevel < 2 ){
- + pkterror = BASIC_DVR;
- + return(-1);
- + }
- +
- + regs.r_ax = PD_SET_RCV;
- + regs.r_bx = handle;
- + regs.r_cx = mode;
- + intr( pkt_interrupt, ®s );
- +
- + /* The carry flag indicates an error return */
- + if ( regs.r_flags & CARRY ){
- + pkterror = regs.r_dx >> 8;
- + return( -1 );
- + }
- +
- + return( 0 );
- + }
- +
- +
- + /*
- + * _pkt_get_rcv_mode - gets the recieve mode of the interface
- + *
- + * int _pkt_get_rcv_mode( int handle )
- + * Where:
- + * handle is the handle returned by access_type
- + *
- + * Returns:
- + * -1 upon error - pkterror is set
- + * mode is one of the following modes: (upon return)
- + * 1 turn off reciever
- + * 2 recieve only packets sent to this interface
- + * 3 mode 2 plus broadcast packets <default>
- + * 4 mode 3 plus limited multicast packets
- + * 5 mode 3 plus all multicast packets
- + * 6 all packets (AKA promiscuous mode )
- + */
- +
- + int _pkt_get_rcv_mode( handle )
- + int handle;
- + {
- + struct REGPACK regs;
- +
- + /* This needs an Extended driver */
- + if ( _pktdevlevel < 2 ){
- + pkterror = BASIC_DVR;
- + return( -1 );
- + }
- + regs.r_ax = PD_GET_RCV;
- + regs.r_bx = handle;
- + intr( pkt_interrupt, ®s );
- +
- + /* The carry flag indicates an error return */
- + if ( regs.r_flags & CARRY ){
- + pkterror = regs.r_dx >> 8;
- + return( -1 );
- + }
- +
- + return( regs.r_ax );
- + }
- +
- + /*
- + * _pkt_get_multicast_list - gets the current list of multicast addresses
- + * from the packet driver
- + *
- + * int _pkt_get_multicast_list( byte len, eth_address *listbuf )
- + * Where:
- + * len is the length of listbuf
- + * listbuf is the buffer into which the list is placed
- + * Returns:
- + * -1 upon error - pkterror is set
- + * len if retrieval was successful
- + *
- + */
- +
- + int _pkt_get_multicast_list( len, listbuf )
- + byte len;
- + eth_address *listbuf;
- + {
- + struct REGPACK regs;
- +
- + /* Basic drivers don't support multicast */
- + if ( _pktdevlevel < 2 ) {
- + pkterror = BASIC_DVR;
- + return( -1 );
- + }
- +
- + regs.r_ax = PD_GET_MULTI;
- + intr( pkt_interrupt, ®s );
- +
- + /* The carry flag indicates an error return */
- + if ( regs.r_flags & CARRY ) {
- + pkterror = regs.r_dx >> 8;
- + return( -1 );
- + }
- +
- + /* move it into the caller's buffer and return happily */
- + len = min( len, regs.r_cx );
- + movedata(regs.r_es, regs.r_di, FP_SEG( listbuf ), FP_OFF( listbuf ),
- + len);
- + return(len);
- + }
- +
- + /*
- + * _pkt_set_multicast_list - sets the list of multicast addresses for which
- + * the PD is responsible.
- + *
- + * int _pkt_set_multicast_list( byte len, eth_address *listbuf )
- + * Where:
- + * len is the length of listbuf
- + * listbuf is the buffer containing the list
- + * Returns:
- + * -1 upon error - pkterror is set
- + * 0 if set was successful
- + */
- +
- + _pkt_set_multicast_list( len, listbuf )
- + byte len;
- + eth_address *listbuf;
- + {
- + struct REGPACK regs;
- +
- + /* Basic drivers don't support multicast */
- + if ( _pktdevlevel < 2 ){
- + pkterror = BASIC_DVR;
- + return( -1 );
- + }
- +
- + regs.r_ax = PD_SET_MULTI;
- + regs.r_cx = len;
- + regs.r_es = FP_SEG( listbuf );
- + regs.r_di = FP_OFF( listbuf );
- + intr( pkt_interrupt, ®s );
- +
- + /* The carry flag indicates an error return */
- + if ( regs.r_flags & CARRY ){
- + pkterror = regs.r_dx >> 8;
- + return( -1 );
- + }
- +
- + return( 0 );
- + }
- +
- + /*
- + * _pkt_get_ip_rcv_mode - gets the recieve mode of the interface for
- + * the IP handle
- + *
- + * int _pkt_get_ip_rcv_mode( )
- + * Returns:
- + * -1 if the request failed - pkterror is set
- + * mode is one of the following modes: (upon return)
- + * 1 turn off reciever
- + * 2 recieve only packets sent to this interface
- + * 3 mode 2 plus broadcast packets <default>
- + * 4 mode 3 plus limited multicast packets
- + * 5 mode 3 plus all multicast packets
- + * 6 all packets (AKA promiscuous mode )
- + */
-
- + int _pkt_get_ip_rcv_mode()
- + {
- + return( _pkt_get_rcv_mode(pkt_ip_handle));
- + }
- +
- + /*
- + * _pkt_set_ip_rcv_mode - sets the recieve mode of the interface for
- + * the IP handle
- + *
- + * int _pkt_set_ip_rcv_mode( int mode )
- + * Where:
- + * mode is one of the following modes: (upon return)
- + * 1 turn off reciever
- + * 2 recieve only packets sent to this interface
- + * 3 mode 2 plus broadcast packets <default>
- + * 4 mode 3 plus limited multicast packets
- + * 5 mode 3 plus all multicast packets
- + * 6 all packets (AKA promiscuous mode )
- + * Returns:
- + * -1 if the request failed - pkterror is set
- + * 0 mode set was successful
- + */
- +
- + int _pkt_set_ip_rcv_mode( mode )
- + int mode;
- + {
- + return( _pkt_set_rcv_mode(pkt_ip_handle, mode));
- + }
- + #endif /* MULTICAST */
-
- *** src/pcsed.c Thu Jul 15 11:15:56 1993
- --- src/pcsed.c Tue Nov 09 23:43:48 1993
- ***************
- *** 19,28 ****
- --- 19,35 ----
- #include <wattcp.h>
- #include <ethdev.h>
- #include <mem.h>
- + #if defined(MULTICAST)
- + #include <dos.h>
- + #endif
-
- eth_address _eth_addr; /* local ethernet address */
- eth_address _eth_brdcast; /* Ethernet broadcast address */
- word _pktdevclass = 1; /* Ethernet = 1, SLIP = 6 */
- + #if defined(MULTICAST)
- + byte _pktdevlevel = 1; /* assume basic unless otherwise specified */
- + byte pkterror;
- + #endif /* MULTICAST */
-
- /*
- * Initialize the Ethernet Interface, and this package. Enable input on
- ***************
- *** 117,120 ****
- --- 124,264 ----
- {
- return( p - 8 );
- }
- +
- + #if defined(MULTICAST)
- + /*
- + * _eth_join_mcast_group - joins a multicast group (at the physical layer)
- + *
- + * int _eth_join_mcast_group( int entry )
- + * Where:
- + * entry the entry # in the _ipmulti table
- + * Returns:
- + * 1 if the group was joined successfully
- + * 0 if attempt failed
- + */
- +
- + int _eth_join_mcast_group( entry )
- + int entry;
- + {
- + eth_address list[IPMULTI_SIZE];
- + int mode;
- + int i;
- + byte len;
- + byte nextentry = 0;
- +
- + /* initialize a few things */
- + _ipmulti[entry].active = 0;
- + _ipmulti[entry].replytime = time(NULL);
- + _ipmulti[entry].processes = 1;
- +
- + /* Fill in the hardware address */
- + if( ! multi_to_eth( _ipmulti[entry].ina, _ipmulti[entry].ethaddr ))
- + return( 0 ); /* can't convert it */
- +
- + mode=_pkt_get_ip_rcv_mode();
- + if( mode == -1 ) /* something seems to be broken */
- + return( 0 );
- + else if ( mode == 5 ) { /* we are in all mcast mode, so don't bother */
- + _ipmulti[entry].active = 1;
- + return( 1 );
- + }
- +
- + if( (len = _pkt_get_multicast_list( sizeof list, &list[0] )) == -1)
- + return( 0 );
- +
- + /* check to see if the address is already in the list */
- + for (i = 0; i< (len/sizeof list[0]); i++){
- + if( !memcmp(list[i],_ipmulti[entry].ethaddr,sizeof list[0])){
- + _ipmulti[entry].active = 1;
- + return(1);
- + }
- + }
- +
- + if ( len )
- + nextentry = len / (sizeof list[0]);
- +
- + movedata(FP_SEG(_ipmulti[entry].ethaddr),FP_OFF(_ipmulti[entry].ethaddr),
- + FP_SEG(&list[nextentry]),FP_OFF(&list[nextentry]), 6);
- +
- + len+= sizeof list[0];
- +
- + if( _pkt_set_multicast_list( len, &list[0] ) == -1)
- + if( pkterror == NO_SPACE ){ /* out of space, switch mode */
- + if( _pkt_set_ip_rcv_mode( 5 ) == -1 )
- + return( 0 );
- + } else
- + return( 0 );
- + _ipmulti[entry].active = 1;
- + return( 1 );
- + }
- +
- +
- + /*
- + * _eth_leave_mcast_group - leaves a multicast group (at the physical layer)
- + *
- + * int _eth_leave_mcast_group( int entry )
- + * Where:
- + * entry the entry # in the _ipmulti table
- + * Returns:
- + * 1 if the group was left successfully
- + * 0 if attempt failed
- + */
- +
- + int _eth_leave_mcast_group( entry )
- + int entry;
- + {
- + eth_address list[IPMULTI_SIZE];
- + int mode;
- + int i;
- + int ethindex = -1;
- + byte len;
- +
- +
- + /* NOTE: This should be expanded to include switching back to mode 4
- + if the list of multicast addresses has shrunk sufficiently */
- +
- + /* First check to see if we're in mode 5. if so, mark the entry
- + as inactive and return */
- + mode=_pkt_get_ip_rcv_mode();
- + if( mode == -1 ) /* something seems to be broken */
- + return( 0 );
- + else if ( mode == 5 ) { /* we are in all mcast mode, so don't bother */
- + _ipmulti[entry].active = 0;
- + return( 1 );
- + }
- +
- + /* get the list of current multicast addresses */
- + if( (len = _pkt_get_multicast_list( sizeof list, &list[0] )) == -1)
- + return( 0 );
- +
- + /* find the apropriate entry */
- + for (i = 0; i< (len/(sizeof list[0])); i++)
- + if( !memcmp(list[i],_ipmulti[entry].ethaddr,sizeof list[0]))
- + ethindex = i;
- +
- + /* if it's not in the list, just set the entry inactive and return */
- + if ( ethindex == -1 ){
- + _ipmulti[entry].active = 0;
- + return( 1 );
- + }
- +
- + /* ahh, but it _is_ in the list. So shorten the list and send it
- + back to the PD */
- + if( ethindex+1 < (len/(sizeof list[0]))){
- + movedata(FP_SEG(&list[ethindex+1]),FP_OFF(&list[ethindex+1]),
- + FP_SEG(&list[ethindex]),FP_OFF(&list[ethindex]),
- + len - ((ethindex+1)*(sizeof list[0])));
- + }
- + len -= sizeof list[0];
- +
- + if( _pkt_set_multicast_list( len, &list[0] ) == -1)
- + if( pkterror == NO_SPACE ){ /* out of space, switch mode */
- + if( _pkt_set_ip_rcv_mode( 5 ) == -1 )
- + return( 0 );
- + } else
- + return( 0 );
- + _ipmulti[entry].active = 0;
- + return( 1 );
- + }
- + #endif /* MUTICAST */
-
- *** src/pctcp.c Thu Sep 30 13:47:42 1993
- --- src/pctcp.c Wed Nov 10 01:48:12 1993
- ***************
- *** 293,299 ****
- --- 293,308 ----
- /* check for broadcast */
- if ( (long)(ina) == -1 || !ina )
- memset( s->hisethaddr, 0xff, sizeof( eth_address ));
- + #if defined(MULTICAST)
- + else /* check for multicast */
- + if ( is_multicast( ina )){
- + if ( ! multi_to_eth( ina, &s->hisethaddr[0] ))
- + return( 0 );
- + s->ttl = 1; /* so we don't send worldwide as default */
- + } else if ( ! _arp_resolve(ina, &s->hisethaddr[0], 0) )
- + #else
- else if ( ! _arp_resolve(ina, (eth_address *) &s->hisethaddr[0], 0) )
- + #endif
- return( 0 );
-
- s->hisaddr = ina;
- ***************
- *** 306,312 ****
- --- 315,339 ----
- return( 1 );
- }
-
- + #if defined(MULTICAST)
- /*
- + * Set the TTL on an outgoing UDP datagram.
- + * udp_SetTTL(udp_Socket *s, byte ttl)
- + * where:
- + * s the socket of the UDP connection (?!?) in question
- + * ttl the desired ttl for the outgoing datagrams
- + */
- +
- + int udp_SetTTL( s, ttl )
- + udp_Socket *s;
- + byte ttl;
- + {
- + s->ttl = ttl;
- + return( 1 );
- + }
- + #endif /* MULTICAST */
- +
- + /*
- * Actively open a TCP connection to a particular destination.
- * - 0 on error
- */
- ***************
- *** 595,600 ****
- --- 622,630 ----
- static longword timeout = 0;
- static longword start = 0;
-
- + #if defined(MULTICAST)
- + int i;
- + #endif /* MULTICAST */
- int x;
- int packettype;
-
- ***************
- *** 631,636 ****
- --- 661,671 ----
- case ICMP_PROTO :
- icmp_handler(ip);
- break;
- + #if defined(MULTICAST)
- + case IGMP_PROTO :
- + igmp_handler(ip);
- + break;
- + #endif
- }
- } else {
- if (debug_on)
- ***************
- *** 649,654 ****
- --- 684,702 ----
- /* check for our outstanding packets */
- tcp_Retransmitter();
-
- + #if defined(MULTICAST)
- + /* check to see if we owe any IGMP Reports */
- + for(i=0; i < IPMULTI_SIZE ; i++){
- + if( _ipmulti[i].active &&
- + ( _ipmulti[i].ina != ALL_SYSTEMS ) &&
- + ( _ipmulti[i].replytime ) &&
- + ( _ipmulti[i].replytime <= time(NULL) )){
- + igmp_report(_ipmulti[i].ina);
- + _ipmulti[i].replytime = 0;
- + }
- + }
- + #endif /* MULTICAST */
- +
- return( s->udp.ip_type );
- }
-
- ***************
- *** 700,706 ****
- --- 748,758 ----
- /* inp->vht = 0x4500;*/ /* version 4, hdrlen 5, tos 0 */
- inp->identification = intel16( ++ip_id ); /* was post inc */
- // inp->frag = 0;
- + #if defined(MULTICAST)
- + inp->ttl = s->ttl ? s->ttl : 254 ; /* if set, us it. Otherwise 254 */
- + #else
- inp->ttl = 254;
- + #endif
- inp->proto = UDP_PROTO; /* udp */
- /* inp->ttlProtocol = (250<<8) + 6; */
- inp->checksum = 0;
- ***************
- *** 912,922 ****
-
- temp = intel( ip->destination );
-
- if ( ((~temp & ~sin_mask) != 0) && /* not a broadcast packet*/
- ((( temp - my_ip_addr) > multihomes ) /* not my address */
- && my_ip_addr)) /* and I know my address */
- return;
- !
-
- len = in_GetHdrlenBytes(ip);
- up = (udp_Header *)((byte *)ip + len); /* udp segment pointer */
- --- 964,980 ----
-
- temp = intel( ip->destination );
-
- + #if defined(MULTICAST)
- + /* This is the only really gross hack in the multicasting stuff.
- + * I'll fix it as soon as I can figure out what I want to do here.
- + * -JRM 8/1/93
- + */
- + #else
- if ( ((~temp & ~sin_mask) != 0) && /* not a broadcast packet*/
- ((( temp - my_ip_addr) > multihomes ) /* not my address */
- && my_ip_addr)) /* and I know my address */
- return;
- ! #endif /* MULTICAST */
-
- len = in_GetHdrlenBytes(ip);
- up = (udp_Header *)((byte *)ip + len); /* udp segment pointer */
- ***************
- *** 949,954 ****
- --- 1007,1027 ----
- break;
- }
- }
- +
- + #if defined(MULTICAST)
- + if ( !s ) {
- + /* demux to multicast sockets */
- + for ( s = udp_allsocs; s; s = s->next ){
- + if ( s->hisport != 0 &&
- + s->hisaddr == intel( ip->destination ) &&
- + intel16( up->dstPort ) == s->myport &&
- + is_multicast( intel( ip->destination ))){
- + break;
- + }
- + }
- + }
- + #endif /* MULTICAST */
- +
- if ( !s ) {
- /* demux to broadcast sockets */
- for ( s = udp_allsocs; s; s = s->next )
- *** src/sock_ini.c Thu Oct 22 17:26:16 1992
- --- src/sock_ini.c Tue Nov 09 23:43:48 1993
- ***************
- *** 37,40 ****
- --- 37,47 ----
- if ( !_survivebootp )
- exit( 3 );
- }
- + #if defined(MULTICAST)
- + /* to initialize the random number generator */
- + randomize();
- +
- + /* all multicast level 2 systems must join at startup */
- + join_mcast_group(ALL_SYSTEMS);
- + #endif /* MULTICAST */
- }
-