/*
- * $Id: atp_packet.c,v 1.3 2001-06-29 14:14:46 rufustfirefly Exp $
+ * $Id: atp_packet.c,v 1.6 2009-10-13 22:55:37 didg Exp $
*
* Copyright (c) 1990,1991 Regents of The University of Michigan.
* All Rights Reserved.
#ifdef EBUG
#include <stdio.h>
-static void print_func( ctrlinfo )
- u_int8_t ctrlinfo;
+static void print_func(u_int8_t ctrlinfo)
{
switch ( ctrlinfo & ATP_FUNCMASK ) {
case ATP_TREQ:
}
}
-static void dump_packet( buf, len )
- char *buf;
- int len;
+static void dump_packet(char *buf, int len)
{
int i;
putchar( '\n' );
}
-void atp_print_addr( s, saddr )
- char *s;
- struct sockaddr_at *saddr;
+void atp_print_addr(char *s, struct sockaddr_at *saddr)
{
printf( "%s ", s );
saddr->sat_family == AF_APPLETALK ? printf( "at." ) :
#endif /* EBUG */
-void atp_build_req_packet( pktbuf, tid, ctrl, atpb )
- struct atpbuf *pktbuf;
- u_int16_t tid;
- u_int8_t ctrl;
- struct atp_block *atpb;
+void atp_build_req_packet( struct atpbuf *pktbuf,
+ u_int16_t tid,
+ u_int8_t ctrl,
+ struct atp_block *atpb )
{
struct atphdr hdr;
/* set length
*/
- pktbuf->atpbuf_dlen = ATP_HDRSIZE + atpb->atp_sreqdlen;
+ pktbuf->atpbuf_dlen = ATP_HDRSIZE + (size_t) atpb->atp_sreqdlen;
}
-void atp_build_resp_packet( pktbuf, tid, ctrl, atpb, seqnum )
- struct atpbuf *pktbuf;
- u_int16_t tid;
- u_int8_t ctrl;
- struct atp_block *atpb;
- u_int8_t seqnum;
+void atp_build_resp_packet( struct atpbuf *pktbuf,
+ u_int16_t tid,
+ u_int8_t ctrl,
+ struct atp_block *atpb,
+ u_int8_t seqnum )
{
struct atphdr hdr;
/* set length
*/
- pktbuf->atpbuf_dlen = ATP_HDRSIZE + atpb->atp_sresiov[ seqnum ].iov_len;
+ pktbuf->atpbuf_dlen = ATP_HDRSIZE + (size_t) atpb->atp_sresiov[ seqnum ].iov_len;
}
int
-atp_recv_atp( ah, fromaddr, func, tid, rbuf, wait )
- ATP ah;
- struct sockaddr_at *fromaddr;
- u_int8_t *func;
- u_int16_t tid;
- char *rbuf;
- int wait;
+atp_recv_atp( ATP ah,
+ struct sockaddr_at *fromaddr,
+ u_int8_t *func,
+ u_int16_t tid,
+ char *rbuf,
+ int wait )
{
/*
Receive a packet from address fromaddr of the correct function type
if ( cq != NULL ) {
/* we found one in the queue -- copy to rbuf
*/
- dlen = cq->atpbuf_dlen;
+ dlen = (int) cq->atpbuf_dlen;
*func = rfunc;
memcpy( fromaddr, &cq->atpbuf_addr, sizeof( struct sockaddr_at ));
memcpy( rbuf, cq->atpbuf_info.atpbuf_data, cq->atpbuf_dlen );
memcpy( &inbuf->atpbuf_addr, &faddr,
sizeof( struct sockaddr_at ));
inbuf->atpbuf_next = ah->atph_queue;
- inbuf->atpbuf_dlen = recvlen;
+ inbuf->atpbuf_dlen = (size_t) recvlen;
memcpy( inbuf->atpbuf_info.atpbuf_data, rbuf, recvlen );
}
}
}
-int at_addr_eq( paddr, saddr )
- struct sockaddr_at *paddr; /* primary address */
- struct sockaddr_at *saddr; /* secondary address */
+int at_addr_eq(
+ struct sockaddr_at *paddr, /* primary address */
+ struct sockaddr_at *saddr) /* secondary address */
{
/* compare two atalk addresses -- only check the non-zero fields
of paddr against saddr.