return( argv );
}
-writeconf( cf )
+int writeconf( cf )
char *cf;
{
struct stat st;
if (( p = strrchr( path, '/' )) == NULL ) {
strcpy( newpath, _PATH_ATALKDTMP );
} else {
- sprintf( newpath, "%.*s/%s", p - path, path, _PATH_ATALKDTMP );
+ sprintf( newpath, "%.*s/%s", (int)(p - path), path, _PATH_ATALKDTMP );
}
if (( fd = open( newpath, O_WRONLY|O_CREAT|O_TRUNC, mode )) < 0 ) {
syslog( LOG_ERR, "%s: %m", newpath );
* zone for an interface is the first zone encountered for that
* interface.
*/
-readconf( cf )
+int readconf( cf )
char *cf;
{
struct ifreq ifr;
}
/*ARGSUSED*/
-router( iface, av )
+int router( iface, av )
struct interface *iface;
char **av;
{
}
/*ARGSUSED*/
-dontroute( iface, av )
+int dontroute( iface, av )
struct interface *iface;
char **av;
{
}
/*ARGSUSED*/
-seed( iface, av )
+int seed( iface, av )
struct interface *iface;
char **av;
{
return( 1 );
}
-phase( iface, av )
+int phase( iface, av )
struct interface *iface;
char **av;
{
return( 2 );
}
-net( iface, av )
+int net( iface, av )
struct interface *iface;
char **av;
{
}
net = atoi( nrange );
if ( net < 0 || net >= 0xffff ) {
- fprintf( stderr, "Bad network: %d\n" );
+ fprintf( stderr, "Bad network: %d\n", net );
return -1;
}
if ( stop != 0 ) {
net = atoi( stop );
if ( net < 0 || net >= 0xffff ) {
- fprintf( stderr, "Bad network: %d\n" );
+ fprintf( stderr, "Bad network: %d\n", net );
return -1;
}
}
return( 2 );
}
-addr( iface, av )
+int addr( iface, av )
struct interface *iface;
char **av;
{
return( 2 );
}
-zone( iface, av )
+int zone( iface, av )
struct interface *iface;
char **av;
{
* Get the configuration from the kernel. Only called if there's no
* configuration.
*/
-getifconf()
+int getifconf()
{
struct interface *iface, *niface;
struct ifreq ifr;
* Allocate a new interface structure. Centralized here so we can change
* the interface structure and have it updated nicely.
*/
- struct interface *
-newiface( name )
+
+struct interface *newiface( name )
const char *name;
{
struct interface *niface;
}
#ifdef __svr4__
- int
-plumb()
+int plumb()
{
struct interface *iface;
char device[ MAXPATHLEN + 1], *p;
#include "rtmp.h"
#include "zip.h"
#include "atserv.h"
+#include "main.h"
/* FIXME/SOCKLEN_T: socklen_t is a unix98 feature */
#ifndef SOCKLEN_T
static char *pidfile = _PATH_ATALKDLOCK;
+/* from config.c */
+
+int readconf( char * );
+int getifconf( void );
+int writeconf( char * );
+
/* this is the messiest of the bunch as atalkd can exit pretty much
* everywhere. we delete interfaces here instead of in as_down. */
static void atalkd_exit(const int i)
atalkd_exit( 0 );
}
-main( ac, av )
+int main( ac, av )
int ac;
char **av;
{
* and rtmp_packet()) to set the initial "bootstrapping" address
* on an interface.
*/
-bootaddr( iface )
+void bootaddr( iface )
struct interface *iface;
{
if ( iface == 0 ) {
* Change setaddr()
* to manage the i_ports field and the fds for select().
*/
-setaddr( iface, phase, net, node, first, last )
+void setaddr( iface, phase, net, node, first, last )
struct interface *iface;
u_int8_t phase;
u_int16_t net;
nfds++;
}
-ifconfig( iname, cmd, sa )
+int ifconfig( iname, cmd, sa )
char *iname;
unsigned long cmd;
struct sockaddr_at *sa;
return( 0 );
}
-dumpconfig( iface )
+void dumpconfig( iface )
struct interface *iface;
{
struct list *l;
}
#ifdef DEBUG
-dumproutes()
+void dumproutes()
{
struct interface *iface;
struct rtmptab *rtmp;
fflush( stdout );
}
-dumpzones()
+void dumpzones()
{
struct interface *iface;
struct rtmptab *rtmp;
--- /dev/null
+#ifndef ATALKD_MAIN_H
+#define ATALKD_MAIN_H
+
+#include <sys/cdefs.h>
+
+int ifconfig __P(( char *, unsigned long, struct sockaddr_at * ));
+void setaddr __P(( struct interface *, u_int8_t, u_int16_t,
+ u_int8_t, u_int16_t, u_int16_t ));
+void bootaddr __P(( struct interface * ));
+void dumpconfig __P(( struct interface * ));
+
+#endif /* ATALKD_MAIN_H */
#include <atalk/util.h>
#include <netatalk/endian.h>
+#include "rtmp.h"
#include "zip.h"
+#include "main.h"
+
static const unsigned char ethermulti[ 6 ] = {
0x09, 0x00, 0x07, 0xff, 0xff, 0xff,
#include "config.h"
#endif
+#include <string.h>
#include <sys/param.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <net/route.h>
+#include <sys/ioctl.h>
#include <netatalk/at.h>
#include "rtmp.h"
+#include "route.h"
#ifndef BSD4_4
-route( message, dst, gate, flags )
+int route( message, dst, gate, flags )
int message;
struct sockaddr *dst, *gate;
int flags;
struct rtentry rtent;
#endif
- bzero( &rtent, sizeof( struct rtentry ));
+ memset( &rtent, 0, sizeof( struct rtentry ));
rtent.rt_dst = *dst;
rtent.rt_gateway = *gate;
rtent.rt_flags = flags;
{
int rc;
- bzero( &rtma, sizeof( struct rt_msg_at ));
+ memset( &rtma, 0, sizeof( struct rt_msg_at ));
rtma.rtma_rtm.rtm_msglen = sizeof( struct rt_msg_at );
rtma.rtma_rtm.rtm_version = RTM_VERSION;
rtma.rtma_rtm.rtm_type = message;
--- /dev/null
+#ifndef ATALKD_ROUTE_H
+#define ATALKD_ROUTE_H 1
+
+#include <sys/cdefs.h>
+
+int route __P(( int, struct sockaddr *, struct sockaddr *, int ));
+
+#endif /* ATALKD_ROUTE_H */
#endif
#include <stdlib.h>
+#include <string.h>
#include <sys/syslog.h>
#include <sys/types.h>
#include <sys/param.h>
#include "zip.h"
#include "list.h"
#include "atserv.h"
-
+#include "route.h"
+#include "main.h"
void rtmp_delzonemap(rtmp)
struct rtmptab *rtmp;
syslog( LOG_INFO, "rtmp_packet no data header" );
return 1;
}
- bcopy( data, &rh, sizeof( struct rtmprdhdr ));
+ memcpy( &rh, data, sizeof( struct rtmprdhdr ));
data += sizeof( struct rtmprdhdr );
/* check rh address against from address */
syslog( LOG_INFO, "rtmp_packet missing first tuple" );
return 1;
}
- bcopy( data, &rt, SZ_RTMPTUPLE );
+ memcpy( &rt, data, SZ_RTMPTUPLE );
data += SZ_RTMPTUPLE;
if ( rt.rt_net == 0 ) {
syslog( LOG_INFO, "rtmp_packet missing second tuple" );
return 1;
}
- 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 1;
}
- bcopy( data, &xrt, SZ_RTMPTUPLE );
+ memcpy( &xrt, data, SZ_RTMPTUPLE );
data += SZ_RTMPTUPLE;
if ( xrt.rt_dist != 0x82 ) {
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 1;
}
- bcopy( data, &xrt, SZ_RTMPTUPLE );
+ memcpy( &xrt, data, SZ_RTMPTUPLE );
data += SZ_RTMPTUPLE;
}
}
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,
/*
* 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
return -1;
}
- 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
* 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
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
struct rtmptab *newrt __P((const struct interface *));
void rtmp_delzonemap __P((struct rtmptab *));
+int rtmp_request __P(( struct interface * ));
+void rtmp_free __P(( struct rtmptab * ));
+int rtmp_replace __P(( struct rtmptab * ));
+int looproute __P(( struct interface *, int ));
+int gateroute __P(( int, struct rtmptab * ));
+
#endif /* atalkd/rtmp.h */
#include "rtmp.h"
#include "list.h"
#include "multicast.h"
+#include "main.h"
struct ziptab *ziptab = NULL, *ziplast = NULL;
+
static int zonecheck( rtmp, iface )
struct rtmptab *rtmp;
struct interface *iface;
syslog( LOG_ERR, "addzone corrupted zone/route mapping" );
return -1;
}
+ return 0;
}
extern struct ziptab *ziptab, *ziplast;
struct ziptab *newzt __P((const int, const char *));
+int addzone __P(( struct rtmptab *, int, char * ));
+int zip_getnetinfo __P(( struct interface * ));
+
#endif /* atalkd/zip.h */