ca76526b11
if it exists.
257 lines
6.4 KiB
Plaintext
257 lines
6.4 KiB
Plaintext
--- etc/atalkd/rtmp.c.orig Sun Aug 17 09:21:45 1997
|
|
+++ etc/atalkd/rtmp.c Tue Nov 30 18:13:48 1999
|
|
@@ -3,6 +3,7 @@
|
|
* All Rights Reserved. See COPYRIGHT.
|
|
*/
|
|
|
|
+#include <string.h>
|
|
#include <sys/syslog.h>
|
|
#include <sys/types.h>
|
|
#include <sys/socket.h>
|
|
@@ -27,6 +28,9 @@
|
|
#include "list.h"
|
|
#include "atserv.h"
|
|
|
|
+extern int setaddr(), bootaddr();
|
|
+
|
|
+void
|
|
rtmp_packet( ap, from, data, len )
|
|
struct atport *ap;
|
|
struct sockaddr_at *from;
|
|
@@ -38,9 +42,7 @@
|
|
struct gate *gate;
|
|
struct interface *iface;
|
|
struct rtmptab *rtmp;
|
|
- u_short tonet;
|
|
char *end, packet[ 587 ];
|
|
- extern int debug;
|
|
|
|
end = data + len;
|
|
|
|
@@ -66,7 +68,7 @@
|
|
syslog( LOG_INFO, "rtmp_packet no data header" );
|
|
return;
|
|
}
|
|
- bcopy( data, &rh, sizeof( struct rtmprdhdr ));
|
|
+ memcpy( &rh, data, sizeof( struct rtmprdhdr ));
|
|
data += sizeof( struct rtmprdhdr );
|
|
|
|
/* check rh address against from address */
|
|
@@ -110,7 +112,7 @@
|
|
syslog( LOG_INFO, "rtmp_packet missing first tuple" );
|
|
return;
|
|
}
|
|
- bcopy( data, &rt, SZ_RTMPTUPLE );
|
|
+ memcpy( &rt, data, SZ_RTMPTUPLE );
|
|
data += SZ_RTMPTUPLE;
|
|
|
|
if ( rt.rt_net == 0 ) {
|
|
@@ -128,14 +130,14 @@
|
|
syslog( LOG_INFO, "rtmp_packet missing second tuple" );
|
|
return;
|
|
}
|
|
- bcopy( data, &rt, SZ_RTMPTUPLE );
|
|
+ memcpy( &rt, data, SZ_RTMPTUPLE );
|
|
data += SZ_RTMPTUPLE;
|
|
} else if ( rt.rt_dist & 0x80 ) {
|
|
if ( data + SZ_RTMPTUPLE > end ) {
|
|
syslog( LOG_INFO, "rtmp_packet missing first range-end" );
|
|
return;
|
|
}
|
|
- bcopy( data, &xrt, SZ_RTMPTUPLE );
|
|
+ memcpy( &xrt, data, SZ_RTMPTUPLE );
|
|
data += SZ_RTMPTUPLE;
|
|
|
|
if ( xrt.rt_dist != 0x82 ) {
|
|
@@ -345,14 +347,14 @@
|
|
if ( data + SZ_RTMPTUPLE > end ) {
|
|
break;
|
|
}
|
|
- bcopy( data, &rt, SZ_RTMPTUPLE );
|
|
+ memcpy( &rt, data, SZ_RTMPTUPLE );
|
|
data += SZ_RTMPTUPLE;
|
|
if ( rt.rt_dist & 0x80 ) {
|
|
if ( data + SZ_RTMPTUPLE > end ) {
|
|
syslog( LOG_INFO, "rtmp_packet missing range-end" );
|
|
return;
|
|
}
|
|
- bcopy( data, &xrt, SZ_RTMPTUPLE );
|
|
+ memcpy( &xrt, data, SZ_RTMPTUPLE );
|
|
data += SZ_RTMPTUPLE;
|
|
}
|
|
}
|
|
@@ -379,18 +381,18 @@
|
|
rh.rh_net = iface->i_addr.sat_addr.s_net;
|
|
rh.rh_nodelen = 8;
|
|
rh.rh_node = iface->i_addr.sat_addr.s_node;
|
|
- bcopy( &rh, data, sizeof( struct rtmp_head ));
|
|
+ memcpy( data, &rh, sizeof( struct rtmp_head ));
|
|
data += sizeof( struct rtmp_head );
|
|
|
|
if ( iface->i_flags & IFACE_PHASE2 ) {
|
|
rt.rt_net = iface->i_rt->rt_firstnet;
|
|
rt.rt_dist = 0x80;
|
|
- bcopy( &rt, data, SZ_RTMPTUPLE );
|
|
+ memcpy( data, &rt, SZ_RTMPTUPLE );
|
|
data += SZ_RTMPTUPLE;
|
|
|
|
rt.rt_net = iface->i_rt->rt_lastnet;
|
|
rt.rt_dist = 0x82;
|
|
- bcopy( &rt, data, SZ_RTMPTUPLE );
|
|
+ memcpy( data, &rt, SZ_RTMPTUPLE );
|
|
data += SZ_RTMPTUPLE;
|
|
}
|
|
if ( sendto( ap->ap_fd, packet, data - packet, 0,
|
|
@@ -417,18 +419,18 @@
|
|
}
|
|
}
|
|
|
|
+void
|
|
rtmp_request( iface )
|
|
struct interface *iface;
|
|
{
|
|
struct sockaddr_at sat;
|
|
struct atport *ap;
|
|
char *data, packet[ 2 ];
|
|
- int i;
|
|
|
|
syslog( LOG_INFO, "rtmp_request for %s", iface->i_name );
|
|
|
|
for ( ap = iface->i_ports; ap; ap = ap->ap_next ) {
|
|
- if ( ap->ap_packet == rtmp_packet ) {
|
|
+ if ( (void *) ap->ap_packet == (void *) rtmp_packet ) {
|
|
break;
|
|
}
|
|
}
|
|
@@ -444,7 +446,7 @@
|
|
/*
|
|
* There is a problem with the net zero "hint" hack.
|
|
*/
|
|
- bzero( &sat, sizeof( struct sockaddr_at ));
|
|
+ memset( &sat, 0, sizeof( struct sockaddr_at ));
|
|
#ifdef BSD4_4
|
|
sat.sat_len = sizeof( struct sockaddr_at );
|
|
#endif BSD4_4
|
|
@@ -463,6 +465,7 @@
|
|
/*
|
|
* Complete configuration for phase 1 interface using RTMP information.
|
|
*/
|
|
+void
|
|
rtmp_config( rh, iface )
|
|
struct rtmp_head *rh;
|
|
struct interface *iface;
|
|
@@ -517,6 +520,7 @@
|
|
}
|
|
}
|
|
|
|
+int
|
|
looproute( iface, cmd )
|
|
struct interface *iface;
|
|
int cmd;
|
|
@@ -533,14 +537,14 @@
|
|
abort();
|
|
}
|
|
|
|
- bzero( &dst, sizeof( struct sockaddr_at ));
|
|
+ memset( &dst, 0, sizeof( struct sockaddr_at ));
|
|
#ifdef BSD4_4
|
|
dst.sat_len = sizeof( struct sockaddr_at );
|
|
#endif BSD4_4
|
|
dst.sat_family = AF_APPLETALK;
|
|
dst.sat_addr.s_net = iface->i_addr.sat_addr.s_net;
|
|
dst.sat_addr.s_node = iface->i_addr.sat_addr.s_node;
|
|
- bzero( &loop, sizeof( struct sockaddr_at ));
|
|
+ memset( &loop, 0, sizeof( struct sockaddr_at ));
|
|
#ifdef BSD4_4
|
|
loop.sat_len = sizeof( struct sockaddr_at );
|
|
#endif BSD4_4
|
|
@@ -560,12 +564,13 @@
|
|
return( 0 );
|
|
}
|
|
|
|
+int
|
|
gateroute( command, rtmp )
|
|
int command;
|
|
struct rtmptab *rtmp;
|
|
{
|
|
struct sockaddr_at dst, gate;
|
|
- unsigned short net;
|
|
+ u_int16_t net;
|
|
|
|
if ( command == RTMP_DEL && ( rtmp->rt_flags & RTMPTAB_ROUTE ) == 0 ) {
|
|
return( -1 );
|
|
@@ -581,7 +586,7 @@
|
|
* the kernel. Otherwise, we'll get a bunch of routes to the loop
|
|
* back interface, and who wants that?
|
|
*/
|
|
- bzero( &gate, sizeof( struct sockaddr_at ));
|
|
+ memset( &gate, 0, sizeof( struct sockaddr_at ));
|
|
#ifdef BSD4_4
|
|
gate.sat_len = sizeof( struct sockaddr_at );
|
|
#endif BSD4_4
|
|
@@ -592,7 +597,7 @@
|
|
gate.sat_addr.s_net = net;
|
|
}
|
|
|
|
- bzero( &dst, sizeof( struct sockaddr_at ));
|
|
+ memset( &dst, 0, sizeof( struct sockaddr_at ));
|
|
#ifdef BSD4_4
|
|
dst.sat_len = sizeof( struct sockaddr_at );
|
|
#endif BSD4_4
|
|
@@ -618,6 +623,7 @@
|
|
return( 0 );
|
|
}
|
|
|
|
+void
|
|
rtmp_new( rtmp )
|
|
struct rtmptab *rtmp;
|
|
{
|
|
@@ -679,6 +685,7 @@
|
|
* Find a replacement for "replace". If we can't find a replacement,
|
|
* return 1. If we do find a replacement, return 0.
|
|
*/
|
|
+int
|
|
rtmp_replace( replace )
|
|
struct rtmptab *replace;
|
|
{
|
|
@@ -720,6 +727,7 @@
|
|
* Remove rtmp from the in-use table and the per-gate table.
|
|
* Free any associated space.
|
|
*/
|
|
+void
|
|
rtmp_free( rtmp )
|
|
struct rtmptab *rtmp;
|
|
{
|
|
@@ -755,6 +763,7 @@
|
|
* Delete rtmp from the per-interface in-use table, remove all
|
|
* zone references, and remove the route from the kernel.
|
|
*/
|
|
+void
|
|
rtmp_delinuse( rtmp )
|
|
struct rtmptab *rtmp;
|
|
{
|
|
@@ -835,6 +844,7 @@
|
|
/*
|
|
* Add rtmp to the per-interface in-use table. No verification is done...
|
|
*/
|
|
+void
|
|
rtmp_addinuse( rtmp )
|
|
struct rtmptab *rtmp;
|
|
{
|
|
@@ -863,6 +873,7 @@
|
|
* at this point? What do we do if we get several copies of a route in
|
|
* an RTMP packet?
|
|
*/
|
|
+void
|
|
rtmp_copyzones( to, from )
|
|
struct rtmptab *to, *from;
|
|
{
|
|
@@ -899,6 +910,6 @@
|
|
return( 0 );
|
|
}
|
|
|
|
- bzero( rtmp, sizeof( struct rtmptab ));
|
|
+ memset( rtmp, 0, sizeof( struct rtmptab ));
|
|
return( rtmp );
|
|
}
|