xref: /minix3/sys/lib/libsa/iodesc.h (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc /*	$NetBSD: iodesc.h,v 1.10 2014/03/29 14:30:16 jakllsch Exp $	*/
258a2b000SEvgeniy Ivanov 
358a2b000SEvgeniy Ivanov /*
458a2b000SEvgeniy Ivanov  * Copyright (c) 1993 Adam Glass
558a2b000SEvgeniy Ivanov  * Copyright (c) 1992 Regents of the University of California.
658a2b000SEvgeniy Ivanov  * All rights reserved.
758a2b000SEvgeniy Ivanov  *
858a2b000SEvgeniy Ivanov  * This software was developed by the Computer Systems Engineering group
958a2b000SEvgeniy Ivanov  * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
1058a2b000SEvgeniy Ivanov  * contributed to Berkeley.
1158a2b000SEvgeniy Ivanov  *
1258a2b000SEvgeniy Ivanov  * Redistribution and use in source and binary forms, with or without
1358a2b000SEvgeniy Ivanov  * modification, are permitted provided that the following conditions
1458a2b000SEvgeniy Ivanov  * are met:
1558a2b000SEvgeniy Ivanov  * 1. Redistributions of source code must retain the above copyright
1658a2b000SEvgeniy Ivanov  *    notice, this list of conditions and the following disclaimer.
1758a2b000SEvgeniy Ivanov  * 2. Redistributions in binary form must reproduce the above copyright
1858a2b000SEvgeniy Ivanov  *    notice, this list of conditions and the following disclaimer in the
1958a2b000SEvgeniy Ivanov  *    documentation and/or other materials provided with the distribution.
2058a2b000SEvgeniy Ivanov  * 3. All advertising materials mentioning features or use of this software
2158a2b000SEvgeniy Ivanov  *    must display the following acknowledgement:
2258a2b000SEvgeniy Ivanov  *	This product includes software developed by the University of
2358a2b000SEvgeniy Ivanov  *	California, Lawrence Berkeley Laboratory and its contributors.
2458a2b000SEvgeniy Ivanov  * 4. Neither the name of the University nor the names of its contributors
2558a2b000SEvgeniy Ivanov  *    may be used to endorse or promote products derived from this software
2658a2b000SEvgeniy Ivanov  *    without specific prior written permission.
2758a2b000SEvgeniy Ivanov  *
2858a2b000SEvgeniy Ivanov  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2958a2b000SEvgeniy Ivanov  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
3058a2b000SEvgeniy Ivanov  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
3158a2b000SEvgeniy Ivanov  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
3258a2b000SEvgeniy Ivanov  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
3358a2b000SEvgeniy Ivanov  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
3458a2b000SEvgeniy Ivanov  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
3558a2b000SEvgeniy Ivanov  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3658a2b000SEvgeniy Ivanov  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3758a2b000SEvgeniy Ivanov  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3858a2b000SEvgeniy Ivanov  * SUCH DAMAGE.
3958a2b000SEvgeniy Ivanov  */
4058a2b000SEvgeniy Ivanov 
4158a2b000SEvgeniy Ivanov #ifndef __SYS_LIBNETBOOT_IODESC_H
4258a2b000SEvgeniy Ivanov #define __SYS_LIBNETBOOT_IODESC_H
4358a2b000SEvgeniy Ivanov 
44*0a6a1f1dSLionel Sambuc #include <net/if_ether.h>		/* for ETHER_ADDR_LEN */
45*0a6a1f1dSLionel Sambuc 
4658a2b000SEvgeniy Ivanov #ifdef _STANDALONE
4758a2b000SEvgeniy Ivanov /*
4858a2b000SEvgeniy Ivanov  * libsa code uses the following types to avoid 64 bit time_t:
4958a2b000SEvgeniy Ivanov  *
5058a2b000SEvgeniy Ivanov  * satime_t:
5158a2b000SEvgeniy Ivanov  *	numbers in seconds returned by the machine dependent getsecs() function
5258a2b000SEvgeniy Ivanov  *	which are used to measure relative time
5358a2b000SEvgeniy Ivanov  *
5458a2b000SEvgeniy Ivanov  * saseconds_t:
5558a2b000SEvgeniy Ivanov  *	numbers in seconds used to specify timeout to network drivers
5658a2b000SEvgeniy Ivanov  *
5758a2b000SEvgeniy Ivanov  */
5858a2b000SEvgeniy Ivanov typedef unsigned int	satime_t;
5958a2b000SEvgeniy Ivanov typedef int		saseconds_t;
6058a2b000SEvgeniy Ivanov #else
6158a2b000SEvgeniy Ivanov typedef time_t		satime_t;
6258a2b000SEvgeniy Ivanov typedef time_t		saseconds_t;
6358a2b000SEvgeniy Ivanov #endif
6458a2b000SEvgeniy Ivanov 
6558a2b000SEvgeniy Ivanov struct iodesc {
6658a2b000SEvgeniy Ivanov 	struct	in_addr destip;		/* dest. ip addr, net order */
6758a2b000SEvgeniy Ivanov 	struct	in_addr myip;		/* local ip addr, net order */
6858a2b000SEvgeniy Ivanov 	u_short	destport;		/* dest. port, net order */
6958a2b000SEvgeniy Ivanov 	u_short	myport;			/* local port, net order */
7058a2b000SEvgeniy Ivanov 	u_long	xid;			/* transaction identification */
71*0a6a1f1dSLionel Sambuc 	u_char	myea[ETHER_ADDR_LEN];	/* my ethernet address */
7258a2b000SEvgeniy Ivanov 	void	*io_netif;
7358a2b000SEvgeniy Ivanov };
7458a2b000SEvgeniy Ivanov 
7558a2b000SEvgeniy Ivanov struct iodesc	*socktodesc(int);
7658a2b000SEvgeniy Ivanov ssize_t		netif_get(struct iodesc *, void *, size_t, saseconds_t);
7758a2b000SEvgeniy Ivanov ssize_t		netif_put(struct iodesc *, void *, size_t);
7858a2b000SEvgeniy Ivanov 
7958a2b000SEvgeniy Ivanov #endif /* __SYS_LIBNETBOOT_IODESC_H */
80