/* vim: set filetype=c:
 *
 **************************************************************************
 *
 * Boot-ROM-Code to load an operating system across a TCP/IP network.
 *
 * Module:  net.h86
 * Purpose: Definitions for the bootrom kernel network interface
 * Entries: none
 *
 **************************************************************************
 *
 * Copyright (C) 1995-2007 Gero Kuhlmann <gero@gkminix.han.de>
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 * $Id: net.h86,v 1.6 2007/01/06 18:30:47 gkminix Exp $
 */

#ifndef HEADERS_NET_H86
#define HEADERS_NET_H86


/*
 **************************************************************************
 *
 * This file can only get included into target C source files.
 */
#if defined(_ASSEMBLY_) || !defined(_TARGET_) || !defined(_BOOTROM_)
# error This file can only get included into target C source files
#endif



/*
 **************************************************************************
 *
 * We need some system include files here
 */
#include <common.h86>
#include <net/ethernet.h86>
#include <net/in.h86>



/*
 **************************************************************************
 *
 * Public variables of the network interface library:
 */
extern __u8 myhwaddr[ETH_ALEN];
extern unsigned short mymtu;
extern unsigned short mytype;
extern t_ipaddr myipaddr;
extern t_ipaddr mynetmask;
extern t_ipaddr mygateway;
extern bool_t udpoflag;



/*
 **************************************************************************
 *
 * Public routines of the network interface library:
 */

/* Startup the network code */
extern short net_start(void *biosparams);

/* Shutdown the network code */
extern short net_stop(void);

/* Terminate the network code */
extern short net_cleanup(void);

/* Open a UDP socket */
extern short udp_open(t_ipaddr daddr, t_ipaddr gw, short source, short dest);

/* Close a UDP socket */
extern short udp_close(void);

/* Read from a UDP socket */
extern short udp_read(__fptr buf, size_t *bufsize, unsigned short timeout,
					char abortch, bool_t dospin);

/* Write to a UDP socket */
extern short udp_write(__fptr buf, size_t len);


/* Set a multicast address for UDP receiving */
extern short udp_set_mcast(t_ipaddr maddr, short port);


#endif

