Subversion Repositories SvarDOS

Compare Revisions

No changes between revisions

Ignore whitespace Rev 615 → Rev 616

/pkgnet/trunk/Makefile
0,0 → 1,46
#
# Makefile for DOS 16-bit (OpenWatcom 1.9)
#
 
CFLAGS = -j -ml -0 -bt=dos -wx -we -d0 -ox -dNOLFN -i=watt32\inc
LIB = watt32\lib\wattcpwl.lib
 
all: pkgnet.exe
 
release: pkgnet.exe .symbolic
mkdir bin
mkdir appinfo
copy pkgnet.exe bin
copy pkgnet.lsm appinfo
zip -9 -k -r -m pkgnet.zip bin appinfo
 
pkgnet.exe: pkgnet.obj net.obj unchunk.obj lsm.obj helpers.obj trim.obj
wcl -lr -k4096 $(LIB) pkgnet.obj net.obj unchunk.obj lsm.obj helpers.obj trim.obj -fe=pkgnet.exe
 
pkgnet.obj: pkgnet.c
*wcc $(CFLAGS) pkgnet.c
 
trim.obj: ..\pkg\trim.c
*wcc $(CFLAGS) ..\pkg\trim.c
 
lsm.obj: ..\pkg\lsm.c
*wcc $(CFLAGS) ..\pkg\lsm.c
 
helpers.obj: ..\pkg\helpers.c
*wcc $(CFLAGS) ..\pkg\helpers.c
 
net.obj: net.c
*wcc $(CFLAGS) net.c
 
unchunk.obj: unchunk.c
*wcc $(CFLAGS) unchunk.c
 
unchtest.obj: unchtest.c
*wcc $(CFLAGS) unchtest.c
 
unchtest.exe: unchtest.obj unchunk.obj
wcl -lr $(LIB) unchtest.obj unchunk.obj -fe=unchtest.exe
 
clean: .symbolic
del *.obj
del pkgnet.exe
/pkgnet/trunk/net.c
0,0 → 1,134
/*
* This file is part of the pkgnet package - the SvarDOS package manager.
* Copyright (C) Mateusz Viste 2013-2021
*
* Provides all network functions used by pkgnet, wrapped around the
* Watt-32 TCP/IP stack.
*/
 
#include <stdlib.h>
 
/* Watt32 */
#include <tcp.h>
 
#include "net.h" /* include self for control */
 
 
/* if there is enough memory, net_connect() will try setting up a tcp window
* larger than the WATT32's default of only 2K
* on my system's DOSEMU install the relation between tcp buffer and download
* speed were measured as follows (this is on a 4 Mbps ADSL link):
* 2K = 20 KiB/s
* 4K = 51 KiB/s
* 8K = 67 KiB/s
* 9K = 98 KiB/s
* 10K = 98 KiB/s
* 16K = 96 KiB/s
* 32K = 98 KiB/s
* 60K = 98 KiB/s
*/
#define TCPBUFF_SIZE (16 * 1024)
 
 
struct net_tcpsocket {
tcp_Socket *sock;
tcp_Socket _sock; /* watt32 socket */
char tcpbuff[1];
};
 
 
int net_dnsresolve(char *ip, const char *name) {
unsigned long ipnum;
ipnum = resolve(name); /* I could use WatTCP's lookup_host() here to do all
the job for me, unfortunately lookup_host() issues
wild outs() calls putting garbage on screen... */
if (ipnum == 0) return(-1);
_inet_ntoa(ip, ipnum); /* convert to string */
return(0);
}
 
 
static int dummy_printf(const char * format, ...) {
if (format == NULL) return(-1);
return(0);
}
 
 
/* must be called before using libtcp. returns 0 on success, or non-zero if network subsystem is not available. */
int net_init(void) {
tzset();
_printf = dummy_printf; /* this is to avoid watt32 printing its stuff to console */
return(sock_init());
}
 
 
struct net_tcpsocket *net_connect(const char *ipstr, unsigned short port) {
struct net_tcpsocket *resultsock, *resizsock;
unsigned long ipaddr;
 
/* convert ip to value */
ipaddr = _inet_addr(ipstr);
if (ipaddr == 0) return(NULL);
 
resultsock = calloc(sizeof(struct net_tcpsocket), 1);
if (resultsock == NULL) return(NULL);
resultsock->sock = &(resultsock->_sock);
 
if (!tcp_open(resultsock->sock, 0, ipaddr, port, NULL)) {
sock_abort(resultsock->sock);
free(resultsock);
return(NULL);
}
 
/* set user-managed buffer if possible (watt32's default is only 2K)
* this must be set AFTER tcp_open(), since the latter rewrites the tcp
* rx buffer */
resizsock = realloc(resultsock, sizeof(struct net_tcpsocket) + TCPBUFF_SIZE);
if (resizsock != NULL) {
resultsock = resizsock;
sock_setbuf(resultsock->sock, resultsock->tcpbuff, TCPBUFF_SIZE);
}
 
return(resultsock);
}
 
 
int net_isconnected(struct net_tcpsocket *s) {
if (tcp_tick(s->sock) == 0) return(-1);
if (sock_established(s->sock) == 0) return(0);
return(1);
}
 
 
/* Sends data on socket 'socket'.
Returns the number of bytes sent on success, and < 0 otherwise */
int net_send(struct net_tcpsocket *socket, const void *line, long len) {
/* call this to let Watt-32 handle its internal stuff */
if (tcp_tick(socket->sock) == 0) return(-1);
/* send bytes */
return(sock_write(socket->sock, line, len));
}
 
 
/* Reads data from socket 'sock' and write it into buffer 'buff', until end of connection. Will fall into error if the amount of data is bigger than 'maxlen' bytes.
Returns the amount of data read (in bytes) on success, or a negative value otherwise. The error code can be translated into a human error message via libtcp_strerr(). */
int net_recv(struct net_tcpsocket *socket, void *buff, long maxlen) {
/* call this to let WatTCP handle its internal stuff */
if (tcp_tick(socket->sock) == 0) return(-1);
return(sock_fastread(socket->sock, buff, maxlen));
}
 
 
/* Close the 'sock' socket. */
void net_close(struct net_tcpsocket *socket) {
/* I could use sock_close() and sock_wait_closed() if I'd want to be
* friendly, but it's much easier on the tcp stack to send a single RST and
* forget about the connection (esp. if the peer is misbehaving) */
sock_abort(socket->sock);
free(socket);
}
 
 
const char *net_engine(void) {
return(wattcpVersion());
}
/pkgnet/trunk/net.h
0,0 → 1,43
/*
* This file is part of the pkgnet package - the SvarDOS package manager.
* Copyright (C) Mateusz Viste 2013-2021
*/
 
 
#ifndef libtcp_hdr
#define libtcp_hdr
 
struct net_tcpsocket; /* opaque struct, exact implementation in net.c */
 
/* resolves name and fills resovled addr into ip. returns 0 on success. */
int net_dnsresolve(char *ip, const char *name);
 
/* must be called before using libtcp. returns 0 on success, or non-zero if network subsystem is not available. */
int net_init(void);
 
/* initiates a connection to an IP host and returns a socket pointer (or NULL
* on error) - note that connection is NOT established at this point!
* use net_isconnected() to know when the connection is connected. */
struct net_tcpsocket *net_connect(const char *ip, unsigned short port);
 
/* checks whether or not a socket is connected. returns:
* 0 = not connected,
* 1 = connected
* -1 = error */
int net_isconnected(struct net_tcpsocket *s);
 
/* Sends data on socket 'socket'.
Returns the number of bytes sent on success, and <0 otherwise. The error code can be translated into a human error message via libtcp_strerr(). */
int net_send(struct net_tcpsocket *socket, const void *line, long len);
 
/* Reads data from socket 'sock' and write it into buffer 'buff', until end of connection. Will fall into error if the amount of data is bigger than 'maxlen' bytes.
Returns the amount of data read (in bytes) on success, or a negative value otherwise. The error code can be translated into a human error message via libtcp_strerr(). */
int net_recv(struct net_tcpsocket *socket, void *buff, long maxlen);
 
/* Close the 'sock' socket. */
void net_close(struct net_tcpsocket *socket);
 
/* Returns an info string about the networking engine being used */
const char *net_engine(void);
 
#endif
/pkgnet/trunk/pkgnet.c
0,0 → 1,447
/*
* pkgnet - pulls SvarDOS packages from the project's online repository
*
* PUBLISHED UNDER THE TERMS OF THE MIT LICENSE
*
* COPYRIGHT (C) 2016-2022 MATEUSZ VISTE, ALL RIGHTS RESERVED.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
* http://svardos.osdn.io
*/
 
#include <direct.h> /* opendir() and friends */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
 
#include "net.h"
#include "unchunk.h"
 
#include "../pkg/lsm.h"
 
 
#define PVER "20220119"
#define PDATE "2021-2022"
 
#define HOSTADDR "svardos.osdn.io"
 
 
/* returns length of all http headers, or 0 if uncomplete yet */
static unsigned short detecthttpheadersend(const unsigned char *buff) {
char lastbyteislf = 0;
unsigned short i;
for (i = 0; buff[i] != 0; i++) {
if (buff[i] == '\r') continue; /* ignore CR characters */
if (buff[i] != '\n') {
lastbyteislf = 0;
continue;
}
/* cur byte is LF -> if last one was also LF then this is an empty line, meaning headers are over */
if (lastbyteislf == 0) {
lastbyteislf = 1;
continue;
}
/* end of headers! return length of headers */
return(i + 1); /* add 1 to skip the current \n character */
}
return(0);
}
 
 
static void help(void) {
puts("pkgnet ver " PVER " -- Copyright (C) " PDATE " Mateusz Viste");
puts("");
puts("pkgnet is the SvarDOS package downloader.");
puts("");
puts("usage: pkgnet search <term>");
puts(" pkgnet pull <package>");
puts(" pkgnet pull <package>-<version>");
puts(" pkgnet checkup");
puts("");
puts("actions:");
puts(" search - asks remote repository for the list of matching packages");
puts(" pull - downloads package into current directory");
puts(" checkup - lists updates available for your system");
puts("");
printf("Watt32 kernel: %s", net_engine());
puts("");
puts("");
}
 
 
/* parses command line arguments and fills outfname and url accordingly
* returns 0 on success, non-zero otherwise */
static int parseargv(int argc, char * const *argv, char *outfname, char *url, int *ispost) {
*outfname = 0;
*url = 0;
*ispost = 0;
if ((argc == 3) && (strcasecmp(argv[1], "search") == 0)) {
sprintf(url, "/repo/?a=search&p=%s", argv[2]);
} else if ((argc == 3) && (strcasecmp(argv[1], "pull") == 0)) {
unsigned short i;
sprintf(url, "/repo/?a=pull&p=%s", argv[2]);
/* copy argv[2] into outfname, but stop at first '-' or null terminator
* this trims any '-version' part in filename to respect 8+3 */
for (i = 0; (argv[2][i] != 0) && (argv[2][i] != '-') && (i < 8); i++) {
outfname[i] = argv[2][i];
}
/* add the zip extension to filename */
strcpy(outfname + i, ".zip");
} else if ((argc == 2) && (strcasecmp(argv[1], "checkup") == 0)) {
sprintf(url, "/repo/?a=checkup");
*ispost = 1;
} else {
help();
return(-1);
}
return(0);
}
 
 
static int htget_headers(unsigned char *buffer, size_t buffersz, struct net_tcpsocket *sock, int *httpcode, int *ischunked) {
unsigned char *buffptr = buffer;
unsigned short bufflen = 0;
int byteread;
time_t starttime = time(NULL);
for (;;) {
byteread = net_recv(sock, buffptr, buffersz - (bufflen + 1)); /* -1 because I will append a NULL terminator */
 
if (byteread > 0) { /* got data */
int hdlen;
bufflen += byteread;
buffptr += byteread;
buffer[bufflen] = 0;
hdlen = detecthttpheadersend(buffer);
if (hdlen > 0) { /* full headers - parse http code and continue processing */
int i;
buffer[hdlen - 1] = 0;
/* find the first space (HTTP/1.1 200 OK) */
for (i = 0; i < 16; i++) {
if ((buffer[i] == ' ') || (buffer[i] == 0)) break;
}
if (buffer[i] != ' ') return(-1);
*httpcode = atoi((char *)(buffer + i + 1));
/* switch all headers to low-case so it is easier to parse them */
for (i = 0; i < hdlen; i++) if ((buffer[i] >= 'A') && (buffer[i] <= 'Z')) buffer[i] += ('a' - 'A');
/* look out for chunked transfer encoding */
{
char *lineptr = strstr((char *)buffer, "\ntransfer-encoding:");
if (lineptr != NULL) {
lineptr += 19;
/* replace nearest \r, \n or 0 by 0 */
for (i = 0; ; i++) {
if ((lineptr[i] == '\r') || (lineptr[i] == '\n') || (lineptr[i] == 0)) {
lineptr[i] = 0;
break;
}
}
/* do I see the 'chunked' word? */
if (strstr((char *)lineptr, "chunked") != NULL) *ischunked = 1;
}
}
/* rewind the buffer */
bufflen -= hdlen;
memmove(buffer, buffer + hdlen, bufflen);
return(bufflen); /* move to body processing now */
}
 
} else if (byteread < 0) { /* abort on error */
return(-2); /* unexpected end of connection (while waiting for all http headers) */
 
} else { /* else no data received - look for timeout and release a cpu cycle */
if (time(NULL) - starttime > 20) return(-3); /* TIMEOUT! */
_asm int 28h; /* release a CPU cycle */
}
}
}
 
 
/* provides body data of the POST query for checkup actions
fills buff with data and returns data length.
must be called repeateadly until zero-lengh is returned */
static unsigned short checkupdata(char *buff) {
static char *dosdir = NULL;
static DIR *dp;
static struct dirent *ep;
 
/* make sure I know %DOSDIR% */
if (dosdir == NULL) {
dosdir = getenv("DOSDIR");
if ((dosdir == NULL) || (dosdir[0] == 0)) {
puts("ERROR: %DOSDIR% not set");
return(0);
}
}
 
/* if first call, open the package directory */
if (dp == NULL) {
sprintf(buff, "%s\\packages", dosdir);
dp = opendir(buff);
if (dp == NULL) {
puts("ERROR: Could not access %DOSDIR%\\packages directory");
return(0);
}
}
 
for (;;) {
int tlen;
char ver[20];
ep = readdir(dp); /* readdir() result must never be freed (statically allocated) */
if (ep == NULL) { /* no more entries */
closedir(dp);
return(0);
}
 
tlen = strlen(ep->d_name);
if (tlen < 4) continue; /* files must be at least 5 bytes long ("x.lst") */
if (strcasecmp(ep->d_name + tlen - 4, ".lst") != 0) continue; /* if not an .lst file, skip it silently */
ep->d_name[tlen - 4] = 0; /* trim out the ".lst" suffix */
 
/* load the metadata from %DOSDIR\APPINFO\*.lsm */
sprintf(buff, "%s\\appinfo\\%s.lsm", dosdir, ep->d_name);
readlsm(buff, ver, sizeof(ver));
 
return(sprintf(buff, "%s\t%s\n", ep->d_name, ver));
}
}
 
 
/* fetch http data from ipaddr using url
* write result to file outfname if not null, or print to stdout otherwise
* fills bsum with the BSD sum of the data
* is ispost is non-zero, then the request is a POST and its body data is
* obtained through repeated calls to checkupdata()
* returns the length of data obtained, or neg value on error */
static long htget(const char *ipaddr, const char *url, const char *outfname, unsigned short *bsum, int ispost, unsigned char *buffer, size_t buffersz) {
struct net_tcpsocket *sock;
time_t lastactivity, lastprogressoutput = 0;
int httpcode = -1, ischunked = 0;
int byteread;
long flen = 0, lastflen = 0;
FILE *fd = NULL;
 
/* unchunk state variable is using a little part of the supplied buffer */
struct unchunk_state *unchstate = (void *)buffer;
buffer += sizeof(*unchstate);
buffersz -= sizeof(*unchstate);
memset(unchstate, 0, sizeof(*unchstate));
 
sock = net_connect(ipaddr, 80);
if (sock == NULL) {
puts("ERROR: failed to connect to " HOSTADDR);
goto SHITQUIT;
}
 
/* wait for net_connect() to actually connect */
for (;;) {
int connstate = net_isconnected(sock);
if (connstate > 0) break;
if (connstate < 0) {
puts("ERROR: connection error");
goto SHITQUIT;
}
_asm int 28h; /* DOS idle */
}
 
/* socket is connected - send the http request (MUST be HTTP/1.0 because I do not support chunked transfers!) */
if (ispost) {
snprintf((char *)buffer, buffersz, "POST %s HTTP/1.1\r\nHOST: " HOSTADDR "\r\nUSER-AGENT: pkgnet/" PVER "\r\nTransfer-Encoding: chunked\r\nConnection: close\r\n\r\n", url);
} else {
snprintf((char *)buffer, buffersz, "GET %s HTTP/1.1\r\nHOST: " HOSTADDR "\r\nUSER-AGENT: pkgnet/" PVER "\r\nConnection: close\r\n\r\n", url);
}
 
if (net_send(sock, buffer, strlen((char *)buffer)) != (int)strlen((char *)buffer)) {
puts("ERROR: failed to send HTTP query to remote server");
goto SHITQUIT;
}
 
/* send chunked data for POST queries */
if (ispost) {
unsigned short blen;
int hlen;
char *hbuf = (char *)buffer + buffersz - 16;
do {
blen = checkupdata((char *)buffer);
if (blen == 0) { /* last item contains the message trailer */
hlen = sprintf(hbuf, "0\r\n");
} else {
hlen = sprintf(hbuf, "%X\r\n", blen);
}
if (net_send(sock, hbuf, hlen) != hlen) {
puts("ERROR: failed to send POST data to remote server");
goto SHITQUIT;
}
/* add trailing CR/LF to buffer as required by chunked mode */
buffer[blen++] = '\r';
buffer[blen++] = '\n';
if (net_send(sock, buffer, blen) != blen) {
puts("ERROR: failed to send POST data to remote server");
goto SHITQUIT;
}
} while (blen != 2);
}
 
/* receive and process HTTP headers */
byteread = htget_headers(buffer, buffersz, sock, &httpcode, &ischunked);
 
/* transmission error? */
if (byteread < 0) {
printf("ERROR: communication error (%d)", byteread);
puts("");
goto SHITQUIT;
}
 
/* open destination file if required and if no server-side error occured */
if ((httpcode >= 200) && (httpcode <= 299) && (*outfname != 0)) {
fd = fopen(outfname, "wb");
if (fd == NULL) {
printf("ERROR: failed to create file %s", outfname);
puts("");
goto SHITQUIT;
}
}
 
/* read body of the answer (and chunk-decode it if needed) */
lastactivity = time(NULL);
for (;; byteread = net_recv(sock, buffer, buffersz - 1)) { /* read 1 byte less because I need to append a NULL terminator when printf'ing the content */
 
if (byteread > 0) { /* got data */
lastactivity = time(NULL);
 
/* unpack data if server transmits in chunked mode */
if (ischunked) byteread = unchunk(buffer, byteread, unchstate);
 
/* if downloading to file, write stuff to disk */
if (fd != NULL) {
int i;
if (fwrite(buffer, 1, byteread, fd) != byteread) {
printf("ERROR: failed to write data to file %s after %ld bytes", outfname, flen);
puts("");
break;
}
flen += byteread;
/* update progress once a sec */
if (lastprogressoutput != lastactivity) {
lastprogressoutput = lastactivity;
printf("%ld KiB (%ld KiB/s) \r", flen >> 10, (flen >> 10) - (lastflen >> 10)); /* trailing spaces are meant to avoid leaving garbage on screen if speed goes from, say, 1000 KiB/s to 9 KiB/s */
lastflen = flen;
fflush(stdout); /* avoid console buffering */
}
/* update the bsd sum */
for (i = 0; i < byteread; i++) {
/* rotr16 */
unsigned short bsumlsb = *bsum & 1;
*bsum >>= 1;
*bsum |= (bsumlsb << 15);
*bsum += buffer[i];
}
} else { /* otherwise dump to screen */
buffer[byteread] = 0;
printf("%s", buffer);
}
 
} else if (byteread < 0) { /* end of connection */
break;
 
} else { /* check for timeout (byteread == 0) */
if (time(NULL) - lastactivity > 20) { /* TIMEOUT! */
puts("ERROR: Timeout while waiting for data");
goto SHITQUIT;
}
/* waiting for packets - release a CPU cycle in the meantime */
_asm int 28h;
}
}
 
goto ALLGOOD;
 
SHITQUIT:
flen = -1;
 
ALLGOOD:
if (fd != NULL) fclose(fd);
net_close(sock);
return(flen);
}
 
 
/* checks if file exists, returns 0 if not, non-zero otherwise */
static int fexists(const char *fname) {
FILE *fd = fopen(fname, "rb");
if (fd == NULL) return(0);
fclose(fd);
return(1);
}
 
 
int main(int argc, char **argv) {
unsigned short bsum = 0;
long flen;
int ispost; /* is the request a POST? */
 
struct {
unsigned char buffer[5000];
char ipaddr[64];
char url[64];
char outfname[16];
} *mem;
 
/* allocate memory */
mem = malloc(sizeof(*mem));
if (mem == NULL) {
puts("ERROR: out of memory");
return(1);
}
 
/* parse command line arguments */
if (parseargv(argc, argv, mem->outfname, mem->url, &ispost) != 0) return(1);
 
/* if outfname requested, make sure that file does not exist yet */
if ((mem->outfname[0] != 0) && (fexists(mem->outfname))) {
printf("ERROR: file %s already exists", mem->outfname);
puts("");
return(1);
}
 
/* init network stack */
if (net_init() != 0) {
puts("ERROR: Network subsystem initialization failed");
return(1);
}
 
puts(""); /* required because watt-32 likes to print out garbage sometimes ("configuring through DHCP...") */
 
if (net_dnsresolve(mem->ipaddr, HOSTADDR) != 0) {
puts("ERROR: DNS resolution failed");
return(1);
}
 
flen = htget(mem->ipaddr, mem->url, mem->outfname, &bsum, ispost, mem->buffer, sizeof(mem->buffer));
if (flen < 1) return(1);
 
if (mem->outfname[0] != 0) {
/* print bsum, size, filename */
printf("Downloaded %ld KiB into %s (BSUM: %04X)", flen >> 10, mem->outfname, bsum);
puts("");
}
 
return(0);
}
/pkgnet/trunk/pkgnet.lsm
0,0 → 1,3
version: 20220119
description: pulls packages and updates from the internet SvarDOS repository
license: MIT
/pkgnet/trunk/unchtest.c
0,0 → 1,121
/*
* test suite for the unchunk() function.
*
* Copyright (C) 2021 Mateusz Viste
*/
 
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
 
#include "unchunk.h"
 
static size_t randchunkdata(void *file_chunked, const void *file_raw, size_t file_raw_len, int maxchunksz) {
size_t file_raw_read = 0;
size_t file_chunked_len = 0;
 
for (;;) {
int chunklen = (rand() % maxchunksz) + 1;
if (file_raw_read + chunklen > file_raw_len) chunklen = file_raw_len - file_raw_read;
 
file_chunked_len += sprintf((char *)file_chunked + file_chunked_len, "%x\r\n", chunklen);
if (chunklen > 0) memcpy((char *)file_chunked + file_chunked_len, (char *)file_raw + file_raw_read, chunklen);
file_raw_read += chunklen;
file_chunked_len += chunklen;
file_chunked_len += sprintf((char *)file_chunked + file_chunked_len, "\r\n");
if (chunklen == 0) return(file_chunked_len);
}
}
 
 
/* writes buffer of fsize bytes to file fname */
static void dumpfile(const char *fname, const void *buff, size_t fsize) {
FILE *fd;
fd = fopen(fname, "wb");
fwrite(buff, 1, fsize, fd);
fclose(fd);
}
 
 
int main(int argc, char **argv) {
unsigned char *file_raw; /* original file */
unsigned char *file_chunked; /* chunked version */
unsigned char *file_decoded; /* after being un-chunked */
size_t file_raw_len;
size_t file_chunked_len;
FILE *fd;
unsigned int trycount;
 
if ((argc != 2) || (argv[1][0] == '/')) {
puts("Usage: unchtest <file>");
return(1);
}
 
#define FILESZ_MAX 20000u
 
file_raw = malloc(FILESZ_MAX);
file_chunked = malloc(65000u);
file_decoded = malloc(65000u);
if ((file_raw == NULL) || (file_chunked == NULL) || (file_decoded == NULL)) {
puts("ERROR: out of memory");
return(1);
}
 
fd = fopen(argv[1], "rb");
if (fd == NULL) {
puts("ERROR: failed to open file");
return(1);
}
file_raw_len = fread(file_raw, 1, FILESZ_MAX, fd);
fclose(fd);
 
printf("Loaded '%s' (%zu bytes)\r\n", argv[1], file_raw_len);
srand(time(NULL));
 
for (trycount = 0; trycount < 30000; trycount++) {
size_t bytesprocessed = 0;
size_t file_decoded_len = 0;
int maxchunksz;
struct unchunk_state unchstate = {0};
 
/* segment file into chunks of random size */
maxchunksz = (rand() % 256) + 8;
file_chunked_len = randchunkdata(file_chunked, file_raw, file_raw_len, maxchunksz);
 
printf("=== TRY %d (CHUNKS: %u BYTES MAX) ======================\r\n", trycount + 1, maxchunksz);
 
for (;;) {
size_t bytes;
int decodedbytes;
static unsigned char buffer[4096];
 
bytes = (rand() % 256) + 1;
if (bytes > file_chunked_len - bytesprocessed) bytes = file_chunked_len - bytesprocessed;
printf("processing %4zu bytes of chunked data", bytes);
memcpy(buffer, file_chunked + bytesprocessed, bytes);
 
/* decode the chunked version reading random amounts of data and build a decoded version */
decodedbytes = unchunk(buffer, bytes, &unchstate);
printf(" -> decoded into %4d raw bytes\r\n", decodedbytes);
memcpy(file_decoded + file_decoded_len, buffer, decodedbytes);
file_decoded_len += decodedbytes;
bytesprocessed += bytes;
if (bytesprocessed == file_chunked_len) break;
}
 
/* compare decoded and original */
if ((file_decoded_len != file_raw_len) || (memcmp(file_decoded, file_raw, file_raw_len) != 0)) {
printf("ERROR: decoded file does not match the original. see tst-orig.dat, tst-chnk.txt and tst-unch.dat\r\n");
dumpfile("tst-orig.dat", file_raw, file_raw_len);
dumpfile("tst-chnk.dat", file_chunked, file_chunked_len);
dumpfile("tst-unch.dat", file_decoded, file_decoded_len);
return(1);
}
}
 
printf("OK (%u tests)\r\n", trycount);
 
return(0);
}
/pkgnet/trunk/unchunk.c
0,0 → 1,72
/*
* unpacks a http "chunked" transfer into a raw data stream.
* this file is part of the pkgnet tool from the SvarDOS project.
*
* Copyright (C) 2021 Mateusz Viste
*/
 
#include <stdlib.h> /* atol() */
#include <string.h>
 
#include "unchunk.h"
 
 
/* transforms a http CHUNKED stream into actual data, returns the amount of
* raw data to read or -1 on error. st MUST be zeroed before first call. */
int unchunk(unsigned char *buff, int bufflen, struct unchunk_state *st) {
int hdrstart, hdrend;
 
/* if chunk header was being in progress, try to decode it now */
if (st->bytesleft == -1) {
int partial_hdr_len = strlen(st->partial_hdr);
/* locate header terminator, if available */
for (hdrend = 0; (hdrend < bufflen) && (buff[hdrend] != '\n'); hdrend++);
if (partial_hdr_len + hdrend > 15) return(-1); /* error: chunk header too long */
 
/* copy header to buffer */
memcpy(st->partial_hdr + partial_hdr_len, buff, hdrend);
st->partial_hdr[partial_hdr_len + hdrend] = 0;
 
/* quit if header still no complete */
if (hdrend >= bufflen) return(0);
 
/* good, got whole header */
bufflen -= hdrend + 1;
memmove(buff, buff + hdrend + 1, bufflen);
st->bytesleft = strtol(st->partial_hdr, NULL, 16);
}
 
AGAIN:
 
if (bufflen <= st->bytesleft) {
st->bytesleft -= bufflen;
return(bufflen);
}
 
/* else bufflen > bytesleft */
 
/* skip trailing \r\n after chunk */
for (hdrstart = st->bytesleft; hdrstart < bufflen; hdrstart++) if ((buff[hdrstart] != '\r') && (buff[hdrstart] != '\n')) break;
/* skip chunk size (look for its \n terminator) */
for (hdrend = hdrstart; (hdrend < bufflen) && (buff[hdrend] != '\n'); hdrend++);
 
if (hdrend < bufflen) { /* full header found */
long newchunklen;
/* read the header length */
newchunklen = strtol((char *)buff + hdrstart, NULL, 16);
/* move data over header to get a contiguous block of data */
memmove(buff + st->bytesleft, buff + hdrend + 1, bufflen - (hdrend + 1));
bufflen -= (hdrend + 1 - st->bytesleft);
/* update bytesleft */
st->bytesleft += newchunklen;
/* loop again */
goto AGAIN;
} else { /* partial header */
if ((bufflen - st->bytesleft) > 15) return(-1); /* error: chunk header appears to be longer than 15 characters */
memset(st->partial_hdr, 0, sizeof(st->partial_hdr));
memcpy(st->partial_hdr, buff + st->bytesleft, bufflen - st->bytesleft);
bufflen -= (bufflen - st->bytesleft);
st->bytesleft = -1; /* "header in progress" */
return(bufflen);
}
}
/pkgnet/trunk/unchunk.h
0,0 → 1,20
/*
* unpacks a http "chunked" transfer into a raw data stream.
* this file is part of the pkgnet tool from the SvarDOS project.
*
* Copyright (C) 2021 Mateusz Viste
*/
 
#ifndef UNCHUNK_H
#define UNCHUNK_H
 
struct unchunk_state {
char partial_hdr[16]; /* a small buffer for storing partial chunk headers, if these are transmitted in separate parts */
long bytesleft; /* how many bytes are expected yet in the ongoing chunk */
};
 
/* transforms a http CHUNKED stream into actual data, returns the amount of
* raw data to read or -1 on error. st MUST be zeroed before first call. */
int unchunk(unsigned char *buff, int bufflen, struct unchunk_state *st);
 
#endif
/pkgnet/trunk/watt32/inc/arpa/ftp.h
0,0 → 1,134
/*!\file arpa/ftp.h
* FTP definitions.
*/
 
/*
* Copyright (c) 1983, 1989 Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)ftp.h 8.1 (Berkeley) 6/2/93
*/
 
#ifndef __ARPA_FTP_H
#define __ARPA_FTP_H
 
/* Definitions for FTP; see RFC-765. */
 
/*
* Reply codes.
*/
#define PRELIM 1 /* positive preliminary */
#define COMPLETE 2 /* positive completion */
#define CONTINUE 3 /* positive intermediate */
#define TRANSIENT 4 /* transient negative completion */
#undef ERROR /* <wingdi.h> */
#define ERROR 5 /* permanent negative completion */
 
/*
* Type codes
*/
#define TYPE_A 1 /* ASCII */
#define TYPE_E 2 /* EBCDIC */
#define TYPE_I 3 /* image */
#define TYPE_L 4 /* local byte size */
 
#ifdef FTP_NAMES
const char *typenames[] = {"0", "ASCII", "EBCDIC", "Image", "Local" };
#endif
 
/*
* Form codes
*/
#define FORM_N 1 /* non-print */
#define FORM_T 2 /* telnet format effectors */
#define FORM_C 3 /* carriage control (ASA) */
#ifdef FTP_NAMES
const char *formnames[] = {"0", "Nonprint", "Telnet", "Carriage-control" };
#endif
 
/*
* Structure codes
*/
#define STRU_F 1 /* file (no record structure) */
#define STRU_R 2 /* record structure */
#define STRU_P 3 /* page structure */
#ifdef FTP_NAMES
const char *strunames[] = {"0", "File", "Record", "Page" };
#endif
 
/*
* Mode types
*/
#define MODE_S 1 /* stream */
#define MODE_B 2 /* block */
#define MODE_C 3 /* compressed */
#ifdef FTP_NAMES
const char *modenames[] = {"0", "Stream", "Block", "Compressed" };
#endif
 
/*
* Protection levels
*/
#define PROT_C 1 /* clear */
#define PROT_S 2 /* safe */
#define PROT_P 3 /* private */
#define PROT_E 4 /* confidential */
 
#ifdef FTP_NAMES
const char *levelnames[] = {"0", "Clear", "Safe", "Private", "Confidential" };
#endif
 
#if defined(KERBEROS) && defined(NOENCRYPTION)
/* Define away krb_rd_priv and krb_mk_priv. Don't need them anyway.
* This might not be the best place for this ...
*/
#define krb_rd_priv(o,l,ses,s,h,c,m) krb_rd_safe(o,l,s,h,c,m)
#define krb_mk_priv(i,o,l,ses,s,h,c) krb_mk_safe(i,o,l,s,h,c)
#endif
 
/*
* Record Tokens
*/
#define REC_ESC '\377' /* Record-mode Escape */
#define REC_EOR '\001' /* Record-mode End-of-Record */
#define REC_EOF '\002' /* Record-mode End-of-File */
 
/*
* Block Header
*/
#define BLK_EOR 0x80 /* Block is End-of-Record */
#define BLK_EOF 0x40 /* Block is End-of-File */
#define BLK_ERRORS 0x20 /* Block is suspected of containing errors */
#define BLK_RESTART 0x10 /* Block is Restart Marker */
 
#define BLK_BYTECOUNT 2 /* Bytes in this block */
 
#endif
/pkgnet/trunk/watt32/inc/arpa/inet.h
0,0 → 1,83
/*!\file arpa/inet.h
* Address conversions.
*/
 
/* Modified for emx by hv and em 1994
*
* Copyright (c) 1983, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)inet.h 8.1 (Berkeley) 6/2/93
* From: Id: inet.h,v 8.5 1997/01/29 08:48:09 vixie Exp $
*/
 
#ifndef __ARPA_INET_H
#define __ARPA_INET_H
 
#ifndef __SYS_W32API_H
#include <sys/w32api.h>
#endif
 
#ifndef __SYS_TYPES_H
#include <sys/wtypes.h>
#endif
 
#ifndef __SYS_CDEFS_H
#include <sys/cdefs.h>
#endif
 
#ifndef __NETINET_IN_H
#include <netinet/in.h>
#endif
 
 
__BEGIN_DECLS
 
W32_FUNC int ascii2addr (int, const char *, void *);
W32_FUNC char *addr2ascii (int, const void *, int, char *);
 
W32_FUNC struct in_addr W32_CALL inet_makeaddr (u_long, u_long);
W32_FUNC u_long W32_CALL inet_addr (const char*);
W32_FUNC u_long W32_CALL inet_lnaof (struct in_addr);
W32_FUNC u_long W32_CALL inet_netof (struct in_addr);
W32_FUNC u_long W32_CALL inet_network (const char*);
W32_FUNC int W32_CALL inet_aton (const char *s, struct in_addr *adr);
W32_FUNC char* W32_CALL inet_ntoa (struct in_addr);
W32_FUNC char* W32_CALL inet_ntoa_r (struct in_addr adr, char *buf, int buflen);
 
W32_FUNC char *W32_CALL inet_nsap_ntoa(int binlen, const u_char *binary, char *ascii);
W32_FUNC u_int W32_CALL inet_nsap_addr(const char *ascii, u_char *binary, int maxlen);
W32_FUNC const char *W32_CALL inet_ntop (int af, const void *src, char *dst, size_t size);
W32_FUNC int W32_CALL inet_pton (int af, const char *src, void *dst);
 
__END_DECLS
 
#endif /* !__ARPA_INET_H_ */
/pkgnet/trunk/watt32/inc/arpa/nameser.h
0,0 → 1,322
/*!\file arpa/nameser.h
* Nameserver API.
*/
 
/*
* Copyright (c) 1983, 1989, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* -
* Portions Copyright (c) 1993 by Digital Equipment Corporation.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies, and that
* the name of Digital Equipment Corporation not be used in advertising or
* publicity pertaining to distribution of the document or software without
* specific, written prior permission.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
* CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
* -
* --Copyright--
*
* @(#)nameser.h 8.2 (Berkeley) 2/16/94
* From Id: nameser.h,v 4.9.1.15 1994/07/19 22:51:24 vixie Exp
* $Id: nameser.h,v 1.8 1996/08/29 20:01:00 peter Exp $
*/
 
#ifndef __ARPA_NAMESER_H
#define __ARPA_NAMESER_H
 
#ifndef __SYS_W32API_H
#include <sys/w32api.h>
#endif
 
#ifndef __SYS_PARAM_H
#include <sys/param.h>
#endif
 
#ifndef __SYS_WTYPES_H
#include <sys/wtypes.h>
#endif
 
#ifndef __SYS_CDEFS_H
#include <sys/cdefs.h>
#endif
 
/*
* revision information. this is the release date in YYYYMMDD format.
* it can change every day so the right thing to do with it is use it
* in preprocessor commands such as "#if (__BIND > 19931104)". do not
* compare for equality; rather, use it to determine whether your resolver
* is new enough to contain a certain feature.
*/
 
#define __BIND 19960801 /* interface version stamp */
 
/*
* Define constants based on rfc883
*/
#define PACKETSZ 512 /* maximum packet size */
#define MAXDNAME 1025 /* maximum domain name */
#define MAXCDNAME 255 /* maximum compressed domain name */
#define MAXLABEL 63 /* maximum length of domain label */
#define HFIXEDSZ 12 /* #/bytes of fixed data in header */
#define QFIXEDSZ 4 /* #/bytes of fixed data in query */
#define RRFIXEDSZ 10 /* #/bytes of fixed data in r record */
#define INT32SZ 4 /* for systems without 32-bit ints */
#define INT16SZ 2 /* for systems without 16-bit ints */
#define INADDRSZ 4 /* IPv4 T_A */
#define IN6ADDRSZ 16 /* IPv6 T_AAAA */
 
 
/*
* Internet nameserver port number
*/
#define NAMESERVER_PORT 53
 
/*
* Currently defined opcodes
*/
#define QUERY 0x0 /* standard query */
#define IQUERY 0x1 /* inverse query */
#define STATUS 0x2 /* nameserver status query */
#define NS_NOTIFY_OP 0x4 /* notify secondary of SOA change */
 
#ifdef ALLOW_UPDATES
/* non standard - supports ALLOW_UPDATES stuff from Mike Schwartz */
# define UPDATEA 0x9 /* add resource record */
# define UPDATED 0xa /* delete a specific resource record */
# define UPDATEDA 0xb /* delete all named resource record */
# define UPDATEM 0xc /* modify a specific resource record */
# define UPDATEMA 0xd /* modify all named resource record */
# define ZONEINIT 0xe /* initial zone transfer */
# define ZONEREF 0xf /* incremental zone referesh */
#endif
 
/*
* Currently defined response codes
*/
#if !defined(WIN32) && !defined(_WIN32) /* <winerror.h> value is okay */
#define NOERROR 0 /* no error */
#endif
#define FORMERR 1 /* format error */
#define SERVFAIL 2 /* server failure */
#define NXDOMAIN 3 /* non existent domain */
#define NOTIMP 4 /* not implemented */
#define REFUSED 5 /* query refused */
 
#ifdef ALLOW_UPDATES
/* non standard */
# define NOCHANGE 0xf /* update failed to change db */
#endif
 
/*
* Type values for resources and queries
*/
#define T_A 1 /* host address */
#define T_NS 2 /* authoritative server */
#define T_MD 3 /* mail destination */
#define T_MF 4 /* mail forwarder */
#define T_CNAME 5 /* canonical name */
#define T_SOA 6 /* start of authority zone */
#define T_MB 7 /* mailbox domain name */
#define T_MG 8 /* mail group member */
#define T_MR 9 /* mail rename name */
#define T_NULL 10 /* null resource record */
#define T_WKS 11 /* well known service */
#define T_PTR 12 /* domain name pointer */
#define T_HINFO 13 /* host information */
#define T_MINFO 14 /* mailbox information */
#define T_MX 15 /* mail routing information */
#define T_TXT 16 /* text strings */
#define T_RP 17 /* responsible person */
#define T_AFSDB 18 /* AFS cell database */
#define T_X25 19 /* X_25 calling address */
#define T_ISDN 20 /* ISDN calling address */
#define T_RT 21 /* router */
#define T_NSAP 22 /* NSAP address */
#define T_NSAP_PTR 23 /* reverse NSAP lookup (deprecated) */
#define T_SIG 24 /* security signature */
#define T_KEY 25 /* security key */
#define T_PX 26 /* X.400 mail mapping */
#define T_GPOS 27 /* geographical position (withdrawn) */
#define T_AAAA 28 /* IP6 Address */
#define T_LOC 29 /* Location Information */
#define T_NXT 30 /* Next Valid Name in Zone */
#define T_EID 31 /* Endpoint identifier */
#define T_NIMLOC 32 /* Nimrod locator */
#define T_SRV 33 /* Server selection */
#define T_ATMA 34 /* ATM Address */
#define T_NAPTR 35 /* Naming Authority PoinTeR */
/* non standard */
#define T_UINFO 100 /* user (finger) information */
#define T_UID 101 /* user ID */
#define T_GID 102 /* group ID */
#define T_UNSPEC 103 /* Unspecified format (binary data) */
/* Query type values which do not appear in resource records */
#define T_IXFR 251 /* incremental zone transfer */
#define T_AXFR 252 /* transfer zone of authority */
#define T_MAILB 253 /* transfer mailbox records */
#define T_MAILA 254 /* transfer mail agent records */
#define T_ANY 255 /* wildcard match */
 
#define T_WINS 0xFF01 /* WINS name lookup */
#define T_WINSR 0xFF02 /* WINS reverse lookup */
 
/*
* Values for class field
*/
 
#define C_IN 1 /* the arpa internet */
#define C_CHAOS 3 /* for chaos net (MIT) */
#define C_HS 4 /* for Hesiod name server (MIT) (XXX) */
/* Query class values which do not appear in resource records */
#define C_ANY 255 /* wildcard match */
 
/*
* Status return codes for T_UNSPEC conversion routines
*/
#define CONV_SUCCESS 0
#define CONV_OVERFLOW (-1)
#define CONV_BADFMT (-2)
#define CONV_BADCKSUM (-3)
#define CONV_BADBUFLEN (-4)
 
#include <sys/packon.h>
 
/*
* Structure for query header. The order of the fields is machine- and
* compiler-dependent, depending on the byte/bit order and the layout
* of bit fields. We use bit fields only in int variables, as this
* is all ANSI requires. This requires a somewhat confusing rearrangement.
*/
 
typedef struct {
unsigned id :16; /* query identification number */
 
/* fields in third byte */
unsigned rd :1; /* recursion desired */
unsigned tc :1; /* truncated message */
unsigned aa :1; /* authoritative answer */
unsigned opcode :4; /* purpose of message */
unsigned qr :1; /* response flag */
 
/* fields in fourth byte */
unsigned rcode :4; /* response code */
unsigned cd: 1; /* checking disabled by resolver */
unsigned ad: 1; /* authentic data from named */
unsigned unused :1; /* unused bits (MBZ as of 4.9.3a3) */
unsigned ra :1; /* recursion available */
 
/* remaining bytes */
unsigned qdcount :16; /* number of question entries */
unsigned ancount :16; /* number of answer entries */
unsigned nscount :16; /* number of authority entries */
unsigned arcount :16; /* number of resource entries */
} HEADER;
 
 
/*
* Defines for handling compressed domain names
*/
#define INDIR_MASK 0xc0
 
/*
* Structure for passing resource records around.
*/
struct rrec {
u_short r_zone; /* zone number */
u_short r_class; /* class number */
u_short r_type; /* type number */
u_long r_ttl; /* time to live */
int r_size; /* size of data area */
char *r_data; /* pointer to data */
};
 
#include <sys/packoff.h>
 
 
__BEGIN_DECLS
 
W32_FUNC u_short _getshort (const u_char *);
W32_FUNC u_long _getlong (const u_char *);
 
__END_DECLS
 
/*
* Inline versions of get/put short/long. Pointer is advanced.
*
* These macros demonstrate the property of C whereby it can be
* portable or it can be elegant but rarely both.
*/
#define GETSHORT(s, cp) do { \
register u_char *t_cp = (u_char *)(cp); \
(s) = ((u_short)t_cp[0] << 8) \
| ((u_short)t_cp[1]); \
(cp) += INT16SZ; \
} while (0)
 
#define GETLONG(l, cp) do { \
register u_char *t_cp = (u_char *)(cp); \
(l) = ((u_long)t_cp[0] << 24) \
| ((u_long)t_cp[1] << 16) \
| ((u_long)t_cp[2] << 8) \
| ((u_long)t_cp[3]); \
(cp) += INT32SZ; \
} while (0)
 
#define PUTSHORT(s, cp) do { \
register u_short t_s = (u_short)(s); \
register u_char *t_cp = (u_char *)(cp); \
*t_cp++ = (u_char) (t_s >> 8); \
*t_cp = (u_char) t_s; \
(cp) += INT16SZ; \
} while (0)
 
#define PUTLONG(l, cp) do { \
register u_long t_l = (u_long)(l); \
register u_char *t_cp = (u_char *)(cp); \
*t_cp++ = (u_char) (t_l >> 24); \
*t_cp++ = (u_char) (t_l >> 16); \
*t_cp++ = (u_char) (t_l >> 8); \
*t_cp = (u_char) t_l; \
(cp) += INT32SZ; \
} while (0)
 
#endif
/pkgnet/trunk/watt32/inc/arpa/telnet.h
0,0 → 1,347
/*!\file arpa/telnet.h
* Telnet definitions.
*/
 
/*
* Copyright (c) 1983, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)telnet.h 8.2 (Berkeley) 12/15/93
*/
 
#ifndef __ARPA_TELNET_H
#define __ARPA_TELNET_H
 
#ifndef __SYS_W32API_H
#include <sys/w32api.h>
#endif
 
/*
* Definitions for the TELNET protocol.
*/
#define IAC 255 /* interpret as command: */
#define DONT 254 /* you are not to use option */
#define DO 253 /* please, you use option */
#define WONT 252 /* I won't use option */
#define WILL 251 /* I will use option */
#define SB 250 /* interpret as subnegotiation */
#define GA 249 /* you may reverse the line */
#define EL 248 /* erase the current line */
#define EC 247 /* erase the current character */
#define AYT 246 /* are you there */
#define AO 245 /* abort output--but let prog finish */
#define IP 244 /* interrupt process--permanently */
#define BREAK 243 /* break */
#define DM 242 /* data mark--for connect. cleaning */
#define NOP 241 /* nop */
#define SE 240 /* end sub negotiation */
#define EOR 239 /* end of record (transparent mode) */
#define ABORT 238 /* Abort process */
#define SUSP 237 /* Suspend process */
#define xEOF 236 /* End of file: EOF is already used... */
 
#define SYNCH 242 /* for telfunc calls */
 
#ifdef TELCMDS
const char *telcmds[] = {
"EOF", "SUSP", "ABORT", "EOR",
"SE", "NOP", "DMARK", "BRK", "IP", "AO", "AYT", "EC",
"EL", "GA", "SB", "WILL", "WONT", "DO", "DONT", "IAC", 0
};
#else
W32_DATA const char *telcmds[];
#endif
 
#define TELCMD_FIRST xEOF
#define TELCMD_LAST IAC
#define TELCMD_OK(x) ((unsigned int)(x) <= TELCMD_LAST && \
(unsigned int)(x) >= TELCMD_FIRST)
#define TELCMD(x) telcmds[(x)-TELCMD_FIRST]
 
/* telnet options
*/
#define TELOPT_BINARY 0 /* 8-bit data path */
#define TELOPT_ECHO 1 /* echo */
#define TELOPT_RCP 2 /* prepare to reconnect */
#define TELOPT_SGA 3 /* suppress go ahead */
#define TELOPT_NAMS 4 /* approximate message size */
#define TELOPT_STATUS 5 /* give status */
#define TELOPT_TM 6 /* timing mark */
#define TELOPT_RCTE 7 /* remote controlled transmission and echo */
#define TELOPT_NAOL 8 /* negotiate about output line width */
#define TELOPT_NAOP 9 /* negotiate about output page size */
#define TELOPT_NAOCRD 10 /* negotiate about CR disposition */
#define TELOPT_NAOHTS 11 /* negotiate about horizontal tabstops */
#define TELOPT_NAOHTD 12 /* negotiate about horizontal tab disposition */
#define TELOPT_NAOFFD 13 /* negotiate about formfeed disposition */
#define TELOPT_NAOVTS 14 /* negotiate about vertical tab stops */
#define TELOPT_NAOVTD 15 /* negotiate about vertical tab disposition */
#define TELOPT_NAOLFD 16 /* negotiate about output LF disposition */
#define TELOPT_XASCII 17 /* extended ascic character set */
#define TELOPT_LOGOUT 18 /* force logout */
#define TELOPT_BM 19 /* byte macro */
#define TELOPT_DET 20 /* data entry terminal */
#define TELOPT_SUPDUP 21 /* supdup protocol */
#define TELOPT_SUPDUPOUTPUT 22 /* supdup output */
#define TELOPT_SNDLOC 23 /* send location */
#define TELOPT_TTYPE 24 /* terminal type */
#define TELOPT_EOR 25 /* end or record */
#define TELOPT_TUID 26 /* TACACS user identification */
#define TELOPT_OUTMRK 27 /* output marking */
#define TELOPT_TTYLOC 28 /* terminal location number */
#define TELOPT_3270REGIME 29 /* 3270 regime */
#define TELOPT_X3PAD 30 /* X.3 PAD */
#define TELOPT_NAWS 31 /* window size */
#define TELOPT_TSPEED 32 /* terminal speed */
#define TELOPT_LFLOW 33 /* remote flow control */
#define TELOPT_LINEMODE 34 /* Linemode option */
#define TELOPT_XDISPLOC 35 /* X Display Location */
#define TELOPT_OLD_ENVIRON 36 /* Old - Environment variables */
#define TELOPT_AUTHENTICATION 37 /* Authenticate */
#define TELOPT_ENCRYPT 38 /* Encryption option */
#define TELOPT_NEW_ENVIRON 39 /* New - Environment variables */
#define TELOPT_EXOPL 255 /* extended-options-list */
 
#define NTELOPTS (1+TELOPT_NEW_ENVIRON)
 
#ifdef TELOPTS
const char *telopts[NTELOPTS+1] = {
"BINARY", "ECHO", "RCP", "SUPPRESS GO AHEAD", "NAME",
"STATUS", "TIMING MARK", "RCTE", "NAOL", "NAOP",
"NAOCRD", "NAOHTS", "NAOHTD", "NAOFFD", "NAOVTS",
"NAOVTD", "NAOLFD", "EXTEND ASCII", "LOGOUT", "BYTE MACRO",
"DATA ENTRY TERMINAL", "SUPDUP", "SUPDUP OUTPUT",
"SEND LOCATION", "TERMINAL TYPE", "END OF RECORD",
"TACACS UID", "OUTPUT MARKING", "TTYLOC",
"3270 REGIME", "X.3 PAD", "NAWS", "TSPEED", "LFLOW",
"LINEMODE", "XDISPLOC", "OLD-ENVIRON", "AUTHENTICATION",
"ENCRYPT", "NEW-ENVIRON", 0
};
#define TELOPT_FIRST TELOPT_BINARY
#define TELOPT_LAST TELOPT_NEW_ENVIRON
#define TELOPT_OK(x) ((unsigned int)(x) <= TELOPT_LAST)
#define TELOPT(x) telopts[(x)-TELOPT_FIRST]
#endif
 
/* sub-option qualifiers
*/
#define TELQUAL_IS 0 /* option is... */
#define TELQUAL_SEND 1 /* send option */
#define TELQUAL_INFO 2 /* ENVIRON: informational version of IS */
#define TELQUAL_REPLY 2 /* AUTHENTICATION: client version of IS */
#define TELQUAL_NAME 3 /* AUTHENTICATION: client version of IS */
 
#define LFLOW_OFF 0 /* Disable remote flow control */
#define LFLOW_ON 1 /* Enable remote flow control */
#define LFLOW_RESTART_ANY 2 /* Restart output on any char */
#define LFLOW_RESTART_XON 3 /* Restart output only on XON */
 
/* LINEMODE suboptions
*/
#define LM_MODE 1
#define LM_FORWARDMASK 2
#define LM_SLC 3
 
#define MODE_EDIT 0x01
#define MODE_TRAPSIG 0x02
#define MODE_ACK 0x04
#define MODE_SOFT_TAB 0x08
#define MODE_LIT_ECHO 0x10
 
#define MODE_MASK 0x1f
 
/* Not part of protocol, but needed to simplify things...
*/
#define MODE_FLOW 0x0100
#define MODE_ECHO 0x0200
#define MODE_INBIN 0x0400
#define MODE_OUTBIN 0x0800
#define MODE_FORCE 0x1000
 
#define SLC_SYNCH 1
#define SLC_BRK 2
#define SLC_IP 3
#define SLC_AO 4
#define SLC_AYT 5
#define SLC_EOR 6
#define SLC_ABORT 7
#define SLC_EOF 8
#define SLC_SUSP 9
#define SLC_EC 10
#define SLC_EL 11
#define SLC_EW 12
#define SLC_RP 13
#define SLC_LNEXT 14
#define SLC_XON 15
#define SLC_XOFF 16
#define SLC_FORW1 17
#define SLC_FORW2 18
#define SLC_MCL 19
#define SLC_MCR 20
#define SLC_MCWL 21
#define SLC_MCWR 22
#define SLC_MCBOL 23
#define SLC_MCEOL 24
#define SLC_INSRT 25
#define SLC_OVER 26
#define SLC_ECR 27
#define SLC_EWR 28
#define SLC_EBOL 29
#define SLC_EEOL 30
 
#define NSLC 30
 
/*
* For backwards compatability, we define SLC_NAMES to be the
* list of names if SLC_NAMES is not defined.
*/
#define SLC_NAMELIST "0", "SYNCH", "BRK", "IP", "AO", "AYT", "EOR", \
"ABORT", "EOF", "SUSP", "EC", "EL", "EW", "RP", \
"LNEXT", "XON", "XOFF", "FORW1", "FORW2", \
"MCL", "MCR", "MCWL", "MCWR", "MCBOL", \
"MCEOL", "INSRT", "OVER", "ECR", "EWR", \
"EBOL", "EEOL", \
0
#ifdef SLC_NAMES
const char *slc_names[] = { SLC_NAMELIST };
#else
W32_DATA const char *slc_names[];
#define SLC_NAMES SLC_NAMELIST
#endif
 
#define SLC_NAME_OK(x) ((unsigned int)(x) <= NSLC)
#define SLC_NAME(x) slc_names[x]
 
#define SLC_NOSUPPORT 0
#define SLC_CANTCHANGE 1
#define SLC_VARIABLE 2
#define SLC_DEFAULT 3
#define SLC_LEVELBITS 0x03
 
#define SLC_FUNC 0
#define SLC_FLAGS 1
#define SLC_VALUE 2
 
#define SLC_ACK 0x80
#define SLC_FLUSHIN 0x40
#define SLC_FLUSHOUT 0x20
 
#define OLD_ENV_VAR 1
#define OLD_ENV_VALUE 0
#define NEW_ENV_VAR 0
#define NEW_ENV_VALUE 1
#define ENV_ESC 2
#define ENV_USERVAR 3
 
/*
* AUTHENTICATION suboptions
*/
 
/* Who is authenticating who ...
*/
#define AUTH_WHO_CLIENT 0 /* Client authenticating server */
#define AUTH_WHO_SERVER 1 /* Server authenticating client */
#define AUTH_WHO_MASK 1
 
/* Amount of authentication done
*/
#define AUTH_HOW_ONE_WAY 0
#define AUTH_HOW_MUTUAL 2
#define AUTH_HOW_MASK 2
 
#define AUTHTYPE_NULL 0
#define AUTHTYPE_KERBEROS_V4 1
#define AUTHTYPE_KERBEROS_V5 2
#define AUTHTYPE_SPX 3
#define AUTHTYPE_MINK 4
#define AUTHTYPE_SRP 5
#define AUTHTYPE_CNT 6
 
#define AUTHTYPE_TEST 99
 
#ifdef AUTH_NAMES
const char *authtype_names[] = {
"NULL", "KERBEROS_V4", "KERBEROS_V5", "SPX", "MINK", "SRP", 0
};
#else
W32_DATA const char *authtype_names[];
#endif
 
#define AUTHTYPE_NAME_OK(x) ((unsigned int)(x) < AUTHTYPE_CNT)
#define AUTHTYPE_NAME(x) authtype_names[x]
 
/*
* ENCRYPTion suboptions
*/
#define ENCRYPT_IS 0 /* I pick encryption type ... */
#define ENCRYPT_SUPPORT 1 /* I support encryption types ... */
#define ENCRYPT_REPLY 2 /* Initial setup response */
#define ENCRYPT_START 3 /* Am starting to send encrypted */
#define ENCRYPT_END 4 /* Am ending encrypted */
#define ENCRYPT_REQSTART 5 /* Request you start encrypting */
#define ENCRYPT_REQEND 6 /* Request you send encrypting */
#define ENCRYPT_ENC_KEYID 7
#define ENCRYPT_DEC_KEYID 8
#define ENCRYPT_CNT 9
 
#define ENCTYPE_ANY 0
#define ENCTYPE_DES_CFB64 1
#define ENCTYPE_DES_OFB64 2
#define ENCTYPE_CAST5_40_CFB64 8
#define ENCTYPE_CAST5_40_OFB64 9
#define ENCTYPE_CAST128_CFB64 10
#define ENCTYPE_CAST128_OFB64 11
#define ENCTYPE_CNT 12
 
#ifdef ENCRYPT_NAMES
const char *encrypt_names[] = {
"IS", "SUPPORT", "REPLY", "START", "END",
"REQUEST-START", "REQUEST-END", "ENC-KEYID", "DEC-KEYID",
0
};
const char *enctype_names[] = {
"ANY", "DES_CFB64", "DES_OFB64", "UNKNOWN", "UNKNOWN", "UNKNOWN",
"UNKNOWN", "UNKNOWN", "CAST5_40_CFB64", "CAST5_40_OFB64",
"CAST128_CFB64", "CAST128_OFB64", 0,
};
#else
W32_DATA const char *encrypt_names[];
W32_DATA const char *enctype_names[];
#endif
 
 
#define ENCRYPT_NAME_OK(x) ((unsigned int)(x) < ENCRYPT_CNT)
#define ENCRYPT_NAME(x) encrypt_names[x]
 
#define ENCTYPE_NAME_OK(x) ((unsigned int)(x) < ENCTYPE_CNT)
#define ENCTYPE_NAME(x) enctype_names[x]
 
#endif
/pkgnet/trunk/watt32/inc/arpa/tftp.h
0,0 → 1,92
/*!\file arpa/tftp.h
* TFTP definitions.
*/
 
/*
* Copyright (c) 1983, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)tftp.h 8.1 (Berkeley) 6/2/93
* $FreeBSD: /repoman/r/ncvs/src/include/arpa/tftp.h,v 1.3.6.1 2002/08/14 21:59:26 peter Exp $
*/
 
#ifndef __ARPA_TFTP_H
#define __ARPA_TFTP_H
 
/*
* Trivial File Transfer Protocol (IEN-133)
*/
#define SEGSIZE 512 /* data segment size */
 
/*
* Packet types.
*/
#define RRQ 01 /* read request */
#define WRQ 02 /* write request */
#define DATA 03 /* data packet */
#define ACK 04 /* acknowledgement */
#undef ERROR /* In <wingdi.h> */
#define ERROR 05 /* error code */
#define OACK 06 /* option acknowledgement */
 
#include <sys/packon.h>
 
struct tftphdr {
unsigned short th_opcode; /* packet type */
union {
unsigned short tu_block; /* block # */
unsigned short tu_code; /* error code */
char tu_stuff[1]; /* request packet stuff */
} th_u;
char th_data[1]; /* data or error string */
};
 
#include <sys/packoff.h>
 
#define th_block th_u.tu_block
#define th_code th_u.tu_code
#define th_stuff th_u.tu_stuff
#define th_msg th_data
 
/*
* Error codes.
*/
#define EUNDEF 0 /* not defined */
#define ENOTFOUND 1 /* file not found */
#define EACCESS 2 /* access violation */
#define ENOSPACE 3 /* disk full or allocation exceeded */
#define EBADOP 4 /* illegal TFTP operation */
#define EBADID 5 /* unknown transfer ID */
#define EEXISTS 6 /* file already exists */
#define ENOUSER 7 /* no such user */
#define EOPTNEG 8 /* option negotiation failed */
 
#endif
/pkgnet/trunk/watt32/inc/copying.bsd
0,0 → 1,30
Copyright (c) 1987 Regents of the University of California.
All rights reserved.
 
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. All advertising materials mentioning features or use of this software
must display the following acknowledgement:
This product includes software developed by the University of
California, Berkeley and its contributors.
4. Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
/pkgnet/trunk/watt32/inc/err.h
0,0 → 1,8
/*!\file err.h
*
* Compatibility header (for Net/FreeBSD programs)
*/
#ifndef __SYS_WERRNO_H
#include <sys/werrno.h>
#endif
 
/pkgnet/trunk/watt32/inc/net/bpf.h
0,0 → 1,271
/*!\file net/bpf.h
* Berkeley Packet Filter.
*/
/*
* Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
* The Regents of the University of California. All rights reserved.
*
* This code is derived from the Stanford/CMU enet packet filter,
* (net/enet.c) distributed as part of 4.3BSD, and code contributed
* to Berkeley by Steven McCanne and Van Jacobson both of Lawrence
* Berkeley Laboratory.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)bpf.h 8.1 (Berkeley) 6/10/93
* @(#) Header: bpf.h,v 1.36 97/06/12 14:29:53 leres Exp (LBL)
*/
 
#ifndef __NET_BPF_H
#define __NET_BPF_H
 
#ifndef __SYS_WTYPES_H
#include <sys/wtypes.h>
#endif
 
#ifndef __SYS_WTIME_H
#include <sys/wtime.h>
#endif
 
/* BSD style release date */
#define BPF_RELEASE 199606
 
typedef long bpf_int32;
typedef u_int32_t bpf_u_int32;
 
/*
* Alignment macros. BPF_WORDALIGN rounds up to the next
* even multiple of BPF_ALIGNMENT.
*/
#define BPF_ALIGNMENT sizeof(long)
#define BPF_WORDALIGN(x) (((x)+(BPF_ALIGNMENT-1)) & ~(BPF_ALIGNMENT-1))
 
#define BPF_MAXINSNS 512
#define BPF_MAXBUFSIZE 0x8000
#define BPF_MINBUFSIZE 32
 
/*
* Structure for BIOCSETF.
*/
struct bpf_program {
u_int bf_len;
struct bpf_insn *bf_insns;
};
/*
* Struct returned by BIOCGSTATS.
*/
struct bpf_stat {
u_int bs_recv; /* number of packets received */
u_int bs_drop; /* number of packets dropped */
};
 
/*
* Struct return by BIOCVERSION. This represents the version number of
* the filter language described by the instruction encodings below.
* bpf understands a program iff kernel_major == filter_major &&
* kernel_minor >= filter_minor, that is, if the value returned by the
* running kernel has the same major number and a minor number equal
* equal to or less than the filter being downloaded. Otherwise, the
* results are undefined, meaning an error may be returned or packets
* may be accepted haphazardly.
* It has nothing to do with the source code version.
*/
struct bpf_version {
u_short bv_major;
u_short bv_minor;
};
 
/* Current version number of filter architecture. */
#define BPF_MAJOR_VERSION 1
#define BPF_MINOR_VERSION 1
 
/*
* BPF ioctls
*
* The first set is for compatibility with Sun's pcc style
* header files. If your using gcc, we assume that you
* have run fixincludes so the latter set should work.
*/
#if (defined(sun) || defined(ibm032)) && !defined(__GNUC__)
# define BIOCGBLEN _IOR(B,102, u_int)
# define BIOCSBLEN _IOWR(B,102, u_int)
# define BIOCSETF _IOW(B,103, struct bpf_program)
# define BIOCFLUSH _IO(B,104)
# define BIOCPROMISC _IO(B,105)
# define BIOCGDLT _IOR(B,106, u_int)
# define BIOCGETIF _IOR(B,107, struct ifreq)
# define BIOCSETIF _IOW(B,108, struct ifreq)
# define BIOCSRTIMEOUT _IOW(B,109, struct timeval)
# define BIOCGRTIMEOUT _IOR(B,110, struct timeval)
# define BIOCGSTATS _IOR(B,111, struct bpf_stat)
# define BIOCIMMEDIATE _IOW(B,112, u_int)
# define BIOCVERSION _IOR(B,113, struct bpf_version)
# define BIOCSTCPF _IOW(B,114, struct bpf_program)
# define BIOCSUDPF _IOW(B,115, struct bpf_program)
#else
# define BIOCGBLEN _IOR('B',102, u_int)
# define BIOCSBLEN _IOWR('B',102, u_int)
# define BIOCSETF _IOW('B',103, struct bpf_program)
# define BIOCFLUSH _IO('B',104)
# define BIOCPROMISC _IO('B',105)
# define BIOCGDLT _IOR('B',106, u_int)
# define BIOCGETIF _IOR('B',107, struct ifreq)
# define BIOCSETIF _IOW('B',108, struct ifreq)
# define BIOCSRTIMEOUT _IOW('B',109, struct timeval)
# define BIOCGRTIMEOUT _IOR('B',110, struct timeval)
# define BIOCGSTATS _IOR('B',111, struct bpf_stat)
# define BIOCIMMEDIATE _IOW('B',112, u_int)
# define BIOCVERSION _IOR('B',113, struct bpf_version)
# define BIOCSTCPF _IOW('B',114, struct bpf_program)
# define BIOCSUDPF _IOW('B',115, struct bpf_program)
#endif
 
/*
* Structure prepended to each packet.
*/
struct bpf_hdr {
struct timeval bh_tstamp; /* time stamp */
u_int32_t bh_caplen; /* length of captured portion */
u_int32_t bh_datalen; /* original length of packet */
u_int16_t bh_hdrlen; /* length of bpf header (this struct */
}; /* plus alignment padding) */
 
/*
* Because the structure above is not a multiple of 4 bytes, some compilers
* will insist on inserting padding; hence, sizeof(struct bpf_hdr) won't work.
* Only the kernel needs to know about it; applications use bh_hdrlen.
* XXX To save a few bytes on 32-bit machines, we avoid end-of-struct
* XXX padding by using the size of the header data elements. This is
* XXX fail-safe: on new machines, we just use the 'safe' sizeof.
*/
#define SIZEOF_BPF_HDR sizeof(struct bpf_hdr)
 
/*
* Data-link level type codes.
*/
#define DLT_NULL 0 /* no link-layer encapsulation */
#define DLT_EN10MB 1 /* Ethernet (10Mb) */
#define DLT_EN3MB 2 /* Experimental Ethernet (3Mb) */
#define DLT_AX25 3 /* Amateur Radio AX.25 */
#define DLT_PRONET 4 /* Proteon ProNET Token Ring */
#define DLT_CHAOS 5 /* Chaos */
#define DLT_IEEE802 6 /* IEEE 802 Networks */
#define DLT_ARCNET 7 /* ARCNET */
#define DLT_SLIP 8 /* Serial Line IP */
#define DLT_PPP 9 /* Point-to-point Protocol */
#define DLT_FDDI 10 /* FDDI */
#define DLT_ATM_RFC1483 11 /* LLC/SNAP encapsulated atm */
#define DLT_RAW 12 /* raw IP */
#define DLT_SLIP_BSDOS 13 /* BSD/OS Serial Line IP */
#define DLT_PPP_BSDOS 14 /* BSD/OS Point-to-point Protocol */
#define DLT_LANE8023 15 /* LANE 802.3(Ethernet) */
#define DLT_CIP 16 /* ATM Classical IP */
 
/*
* The instruction encondings.
*/
/* instruction classes */
#define BPF_CLASS(code) ((code) & 0x07)
#define BPF_LD 0x00
#define BPF_LDX 0x01
#define BPF_ST 0x02
#define BPF_STX 0x03
#define BPF_ALU 0x04
#define BPF_JMP 0x05
#define BPF_RET 0x06
#define BPF_MISC 0x07
 
/* ld/ldx fields */
#define BPF_SIZE(code) ((code) & 0x18)
#define BPF_W 0x00
#define BPF_H 0x08
#define BPF_B 0x10
#define BPF_MODE(code) ((code) & 0xe0)
#define BPF_IMM 0x00
#define BPF_ABS 0x20
#define BPF_IND 0x40
#define BPF_MEM 0x60
#define BPF_LEN 0x80
#define BPF_MSH 0xa0
 
/* alu/jmp fields */
#define BPF_OP(code) ((code) & 0xf0)
#define BPF_ADD 0x00
#define BPF_SUB 0x10
#define BPF_MUL 0x20
#define BPF_DIV 0x30
#define BPF_OR 0x40
#define BPF_AND 0x50
#define BPF_LSH 0x60
#define BPF_RSH 0x70
#define BPF_NEG 0x80
#define BPF_JA 0x00
#define BPF_JEQ 0x10
#define BPF_JGT 0x20
#define BPF_JGE 0x30
#define BPF_JSET 0x40
#define BPF_SRC(code) ((code) & 0x08)
#define BPF_K 0x00
#define BPF_X 0x08
 
/* ret - BPF_K and BPF_X also apply */
#define BPF_RVAL(code) ((code) & 0x18)
#define BPF_A 0x10
 
/* misc */
#define BPF_MISCOP(code) ((code) & 0xf8)
#define BPF_TAX 0x00
#define BPF_TXA 0x80
 
/*
* The instruction data structure.
*/
struct bpf_insn {
u_int16_t code;
u_char jt;
u_char jf;
int32_t k;
};
 
/*
* Macros for insn array initializers.
*/
#define BPF_STMT(code, k) { (u_int16_t)(code), 0, 0, k }
#define BPF_JUMP(code, k, jt, jf) { (u_int16_t)(code), jt, jf, k }
 
u_int bpf_filter (struct bpf_insn *, u_char *, u_int, u_int);
 
/*
* Number of scratch memory words (for BPF_LD|BPF_MEM and BPF_ST).
*/
#define BPF_MEMWORDS 16
 
#endif
/pkgnet/trunk/watt32/inc/net/bpfdesc.h
0,0 → 1,107
/*!\file net/bpfdesc.h
* Berkeley Packet Filter definitions.
*/
 
/* $NetBSD: bpfdesc.h,v 1.13 1997/10/09 18:58:12 christos Exp $ */
 
/*
* Copyright (c) 1990, 1991, 1993
* The Regents of the University of California. All rights reserved.
*
* This code is derived from the Stanford/CMU enet packet filter,
* (net/enet.c) distributed as part of 4.3BSD, and code contributed
* to Berkeley by Steven McCanne and Van Jacobson both of Lawrence
* Berkeley Laboratory.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)bpfdesc.h 8.1 (Berkeley) 6/10/93
*
* @(#) Header: bpfdesc.h,v 1.14 96/06/16 22:28:07 leres Exp (LBL)
*/
 
#ifndef __NET_BPF_DESC_H
#define __NET_BPF_DESC_H
 
/*
* Descriptor associated with each open bpf file.
*/
struct bpf_d {
struct bpf_d *bd_next; /* Linked list of descriptors */
/*
* Buffer slots: two mbuf clusters buffer the incoming packets.
* The model has three slots. Sbuf is always occupied.
* sbuf (store) - Receive interrupt puts packets here.
* hbuf (hold) - When sbuf is full, put cluster here and
* wakeup read (replace sbuf with fbuf).
* fbuf (free) - When read is done, put cluster here.
* On receiving, if sbuf is full and fbuf is 0, packet is dropped.
*/
caddr_t bd_sbuf; /* store slot */
caddr_t bd_hbuf; /* hold slot */
caddr_t bd_fbuf; /* free slot */
int bd_slen; /* current length of store buffer */
int bd_hlen; /* current length of hold buffer */
 
int bd_bufsize; /* absolute length of buffers */
 
struct bpf_if * bd_bif; /* interface descriptor */
u_long bd_rtout; /* Read timeout in 'ticks' */
struct bpf_insn *bd_filter; /* filter code */
u_long bd_rcount; /* number of packets received */
u_long bd_dcount; /* number of packets dropped */
 
u_char bd_promisc; /* true if listening promiscuously */
u_char bd_state; /* idle, waiting, or timed out */
u_char bd_immediate; /* true to return on packet arrival */
int bd_async; /* non-zero if packet reception should generate signal */
int bd_pgid; /* process or group id for signal */
#if BSD < 199103
u_char bd_selcoll; /* true if selects collide */
int bd_timedout;
struct proc * bd_selproc; /* process that last selected us */
#else
u_char bd_pad; /* explicit alignment */
struct selinfo bd_sel; /* bsd select info */
#endif
};
 
/*
* Descriptor associated with each attached hardware interface.
*/
struct bpf_if {
struct bpf_if *bif_next; /* list of all interfaces */
struct bpf_d *bif_dlist; /* descriptor list */
struct bpf_if **bif_driverp; /* pointer into softc */
u_int bif_dlt; /* link layer type */
u_int bif_hdrlen; /* length of header (with padding) */
struct ifnet *bif_ifp; /* correspoding interface */
};
 
#endif
/pkgnet/trunk/watt32/inc/net/ethertyp.h
0,0 → 1,68
/*!\file net/ethertyp.h
* Ethernet protocol types.
*/
 
/* $NetBSD: ethertypes.h,v 1.2 1997/03/15 18:12:19 is Exp $ */
 
/*
* Copyright (c) 1982, 1986, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)if_ether.h 8.1 (Berkeley) 6/10/93
*/
 
/*
* Ethernet protocol types.
*
* According to "assigned numbers", the Ethernet protocol numbers are also
* used as ARP protocol type numbers.
*
* I factor them out here to avoid pulling all the Ethernet header file
* into the hardware independent ARP code. -is
*/
 
#ifndef __NET_ETHERTYPE_H
#define __NET_ETHERTYPE_H
 
#define ETHERTYPE_PUP 0x0200 /* PUP protocol */
#define ETHERTYPE_IP 0x0800 /* IP protocol */
#define ETHERTYPE_ARP 0x0806 /* address resolution protocol */
#define ETHERTYPE_REVARP 0x8035 /* reverse addr resolution protocol */
 
/*
* The ETHERTYPE_NTRAILER packet types starting at ETHERTYPE_TRAIL have
* (type-ETHERTYPE_TRAIL)*512 bytes of data followed
* by an ETHER type (as given above) and then the (variable-length) header.
*/
#define ETHERTYPE_TRAIL 0x1000 /* Trailer packet */
#define ETHERTYPE_NTRAILER 16
 
#endif
/pkgnet/trunk/watt32/inc/net/if.h
0,0 → 1,354
/*!\file net/if.h
* Network interface data.
*/
 
/* $NetBSD: if.h,v 1.29 1997/10/02 19:41:57 is Exp $ */
 
/*
* Copyright (c) 1982, 1986, 1989, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)if.h 8.1 (Berkeley) 6/10/93
*/
 
#ifndef __NET_IF_H
#define __NET_IF_H
 
#include <sys/queue.h>
 
/*
* Structures defining a network interface, providing a packet
* transport mechanism (ala level 0 of the PUP protocols).
*
* Each interface accepts output datagrams of a specified maximum
* length, and provides higher level routines with input datagrams
* received from its medium.
*
* Output occurs when the routine if_output is called, with four parameters:
* (*ifp->if_output)(ifp, m, dst, rt)
* Here m is the mbuf chain to be sent and dst is the destination address.
* The output routine encapsulates the supplied datagram if necessary,
* and then transmits it on its medium.
*
* On input, each interface unwraps the data received by it, and either
* places it on the input queue of a internetwork datagram routine
* and posts the associated software interrupt, or passes the datagram to a raw
* packet input routine.
*
* Routines exist for locating interfaces by their addresses
* or for locating a interface on a certain network, as well as more general
* routing and gateway routines maintaining information used to locate
* interfaces. These routines live in the files if.c and route.c
*/
#ifndef __SYS_WTIME_H
#include <sys/wtime.h>
#endif
 
struct mbuf;
struct rtentry;
struct ether_header;
struct proc { int dummy; };
struct socket { int dummy; };
 
/*
* Structure defining statistics and other data kept regarding a network
* interface.
*/
struct if_data {
/* generic interface information */
u_char ifi_type; /* ethernet, tokenring, etc. */
u_char ifi_addrlen; /* media address length */
u_char ifi_hdrlen; /* media header length */
u_long ifi_mtu; /* maximum transmission unit */
u_long ifi_metric; /* routing metric (external only) */
u_long ifi_baudrate; /* linespeed */
/* volatile statistics */
u_long ifi_ipackets; /* packets received on interface */
u_long ifi_ierrors; /* input errors on interface */
u_long ifi_opackets; /* packets sent on interface */
u_long ifi_oerrors; /* output errors on interface */
u_long ifi_collisions; /* collisions on csma interfaces */
u_long ifi_ibytes; /* total number of octets received */
u_long ifi_obytes; /* total number of octets sent */
u_long ifi_imcasts; /* packets received via multicast */
u_long ifi_omcasts; /* packets sent via multicast */
u_long ifi_iqdrops; /* dropped on input, this interface */
u_long ifi_noproto; /* destined for unsupported protocol */
struct timeval ifi_lastchange; /* last updated */
};
 
/*
* Structure defining a queue for a network interface.
*
* (Would like to call this struct ``if'', but C isn't PL/1.)
*/
TAILQ_HEAD(ifnet_head, ifnet); /* the actual queue head */
 
/*
* Length of interface external name, including terminating '\0'.
* Note: this is the same size as a generic device's external name.
*/
#define IFNAMSIZ 16
 
#ifndef IF_NAMESIZE
#define IF_NAMESIZE IFNAMSIZ
#endif
 
struct ifnet { /* and the entries */
void *if_softc; /* lower-level data for this if */
TAILQ_ENTRY(ifnet) if_list; /* all struct ifnets are chained */
TAILQ_HEAD(xx, ifaddr) if_addrlist; /* linked list of addresses per if */
char if_xname[IFNAMSIZ]; /* external name (name + unit) */
int if_pcount; /* number of promiscuous listeners */
caddr_t if_bpf; /* packet filter structure */
u_short if_index; /* numeric abbreviation for this if */
short if_timer; /* time 'til if_watchdog called */
short if_flags; /* up/down, broadcast, etc. */
short if__pad1; /* be nice to m68k ports */
struct if_data if_data; /* statistics and other data about if */
/* procedure handles */
int (*if_output) /* output routine (enqueue) */
(struct ifnet *, struct mbuf *, struct sockaddr *,
struct rtentry *);
void (*if_start) /* initiate output routine */
(struct ifnet *);
int (*if_ioctl) /* ioctl routine */
(struct ifnet *, u_long, caddr_t);
int (*if_reset) /* XXX bus reset routine */
(struct ifnet *);
void (*if_watchdog) /* timer routine */
(struct ifnet *);
struct ifqueue {
struct mbuf *ifq_head;
struct mbuf *ifq_tail;
int ifq_len;
int ifq_maxlen;
int ifq_drops;
} if_snd; /* output queue */
struct sockaddr_dl *if_sadl; /* pointer to our sockaddr_dl */
u_int8_t *if_broadcastaddr; /* linklevel broadcast bytestring */
};
 
#define if_mtu if_data.ifi_mtu
#define if_type if_data.ifi_type
#define if_addrlen if_data.ifi_addrlen
#define if_hdrlen if_data.ifi_hdrlen
#define if_metric if_data.ifi_metric
#define if_baudrate if_data.ifi_baudrate
#define if_ipackets if_data.ifi_ipackets
#define if_ierrors if_data.ifi_ierrors
#define if_opackets if_data.ifi_opackets
#define if_oerrors if_data.ifi_oerrors
#define if_collisions if_data.ifi_collisions
#define if_ibytes if_data.ifi_ibytes
#define if_obytes if_data.ifi_obytes
#define if_imcasts if_data.ifi_imcasts
#define if_omcasts if_data.ifi_omcasts
#define if_iqdrops if_data.ifi_iqdrops
#define if_noproto if_data.ifi_noproto
#define if_lastchange if_data.ifi_lastchange
 
#define IFF_UP 0x1 /* interface is up */
#define IFF_BROADCAST 0x2 /* broadcast address valid */
#define IFF_DEBUG 0x4 /* turn on debugging */
#define IFF_LOOPBACK 0x8 /* is a loopback net */
#define IFF_POINTOPOINT 0x10 /* interface is point-to-point link */
#define IFF_NOTRAILERS 0x20 /* avoid use of trailers */
#define IFF_RUNNING 0x40 /* resources allocated */
#define IFF_NOARP 0x80 /* no address resolution protocol */
#define IFF_PROMISC 0x100 /* receive all packets */
#define IFF_ALLMULTI 0x200 /* receive all multicast packets */
#define IFF_OACTIVE 0x400 /* transmission in progress */
#define IFF_SIMPLEX 0x800 /* can't hear own transmissions */
#define IFF_LINK0 0x1000 /* per link layer defined bit */
#define IFF_LINK1 0x2000 /* per link layer defined bit */
#define IFF_LINK2 0x4000 /* per link layer defined bit */
#define IFF_MULTICAST 0x8000 /* supports multicast */
 
/* flags set internally only: */
#define IFF_CANTCHANGE \
(IFF_BROADCAST|IFF_POINTOPOINT|IFF_RUNNING|IFF_OACTIVE|\
IFF_SIMPLEX|IFF_MULTICAST|IFF_ALLMULTI)
 
/*
* Output queues (ifp->if_snd) and internetwork datagram level (pup level 1)
* input routines have queues of messages stored on ifqueue structures
* (defined above). Entries are added to and deleted from these structures
* by these macros, which should be called with ipl raised to splimp().
*/
#define IF_QFULL(ifq) ((ifq)->ifq_len >= (ifq)->ifq_maxlen)
#define IF_DROP(ifq) ((ifq)->ifq_drops++)
#define IF_ENQUEUE(ifq, m) { \
(m)->m_nextpkt = 0; \
if ((ifq)->ifq_tail == 0) \
(ifq)->ifq_head = m; \
else \
(ifq)->ifq_tail->m_nextpkt = m; \
(ifq)->ifq_tail = m; \
(ifq)->ifq_len++; \
}
#define IF_PREPEND(ifq, m) { \
(m)->m_nextpkt = (ifq)->ifq_head; \
if ((ifq)->ifq_tail == 0) \
(ifq)->ifq_tail = (m); \
(ifq)->ifq_head = (m); \
(ifq)->ifq_len++; \
}
#define IF_DEQUEUE(ifq, m) { \
(m) = (ifq)->ifq_head; \
if (m) { \
if (((ifq)->ifq_head = (m)->m_nextpkt) == 0) \
(ifq)->ifq_tail = 0; \
(m)->m_nextpkt = 0; \
(ifq)->ifq_len--; \
} \
}
 
#define IFQ_MAXLEN 50
#define IFNET_SLOWHZ 1 /* granularity is 1 second */
 
/*
* The ifaddr structure contains information about one address
* of an interface. They are maintained by the different address families,
* are allocated and attached when an address is set, and are linked
* together so all addresses for an interface can be located.
*/
struct ifaddr {
struct sockaddr *ifa_addr; /* address of interface */
struct sockaddr *ifa_dstaddr; /* other end of p-to-p link */
#define ifa_broadaddr ifa_dstaddr /* broadcast address interface */
struct sockaddr *ifa_netmask; /* used to determine subnet */
struct ifnet *ifa_ifp; /* back-pointer to interface */
TAILQ_ENTRY(ifaddr) ifa_list; /* list of addresses for interface */
void (*ifa_rtrequest) /* check or clean routes (+ or -)'d */
(int, struct rtentry *, struct sockaddr *);
u_short ifa_flags; /* mostly rt_flags for cloning */
short ifa_refcnt; /* count of references */
int ifa_metric; /* cost of going out this interface */
};
#define IFA_ROUTE RTF_UP /* route installed */
 
/*
* Message format for use in obtaining information about interfaces
* from sysctl and the routing socket.
*/
struct if_msghdr {
u_short ifm_msglen; /* to skip over non-understood messages */
u_char ifm_version; /* future binary compatability */
u_char ifm_type; /* message type */
int ifm_addrs; /* like rtm_addrs */
int ifm_flags; /* value of if_flags */
u_short ifm_index; /* index for associated ifp */
struct if_data ifm_data;/* statistics and other data about if */
};
 
/*
* Message format for use in obtaining information about interface addresses
* from sysctl and the routing socket.
*/
struct ifa_msghdr {
u_short ifam_msglen; /* to skip over non-understood messages */
u_char ifam_version; /* future binary compatability */
u_char ifam_type; /* message type */
int ifam_addrs; /* like rtm_addrs */
int ifam_flags; /* value of ifa_flags */
u_short ifam_index; /* index for associated ifp */
int ifam_metric; /* value of ifa_metric */
};
 
/*
* Interface request structure used for socket
* ioctl's. All interface ioctl's must have parameter
* definitions which begin with ifr_name. The
* remainder may be interface specific.
*/
struct ifreq {
char ifr_name[IFNAMSIZ]; /* if name, e.g. "en0" */
union {
struct sockaddr ifru_addr;
struct sockaddr ifru_dstaddr;
struct sockaddr ifru_hwaddr;
struct sockaddr ifru_broadaddr;
short ifru_flags;
int ifru_metric;
int ifru_mtu;
caddr_t ifru_data;
} ifr_ifru;
#define ifr_addr ifr_ifru.ifru_addr /* address */
#define ifr_dstaddr ifr_ifru.ifru_dstaddr /* other end of p-to-p link */
#define ifr_hwaddr ifr_ifru.ifru_hwaddr /* hardware address */
#define ifr_broadaddr ifr_ifru.ifru_broadaddr /* broadcast address */
#define ifr_flags ifr_ifru.ifru_flags /* flags */
#define ifr_metric ifr_ifru.ifru_metric /* metric */
#define ifr_mtu ifr_ifru.ifru_mtu /* mtu */
#define ifr_media ifr_ifru.ifru_metric /* media options (overload) */
#define ifr_data ifr_ifru.ifru_data /* for use by interface */
};
 
struct ifaliasreq {
char ifra_name[IFNAMSIZ]; /* if name, e.g. "en0" */
struct sockaddr ifra_addr;
struct sockaddr ifra_dstaddr;
#define ifra_broadaddr ifra_dstaddr
struct sockaddr ifra_mask;
};
 
struct ifmediareq {
char ifm_name[IFNAMSIZ]; /* if name, e.g. "en0" */
int ifm_current; /* current media options */
int ifm_mask; /* don't care mask */
int ifm_status; /* media status */
int ifm_active; /* active options */
int ifm_count; /* # entries in ifm_ulist array */
int *ifm_ulist; /* media words */
};
 
/*
* Structure used in SIOCGIFCONF request.
* Used to retrieve interface configuration
* for machine (useful for programs which
* must know all networks accessible).
*/
struct ifconf {
int ifc_len; /* size of associated buffer */
union {
caddr_t ifcu_buf;
struct ifreq *ifcu_req;
} ifc_ifcu;
#define ifc_buf ifc_ifcu.ifcu_buf /* buffer address */
#define ifc_req ifc_ifcu.ifcu_req /* array of structures returned */
};
 
#ifndef __NET_IF_ARP_H
#include <net/if_arp.h>
#endif
 
#endif
/pkgnet/trunk/watt32/inc/net/if_arc.h
0,0 → 1,123
/*!\file net/if_arc.h
* ARC-net definitions.
*/
 
/* $NetBSD: if_arc.h,v 1.6 1997/03/15 18:12:30 is Exp $ */
 
/*
* Copyright (c) 1982, 1986, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: NetBSD: if_ether.h,v 1.10 1994/06/29 06:37:55 cgd Exp
* @(#)if_ether.h 8.1 (Berkeley) 6/10/93
*/
 
#ifndef __NET_IF_ARC_H
#define __NET_IF_ARC_H
 
#include <sys/packon.h>
 
/*
* Arcnet address - 1 octets
* don't know who uses this.
*/
struct arc_addr {
u_int8_t arc_addr_octet[1];
};
 
/*
* Structure of a 2.5MB/s Arcnet header.
* as given to interface code.
*/
struct arc_header {
u_int8_t arc_shost;
u_int8_t arc_dhost;
u_int8_t arc_type;
/*
* only present for newstyle encoding with LL fragmentation.
* Don't use sizeof(anything), use ARC_HDR{,NEW}LEN instead.
*/
u_int8_t arc_flag;
u_int16_t arc_seqid;
 
/*
* only present in exception packets (arc_flag == 0xff)
*/
u_int8_t arc_type2; /* same as arc_type */
u_int8_t arc_flag2; /* real flag value */
u_int16_t arc_seqid2; /* real seqid value */
};
 
#define ARC_ADDR_LEN 1
 
#define ARC_HDRLEN 3
#define ARC_HDRNEWLEN 6
 
/* these lengths are data link layer length - 2*ARC_ADDR_LEN */
#define ARC_MIN_LEN 1
#define ARC_MIN_FORBID_LEN 254
#define ARC_MAX_FORBID_LEN 256
#define ARC_MAX_LEN 508
 
 
/* RFC 1051 */
#define ARCTYPE_IP_OLD 240 /* IP protocol */
#define ARCTYPE_ARP_OLD 241 /* address resolution protocol */
 
/* RFC 1201 */
#define ARCTYPE_IP 212 /* IP protocol */
#define ARCTYPE_ARP 213 /* address resolution protocol */
#define ARCTYPE_REVARP 214 /* reverse addr resolution protocol */
 
#define ARCTYPE_ATALK 221 /* Appletalk */
#define ARCTYPE_BANIAN 247 /* Banyan Vines */
#define ARCTYPE_IPX 250 /* Novell IPX */
 
#define ARCMTU 507
#define ARCMIN 0
 
struct arccom {
struct ifnet ac_if; /* network-visible interface */
 
u_int16_t ac_seqid; /* seq. id used by PHDS encap. */
 
struct ac_frag {
u_int8_t af_maxflag; /* from first packet */
u_int8_t af_lastseen; /* last split flag seen */
u_int16_t af_seqid;
struct mbuf *af_packet;
} ac_fragtab[256]; /* indexed by sender ll address */
 
};
 
#include <sys/packoff.h>
 
#endif
/pkgnet/trunk/watt32/inc/net/if_arp.h
0,0 → 1,117
/*!\file net/if_arp.h
* ARP definitions.
*/
 
/* $NetBSD: if_arp.h,v 1.12 1997/09/08 02:06:30 mikel Exp $ */
 
/*
* Copyright (c) 1986, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)if_arp.h 8.1 (Berkeley) 6/10/93
*/
 
#ifndef __NET_IF_ARP_H
#define __NET_IF_ARP_H
/*
* Address Resolution Protocol.
*
* See RFC 826 for protocol description. ARP packets are variable
* in size; the arphdr structure defines the fixed-length portion.
* Protocol type values are the same as those for 10 Mb/s Ethernet.
* It is followed by the variable-sized fields ar_sha, arp_spa,
* arp_tha and arp_tpa in that order, according to the lengths
* specified. Field names used correspond to RFC 826.
*/
 
#include <sys/packon.h>
 
struct arphdr {
u_int16_t ar_hrd; /* format of hardware address */
#define ARPHRD_ETHER 1 /* ethernet hardware format */
#define ARPHRD_TOKEN 6 /* TokenRing hardware format */
#define ARPHRD_ARCNET 7 /* ethernet hardware format */
#define ARPHRD_FRELAY 15 /* frame relay hardware format */
#define ARPHRD_STRIP 23 /* Ricochet Starmode Radio hardware format */
u_int16_t ar_pro; /* format of protocol address */
u_int8_t ar_hln; /* length of hardware address */
u_int8_t ar_pln; /* length of protocol address */
u_int16_t ar_op; /* one of: */
#define ARPOP_REQUEST 1 /* request to resolve address */
#define ARPOP_REPLY 2 /* response to previous request */
#define ARPOP_REVREQUEST 3 /* request protocol address given hardware */
#define ARPOP_REVREPLY 4 /* response giving protocol address */
#define ARPOP_INVREQUEST 8 /* request to identify peer */
#define ARPOP_INVREPLY 9 /* response identifying peer */
/*
* The remaining fields are variable in size,
* according to the sizes above.
*/
#ifdef COMMENT_ONLY
u_int8_t ar_sha[]; /* sender hardware address */
u_int8_t ar_spa[]; /* sender protocol address */
u_int8_t ar_tha[]; /* target hardware address */
u_int8_t ar_tpa[]; /* target protocol address */
#endif
#ifdef __GNUC__ /* only GNU C allows zero arrays */
u_int8_t ar_remain[0]; /* minimum size, normally bigger */
#define ar_sha(ap) (((ap)->ar_remain)+0)
#define ar_spa(ap) (((ap)->ar_remain)+(ap)->ar_hln)
#define ar_tha(ap) (((ap)->ar_remain)+(ap)->ar_hln+(ap)->ar_pln)
#define ar_tpa(ap) (((ap)->ar_remain)+2*(ap)->ar_hln+(ap)->ar_pln)
#else
#define ar_sha(ap) (((ap)->ar_op)+2)
#define ar_spa(ap) (((ap)->ar_op)+2+(ap)->ar_hln)
#define ar_tha(ap) (((ap)->ar_op)+2+(ap)->ar_hln+(ap)->ar_pln)
#define ar_tpa(ap) (((ap)->ar_op)+2+2*(ap)->ar_hln+(ap)->ar_pln)
#endif
};
 
 
/*
* ARP ioctl request
*/
struct arpreq {
struct sockaddr arp_pa; /* protocol address */
struct sockaddr arp_ha; /* hardware address */
int arp_flags; /* flags */
};
 
#include <sys/packoff.h>
 
/* arp_flags and at_flags field values */
#define ATF_INUSE 0x01 /* entry in use */
#define ATF_COM 0x02 /* completed entry (enaddr valid) */
#define ATF_PERM 0x04 /* permanent entry */
#define ATF_PUBL 0x08 /* publish entry (respond for other host) */
#define ATF_USETRAILERS 0x10 /* has requested trailers */
 
#endif
/pkgnet/trunk/watt32/inc/net/if_atm.h
0,0 → 1,110
/*!\file net/if_atm.h
* ATM definitions.
*/
 
/* $NetBSD: if_atm.h,v 1.7 1996/11/09 23:02:27 chuck Exp $ */
 
/*
*
* Copyright (c) 1996 Charles D. Cranor and Washington University.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Charles D. Cranor and
* Washington University.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
 
/*
* net/if_atm.h
*/
 
#ifndef __NET_IF_ATM_H
#define __NET_IF_ATM_H
 
#if defined(__NetBSD__) || defined(__OpenBSD__) || defined(__bsdi__)
#define RTALLOC1(A,B) rtalloc1((A),(B))
#elif defined(__FreeBSD__)
#define RTALLOC1(A,B) rtalloc1((A),(B),0UL)
#endif
 
#include <sys/packon.h>
 
/*
* pseudo header for packet transmission
*/
 
struct atm_pseudohdr {
u_int8_t atm_ph[4]; /* flags+VPI+VCI1(msb)+VCI2(lsb) */
};
 
#define ATM_PH_FLAGS(X) ((X)->atm_ph[0])
#define ATM_PH_VPI(X) ((X)->atm_ph[1])
#define ATM_PH_VCI(X) ((((X)->atm_ph[2]) << 8) | ((X)->atm_ph[3]))
#define ATM_PH_SETVCI(X,V) { \
(X)->atm_ph[2] = ((V) >> 8) & 0xff; \
(X)->atm_ph[3] = ((V) & 0xff); \
}
 
#define ATM_PH_AAL5 0x01 /* use AAL5? (0 == aal0) */
#define ATM_PH_LLCSNAP 0x02 /* use the LLC SNAP encoding (iff aal5) */
 
#define ATM_PH_DRIVER7 0x40 /* reserve for driver's use */
#define ATM_PH_DRIVER8 0x80 /* reserve for driver's use */
 
#define ATMMTU 9180 /* ATM MTU size for IP */
/* XXX: could be 9188 with LLC/SNAP according
to comer */
 
/* user's ioctl hook for raw atm mode */
#define SIOCRAWATM _IOWR('a', 122, int) /* set driver's raw mode */
 
/* atm_pseudoioctl: turns on and off RX VCIs [for internal use only!] */
struct atm_pseudoioctl {
struct atm_pseudohdr aph;
void *rxhand;
};
#define SIOCATMENA _IOWR('a', 123, struct atm_pseudoioctl) /* enable */
#define SIOCATMDIS _IOWR('a', 124, struct atm_pseudoioctl) /* disable */
 
/*
* XXX forget all the garbage in if_llc.h and do it the easy way
*/
 
#define ATMLLC_HDR "\252\252\3\0\0\0"
struct atmllc {
u_int8_t llchdr[6]; /* aa.aa.03.00.00.00 */
u_int8_t type[2]; /* "ethernet" type */
};
 
#include <sys/packoff.h>
 
/* ATM_LLC macros: note type code in host byte order */
#define ATM_LLC_TYPE(X) (((X)->type[0] << 8) | ((X)->type[1]))
#define ATM_LLC_SETTYPE(X,V) { \
(X)->type[1] = ((V) >> 8) & 0xff; \
(X)->type[0] = ((V) & 0xff); \
}
 
#endif
/pkgnet/trunk/watt32/inc/net/if_dl.h
0,0 → 1,95
/*!\file net/if_dl.h
* Link-level sockaddr_dl definition.
*/
 
/* $NetBSD: if_dl.h,v 1.8 1995/03/26 20:30:13 jtc Exp $ */
 
/*
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)if_dl.h 8.1 (Berkeley) 6/10/93
*/
#ifndef __NET_IF_DL_H
#define __NET_IF_DL_H
 
#ifndef __SYS_W32API_H
#include <sys/w32api.h>
#endif
 
#ifndef __SYS_CDEFS_H
#include <sys/cdefs.h>
#endif
 
/*
* A Link-Level Sockaddr may specify the interface in one of two
* ways: either by means of a system-provided index number (computed
* anew and possibly differently on every reboot), or by a human-readable
* string such as "il0" (for managerial convenience).
*
* Census taking actions, such as something akin to SIOCGCONF would return
* both the index and the human name.
*
* High volume transactions (such as giving a link-level ``from'' address
* in a recvfrom or recvmsg call) may be likely only to provide the indexed
* form, (which requires fewer copy operations and less space).
*
* The form and interpretation of the link-level address is purely a matter
* of convention between the device driver and its consumers; however, it is
* expected that all drivers for an interface of a given if_type will agree.
*/
 
/*
* Structure of a Link-Level sockaddr:
*/
struct sockaddr_dl {
u_char sdl_len; /* Total length of sockaddr */
u_char sdl_family; /* AF_DLI */
u_int16_t sdl_index; /* if != 0, system given index for interface */
u_char sdl_type; /* interface type */
u_char sdl_nlen; /* interface name length, no trailing 0 reqd. */
u_char sdl_alen; /* link level address length */
u_char sdl_slen; /* link layer selector length */
char sdl_data[12]; /* minimum work area, can be larger;
contains both if name and ll address */
};
 
#define LLADDR(s) ((caddr_t)((s)->sdl_data + (s)->sdl_nlen))
 
 
__BEGIN_DECLS
 
W32_FUNC void link_addr (const char *, struct sockaddr_dl *);
W32_FUNC char *link_ntoa (const struct sockaddr_dl *);
 
__END_DECLS
 
#endif
/pkgnet/trunk/watt32/inc/net/if_ether.h
0,0 → 1,5
/*!\file net/if_ether.h
* Compatability header.
*/
#include <netinet/if_ether.h>
 
/pkgnet/trunk/watt32/inc/net/if_fddi.h
0,0 → 1,4
/*!\file inc/net/if_fddi.h
* Compatability header.
*/
#include <netinet/if_fddi.h>
/pkgnet/trunk/watt32/inc/net/if_llc.h
0,0 → 1,164
/*!\file net/if_llc.h
* IEEE 802.2 Link Level Control.
*/
 
/* $NetBSD: if_llc.h,v 1.9 1997/05/02 21:08:54 christos Exp $ */
 
/*
* Copyright (c) 1988, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)if_llc.h 8.1 (Berkeley) 6/10/93
*/
#ifndef __NET_IF_LLC_H
#define __NET_IF_LLC_H
 
/*
* IEEE 802.2 Link Level Control headers, for use in conjunction with
* 802.{3,4,5} media access control methods.
*
* Headers here do not use bit fields due to shortcommings in many
* compilers.
*/
 
#include <sys/packon.h>
 
struct llc {
u_int8_t llc_dsap;
u_int8_t llc_ssap;
union {
struct {
u_int8_t control;
u_int8_t format_id;
u_int8_t class;
u_int8_t window_x2;
} type_u;
struct {
u_int8_t num_snd_x2;
u_int8_t num_rcv_x2;
} type_i;
struct {
u_int8_t control;
u_int8_t num_rcv_x2;
} type_s;
struct {
u_int8_t control;
/*
* We cannot put the following fields in a structure because
* the structure rounding might cause padding.
*/
u_int8_t frmr_rej_pdu0;
u_int8_t frmr_rej_pdu1;
u_int8_t frmr_control;
u_int8_t frmr_control_ext;
u_int8_t frmr_cause;
} type_frmr;
struct {
u_int8_t control;
u_int8_t org_code[3];
u_int16_t ether_type;
} type_snap;
struct {
u_int8_t control;
u_int8_t control_ext;
} type_raw;
} llc_un;
};
 
struct frmrinfo {
u_int8_t frmr_rej_pdu0;
u_int8_t frmr_rej_pdu1;
u_int8_t frmr_control;
u_int8_t frmr_control_ext;
u_int8_t frmr_cause;
};
 
#include <sys/packoff.h>
 
#define llc_control llc_un.type_u.control
#define llc_control_ext llc_un.type_raw.control_ext
#define llc_fid llc_un.type_u.format_id
#define llc_class llc_un.type_u.class
#define llc_window llc_un.type_u.window_x2
#define llc_frmrinfo llc_un.type_frmr.frmr_rej_pdu0
#define llc_frmr_pdu0 llc_un.type_frmr.frmr_rej_pdu0
#define llc_frmr_pdu1 llc_un.type_frmr.frmr_rej_pdu1
#define llc_frmr_control llc_un.type_frmr.frmr_control
#define llc_frmr_control_ext llc_un.type_frmr.frmr_control_ext
#define llc_frmr_cause llc_un.type_frmr.frmr_cause
 
/*
* Don't use sizeof(struct llc_un) for LLC header sizes
*/
#define LLC_ISFRAMELEN 4
#define LLC_UFRAMELEN 3
#define LLC_FRMRLEN 7
 
/*
* Unnumbered LLC format commands
*/
#define LLC_UI 0x3
#define LLC_UI_P 0x13
#define LLC_DISC 0x43
#define LLC_DISC_P 0x53
#define LLC_UA 0x63
#define LLC_UA_P 0x73
#define LLC_TEST 0xe3
#define LLC_TEST_P 0xf3
#define LLC_FRMR 0x87
#define LLC_FRMR_P 0x97
#define LLC_DM 0x0f
#define LLC_DM_P 0x1f
#define LLC_XID 0xaf
#define LLC_XID_P 0xbf
#define LLC_SABME 0x6f
#define LLC_SABME_P 0x7f
 
/*
* Supervisory LLC commands
*/
#define LLC_RR 0x01
#define LLC_RNR 0x05
#define LLC_REJ 0x09
 
/*
* Info format - dummy only
*/
#define LLC_INFO 0x00
 
/*
* ISO PDTR 10178 contains among others
*/
#define LLC_X25_LSAP 0x7e
#define LLC_SNAP_LSAP 0xaa
#define LLC_ISO_LSAP 0xfe
 
#endif
/pkgnet/trunk/watt32/inc/net/if_media.h
0,0 → 1,258
/*!\file net/if_media.h
* Network interface media selection.
*/
 
/* $NetBSD: if_media.h,v 1.3 1997/03/26 01:19:27 thorpej Exp $ */
 
/*
* Copyright (c) 1997
* Jonathan Stone and Jason R. Thorpe. All rights reserved.
*
* This software is derived from information provided by Matt Thomas.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Jonathan Stone
* and Jason R. Thorpe for the NetBSD Project.
* 4. The names of the authors may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
 
#ifndef __NET_IF_MEDIA_H
#define __NET_IF_MEDIA_H
 
/*
* Prototypes and definitions for BSD/OS-compatible network interface
* media selection.
*
* Where it is safe to do so, this code strays slightly from the BSD/OS
* design. Software which uses the API (device drivers, basically)
* shouldn't notice any difference.
*
* Many thanks to Matt Thomas for providing the information necessary
* to implement this interface.
*/
 
 
/*
* if_media Options word:
* Bits Use
* ---- -------
* 0-3 Media variant
* 4 RFU
* 5-7 Media type
* 8-15 Type specific options
* 16-19 RFU
* 20-27 Shared (global) options
* 28-31 Instance
*/
 
/*
* Ethernet
*/
#define IFM_ETHER 0x00000020
#define IFM_10_T 3 /* 10BaseT - RJ45 */
#define IFM_10_2 4 /* 10Base2 - Thinnet */
#define IFM_10_5 5 /* 10Base5 - AUI */
#define IFM_100_TX 6 /* 100BaseTX - RJ45 */
#define IFM_100_FX 7 /* 100BaseFX - Fiber */
#define IFM_100_T4 8 /* 100BaseT4 - 4 pair cat 3 */
#define IFM_100_VG 9 /* 100VG-AnyLAN */
#define IFM_100_T2 10 /* 100BaseT2 */
 
/*
* Token ring
*/
#define IFM_TOKEN 0x00000040
#define IFM_TOK_STP4 3 /* Shielded twisted pair 4m - DB9 */
#define IFM_TOK_STP16 4 /* Shielded twisted pair 16m - DB9 */
#define IFM_TOK_UTP4 5 /* Unshielded twisted pair 4m - RJ45 */
#define IFM_TOK_UTP16 6 /* Unshielded twisted pair 16m - RJ45 */
#define IFM_TOK_ETR 0x00000200 /* Early token release */
#define IFM_TOK_SRCRT 0x00000400 /* Enable source routing features */
#define IFM_TOK_ALLR 0x00000800 /* All routes / Single route bcast */
 
/*
* FDDI
*/
#define IFM_FDDI 0x00000060
#define IFM_FDDI_SMF 3 /* Single-mode fiber */
#define IFM_FDDI_MMF 4 /* Multi-mode fiber */
#define IFM_FDDI_UTP 5 /* CDDI / UTP */
#define IFM_FDDI_DA 0x00000100 /* Dual attach / single attach */
 
/*
* Shared media sub-types
*/
#define IFM_AUTO 0 /* Autoselect best media */
#define IFM_MANUAL 1 /* Jumper/dipswitch selects media */
#define IFM_NONE 2 /* Deselect all media */
 
/*
* Shared options
*/
#define IFM_FDX 0x00100000 /* Force full duplex */
#define IFM_HDX 0x00200000 /* Force half duplex */
#define IFM_FLAG0 0x01000000 /* Driver defined flag */
#define IFM_FLAG1 0x02000000 /* Driver defined flag */
#define IFM_FLAG2 0x04000000 /* Driver defined flag */
#define IFM_LOOP 0x08000000 /* Put hardware in loopback */
 
/*
* Masks
*/
#define IFM_NMASK 0x000000e0 /* Network type */
#define IFM_TMASK 0x0000000f /* Media sub-type */
#define IFM_IMASK 0xf0000000 /* Instance */
#define IFM_ISHIFT 28 /* Instance shift */
#define IFM_OMASK 0x0000ff00 /* Type specific options */
#define IFM_GMASK 0x0ff00000 /* Global options */
 
/*
* Status bits
*/
#define IFM_AVALID 0x00000001 /* Active bit valid */
#define IFM_ACTIVE 0x00000002 /* Interface attached to working net */
 
/*
* Macros to extract various bits of information from the media word.
*/
#define IFM_TYPE(x) ((x) & IFM_NMASK)
#define IFM_SUBTYPE(x) ((x) & IFM_TMASK)
#define IFM_INST(x) (((x) & IFM_IMASK) >> IFM_ISHIFT)
 
/*
* NetBSD extension not defined in the BSDI API. This is used in various
* places to get the canonical description for a given type/subtype.
*
* NOTE: all but the top-level type descriptions must contain NO whitespace!
* Otherwise, parsing these in ifconfig(8) would be a nightmare.
*/
struct ifmedia_description {
int ifmt_word; /* word value; may be masked */
const char *ifmt_string; /* description */
};
 
#define IFM_TYPE_DESCRIPTIONS { \
{ IFM_ETHER, "Ethernet" }, \
{ IFM_TOKEN, "Token ring" }, \
{ IFM_FDDI, "FDDI" }, \
{ 0, NULL }, \
}
 
#define IFM_SUBTYPE_ETHERNET_DESCRIPTIONS { \
{ IFM_10_T, "10baseT/UTP" }, \
{ IFM_10_2, "10base2/BNC" }, \
{ IFM_10_5, "10base5/AUI" }, \
{ IFM_100_TX, "100baseTX" }, \
{ IFM_100_FX, "100baseFX" }, \
{ IFM_100_T4, "100baseT4" }, \
{ IFM_100_VG, "100baseVG" }, \
{ IFM_100_T2, "100baseT2" }, \
{ 0, NULL }, \
}
 
#define IFM_SUBTYPE_ETHERNET_ALIASES { \
{ IFM_10_T, "UTP" }, \
{ IFM_10_T, "10UTP" }, \
{ IFM_10_2, "BNC" }, \
{ IFM_10_2, "10BNC" }, \
{ IFM_10_5, "AUI" }, \
{ IFM_10_5, "10AUI" }, \
{ IFM_100_TX, "100TX" }, \
{ IFM_100_FX, "100FX" }, \
{ IFM_100_T4, "100T4" }, \
{ IFM_100_VG, "100VG" }, \
{ IFM_100_T2, "100T2" }, \
{ 0, NULL }, \
}
 
#define IFM_SUBTYPE_ETHERNET_OPTION_DESCRIPTIONS { \
{ 0, NULL }, \
}
 
#define IFM_SUBTYPE_TOKENRING_DESCRIPTIONS { \
{ IFM_TOK_STP4, "DB9/4Mbit" }, \
{ IFM_TOK_STP16, "DB9/16Mbit" }, \
{ IFM_TOK_UTP4, "UTP/4Mbit" }, \
{ IFM_TOK_UTP16, "UTP/16Mbit" }, \
{ 0, NULL }, \
}
 
#define IFM_SUBTYPE_TOKENRING_ALIASES { \
{ IFM_TOK_STP4, "4STP" }, \
{ IFM_TOK_STP16, "16STP" }, \
{ IFM_TOK_UTP4, "4UTP" }, \
{ IFM_TOK_UTP16, "16UTP" }, \
{ 0, NULL }, \
}
 
#define IFM_SUBTYPE_TOKENRING_OPTION_DESCRIPTIONS { \
{ IFM_TOK_ETR, "EarlyTokenRelease" }, \
{ IFM_TOK_SRCRT, "SourceRouting" }, \
{ IFM_TOK_ALLR, "AllRoutes" }, \
{ 0, NULL }, \
}
 
#define IFM_SUBTYPE_FDDI_DESCRIPTIONS { \
{ IFM_FDDI_SMF, "Single-mode" }, \
{ IFM_FDDI_MMF, "Multi-mode" }, \
{ IFM_FDDI_UTP, "UTP" }, \
{ 0, NULL }, \
}
 
#define IFM_SUBTYPE_FDDI_ALIASES { \
{ IFM_FDDI_SMF, "SMF" }, \
{ IFM_FDDI_MMF, "MMF" }, \
{ IFM_FDDI_UTP, "CDDI" }, \
{ 0, NULL }, \
}
 
#define IFM_SUBTYPE_FDDI_OPTION_DESCRIPTIONS { \
{ IFM_FDDI_DA, "Dual-attach" }, \
{ 0, NULL }, \
}
 
#define IFM_SUBTYPE_SHARED_DESCRIPTIONS { \
{ IFM_AUTO, "autoselect" }, \
{ IFM_MANUAL, "manual" }, \
{ IFM_NONE, "none" }, \
{ 0, NULL }, \
}
 
#define IFM_SUBTYPE_SHARED_ALIASES { \
{ IFM_AUTO, "auto" }, \
{ 0, NULL }, \
}
 
#define IFM_SHARED_OPTION_DESCRIPTIONS { \
{ IFM_FDX, "full-duplex" }, \
{ IFM_HDX, "half-duplex" }, \
{ IFM_FLAG0, "flag0" }, \
{ IFM_FLAG1, "flag1" }, \
{ IFM_FLAG2, "flag2" }, \
{ IFM_LOOP, "hw-loopback" }, \
{ 0, NULL }, \
}
 
#endif
/pkgnet/trunk/watt32/inc/net/if_packe.h
0,0 → 1,108
/*!\file net/if_packe.h
*
* Linux compatability header.
*/
#ifndef __LINUX_IF_PACKET_H
#define __LINUX_IF_PACKET_H
 
struct sockaddr_pkt
{
unsigned short spkt_family;
unsigned char spkt_device[14];
unsigned short spkt_protocol;
};
 
struct sockaddr_ll
{
unsigned short sll_family;
unsigned short sll_protocol;
int sll_ifindex;
unsigned short sll_hatype;
unsigned char sll_pkttype;
unsigned char sll_halen;
unsigned char sll_addr[8];
};
 
/* Packet types */
 
#define PACKET_HOST 0 /* To us */
#define PACKET_BROADCAST 1 /* To all */
#define PACKET_MULTICAST 2 /* To group */
#define PACKET_OTHERHOST 3 /* To someone else */
#define PACKET_OUTGOING 4 /* Outgoing of any type */
 
/* These ones are invisible by user level */
#define PACKET_LOOPBACK 5 /* MC/BRD frame looped back */
#define PACKET_FASTROUTE 6 /* Fastrouted frame */
 
/* Packet socket options */
 
#define PACKET_ADD_MEMBERSHIP 1
#define PACKET_DROP_MEMBERSHIP 2
#define PACKET_RECV_OUTPUT 3
 
/* Value 4 is still used by obsolete turbo-packet. */
#define PACKET_RX_RING 5
#define PACKET_STATISTICS 6
#define PACKET_COPY_THRESH 7
 
struct tpacket_stats
{
unsigned int tp_packets;
unsigned int tp_drops;
};
 
struct tpacket_hdr
{
unsigned long tp_status;
#define TP_STATUS_KERNEL 0
#define TP_STATUS_USER 1
#define TP_STATUS_COPY 2
#define TP_STATUS_LOSING 4
#define TP_STATUS_CSUMNOTREADY 8
unsigned int tp_len;
unsigned int tp_snaplen;
unsigned short tp_mac;
unsigned short tp_net;
unsigned int tp_sec;
unsigned int tp_usec;
};
 
#define TPACKET_ALIGNMENT 16
#define TPACKET_ALIGN(x) (((x)+TPACKET_ALIGNMENT-1) & ~(TPACKET_ALIGNMENT-1))
#define TPACKET_HDRLEN (TPACKET_ALIGN(sizeof(struct tpacket_hdr)) + sizeof(struct sockaddr_ll))
 
/*
Frame structure:
 
- Start. Frame must be aligned to TPACKET_ALIGNMENT=16
- struct tpacket_hdr
- pad to TPACKET_ALIGNMENT=16
- struct sockaddr_ll
- Gap, chosen so that packet data (Start+tp_net) alignes to TPACKET_ALIGNMENT=16
- Start+tp_mac: [ Optional MAC header ]
- Start+tp_net: Packet data, aligned to TPACKET_ALIGNMENT=16.
- Pad to align to TPACKET_ALIGNMENT=16
*/
 
struct tpacket_req
{
unsigned int tp_block_size; /* Minimal size of contiguous block */
unsigned int tp_block_nr; /* Number of blocks */
unsigned int tp_frame_size; /* Size of frame */
unsigned int tp_frame_nr; /* Total number of frames */
};
 
struct packet_mreq
{
int mr_ifindex;
unsigned short mr_type;
unsigned short mr_alen;
unsigned char mr_address[8];
};
 
#define PACKET_MR_MULTICAST 0
#define PACKET_MR_PROMISC 1
#define PACKET_MR_ALLMULTI 2
 
#endif
/pkgnet/trunk/watt32/inc/net/if_ppp.h
0,0 → 1,133
/*!\file net/if_ppp.h
* PPP definitions.
*/
 
/* $NetBSD: if_ppp.h,v 1.14 1997/05/17 21:12:02 christos Exp $ */
/* Id: if_ppp.h,v 1.16 1997/04/30 05:46:04 paulus Exp */
 
/*
* if_ppp.h - Point-to-Point Protocol definitions.
*
* Copyright (c) 1989 Carnegie Mellon University.
* All rights reserved.
*
* Redistribution and use in source and binary forms are permitted
* provided that the above copyright notice and this paragraph are
* duplicated in all such forms and that any documentation,
* advertising materials, and other materials related to such
* distribution and use acknowledge that the software was developed
* by Carnegie Mellon University. The name of the
* University may not be used to endorse or promote products derived
* from this software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
 
#ifndef __NET_IF_PPP_H
#define __NET_IF_PPP_H
 
/*
* Bit definitions for flags.
*/
#define SC_COMP_PROT 0x00000001 /* protocol compression (output) */
#define SC_COMP_AC 0x00000002 /* header compression (output) */
#define SC_COMP_TCP 0x00000004 /* TCP (VJ) compression (output) */
#define SC_NO_TCP_CCID 0x00000008 /* disable VJ connection-id comp. */
#define SC_REJ_COMP_AC 0x00000010 /* reject adrs/ctrl comp. on input */
#define SC_REJ_COMP_TCP 0x00000020 /* reject TCP (VJ) comp. on input */
#define SC_CCP_OPEN 0x00000040 /* Look at CCP packets */
#define SC_CCP_UP 0x00000080 /* May send/recv compressed packets */
#define SC_DEBUG 0x00010000 /* enable debug messages */
#define SC_LOG_INPKT 0x00020000 /* log contents of good pkts recvd */
#define SC_LOG_OUTPKT 0x00040000 /* log contents of pkts sent */
#define SC_LOG_RAWIN 0x00080000 /* log all chars received */
#define SC_LOG_FLUSH 0x00100000 /* log all chars flushed */
#define SC_RCV_B7_0 0x01000000 /* have rcvd char with bit 7 = 0 */
#define SC_RCV_B7_1 0x02000000 /* have rcvd char with bit 7 = 1 */
#define SC_RCV_EVNP 0x04000000 /* have rcvd char with even parity */
#define SC_RCV_ODDP 0x08000000 /* have rcvd char with odd parity */
#define SC_MASK 0x0fff00ff /* bits that user can change */
 
/*
* State bits in sc_flags, not changeable by user.
*/
#define SC_TIMEOUT 0x00000400 /* timeout is currently pending */
#define SC_VJ_RESET 0x00000800 /* need to reset VJ decomp */
#define SC_COMP_RUN 0x00001000 /* compressor has been inited */
#define SC_DECOMP_RUN 0x00002000 /* decompressor has been inited */
#define SC_DC_ERROR 0x00004000 /* non-fatal decomp error detected */
#define SC_DC_FERROR 0x00008000 /* fatal decomp error detected */
#define SC_TBUSY 0x10000000 /* xmitter doesn't need a packet yet */
#define SC_PKTLOST 0x20000000 /* have lost or dropped a packet */
#define SC_FLUSH 0x40000000 /* flush input until next PPP_FLAG */
#define SC_ESCAPED 0x80000000 /* saw a PPP_ESCAPE */
 
/*
* Ioctl definitions.
*/
 
struct npioctl {
int protocol; /* PPP procotol, e.g. PPP_IP */
enum NPmode mode;
};
 
/* Structure describing a CCP configuration option, for PPPIOCSCOMPRESS */
struct ppp_option_data {
u_char *ptr;
u_int length;
int transmit;
};
 
struct ifpppstatsreq {
char ifr_name[IFNAMSIZ];
struct ppp_stats stats;
};
 
struct ifpppcstatsreq {
char ifr_name[IFNAMSIZ];
struct ppp_comp_stats stats;
};
 
/*
* Ioctl definitions.
*/
 
#define PPPIOCGFLAGS _IOR('t', 90, int) /* get configuration flags */
#define PPPIOCSFLAGS _IOW('t', 89, int) /* set configuration flags */
#define PPPIOCGASYNCMAP _IOR('t', 88, int) /* get async map */
#define PPPIOCSASYNCMAP _IOW('t', 87, int) /* set async map */
#define PPPIOCGUNIT _IOR('t', 86, int) /* get ppp unit number */
#define PPPIOCGRASYNCMAP _IOR('t', 85, int) /* get receive async map */
#define PPPIOCSRASYNCMAP _IOW('t', 84, int) /* set receive async map */
#define PPPIOCGMRU _IOR('t', 83, int) /* get max receive unit */
#define PPPIOCSMRU _IOW('t', 82, int) /* set max receive unit */
#define PPPIOCSMAXCID _IOW('t', 81, int) /* set VJ max slot ID */
#define PPPIOCGXASYNCMAP _IOR('t', 80, ext_accm) /* get extended ACCM */
#define PPPIOCSXASYNCMAP _IOW('t', 79, ext_accm) /* set extended ACCM */
#define PPPIOCXFERUNIT _IO('t', 78) /* transfer PPP unit */
#define PPPIOCSCOMPRESS _IOW('t', 77, struct ppp_option_data)
#define PPPIOCGNPMODE _IOWR('t', 76, struct npioctl) /* get NP mode */
#define PPPIOCSNPMODE _IOW('t', 75, struct npioctl) /* set NP mode */
#define PPPIOCGIDLE _IOR('t', 74, struct ppp_idle) /* get idle time */
#ifdef PPP_FILTER
#define PPPIOCSPASS _IOW('t', 71, struct bpf_program) /* set pass filter */
#define PPPIOCSACTIVE _IOW('t', 70, struct bpf_program) /* set active filt */
#endif /* PPP_FILTER */
 
/* PPPIOC[GS]MTU are alternatives to SIOC[GS]IFMTU, used under Ultrix */
#define PPPIOCGMTU _IOR('t', 73, int) /* get interface MTU */
#define PPPIOCSMTU _IOW('t', 72, int) /* set interface MTU */
 
/*
* These two are interface ioctls so that pppstats can do them on
* a socket without having to open the serial device.
*/
#define SIOCGPPPSTATS _IOWR('i', 123, struct ifpppstatsreq)
#define SIOCGPPPCSTATS _IOWR('i', 122, struct ifpppcstatsreq)
 
#ifndef ifr_mtu
#define ifr_mtu ifr_ifru.ifru_metric
#endif
 
#endif
/pkgnet/trunk/watt32/inc/net/if_pppva.h
0,0 → 1,110
/*!\file net/if_pppva.h
* PPP structures and declarations.
*/
 
/* $NetBSD: if_pppvar.h,v 1.7 1997/05/17 21:12:03 christos Exp $ */
/* Id: if_pppvar.h,v 1.3 1996/07/01 01:04:37 paulus Exp */
 
/*
* if_pppvar.h - private structures and declarations for PPP.
*
* Copyright (c) 1994 The Australian National University.
* All rights reserved.
*
* Permission to use, copy, modify, and distribute this software and its
* documentation is hereby granted, provided that the above copyright
* notice appears in all copies. This software is provided without any
* warranty, express or implied. The Australian National University
* makes no representations about the suitability of this software for
* any purpose.
*
* IN NO EVENT SHALL THE AUSTRALIAN NATIONAL UNIVERSITY BE LIABLE TO ANY
* PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
* THE AUSTRALIAN NATIONAL UNIVERSITY HAVE BEEN ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE.
*
* THE AUSTRALIAN NATIONAL UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
* ON AN "AS IS" BASIS, AND THE AUSTRALIAN NATIONAL UNIVERSITY HAS NO
* OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS,
* OR MODIFICATIONS.
*
* Copyright (c) 1989 Carnegie Mellon University.
* All rights reserved.
*
* Redistribution and use in source and binary forms are permitted
* provided that the above copyright notice and this paragraph are
* duplicated in all such forms and that any documentation,
* advertising materials, and other materials related to such
* distribution and use acknowledge that the software was developed
* by Carnegie Mellon University. The name of the
* University may not be used to endorse or promote products derived
* from this software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
 
#ifndef __NET_IF_PPPVAR_H
#define __NET_IF_PPPVAR_H
 
/*
* Supported network protocols. These values are used for
* indexing sc_npmode.
*/
#define NP_IP 0 /* Internet Protocol */
#define NUM_NP 1 /* Number of NPs. */
 
/*
* Structure describing each ppp unit.
*/
struct ppp_softc {
struct ifnet sc_if; /* network-visible interface */
int sc_unit; /* XXX unit number */
u_int sc_flags; /* control/status bits; see if_ppp.h */
void *sc_devp; /* pointer to device-dep structure */
void (*sc_start) __P((struct ppp_softc *)); /* start output proc */
void (*sc_ctlp) __P((struct ppp_softc *)); /* rcvd control pkt */
void (*sc_relinq) __P((struct ppp_softc *)); /* relinquish ifunit */
u_int16_t sc_mru; /* max receive unit */
int sc_xfer; /* used in transferring unit */
struct ifqueue sc_rawq; /* received packets */
struct ifqueue sc_inq; /* queue of input packets for daemon */
struct ifqueue sc_fastq; /* interactive output packet q */
struct mbuf *sc_togo; /* output packet ready to go */
struct mbuf *sc_npqueue; /* output packets not to be sent yet */
struct mbuf **sc_npqtail; /* ptr to last next ptr in npqueue */
struct pppstat sc_stats; /* count of bytes/pkts sent/rcvd */
caddr_t sc_bpf; /* hook for BPF */
enum NPmode sc_npmode[NUM_NP]; /* what to do with each NP */
struct compressor *sc_xcomp; /* transmit compressor */
void *sc_xc_state; /* transmit compressor state */
struct compressor *sc_rcomp; /* receive decompressor */
void *sc_rc_state; /* receive decompressor state */
time_t sc_last_sent; /* time (secs) last NP pkt sent */
time_t sc_last_recv; /* time (secs) last NP pkt rcvd */
#ifdef PPP_FILTER
struct bpf_program sc_pass_filt; /* filter for packets to pass */
struct bpf_program sc_active_filt; /* filter for "non-idle" packets */
#endif /* PPP_FILTER */
#ifdef VJC
struct slcompress *sc_comp; /* vjc control buffer */
#endif
 
/* Device-dependent part for async lines. */
ext_accm sc_asyncmap; /* async control character map */
u_int32_t sc_rasyncmap; /* receive async control char map */
struct mbuf *sc_outm; /* mbuf chain currently being output */
struct mbuf *sc_m; /* pointer to input mbuf chain */
struct mbuf *sc_mc; /* pointer to current input mbuf */
char *sc_mp; /* ptr to next char in input mbuf */
u_int16_t sc_ilen; /* length of input packet so far */
u_int16_t sc_fcs; /* FCS so far (input) */
u_int16_t sc_outfcs; /* FCS so far for output packet */
u_char sc_rawin[16]; /* chars as received */
int sc_rawin_count; /* # in sc_rawin */
};
 
#endif
/pkgnet/trunk/watt32/inc/net/if_slvar.h
0,0 → 1,85
/*!\file net/if_slvar.h
* SLIP interface structures.
*/
 
/* $NetBSD: if_slvar.h,v 1.17 1997/03/27 20:36:17 thorpej Exp $ */
 
/*-
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)if_slvar.h 8.3 (Berkeley) 2/1/94
*/
#ifndef __NET_IF_SLVAR_H
#define __NET_IF_SLVAR_H
 
/*
* Definitions for SLIP interface data structures
*
* (This exists so programs like slstats can get at the definition
* of sl_softc.)
*/
 
struct sl_softc {
struct ifnet sc_if; /* network-visible interface */
int sc_unit; /* XXX unit number */
struct ifqueue sc_fastq; /* interactive output queue */
struct tty *sc_ttyp; /* pointer to tty structure */
u_char *sc_mp; /* pointer to next available buf char */
u_char *sc_ep; /* pointer to last available buf char */
u_char *sc_buf; /* input buffer */
u_char *sc_xxx; /* XXX don't ask... */
u_int sc_flags; /* see below */
u_int sc_escape; /* =1 if last char input was FRAME_ESCAPE */
long sc_lasttime; /* last time a char arrived */
long sc_abortcount; /* number of abort esacpe chars */
long sc_starttime; /* time of first abort in window */
long sc_oqlen; /* previous output queue size */
long sc_otimeout; /* number of times output's stalled */
#ifdef NetBSD
int sc_oldbufsize; /* previous output buffer size */
int sc_oldbufquot; /* previous output buffer quoting */
#endif
#ifdef INET /* XXX */
struct slcompress sc_comp; /* tcp compression data */
#endif
caddr_t sc_bpf; /* BPF data */
};
 
/* internal flags */
#define SC_ERROR 0x0001 /* had an input error */
 
/* visible flags */
#define SC_COMPRESS IFF_LINK0 /* compress TCP traffic */
#define SC_NOICMP IFF_LINK1 /* supress ICMP traffic */
#define SC_AUTOCOMP IFF_LINK2 /* auto-enable TCP compression */
 
#endif
/pkgnet/trunk/watt32/inc/net/if_strip.h
0,0 → 1,60
/*!\file net/if_strip.h
* SLIP interface structures.
*/
 
/* $NetBSD: if_stripvar.h,v 1.4.8.1 1997/11/17 23:36:16 thorpej Exp $ */
 
/*
* Definitions for SLIP interface data structures
*
* (This exists so programs like slstats can get at the definition
* of sl_softc.)
*/
 
#ifndef __NET_IF_STRIP_H
#define __NET_IF_STRIP_H
 
struct strip_softc {
struct ifnet sc_if; /* network-visible interface */
int sc_unit; /* XXX unit number */
struct ifqueue sc_fastq; /* interactive output queue */
struct tty *sc_ttyp; /* pointer to tty structure */
u_char *sc_mp; /* pointer to next available buf char */
u_char *sc_ep; /* pointer to last available buf char */
u_char *sc_buf; /* input buffer */
u_char *sc_rxbuf; /* input destuffing buffer */
u_char *sc_txbuf; /* output stuffing buffer */
u_char *sc_xxx; /* XXX don't ask... */
u_int sc_flags; /* see below */
long sc_oqlen; /* previous output queue size */
long sc_otimeout; /* number of times output's stalled */
#ifdef __NetBSD__
int sc_oldbufsize; /* previous output buffer size */
int sc_oldbufquot; /* previous output buffer quoting */
#endif
#ifdef INET /* XXX */
struct slcompress sc_comp; /* tcp compression data */
#endif
 
int sc_state; /* Radio reset state-machine */
#define ST_ALIVE 0x0 /* answered probe */
#define ST_PROBE_SENT 0x1 /* probe sent, answer pending */
#define ST_DEAD 0x2 /* no answer to probe; do reset */
 
long sc_statetimo; /* When (secs) current state ends */
 
caddr_t sc_bpf; /* BPF data */
};
 
 
/* Internal flags */
#define SC_ERROR 0x0001 /* Incurred error reading current pkt*/
 
#define SC_TIMEOUT 0x00000400 /* timeout is currently pending */
 
/* visible flags */
#define SC_COMPRESS IFF_LINK0 /* compress TCP traffic */
#define SC_NOICMP IFF_LINK1 /* supress ICMP traffic */
#define SC_AUTOCOMP IFF_LINK2 /* auto-enable TCP compression */
 
#endif
/pkgnet/trunk/watt32/inc/net/if_tun.h
0,0 → 1,58
/*!\file net/if_tun.h
* Interface tunneling.
*/
 
/* $NetBSD: if_tun.h,v 1.6 1996/06/25 22:15:18 pk Exp $ */
 
/*
* Copyright (c) 1988, Julian Onions <jpo@cs.nott.ac.uk>
* Nottingham University 1987.
*
* This source may be freely distributed, however I would be interested
* in any changes that are made.
*
* This driver takes packets off the IP i/f and hands them up to a
* user process to have it's wicked way with. This driver has it's
* roots in a similar driver written by Phil Cockcroft (formerly) at
* UCL. This driver is based much more on read/write/select mode of
* operation though.
*
* : $Header: if_tnreg.h,v 1.1.2.1 1992/07/16 22:39:16 friedl Exp
*/
 
#ifndef __NET_IF_TUN_H
#define __NET_IF_TUN_H
 
struct tun_softc {
u_short tun_flags; /* misc flags */
#define TUN_OPEN 0x0001
#define TUN_INITED 0x0002
#define TUN_RCOLL 0x0004
#define TUN_IASET 0x0008
#define TUN_DSTADDR 0x0010
#define TUN_RWAIT 0x0040
#define TUN_ASYNC 0x0080
#define TUN_NBIO 0x0100
#define TUN_PREPADDR 0x0200
 
#define TUN_READY (TUN_OPEN | TUN_INITED | TUN_IASET)
 
struct ifnet tun_if; /* the interface */
int tun_pgrp; /* the process group - if any */
struct selinfo tun_rsel; /* read select */
struct selinfo tun_wsel; /* write select (not used) */
#if NBPFILTER > 0
caddr_t tun_bpf;
#endif
};
 
/* Maximum packet size */
#define TUNMTU 1500
 
/* ioctl's for get/set debug */
#define TUNSDEBUG _IOW('t', 90, int)
#define TUNGDEBUG _IOR('t', 89, int)
#define TUNSIFMODE _IOW('t', 88, int)
#define TUNSLMODE _IOW('t', 87, int)
 
#endif
/pkgnet/trunk/watt32/inc/net/if_types.h
0,0 → 1,105
/*!\file net/if_types.h
* Network interface types.
*/
 
/* $NetBSD: if_types.h,v 1.7 1995/02/27 09:10:24 glass Exp $ */
 
/*
* Copyright (c) 1989, 1993, 1994
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)if_types.h 8.2 (Berkeley) 4/20/94
*/
 
/*
* Interface types for benefit of parsing media address headers.
* This list is derived from the SNMP list of ifTypes, currently
* documented in RFC1573.
*/
#ifndef __NET_IF_TYPES_H
#define __NET_IF_TYPES_H
 
#define IFT_OTHER 0x1 /* none of the following */
#define IFT_1822 0x2 /* old-style arpanet imp */
#define IFT_HDH1822 0x3 /* HDH arpanet imp */
#define IFT_X25DDN 0x4 /* x25 to imp */
#define IFT_X25 0x5 /* PDN X25 interface (RFC877) */
#define IFT_ETHER 0x6 /* Ethernet CSMACD */
#define IFT_ISO88023 0x7 /* CMSA CD */
#define IFT_ISO88024 0x8 /* Token Bus */
#define IFT_ISO88025 0x9 /* Token Ring */
#define IFT_ISO88026 0xa /* MAN */
#define IFT_STARLAN 0xb
#define IFT_P10 0xc /* Proteon 10MBit ring */
#define IFT_P80 0xd /* Proteon 80MBit ring */
#define IFT_HY 0xe /* Hyperchannel */
#define IFT_FDDI 0xf
#define IFT_LAPB 0x10
#define IFT_SDLC 0x11
#define IFT_T1 0x12
#define IFT_CEPT 0x13 /* E1 - european T1 */
#define IFT_ISDNBASIC 0x14
#define IFT_ISDNPRIMARY 0x15
#define IFT_PTPSERIAL 0x16 /* Proprietary PTP serial */
#define IFT_PPP 0x17 /* RFC 1331 */
#define IFT_LOOP 0x18 /* loopback */
#define IFT_EON 0x19 /* ISO over IP */
#define IFT_XETHER 0x1a /* obsolete 3MB experimental ethernet */
#define IFT_NSIP 0x1b /* XNS over IP */
#define IFT_SLIP 0x1c /* IP over generic TTY */
#define IFT_ULTRA 0x1d /* Ultra Technologies */
#define IFT_DS3 0x1e /* Generic T3 */
#define IFT_SIP 0x1f /* SMDS */
#define IFT_FRELAY 0x20 /* Frame Relay DTE only */
#define IFT_RS232 0x21
#define IFT_PARA 0x22 /* parallel-port */
#define IFT_ARCNET 0x23
#define IFT_ARCNETPLUS 0x24
#define IFT_ATM 0x25 /* ATM cells */
#define IFT_MIOX25 0x26
#define IFT_SONET 0x27 /* SONET or SDH */
#define IFT_X25PLE 0x28
#define IFT_ISO88022LLC 0x29
#define IFT_LOCALTALK 0x2a
#define IFT_SMDSDXI 0x2b
#define IFT_FRELAYDCE 0x2c /* Frame Relay DCE */
#define IFT_V35 0x2d
#define IFT_HSSI 0x2e
#define IFT_HIPPI 0x2f
#define IFT_MODEM 0x30 /* Generic Modem */
#define IFT_AAL5 0x31 /* AAL5 over ATM */
#define IFT_SONETPATH 0x32
#define IFT_SONETVT 0x33
#define IFT_SMDSICIP 0x34 /* SMDS InterCarrier Interface */
#define IFT_PROPVIRTUAL 0x35 /* Proprietary Virtual/internal */
#define IFT_PROPMUX 0x36 /* Proprietary Multiplexing */
 
#endif
/pkgnet/trunk/watt32/inc/net/netisr.h
0,0 → 1,78
/*!\file net/netisr.h
*
*/
 
/* $NetBSD: netisr.h,v 1.15 1997/04/02 21:23:29 christos Exp $ */
 
/*
* Copyright (c) 1980, 1986, 1989, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)netisr.h 8.1 (Berkeley) 6/10/93
*/
 
#ifndef __NET_NETISR_H
#define __NET_NETISR_H
 
/*
* The networking code runs off software interrupts.
*
* You can switch into the network by doing splsoftnet() and return by splx().
* The software interrupt level for the network is higher than the software
* level for the clock (so you can enter the network in routines called
* at timeout time).
*
* The routine to request a network software interrupt, setsoftnet(),
* is defined in the machine-specific include files.
*/
 
/*
* Each ``pup-level-1'' input queue has a bit in a ``netisr'' status
* word which is used to de-multiplex a single software
* interrupt used for scheduling the network code to calls
* on the lowest level routine of each protocol.
*/
#define NETISR_IP 2 /* same as AF_INET */
#define NETISR_IMP 3 /* same as AF_IMPLINK */
#define NETISR_NS 6 /* same as AF_NS */
#define NETISR_ISO 7 /* same as AF_ISO */
#define NETISR_CCITT 10 /* same as AF_CCITT */
#define NETISR_ATALK 16 /* same as AF_APPLETALK */
#define NETISR_ARP 18 /* same as AF_LINK */
#define NETISR_ISDN 26 /* same as AF_E164 */
#define NETISR_NATM 27 /* same as AF_NATM */
#define NETISR_PPP 28 /* for PPP processing */
 
#define schednetisr(anisr) { netisr |= 1<<(anisr); setsoftnet(); }
 
extern int netisr; /* scheduling bits for network */
 
#endif
/pkgnet/trunk/watt32/inc/net/pfil.h
0,0 → 1,47
/*!\file net/pfil.h
*
*/
 
/* $NetBSD: pfil.h,v 1.8 1997/10/10 05:40:26 mrg Exp $ */
 
/*
* Copyright (c) 1996 Matthew R. Green
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
 
#ifndef __NET_PFIL_H
#define __NET_PFIL_H
 
/* note: this file needs <net/if.h> and <sys/mbuf.h> */
 
#if NIPFILTER > 0
#ifdef PFIL_HOOKS
#undef PFIL_HOOKS
#endif
#define PFIL_HOOKS
#endif /* NIPFILTER */
 
#endif
/pkgnet/trunk/watt32/inc/net/ppp-comp.h
0,0 → 1,180
/*!\file net/ppp-comp.h
* PPP compression.
*/
 
/* $NetBSD: ppp-comp.h,v 1.3 1997/03/12 20:26:55 christos Exp $ */
 
/*
* ppp-comp.h - Definitions for doing PPP packet compression.
*
* Copyright (c) 1994 The Australian National University.
* All rights reserved.
*
* Permission to use, copy, modify, and distribute this software and its
* documentation is hereby granted, provided that the above copyright
* notice appears in all copies. This software is provided without any
* warranty, express or implied. The Australian National University
* makes no representations about the suitability of this software for
* any purpose.
*
* IN NO EVENT SHALL THE AUSTRALIAN NATIONAL UNIVERSITY BE LIABLE TO ANY
* PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
* THE AUSTRALIAN NATIONAL UNIVERSITY HAVE BEEN ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE.
*
* THE AUSTRALIAN NATIONAL UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
* ON AN "AS IS" BASIS, AND THE AUSTRALIAN NATIONAL UNIVERSITY HAS NO
* OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS,
* OR MODIFICATIONS.
*
* Id: ppp-comp.h,v 1.10 1996/09/26 06:30:11 paulus Exp
*/
 
#ifndef __NET_PPP_COMP_H
#define __NET_PPP_COMP_H
 
/*
* The following symbols control whether we include code for
* various compression methods.
*/
#ifndef DO_BSD_COMPRESS
#define DO_BSD_COMPRESS 1 /* by default, include BSD-Compress */
#endif
 
#ifndef DO_DEFLATE
#define DO_DEFLATE 1 /* by default, include Deflate */
#endif
 
#define DO_PREDICTOR_1 0
#define DO_PREDICTOR_2 0
 
/*
* Structure giving methods for compression/decompression.
*/
#ifdef PACKETPTR
struct compressor {
int compress_proto; /* CCP compression protocol number */
 
/* Allocate space for a compressor (transmit side) */
void *(*comp_alloc) (u_char *options, int opt_len);
 
/* Free space used by a compressor */
void (*comp_free) (void *state);
 
/* Initialize a compressor */
int (*comp_init) (void *state, u_char *options, int opt_len,
int unit, int hdrlen, int debug);
/* Reset a compressor */
void (*comp_reset) (void *state);
 
/* Compress a packet */
int (*compress) (void *state, PACKETPTR *mret,
PACKETPTR mp, int orig_len, int max_len);
 
/* Return compression statistics */
void (*comp_stat) (void *state, struct compstat *stats);
 
/* Allocate space for a decompressor (receive side) */
void *(*decomp_alloc) (u_char *options, int opt_len);
 
/* Free space used by a decompressor */
void (*decomp_free) (void *state);
 
/* Initialize a decompressor */
int (*decomp_init) (void *state, u_char *options, int opt_len,
int unit, int hdrlen, int mru, int debug);
/* Reset a decompressor */
void (*decomp_reset) (void *state);
 
/* Decompress a packet. */
int (*decompress) (void *state, PACKETPTR mp, PACKETPTR *dmpp);
 
/* Update state for an incompressible packet received */
void (*incomp) (void *state, PACKETPTR mp);
 
/* Return decompression statistics */
void (*decomp_stat) (void *state, struct compstat *stats);
};
#endif /* PACKETPTR */
 
/*
* Return values for decompress routine.
* We need to make these distinctions so that we can disable certain
* useful functionality, namely sending a CCP reset-request as a result
* of an error detected after decompression. This is to avoid infringing
* a patent held by Motorola.
* Don't you just lurve software patents.
*/
#define DECOMP_OK 0 /* everything went OK */
#define DECOMP_ERROR 1 /* error detected before decomp. */
#define DECOMP_FATALERROR 2 /* error detected after decomp. */
 
/*
* CCP codes.
*/
#define CCP_CONFREQ 1
#define CCP_CONFACK 2
#define CCP_TERMREQ 5
#define CCP_TERMACK 6
#define CCP_RESETREQ 14
#define CCP_RESETACK 15
 
/*
* Max # bytes for a CCP option
*/
#define CCP_MAX_OPTION_LENGTH 32
 
/*
* Parts of a CCP packet.
*/
#define CCP_CODE(dp) ((dp)[0])
#define CCP_ID(dp) ((dp)[1])
#define CCP_LENGTH(dp) (((dp)[2] << 8) + (dp)[3])
#define CCP_HDRLEN 4
 
#define CCP_OPT_CODE(dp) ((dp)[0])
#define CCP_OPT_LENGTH(dp) ((dp)[1])
#define CCP_OPT_MINLEN 2
 
/*
* Definitions for BSD-Compress.
*/
#define CI_BSD_COMPRESS 21 /* config. option for BSD-Compress */
#define CILEN_BSD_COMPRESS 3 /* length of config. option */
 
/* Macros for handling the 3rd byte of the BSD-Compress config option. */
#define BSD_NBITS(x) ((x) & 0x1F) /* number of bits requested */
#define BSD_VERSION(x) ((x) >> 5) /* version of option format */
#define BSD_CURRENT_VERSION 1 /* current version number */
#define BSD_MAKE_OPT(v, n) (((v) << 5) | (n))
 
#define BSD_MIN_BITS 9 /* smallest code size supported */
#define BSD_MAX_BITS 15 /* largest code size supported */
 
/*
* Definitions for Deflate.
*/
#define CI_DEFLATE 24 /* config option for Deflate */
#define CILEN_DEFLATE 4 /* length of its config option */
 
#define DEFLATE_MIN_SIZE 8
#define DEFLATE_MAX_SIZE 15
#define DEFLATE_METHOD_VAL 8
#define DEFLATE_SIZE(x) (((x) >> 4) + DEFLATE_MIN_SIZE)
#define DEFLATE_METHOD(x) ((x) & 0x0F)
#define DEFLATE_MAKE_OPT(w) ((((w) - DEFLATE_MIN_SIZE) << 4) \
+ DEFLATE_METHOD_VAL)
#define DEFLATE_CHK_SEQUENCE 0
 
/*
* Definitions for other, as yet unsupported, compression methods.
*/
#define CI_PREDICTOR_1 1 /* config option for Predictor-1 */
#define CILEN_PREDICTOR_1 2 /* length of its config option */
#define CI_PREDICTOR_2 2 /* config option for Predictor-2 */
#define CILEN_PREDICTOR_2 2 /* length of its config option */
 
#endif
/pkgnet/trunk/watt32/inc/net/ppp_defs.h
0,0 → 1,195
/*!\file net/ppp_defs.h
* PPP definitions.
*/
 
/* $Id: ppp_defs.h,v 1.11 1997/04/30 05:46:24 paulus Exp $ */
 
/*
* ppp_defs.h - PPP definitions.
*
* Copyright (c) 1994 The Australian National University.
* All rights reserved.
*
* Permission to use, copy, modify, and distribute this software and its
* documentation is hereby granted, provided that the above copyright
* notice appears in all copies. This software is provided without any
* warranty, express or implied. The Australian National University
* makes no representations about the suitability of this software for
* any purpose.
*
* IN NO EVENT SHALL THE AUSTRALIAN NATIONAL UNIVERSITY BE LIABLE TO ANY
* PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
* THE AUSTRALIAN NATIONAL UNIVERSITY HAVE BEEN ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE.
*
* THE AUSTRALIAN NATIONAL UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
* ON AN "AS IS" BASIS, AND THE AUSTRALIAN NATIONAL UNIVERSITY HAS NO
* OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS,
* OR MODIFICATIONS.
*/
 
#ifndef __NET_PPP_DEFS_H
#define __NET_PPP_DEFS_H
 
/*
* The basic PPP frame.
*/
#define PPP_HDRLEN 4 /* octets for standard ppp header */
#define PPP_FCSLEN 2 /* octets for FCS */
 
/*
* Packet sizes
*
* Note - lcp shouldn't be allowed to negotiate stuff outside these
* limits. See lcp.h in the pppd directory.
* (XXX - these constants should simply be shared by lcp.c instead
* of living in lcp.h)
*/
#define PPP_MTU 1500 /* Default MTU (size of Info field) */
#define PPP_MAXMTU 65535 - (PPP_HDRLEN + PPP_FCSLEN)
#define PPP_MINMTU 64
#define PPP_MRU 1500 /* default MRU = max length of info field */
#define PPP_MAXMRU 65000 /* Largest MRU we allow */
#define PPP_MINMRU 128
 
#define PPP_ADDRESS(p) (((u_char *)(p))[0])
#define PPP_CONTROL(p) (((u_char *)(p))[1])
#define PPP_PROTOCOL(p) ((((u_char *)(p))[2] << 8) + ((u_char *)(p))[3])
 
/*
* Significant octet values.
*/
#define PPP_ALLSTATIONS 0xff /* All-Stations broadcast address */
#define PPP_UI 0x03 /* Unnumbered Information */
#define PPP_FLAG 0x7e /* Flag Sequence */
#define PPP_ESCAPE 0x7d /* Asynchronous Control Escape */
#define PPP_TRANS 0x20 /* Asynchronous transparency modifier */
 
/*
* Protocol field values.
*/
#define PPP_IP 0x0021 /* Raw IP */
#define PPP_OSI 0x0023 /* OSI Network Layer */
#define PPP_NS 0x0025 /* Xerox NS IDP */
#define PPP_DECNET 0x0027 /* DECnet Phase IV */
#define PPP_APPLE 0x0029 /* Appletalk */
#define PPP_IPX 0x002b /* Novell IPX */
#define PPP_VJC 0x002d /* Van Jacobson Compressed TCP/IP */
#define PPP_VJNC 0x002f /* Van Jacobson Uncompressed TCP/IP */
#define PPP_VJC_COMP PPP_VJC
#define PPP_VJC_UNCOMP PPP_VJNC
#define PPP_BRPDU 0x0031 /* Bridging PDU */
#define PPP_STII 0x0033 /* Stream Protocol (ST-II) */
#define PPP_VINES 0x0035 /* Banyan Vines */
#define PPP_IPV6 0x0057 /* Internet Protocol Version 6 */
#define PPP_COMP 0x00fd /* compressed packet */
 
#define PPP_HELLO 0x0201 /* 802.1d Hello Packets */
#define PPP_LUXCOM 0x0231 /* Luxcom */
#define PPP_SNS 0x0233 /* Sigma Network Systems */
 
#define PPP_IPCP 0x8021 /* IP Control Protocol */
#define PPP_OSICP 0x8023 /* OSI Network Layer Control Protocol */
#define PPP_NSCP 0x8025 /* Xerox NS IDP Control Protocol */
#define PPP_DECNETCP 0x8027 /* DECnet Control Protocol */
#define PPP_ATCP 0x8029 /* AppleTalk Control Protocol */
#define PPP_IPXCP 0x802b /* IPX Control Protocol */
#define PPP_STIICP 0x8033 /* Strean Protocol Control Protocol */
#define PPP_VINESCP 0x8035 /* Banyan Vines Control Protocol */
#define PPP_CCP 0x80fd /* Compression Control Protocol */
 
#define PPP_LCP 0xc021 /* Link Control Protocol */
#define PPP_PAP 0xc023 /* Password Authentication Protocol */
#define PPP_LQR 0xc025 /* Link Quality Report protocol */
#define PPP_CHAP 0xc223 /* Cryptographic Handshake Auth. Protocol */
#define PPP_CBCP 0xc029 /* Callback Control Protocol */
 
/*
* Values for FCS calculations.
*/
#define PPP_INITFCS 0xffff /* Initial FCS value */
#define PPP_GOODFCS 0xf0b8 /* Good final FCS value */
#define PPP_FCS(fcs, c) (((fcs) >> 8) ^ fcstab[((fcs) ^ (c)) & 0xff])
 
/*
* A 32-bit unsigned integral type.
*/
#if !defined(__BIT_TYPES_DEFINED__) && !defined(_BITYPES) && !defined(__SYS_WTYPES_H)
#ifdef UINT32_T
typedef UINT32_T u_int32_t;
#else
typedef unsigned long u_int32_t;
#endif
#endif
 
/*
* Extended asyncmap - allows any character to be escaped.
*/
typedef u_int32_t ext_accm[8];
 
/*
* What to do with network protocol (NP) packets.
*/
enum NPmode {
NPMODE_PASS, /* pass the packet through */
NPMODE_DROP, /* silently drop the packet */
NPMODE_ERROR, /* return an error */
NPMODE_QUEUE /* save it up for later. */
};
 
/*
* Statistics.
*/
struct pppstat {
unsigned int ppp_ibytes; /* bytes received */
unsigned int ppp_ipackets; /* packets received */
unsigned int ppp_ierrors; /* receive errors */
unsigned int ppp_obytes; /* bytes sent */
unsigned int ppp_opackets; /* packets sent */
unsigned int ppp_oerrors; /* transmit errors */
};
 
struct vjstat {
unsigned int vjs_packets; /* outbound packets */
unsigned int vjs_compressed; /* outbound compressed packets */
unsigned int vjs_searches; /* searches for connection state */
unsigned int vjs_misses; /* times couldn't find conn. state */
unsigned int vjs_uncompressedin; /* inbound uncompressed packets */
unsigned int vjs_compressedin; /* inbound compressed packets */
unsigned int vjs_errorin; /* inbound unknown type packets */
unsigned int vjs_tossed; /* inbound packets tossed because of error */
};
 
struct ppp_stats {
struct pppstat p; /* basic PPP statistics */
struct vjstat vj; /* VJ header compression statistics */
};
 
struct compstat {
unsigned int unc_bytes; /* total uncompressed bytes */
unsigned int unc_packets; /* total uncompressed packets */
unsigned int comp_bytes; /* compressed bytes */
unsigned int comp_packets; /* compressed packets */
unsigned int inc_bytes; /* incompressible bytes */
unsigned int inc_packets; /* incompressible packets */
unsigned int ratio; /* recent compression ratio << 8 */
};
 
struct ppp_comp_stats {
struct compstat c; /* packet compression statistics */
struct compstat d; /* packet decompression statistics */
};
 
/*
* The following structure records the time in seconds since
* the last NP packet was sent or received.
*/
struct ppp_idle {
time_t xmit_idle; /* time since last NP packet sent */
time_t recv_idle; /* time since last NP packet received */
};
 
#endif
/pkgnet/trunk/watt32/inc/net/radix.h
0,0 → 1,167
/*!\file net/radix.h
* Radix search trees.
*/
 
/* $NetBSD: radix.h,v 1.9 1997/04/02 21:17:31 christos Exp $ */
 
/*
* Copyright (c) 1988, 1989, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)radix.h 8.2 (Berkeley) 10/31/94
*/
 
#ifndef _NET_RADIX_H_
#define _NET_RADIX_H_
 
/*
* Radix search tree node layout.
*/
 
struct radix_node {
struct radix_mask *rn_mklist; /* list of masks contained in subtree */
struct radix_node *rn_p; /* parent */
short rn_b; /* bit offset; -1-index(netmask) */
char rn_bmask; /* node: mask for bit test*/
u_char rn_flags; /* enumerated next */
#define RNF_NORMAL 1 /* leaf contains normal route */
#define RNF_ROOT 2 /* leaf is root leaf for tree */
#define RNF_ACTIVE 4 /* This node is alive (for rtfree) */
union {
struct { /* leaf only data: */
caddr_t rn_Key; /* object of search */
caddr_t rn_Mask; /* netmask, if present */
struct radix_node *rn_Dupedkey;
} rn_leaf;
struct { /* node only data: */
int rn_Off; /* where to start compare */
struct radix_node *rn_L;/* progeny */
struct radix_node *rn_R;/* progeny */
} rn_node;
} rn_u;
#ifdef RN_DEBUG
int rn_info;
struct radix_node *rn_twin;
struct radix_node *rn_ybro;
#endif
};
 
#define rn_dupedkey rn_u.rn_leaf.rn_Dupedkey
#define rn_key rn_u.rn_leaf.rn_Key
#define rn_mask rn_u.rn_leaf.rn_Mask
#define rn_off rn_u.rn_node.rn_Off
#define rn_l rn_u.rn_node.rn_L
#define rn_r rn_u.rn_node.rn_R
 
/*
* Annotations to tree concerning potential routes applying to subtrees.
*/
 
extern struct radix_mask {
short rm_b; /* bit offset; -1-index(netmask) */
char rm_unused; /* cf. rn_bmask */
u_char rm_flags; /* cf. rn_flags */
struct radix_mask *rm_mklist; /* more masks to try */
union {
caddr_t rmu_mask; /* the mask */
struct radix_node *rmu_leaf; /* for normal routes */
} rm_rmu;
int rm_refs; /* # of references to this struct */
} *rn_mkfreelist;
 
#define rm_mask rm_rmu.rmu_mask
#define rm_leaf rm_rmu.rmu_leaf /* extra field would make 32 bytes */
 
#define MKGet(m) {\
if (rn_mkfreelist) {\
m = rn_mkfreelist; \
rn_mkfreelist = (m)->rm_mklist; \
} else \
R_Malloc(m, struct radix_mask *, sizeof (*(m))); }\
 
#define MKFree(m) { (m)->rm_mklist = rn_mkfreelist; rn_mkfreelist = (m);}
 
struct radix_node_head {
struct radix_node *rnh_treetop;
int rnh_addrsize; /* permit, but not require fixed keys */
int rnh_pktsize; /* permit, but not require fixed keys */
struct radix_node *(*rnh_addaddr) /* add based on sockaddr */
__P((void *v, void *mask,
struct radix_node_head *head, struct radix_node nodes[]));
struct radix_node *(*rnh_addpkt) /* add based on packet hdr */
__P((void *v, void *mask,
struct radix_node_head *head, struct radix_node nodes[]));
struct radix_node *(*rnh_deladdr) /* remove based on sockaddr */
__P((void *v, void *mask, struct radix_node_head *head));
struct radix_node *(*rnh_delpkt) /* remove based on packet hdr */
__P((void *v, void *mask, struct radix_node_head *head));
struct radix_node *(*rnh_matchaddr) /* locate based on sockaddr */
__P((void *v, struct radix_node_head *head));
struct radix_node *(*rnh_lookup) /* locate based on sockaddr */
__P((void *v, void *mask, struct radix_node_head *head));
struct radix_node *(*rnh_matchpkt) /* locate based on packet hdr */
__P((void *v, struct radix_node_head *head));
int (*rnh_walktree) /* traverse tree */
__P((struct radix_node_head *,
int (*)(struct radix_node *, void *), void *));
struct radix_node rnh_nodes[3]; /* empty tree for common case */
};
 
 
#define Bcmp(a,b,n) memcmp (a,b,n)
#define Bcopy(a,b,n) memcpy (b,a,n)
#define Bzero(p,n) memset ((void*)(p),0,(int)(n));
#define R_Malloc(p,t,n) (p = (t) malloc((unsigned int)(n)))
#define Free(p) free ((void*)p);
 
__BEGIN_DECLS
 
void rn_init (void);
int rn_inithead (void **, int);
int rn_refines (void *, void *);
int rn_walktree (struct radix_node_head *,
int (*)(struct radix_node *, void *),
void *);
 
struct radix_node *rn_addroute (void *, void *, struct radix_node_head *, struct radix_node [2]);
struct radix_node *rn_insert (void *, struct radix_node_head *, int *, struct radix_node [2]);
struct radix_node *rn_newpair (void *, int, struct radix_node[2]);
 
struct radix_node *rn_addmask (void *, int, int);
struct radix_node *rn_delete (void *, void *, struct radix_node_head *);
struct radix_node *rn_lookup (void *, void *, struct radix_node_head *);
struct radix_node *rn_match (void *, struct radix_node_head *);
struct radix_node *rn_search (void *, struct radix_node *);
struct radix_node *rn_search_m (void *, struct radix_node *, void *);
 
__END_DECLS
 
#endif /* _NET_RADIX_H_ */
/pkgnet/trunk/watt32/inc/net/raw_cb.h
0,0 → 1,65
/*!\file net/raw_cb.h
*
*/
 
/* $NetBSD: raw_cb.h,v 1.11 1996/05/28 23:24:50 pk Exp $ */
 
/*
* Copyright (c) 1980, 1986, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)raw_cb.h 8.1 (Berkeley) 6/10/93
*/
 
#ifndef __NET_RAW_CB_H
#define __NET_RAW_CB_H
 
/*
* Raw protocol interface control block. Used
* to tie a socket to the generic raw interface.
*/
struct rawcb {
LIST_ENTRY(rawcb) rcb_list; /* doubly linked list */
struct socket *rcb_socket; /* back pointer to socket */
struct sockaddr *rcb_faddr; /* destination address */
struct sockaddr *rcb_laddr; /* socket's address */
struct sockproto rcb_proto; /* protocol family, protocol */
};
 
#define sotorawcb(so) ((struct rawcb *)(so)->so_pcb)
 
/*
* Nominal space allocated to a raw socket.
*/
#define RAWSNDQ 8192
#define RAWRCVQ 8192
 
#endif
/pkgnet/trunk/watt32/inc/net/route.h
0,0 → 1,236
/*!\file net/route.h
* Route handling.
*/
 
/* $NetBSD: route.h,v 1.11 1997/04/02 21:17:29 christos Exp $ */
 
/*
* Copyright (c) 1980, 1986, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)route.h 8.5 (Berkeley) 2/8/95
*/
 
#ifndef __NET_ROUTE_H
#define __NET_ROUTE_H
/*
* Kernel resident routing tables.
*
* The routing tables are initialized when interface addresses
* are set by making entries for all directly connected interfaces.
*/
 
/*
* A route consists of a destination address and a reference
* to a routing entry. These are often held by protocols
* in their control blocks, e.g. inpcb.
*/
struct route {
struct rtentry *ro_rt;
struct sockaddr ro_dst;
};
 
/*
* These numbers are used by reliable protocols for determining
* retransmission behavior and are included in the routing structure.
*/
struct rt_metrics {
u_long rmx_locks; /* Kernel must leave these values alone */
u_long rmx_mtu; /* MTU for this path */
u_long rmx_hopcount; /* max hops expected */
u_long rmx_expire; /* lifetime for route, e.g. redirect */
u_long rmx_recvpipe; /* inbound delay-bandwith product */
u_long rmx_sendpipe; /* outbound delay-bandwith product */
u_long rmx_ssthresh; /* outbound gateway buffer limit */
u_long rmx_rtt; /* estimated round trip time */
u_long rmx_rttvar; /* estimated rtt variance */
u_long rmx_pksent; /* packets sent using this route */
};
 
/*
* rmx_rtt and rmx_rttvar are stored as microseconds;
* RTTTOPRHZ(rtt) converts to a value suitable for use
* by a protocol slowtimo counter.
*/
#define RTM_RTTUNIT 1000000 /* units for rtt, rttvar, as units per sec */
#define RTTTOPRHZ(r) ((r) / (RTM_RTTUNIT / PR_SLOWHZ))
 
/*
* We distinguish between routes to hosts and routes to networks,
* preferring the former if available. For each route we infer
* the interface to use from the gateway address supplied when
* the route was entered. Routes that forward packets through
* gateways are marked so that the output routines know to address the
* gateway rather than the ultimate destination.
*/
#ifndef RNF_NORMAL
#include <net/radix.h>
#endif
 
struct rtentry {
struct radix_node rt_nodes[2]; /* tree glue, and other values */
#define rt_key(r) ((struct sockaddr *)((r)->rt_nodes->rn_key))
#define rt_mask(r) ((struct sockaddr *)((r)->rt_nodes->rn_mask))
struct sockaddr *rt_gateway; /* value */
short rt_flags; /* up/down?, host/net */
short rt_refcnt; /* # held references */
u_long rt_use; /* raw # packets forwarded */
struct ifnet *rt_ifp; /* the answer: interface to use */
struct ifaddr *rt_ifa; /* the answer: interface to use */
struct sockaddr *rt_genmask; /* for generation of cloned routes */
caddr_t rt_llinfo; /* pointer to link level info cache */
struct rt_metrics rt_rmx; /* metrics used by rx'ing protocols */
struct rtentry *rt_gwroute; /* implied entry for gatewayed routes */
};
 
/*
* Following structure necessary for 4.3 compatibility;
* We should eventually move it to a compat file.
*/
struct ortentry {
u_int32_t rt_hash; /* to speed lookups */
struct sockaddr rt_dst; /* key */
struct sockaddr rt_gateway; /* value */
int16_t rt_flags; /* up/down?, host/net */
int16_t rt_refcnt; /* # held references */
u_int32_t rt_use; /* raw # packets forwarded */
struct ifnet *rt_ifp; /* the answer: interface to use */
};
 
#define RTF_UP 0x1 /* route usable */
#define RTF_GATEWAY 0x2 /* destination is a gateway */
#define RTF_HOST 0x4 /* host entry (net otherwise) */
#define RTF_REJECT 0x8 /* host or net unreachable */
#define RTF_DYNAMIC 0x10 /* created dynamically (by redirect) */
#define RTF_MODIFIED 0x20 /* modified dynamically (by redirect) */
#define RTF_DONE 0x40 /* message confirmed */
#define RTF_MASK 0x80 /* subnet mask present */
#define RTF_CLONING 0x100 /* generate new routes on use */
#define RTF_XRESOLVE 0x200 /* external daemon resolves name */
#define RTF_LLINFO 0x400 /* generated by ARP or ESIS */
#define RTF_STATIC 0x800 /* manually added */
#define RTF_BLACKHOLE 0x1000 /* just discard pkts (during updates) */
#define RTF_PROTO2 0x4000 /* protocol specific routing flag */
#define RTF_PROTO1 0x8000 /* protocol specific routing flag */
 
 
/*
* Routing statistics.
*/
struct rtstat {
short rts_badredirect; /* bogus redirect calls */
short rts_dynamic; /* routes created by redirects */
short rts_newgateway; /* routes modified by redirects */
short rts_unreach; /* lookups which failed */
short rts_wildcard; /* lookups satisfied by a wildcard */
};
/*
* Structures for routing messages.
*/
struct rt_msghdr {
u_short rtm_msglen; /* to skip over non-understood messages */
u_char rtm_version; /* future binary compatibility */
u_char rtm_type; /* message type */
u_short rtm_index; /* index for associated ifp */
int rtm_flags; /* flags, incl. kern & message, e.g. DONE */
int rtm_addrs; /* bitmask identifying sockaddrs in msg */
int rtm_pid; /* identify sender */
int rtm_seq; /* for sender to identify action */
int rtm_errno; /* why failed */
int rtm_use; /* from rtentry */
u_long rtm_inits; /* which metrics we are initializing */
struct rt_metrics rtm_rmx; /* metrics themselves */
};
 
#define RTM_VERSION 3 /* Up the ante and ignore older versions */
 
#define RTM_ADD 0x1 /* Add Route */
#define RTM_DELETE 0x2 /* Delete Route */
#define RTM_CHANGE 0x3 /* Change Metrics or flags */
#define RTM_GET 0x4 /* Report Metrics */
#define RTM_LOSING 0x5 /* Kernel Suspects Partitioning */
#define RTM_REDIRECT 0x6 /* Told to use different route */
#define RTM_MISS 0x7 /* Lookup failed on this address */
#define RTM_LOCK 0x8 /* fix specified metrics */
#define RTM_OLDADD 0x9 /* caused by SIOCADDRT */
#define RTM_OLDDEL 0xa /* caused by SIOCDELRT */
#define RTM_RESOLVE 0xb /* req to resolve dst to LL addr */
#define RTM_NEWADDR 0xc /* address being added to iface */
#define RTM_DELADDR 0xd /* address being removed from iface */
#define RTM_IFINFO 0xe /* iface going up/down etc. */
 
#define RTV_MTU 0x1 /* init or lock _mtu */
#define RTV_HOPCOUNT 0x2 /* init or lock _hopcount */
#define RTV_EXPIRE 0x4 /* init or lock _hopcount */
#define RTV_RPIPE 0x8 /* init or lock _recvpipe */
#define RTV_SPIPE 0x10 /* init or lock _sendpipe */
#define RTV_SSTHRESH 0x20 /* init or lock _ssthresh */
#define RTV_RTT 0x40 /* init or lock _rtt */
#define RTV_RTTVAR 0x80 /* init or lock _rttvar */
 
/*
* Bitmask values for rtm_addr.
*/
#define RTA_DST 0x1 /* destination sockaddr present */
#define RTA_GATEWAY 0x2 /* gateway sockaddr present */
#define RTA_NETMASK 0x4 /* netmask sockaddr present */
#define RTA_GENMASK 0x8 /* cloning mask sockaddr present */
#define RTA_IFP 0x10 /* interface name sockaddr present */
#define RTA_IFA 0x20 /* interface addr sockaddr present */
#define RTA_AUTHOR 0x40 /* sockaddr for author of redirect */
#define RTA_BRD 0x80 /* for NEWADDR, broadcast or p-p dest addr */
 
/*
* Index offsets for sockaddr array for alternate internal encoding.
*/
#define RTAX_DST 0 /* destination sockaddr present */
#define RTAX_GATEWAY 1 /* gateway sockaddr present */
#define RTAX_NETMASK 2 /* netmask sockaddr present */
#define RTAX_GENMASK 3 /* cloning mask sockaddr present */
#define RTAX_IFP 4 /* interface name sockaddr present */
#define RTAX_IFA 5 /* interface addr sockaddr present */
#define RTAX_AUTHOR 6 /* sockaddr for author of redirect */
#define RTAX_BRD 7 /* for NEWADDR, broadcast or p-p dest addr */
#define RTAX_MAX 8 /* size of array to allocate */
 
struct rt_addrinfo {
int rti_addrs;
struct sockaddr *rti_info[RTAX_MAX];
};
 
struct route_cb {
int ip_count;
int ns_count;
int iso_count;
int any_count;
};
 
#endif
/pkgnet/trunk/watt32/inc/net/slcompre.h
0,0 → 1,175
/*!\file net/slcompre.h
* SLIP/PPP compression.
*/
 
/* $NetBSD: slcompress.h,v 1.11 1997/05/17 21:12:11 christos Exp $ */
/* Id: slcompress.h,v 1.4 1994/09/21 06:50:08 paulus Exp */
 
/*
* Copyright (c) 1989, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)slcompress.h 8.1 (Berkeley) 6/10/93
*/
 
/*
* Definitions for tcp compression routines.
*
* Van Jacobson (van@helios.ee.lbl.gov), Dec 31, 1989:
* - Initial distribution.
*/
 
#ifndef __NET_SLCOMPRESS_H
#define __NET_SLCOMPRESS_H
 
#ifndef MLEN
#define MLEN 128
#endif
 
#define MAX_STATES 16 /* must be > 2 and < 256 */
#define MAX_HDR MLEN /* XXX 4bsd-ism: should really be 128 */
 
/*
* Compressed packet format:
*
* The first octet contains the packet type (top 3 bits), TCP
* 'push' bit, and flags that indicate which of the 4 TCP sequence
* numbers have changed (bottom 5 bits). The next octet is a
* conversation number that associates a saved IP/TCP header with
* the compressed packet. The next two octets are the TCP checksum
* from the original datagram. The next 0 to 15 octets are
* sequence number changes, one change per bit set in the header
* (there may be no changes and there are two special cases where
* the receiver implicitly knows what changed -- see below).
*
* There are 5 numbers which can change (they are always inserted
* in the following order): TCP urgent pointer, window,
* acknowlegement, sequence number and IP ID. (The urgent pointer
* is different from the others in that its value is sent, not the
* change in value.) Since typical use of SLIP links is biased
* toward small packets (see comments on MTU/MSS below), changes
* use a variable length coding with one octet for numbers in the
* range 1 - 255 and 3 octets (0, MSB, LSB) for numbers in the
* range 256 - 65535 or 0. (If the change in sequence number or
* ack is more than 65535, an uncompressed packet is sent.)
*/
 
/*
* Packet types (must not conflict with IP protocol version)
*
* The top nibble of the first octet is the packet type. There are
* three possible types: IP (not proto TCP or tcp with one of the
* control flags set); uncompressed TCP (a normal IP/TCP packet but
* with the 8-bit protocol field replaced by an 8-bit connection id --
* this type of packet syncs the sender & receiver); and compressed
* TCP (described above).
*
* LSB of 4-bit field is TCP "PUSH" bit (a worthless anachronism) and
* is logically part of the 4-bit "changes" field that follows. Top
* three bits are actual packet type. For backward compatibility
* and in the interest of conserving bits, numbers are chosen so the
* IP protocol version number (4) which normally appears in this nibble
* means "IP packet".
*/
 
/* packet types */
#define TYPE_IP 0x40
#define TYPE_UNCOMPRESSED_TCP 0x70
#define TYPE_COMPRESSED_TCP 0x80
#define TYPE_ERROR 0x00
 
/* Bits in first octet of compressed packet */
#define NEW_C 0x40 /* flag bits for what changed in a packet */
#define NEW_I 0x20
#define NEW_S 0x08
#define NEW_A 0x04
#define NEW_W 0x02
#define NEW_U 0x01
 
/* reserved, special-case values of above */
#define SPECIAL_I (NEW_S|NEW_W|NEW_U) /* echoed interactive traffic */
#define SPECIAL_D (NEW_S|NEW_A|NEW_W|NEW_U) /* unidirectional data */
#define SPECIALS_MASK (NEW_S|NEW_A|NEW_W|NEW_U)
 
#define TCP_PUSH_BIT 0x10
 
 
/*
* "state" data for each active tcp conversation on the wire. This is
* basically a copy of the entire IP/TCP header from the last packet
* we saw from the conversation together with a small identifier
* the transmit & receive ends of the line use to locate saved header.
*/
struct cstate {
struct cstate *cs_next; /* next most recently used cstate (xmit only) */
u_int16_t cs_hlen; /* size of hdr (receive only) */
u_char cs_id; /* connection # associated with this state */
u_char cs_filler;
union {
char csu_hdr[MAX_HDR];
struct ip csu_ip; /* ip/tcp hdr from most recent packet */
} slcs_u;
};
#define cs_ip slcs_u.csu_ip
#define cs_hdr slcs_u.csu_hdr
 
/*
* all the state data for one serial line (we need one of these
* per line).
*/
struct slcompress {
struct cstate *last_cs; /* most recently used tstate */
u_char last_recv; /* last rcvd conn. id */
u_char last_xmit; /* last sent conn. id */
u_int16_t flags;
#ifndef SL_NO_STATS
int sls_packets; /* outbound packets */
int sls_compressed; /* outbound compressed packets */
int sls_searches; /* searches for connection state */
int sls_misses; /* times couldn't find conn. state */
int sls_uncompressedin; /* inbound uncompressed packets */
int sls_compressedin; /* inbound compressed packets */
int sls_errorin; /* inbound unknown type packets */
int sls_tossed; /* inbound packets tossed because of error */
#endif
struct cstate tstate[MAX_STATES]; /* xmit connection states */
struct cstate rstate[MAX_STATES]; /* receive connection states */
};
/* flag values */
#define SLF_TOSS 1 /* tossing rcvd frames because of input err */
 
void sl_compress_init (struct slcompress *);
void sl_compress_setup (struct slcompress *, int);
u_int sl_compress_tcp (struct mbuf *, struct ip *, struct slcompress *, int);
int sl_uncompress_tcp (u_char **, int, u_int, struct slcompress *);
int sl_uncompress_tcp_core (u_char *, int, int, u_int, struct slcompress *, u_char **, u_int *);
 
#endif
/pkgnet/trunk/watt32/inc/net/slip.h
0,0 → 1,62
/*!\file net/slip.h
* BPF SLIP definitions.
*/
 
/* $NetBSD: slip.h,v 1.6 1994/06/29 06:36:53 cgd Exp $ */
 
/*-
* Copyright (c) 1994
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)slip.h 8.1 (Berkeley) 2/12/94
*/
 
#ifndef __NET_SLIP_H
#define __NET_SLIP_H
 
/* Ioctls operating on SLIP ttys. */
#define SLIOCGUNIT _IOR('t', 88, int) /* get slip unit number */
 
/*
* Definitions of the pseudo-link-level header attached to slip
* packets grabbed by the packet filter (bpf) traffic monitor.
*/
#define SLIP_HDRLEN 16 /* BPF SLIP header length */
 
/* Offsets into BPF SLIP header. */
#define SLX_DIR 0 /* direction; see below */
#define SLX_CHDR 1 /* compressed header data */
#define CHDR_LEN 15 /* length of compressed header data */
 
#define SLIPDIR_IN 0 /* incoming */
#define SLIPDIR_OUT 1 /* outgoing */
 
#endif
/pkgnet/trunk/watt32/inc/netdb.h
0,0 → 1,310
/*!\file netdb.h
* BSD netdb functions.
*/
 
/*-
* Copyright (c) 1980, 1983, 1988, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)netdb.h 8.1 (Berkeley) 6/2/93
* $Id: netdb.h,v 1.5 1996/08/29 20:00:56 peter Exp $
* -
* Portions Copyright (c) 1993 by Digital Equipment Corporation.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies, and that
* the name of Digital Equipment Corporation not be used in advertising or
* publicity pertaining to distribution of the document or software without
* specific, written prior permission.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
* CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
* -
* --Copyright--
*/
 
#ifndef __NETDB_H
#define __NETDB_H
 
#ifndef _PATH_HEQUIV
#define _PATH_HEQUIV "/etc/hosts.equiv"
#endif
 
#ifndef _PATH_HOSTS
#define _PATH_HOSTS "/etc/hosts"
#endif
 
#ifndef _PATH_NETWORKS
#define _PATH_NETWORKS "/etc/networks"
#endif
 
#ifndef _PATH_PROTOCOLS
#define _PATH_PROTOCOLS "/etc/protocols"
#endif
 
#ifndef _PATH_SERVICES
#define _PATH_SERVICES "/etc/services"
#endif
 
#ifndef __SYS_W32API_H
#include <sys/w32api.h>
#endif
 
#ifndef __SYS_SOCKET_H
#include <sys/socket.h> /* struct sockaddr */
#endif
 
#ifndef __SYS_CDEFS_H
#include <sys/cdefs.h>
#endif
 
 
/*
* Structures returned by network data base library. All addresses are
* supplied in host order, and returned in network order (suitable for
* use in system calls).
*/
struct hostent {
char *h_name; /* official name of host */
char **h_aliases; /* alias list */
int h_addrtype; /* host address type */
int h_length; /* length of address */
char **h_addr_list; /* list of addresses from name server */
#define h_addr h_addr_list[0] /* address, for backward compatiblity */
};
 
/*
* Assumption here is that a network number
* fits in 32 bits -- probably a poor one.
*/
struct netent {
char *n_name; /* official name of net */
char **n_aliases; /* alias list */
int n_addrtype; /* net address type */
unsigned long n_net; /* network # */
};
 
struct servent {
char *s_name; /* official service name */
char **s_aliases; /* alias list */
int s_port; /* port # */
char *s_proto; /* protocol to use */
};
 
struct protoent {
char *p_name; /* official protocol name */
char **p_aliases; /* alias list */
int p_proto; /* protocol # */
};
 
struct addrinfo {
int ai_flags; /* AI_PASSIVE, AI_CANONNAME */
int ai_family; /* PF_xxx */
int ai_socktype; /* SOCK_xxx */
int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */
int ai_addrlen; /* length of ai_addr */
char *ai_canonname; /* canonical name for hostname */
struct sockaddr *ai_addr; /* binary address */
struct addrinfo *ai_next; /* next structure in linked list */
};
 
/*
* Error return codes from gethostbyname() and gethostbyaddr()
* (left in extern int h_errno).
*/
W32_DATA int h_errno;
 
#define NETDB_INTERNAL -1 /* see errno */
#define NETDB_SUCCESS 0 /* no problem */
#define HOST_NOT_FOUND 1 /* Authoritative Answer Host not found */
#define TRY_AGAIN 2 /* Non-Authoritive Host not found, or SERVERFAIL */
#define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */
#define NO_DATA 4 /* Valid name, no data record of requested type */
#define NO_ADDRESS NO_DATA /* no address, look for MX record */
 
 
/*
* Error return codes from getaddrinfo()
*/
#define EAI_ADDRFAMILY 1 /* address family for hostname not supported */
#define EAI_AGAIN 2 /* temporary failure in name resolution */
#define EAI_BADFLAGS 3 /* invalid value for ai_flags */
#define EAI_FAIL 4 /* non-recoverable failure in name resolution */
#define EAI_FAMILY 5 /* ai_family not supported */
#define EAI_MEMORY 6 /* memory allocation failure */
#define EAI_NODATA 7 /* no address associated with hostname */
#define EAI_NONAME 8 /* hostname nor servname provided, or not known */
#define EAI_SERVICE 9 /* servname not supported for ai_socktype */
#define EAI_SOCKTYPE 10 /* ai_socktype not supported */
#define EAI_SYSTEM 11 /* system error returned in errno */
#define EAI_BADHINTS 12
#define EAI_PROTOCOL 13
#define EAI_MAX 14
 
/*
* Flag values for getaddrinfo()
*/
#define AI_PASSIVE 0x00000001 /* get address to use bind() */
#define AI_CANONNAME 0x00000002 /* fill ai_canonname */
#define AI_NUMERICHOST 0x00000004 /* prevent name resolution */
 
/* valid flags for addrinfo
*/
#define AI_MASK (AI_PASSIVE | AI_CANONNAME | AI_NUMERICHOST)
 
#define AI_ALL 0x00000100 /* IPv6 and IPv4-mapped (with AI_V4MAPPED) */
#define AI_V4MAPPED_CFG 0x00000200 /* accept IPv4-mapped if kernel supports */
#define AI_ADDRCONFIG 0x00000400 /* only if any address is assigned */
#define AI_V4MAPPED 0x00000800 /* accept IPv4-mapped IPv6 address */
 
/* special recommended flags for getipnodebyname
*/
#define AI_DEFAULT (AI_V4MAPPED_CFG | AI_ADDRCONFIG)
 
/*
* Constants for getnameinfo()
*/
#define NI_MAXHOST 1025
#define NI_MAXSERV 32
 
/*
* Flag values for getnameinfo()
*/
#define NI_NOFQDN 0x00000001
#define NI_NUMERICHOST 0x00000002
#define NI_NAMEREQD 0x00000004
#define NI_NUMERICSERV 0x00000008
#define NI_DGRAM 0x00000010
#define NI_WITHSCOPEID 0x00000020
 
/*
* Scope delimit character
*/
#define SCOPE_DELIMITER '%'
 
__BEGIN_DECLS
 
W32_FUNC void W32_CALL endhostent (void);
W32_FUNC void W32_CALL endnetent (void);
W32_FUNC void W32_CALL endprotoent (void);
W32_FUNC void W32_CALL endservent (void);
 
W32_FUNC struct hostent * W32_CALL gethostbyaddr (const char *, int, int);
W32_FUNC struct hostent * W32_CALL gethostbyname (const char *);
W32_FUNC struct hostent * W32_CALL gethostbyname2 (const char *, int af);
W32_FUNC struct hostent * W32_CALL gethostent (void);
W32_FUNC struct hostent * W32_CALL getipnodebyaddr(const void *, size_t, int, int *);
W32_FUNC struct hostent * W32_CALL getipnodebyname(const char *, int, int, int *);
W32_FUNC struct netent * W32_CALL getnetbyaddr (long, int);
W32_FUNC struct netent * W32_CALL getnetbyname (const char *);
W32_FUNC struct netent * W32_CALL getnetent (void);
W32_FUNC struct protoent * W32_CALL getprotobyname (const char *);
W32_FUNC struct protoent * W32_CALL getprotobynumber (int);
W32_FUNC struct protoent * W32_CALL getprotoent (void);
W32_FUNC struct servent * W32_CALL getservbyname (const char *, const char *);
W32_FUNC struct servent * W32_CALL getservbyport (int, const char *);
W32_FUNC struct servent * W32_CALL getservent (void);
W32_FUNC void W32_CALL herror (const char *);
W32_FUNC const char * W32_CALL hstrerror (int);
W32_FUNC void W32_CALL sethostent (int);
W32_FUNC void W32_CALL setnetent (int);
W32_FUNC void W32_CALL setprotoent (int);
W32_FUNC void W32_CALL setservent (int);
 
W32_FUNC int W32_CALL getnameinfo (const struct sockaddr *sa, int salen,
char *host, int hostlen,
char *serv, int servlen, int flags);
 
W32_FUNC int W32_CALL getaddrinfo (const char *hostname, const char *servname,
const struct addrinfo *hints, struct addrinfo **res);
 
W32_FUNC void W32_CALL freeaddrinfo (struct addrinfo *ai);
W32_FUNC void W32_CALL freehostent (struct hostent *);
W32_FUNC char * W32_CALL gai_strerror (int ecode);
 
W32_FUNC int W32_CALL if_nametoindex (const char *);
W32_FUNC char * W32_CALL if_indextoname (int, char *);
 
W32_FUNC int * W32_CALL __h_errno_location (void);
 
#if defined(_REENTRANT)
W32_FUNC struct hostent * W32_CALL gethostbyaddr_r (
const char *addr, int len, int type, struct hostent *result,
char *buffer, int buflen, int *h_errnop);
 
W32_FUNC struct hostent * W32_CALL gethostbyname_r (
const char *name, struct hostent *result,
char *buffer, int buflen, int *h_errnop);
 
W32_FUNC struct hostent * W32_CALL gethostent_r (
struct hostent *result, char *buffer, int buflen, int *h_errnop);
 
W32_FUNC struct netent * W32_CALL getnetbyaddr_r (
long net, int type, struct netent *result, char *buffer, int buflen);
 
W32_FUNC struct netent * W32_CALL getnetbyname_r (
const char *name, struct netent *result, char *buffer, int buflen);
 
W32_FUNC struct netent * W32_CALL getnetent_r (
struct netent *result, char *buffer, int buflen);
 
W32_FUNC struct protoent * W32_CALL getprotobyname_r (
const char *name, struct protoent *result, char *buffer, int buflen);
 
W32_FUNC struct protoent * W32_CALL getprotobynumber_r (
int proto, struct protoent *result, char *buffer, int buflen);
 
W32_FUNC struct protoent * W32_CALL getprotoent_r (
struct protoent *result, char *buffer, int buflen);
 
W32_FUNC struct servent * W32_CALL getservbyname_r (
const char *name, const char *proto, struct servent *result,
char *buffer, int buflen);
 
W32_FUNC struct servent * W32_CALL getservbyport_r (
int port, const char *proto, struct servent *result,
char *buffer, int buflen);
 
W32_FUNC struct servent * W32_CALL getservent_r (
struct servent *result, char *buffer, int buflen);
 
#endif /* _REENTRANT */
 
__END_DECLS
 
#endif
/pkgnet/trunk/watt32/inc/netinet/icmp6.h
0,0 → 1,739
/*!\file netinet/icmp6.h
* ICMP for IPv6.
*/
 
/* $FreeBSD: src/sys/netinet/icmp6.h,v 1.8 2002/05/06 16:28:25 ume Exp $ */
/* $KAME: icmp6.h,v 1.46 2001/04/27 15:09:48 itojun Exp $ */
 
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the project nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
 
/*
* Copyright (c) 1982, 1986, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)ip_icmp.h 8.1 (Berkeley) 6/10/93
*/
 
#ifndef _NETINET_ICMP6_H_
#define _NETINET_ICMP6_H_
 
#ifndef __SYS_WTYPES_H
#include <sys/wtypes.h>
#endif
 
#define ICMPV6_PLD_MAXLEN 1232 /* IPV6_MMTU - sizeof(struct ip6_hdr)
- sizeof(struct icmp6_hdr) */
#include <sys/packon.h>
 
struct icmp6_hdr {
u_int8_t icmp6_type; /* type field */
u_int8_t icmp6_code; /* code field */
u_int16_t icmp6_cksum; /* checksum field */
union {
u_int32_t icmp6_un_data32[1]; /* type-specific field */
u_int16_t icmp6_un_data16[2]; /* type-specific field */
u_int8_t icmp6_un_data8[4]; /* type-specific field */
} icmp6_dataun;
};
 
#define icmp6_data32 icmp6_dataun.icmp6_un_data32
#define icmp6_data16 icmp6_dataun.icmp6_un_data16
#define icmp6_data8 icmp6_dataun.icmp6_un_data8
#define icmp6_pptr icmp6_data32[0] /* parameter prob */
#define icmp6_mtu icmp6_data32[0] /* packet too big */
#define icmp6_id icmp6_data16[0] /* echo request/reply */
#define icmp6_seq icmp6_data16[1] /* echo request/reply */
#define icmp6_maxdelay icmp6_data16[0] /* mcast group membership */
 
#define ICMP6_DST_UNREACH 1 /* dest unreachable, codes: */
#define ICMP6_PACKET_TOO_BIG 2 /* packet too big */
#define ICMP6_TIME_EXCEEDED 3 /* time exceeded, code: */
#define ICMP6_PARAM_PROB 4 /* ip6 header bad */
 
#define ICMP6_ECHO_REQUEST 128 /* echo service */
#define ICMP6_ECHO_REPLY 129 /* echo reply */
#define ICMP6_MEMBERSHIP_QUERY 130 /* group membership query */
#define MLD_LISTENER_QUERY 130 /* multicast listener query */
#define ICMP6_MEMBERSHIP_REPORT 131 /* group membership report */
#define MLD_LISTENER_REPORT 131 /* multicast listener report */
#define ICMP6_MEMBERSHIP_REDUCTION 132 /* group membership termination */
#define MLD_LISTENER_DONE 132 /* multicast listener done */
 
#ifndef _KERNEL
/* the followings are for backward compatibility to old KAME apps. */
#define MLD6_LISTENER_QUERY MLD_LISTENER_QUERY
#define MLD6_LISTENER_REPORT MLD_LISTENER_REPORT
#define MLD6_LISTENER_DONE MLD_LISTENER_DONE
#endif
 
#define ND_ROUTER_SOLICIT 133 /* router solicitation */
#define ND_ROUTER_ADVERT 134 /* router advertisment */
#define ND_NEIGHBOR_SOLICIT 135 /* neighbor solicitation */
#define ND_NEIGHBOR_ADVERT 136 /* neighbor advertisment */
#define ND_REDIRECT 137 /* redirect */
 
#define ICMP6_ROUTER_RENUMBERING 138 /* router renumbering */
 
#define ICMP6_WRUREQUEST 139 /* who are you request */
#define ICMP6_WRUREPLY 140 /* who are you reply */
#define ICMP6_FQDN_QUERY 139 /* FQDN query */
#define ICMP6_FQDN_REPLY 140 /* FQDN reply */
#define ICMP6_NI_QUERY 139 /* node information request */
#define ICMP6_NI_REPLY 140 /* node information reply */
 
/* The definitions below are experimental. TBA */
#define MLD_MTRACE_RESP 200 /* mtrace resp (to sender) */
#define MLD_MTRACE 201 /* mtrace messages */
 
#define ICMP6_HADISCOV_REQUEST 202 /* XXX To be defined */
#define ICMP6_HADISCOV_REPLY 203 /* XXX To be defined */
#ifndef _KERNEL
#define MLD6_MTRACE_RESP MLD_MTRACE_RESP
#define MLD6_MTRACE MLD_MTRACE
#endif
 
#define ICMP6_MAXTYPE 203
 
#define ICMP6_DST_UNREACH_NOROUTE 0 /* no route to destination */
#define ICMP6_DST_UNREACH_ADMIN 1 /* administratively prohibited */
#define ICMP6_DST_UNREACH_NOTNEIGHBOR 2 /* not a neighbor(obsolete) */
#define ICMP6_DST_UNREACH_BEYONDSCOPE 2 /* beyond scope of source address */
#define ICMP6_DST_UNREACH_ADDR 3 /* address unreachable */
#define ICMP6_DST_UNREACH_NOPORT 4 /* port unreachable */
 
#define ICMP6_TIME_EXCEED_TRANSIT 0 /* ttl==0 in transit */
#define ICMP6_TIME_EXCEED_REASSEMBLY 1 /* ttl==0 in reass */
 
#define ICMP6_PARAMPROB_HEADER 0 /* erroneous header field */
#define ICMP6_PARAMPROB_NEXTHEADER 1 /* unrecognized next header */
#define ICMP6_PARAMPROB_OPTION 2 /* unrecognized option */
 
#define ICMP6_INFOMSG_MASK 0x80 /* all informational messages */
 
#define ICMP6_NI_SUBJ_IPV6 0 /* Query Subject is an IPv6 address */
#define ICMP6_NI_SUBJ_FQDN 1 /* Query Subject is a Domain name */
#define ICMP6_NI_SUBJ_IPV4 2 /* Query Subject is an IPv4 address */
 
#define ICMP6_NI_SUCCESS 0 /* node information successful reply */
#define ICMP6_NI_REFUSED 1 /* node information request is refused */
#define ICMP6_NI_UNKNOWN 2 /* unknown Qtype */
 
#define ICMP6_ROUTER_RENUMBERING_COMMAND 0 /* rr command */
#define ICMP6_ROUTER_RENUMBERING_RESULT 1 /* rr result */
#define ICMP6_ROUTER_RENUMBERING_SEQNUM_RESET 255 /* rr seq num reset */
 
/* Used in kernel only */
#define ND_REDIRECT_ONLINK 0 /* redirect to an on-link node */
#define ND_REDIRECT_ROUTER 1 /* redirect to a better router */
 
/*
* Multicast Listener Discovery
*/
struct mld_hdr {
struct icmp6_hdr mld_icmp6_hdr;
struct in6_addr mld_addr; /* multicast address */
};
 
/* definitions to provide backward compatibility to old KAME applications */
#ifndef _KERNEL
#define mld6_hdr mld_hdr
#define mld6_type mld_type
#define mld6_code mld_code
#define mld6_cksum mld_cksum
#define mld6_maxdelay mld_maxdelay
#define mld6_reserved mld_reserved
#define mld6_addr mld_addr
#endif
 
/* shortcut macro definitions */
#define mld_type mld_icmp6_hdr.icmp6_type
#define mld_code mld_icmp6_hdr.icmp6_code
#define mld_cksum mld_icmp6_hdr.icmp6_cksum
#define mld_maxdelay mld_icmp6_hdr.icmp6_data16[0]
#define mld_reserved mld_icmp6_hdr.icmp6_data16[1]
 
/*
* Neighbor Discovery
*/
 
struct nd_router_solicit { /* router solicitation */
struct icmp6_hdr nd_rs_hdr;
/* could be followed by options */
};
 
#define nd_rs_type nd_rs_hdr.icmp6_type
#define nd_rs_code nd_rs_hdr.icmp6_code
#define nd_rs_cksum nd_rs_hdr.icmp6_cksum
#define nd_rs_reserved nd_rs_hdr.icmp6_data32[0]
 
struct nd_router_advert { /* router advertisement */
struct icmp6_hdr nd_ra_hdr;
u_int32_t nd_ra_reachable; /* reachable time */
u_int32_t nd_ra_retransmit; /* retransmit timer */
/* could be followed by options */
};
 
#define nd_ra_type nd_ra_hdr.icmp6_type
#define nd_ra_code nd_ra_hdr.icmp6_code
#define nd_ra_cksum nd_ra_hdr.icmp6_cksum
#define nd_ra_curhoplimit nd_ra_hdr.icmp6_data8[0]
#define nd_ra_flags_reserved nd_ra_hdr.icmp6_data8[1]
#define ND_RA_FLAG_MANAGED 0x80
#define ND_RA_FLAG_OTHER 0x40
#define ND_RA_FLAG_HA 0x20
 
/*
* Router preference values based on draft-draves-ipngwg-router-selection-01.
* These are non-standard definitions.
*/
#define ND_RA_FLAG_RTPREF_MASK 0x18 /* 00011000 */
 
#define ND_RA_FLAG_RTPREF_HIGH 0x08 /* 00001000 */
#define ND_RA_FLAG_RTPREF_MEDIUM 0x00 /* 00000000 */
#define ND_RA_FLAG_RTPREF_LOW 0x18 /* 00011000 */
#define ND_RA_FLAG_RTPREF_RSV 0x10 /* 00010000 */
 
#define nd_ra_router_lifetime nd_ra_hdr.icmp6_data16[1]
 
struct nd_neighbor_solicit { /* neighbor solicitation */
struct icmp6_hdr nd_ns_hdr;
struct in6_addr nd_ns_target; /*target address */
/* could be followed by options */
};
 
#define nd_ns_type nd_ns_hdr.icmp6_type
#define nd_ns_code nd_ns_hdr.icmp6_code
#define nd_ns_cksum nd_ns_hdr.icmp6_cksum
#define nd_ns_reserved nd_ns_hdr.icmp6_data32[0]
 
struct nd_neighbor_advert { /* neighbor advertisement */
struct icmp6_hdr nd_na_hdr;
struct in6_addr nd_na_target; /* target address */
/* could be followed by options */
};
 
#define nd_na_type nd_na_hdr.icmp6_type
#define nd_na_code nd_na_hdr.icmp6_code
#define nd_na_cksum nd_na_hdr.icmp6_cksum
#define nd_na_flags_reserved nd_na_hdr.icmp6_data32[0]
#if BYTE_ORDER == BIG_ENDIAN
#define ND_NA_FLAG_ROUTER 0x80000000
#define ND_NA_FLAG_SOLICITED 0x40000000
#define ND_NA_FLAG_OVERRIDE 0x20000000
#else
#if BYTE_ORDER == LITTLE_ENDIAN
#define ND_NA_FLAG_ROUTER 0x80
#define ND_NA_FLAG_SOLICITED 0x40
#define ND_NA_FLAG_OVERRIDE 0x20
#endif
#endif
 
struct nd_redirect { /* redirect */
struct icmp6_hdr nd_rd_hdr;
struct in6_addr nd_rd_target; /* target address */
struct in6_addr nd_rd_dst; /* destination address */
/* could be followed by options */
};
 
#define nd_rd_type nd_rd_hdr.icmp6_type
#define nd_rd_code nd_rd_hdr.icmp6_code
#define nd_rd_cksum nd_rd_hdr.icmp6_cksum
#define nd_rd_reserved nd_rd_hdr.icmp6_data32[0]
 
struct nd_opt_hdr { /* Neighbor discovery option header */
u_int8_t nd_opt_type;
u_int8_t nd_opt_len;
/* followed by option specific data*/
};
 
#define ND_OPT_SOURCE_LINKADDR 1
#define ND_OPT_TARGET_LINKADDR 2
#define ND_OPT_PREFIX_INFORMATION 3
#define ND_OPT_REDIRECTED_HEADER 4
#define ND_OPT_MTU 5
 
#define ND_OPT_ROUTE_INFO 200 /* draft-ietf-ipngwg-router-preference, not officially assigned yet */
 
struct nd_opt_prefix_info { /* prefix information */
u_int8_t nd_opt_pi_type;
u_int8_t nd_opt_pi_len;
u_int8_t nd_opt_pi_prefix_len;
u_int8_t nd_opt_pi_flags_reserved;
u_int32_t nd_opt_pi_valid_time;
u_int32_t nd_opt_pi_preferred_time;
u_int32_t nd_opt_pi_reserved2;
struct in6_addr nd_opt_pi_prefix;
};
 
#define ND_OPT_PI_FLAG_ONLINK 0x80
#define ND_OPT_PI_FLAG_AUTO 0x40
 
struct nd_opt_rd_hdr { /* redirected header */
u_int8_t nd_opt_rh_type;
u_int8_t nd_opt_rh_len;
u_int16_t nd_opt_rh_reserved1;
u_int32_t nd_opt_rh_reserved2;
/* followed by IP header and data */
};
 
struct nd_opt_mtu { /* MTU option */
u_int8_t nd_opt_mtu_type;
u_int8_t nd_opt_mtu_len;
u_int16_t nd_opt_mtu_reserved;
u_int32_t nd_opt_mtu_mtu;
};
 
struct nd_opt_route_info { /* route info */
u_int8_t nd_opt_rti_type;
u_int8_t nd_opt_rti_len;
u_int8_t nd_opt_rti_prefixlen;
u_int8_t nd_opt_rti_flags;
u_int32_t nd_opt_rti_lifetime;
/* prefix follows */
};
 
/*
* icmp6 namelookup
*/
 
struct icmp6_namelookup {
struct icmp6_hdr icmp6_nl_hdr;
u_int8_t icmp6_nl_nonce[8];
int32_t icmp6_nl_ttl;
#if 0
u_int8_t icmp6_nl_len;
u_int8_t icmp6_nl_name[3];
#endif
/* could be followed by options */
};
 
/*
* icmp6 node information
*/
struct icmp6_nodeinfo {
struct icmp6_hdr icmp6_ni_hdr;
u_int8_t icmp6_ni_nonce[8];
/* could be followed by reply data */
};
 
#define ni_type icmp6_ni_hdr.icmp6_type
#define ni_code icmp6_ni_hdr.icmp6_code
#define ni_cksum icmp6_ni_hdr.icmp6_cksum
#define ni_qtype icmp6_ni_hdr.icmp6_data16[0]
#define ni_flags icmp6_ni_hdr.icmp6_data16[1]
 
#define NI_QTYPE_NOOP 0 /* NOOP */
#define NI_QTYPE_SUPTYPES 1 /* Supported Qtypes */
#define NI_QTYPE_FQDN 2 /* FQDN (draft 04) */
#define NI_QTYPE_DNSNAME 2 /* DNS Name */
#define NI_QTYPE_NODEADDR 3 /* Node Addresses */
#define NI_QTYPE_IPV4ADDR 4 /* IPv4 Addresses */
 
#if BYTE_ORDER == BIG_ENDIAN
#define NI_SUPTYPE_FLAG_COMPRESS 0x1
#define NI_FQDN_FLAG_VALIDTTL 0x1
#elif BYTE_ORDER == LITTLE_ENDIAN
#define NI_SUPTYPE_FLAG_COMPRESS 0x0100
#define NI_FQDN_FLAG_VALIDTTL 0x0100
#endif
 
#ifdef NAME_LOOKUPS_04
#if BYTE_ORDER == BIG_ENDIAN
#define NI_NODEADDR_FLAG_LINKLOCAL 0x1
#define NI_NODEADDR_FLAG_SITELOCAL 0x2
#define NI_NODEADDR_FLAG_GLOBAL 0x4
#define NI_NODEADDR_FLAG_ALL 0x8
#define NI_NODEADDR_FLAG_TRUNCATE 0x10
#define NI_NODEADDR_FLAG_ANYCAST 0x20 /* just experimental. not in spec */
#elif BYTE_ORDER == LITTLE_ENDIAN
#define NI_NODEADDR_FLAG_LINKLOCAL 0x0100
#define NI_NODEADDR_FLAG_SITELOCAL 0x0200
#define NI_NODEADDR_FLAG_GLOBAL 0x0400
#define NI_NODEADDR_FLAG_ALL 0x0800
#define NI_NODEADDR_FLAG_TRUNCATE 0x1000
#define NI_NODEADDR_FLAG_ANYCAST 0x2000 /* just experimental. not in spec */
#endif
#else /* draft-ietf-ipngwg-icmp-name-lookups-05 (and later?) */
#if BYTE_ORDER == BIG_ENDIAN
#define NI_NODEADDR_FLAG_TRUNCATE 0x1
#define NI_NODEADDR_FLAG_ALL 0x2
#define NI_NODEADDR_FLAG_COMPAT 0x4
#define NI_NODEADDR_FLAG_LINKLOCAL 0x8
#define NI_NODEADDR_FLAG_SITELOCAL 0x10
#define NI_NODEADDR_FLAG_GLOBAL 0x20
#define NI_NODEADDR_FLAG_ANYCAST 0x40 /* just experimental. not in spec */
#elif BYTE_ORDER == LITTLE_ENDIAN
#define NI_NODEADDR_FLAG_TRUNCATE 0x0100
#define NI_NODEADDR_FLAG_ALL 0x0200
#define NI_NODEADDR_FLAG_COMPAT 0x0400
#define NI_NODEADDR_FLAG_LINKLOCAL 0x0800
#define NI_NODEADDR_FLAG_SITELOCAL 0x1000
#define NI_NODEADDR_FLAG_GLOBAL 0x2000
#define NI_NODEADDR_FLAG_ANYCAST 0x4000 /* just experimental. not in spec */
#endif
#endif
 
struct ni_reply_fqdn {
u_int32_t ni_fqdn_ttl; /* TTL */
u_int8_t ni_fqdn_namelen; /* length in octets of the FQDN */
u_int8_t ni_fqdn_name[3]; /* XXX: alignment */
};
 
/*
* Router Renumbering. as router-renum-08.txt
*/
struct icmp6_router_renum { /* router renumbering header */
struct icmp6_hdr rr_hdr;
u_int8_t rr_segnum;
u_int8_t rr_flags;
u_int16_t rr_maxdelay;
u_int32_t rr_reserved;
};
 
#define ICMP6_RR_FLAGS_TEST 0x80
#define ICMP6_RR_FLAGS_REQRESULT 0x40
#define ICMP6_RR_FLAGS_FORCEAPPLY 0x20
#define ICMP6_RR_FLAGS_SPECSITE 0x10
#define ICMP6_RR_FLAGS_PREVDONE 0x08
 
#define rr_type rr_hdr.icmp6_type
#define rr_code rr_hdr.icmp6_code
#define rr_cksum rr_hdr.icmp6_cksum
#define rr_seqnum rr_hdr.icmp6_data32[0]
 
struct rr_pco_match { /* match prefix part */
u_int8_t rpm_code;
u_int8_t rpm_len;
u_int8_t rpm_ordinal;
u_int8_t rpm_matchlen;
u_int8_t rpm_minlen;
u_int8_t rpm_maxlen;
u_int16_t rpm_reserved;
struct in6_addr rpm_prefix;
};
 
#define RPM_PCO_ADD 1
#define RPM_PCO_CHANGE 2
#define RPM_PCO_SETGLOBAL 3
#define RPM_PCO_MAX 4
 
struct rr_pco_use { /* use prefix part */
u_int8_t rpu_uselen;
u_int8_t rpu_keeplen;
u_int8_t rpu_ramask;
u_int8_t rpu_raflags;
u_int32_t rpu_vltime;
u_int32_t rpu_pltime;
u_int32_t rpu_flags;
struct in6_addr rpu_prefix;
};
 
#define ICMP6_RR_PCOUSE_RAFLAGS_ONLINK 0x80
#define ICMP6_RR_PCOUSE_RAFLAGS_AUTO 0x40
 
#if BYTE_ORDER == BIG_ENDIAN
#define ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME 0x80000000
#define ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME 0x40000000
#elif BYTE_ORDER == LITTLE_ENDIAN
#define ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME 0x80
#define ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME 0x40
#endif
 
struct rr_result { /* router renumbering result message */
u_int16_t rrr_flags;
u_int8_t rrr_ordinal;
u_int8_t rrr_matchedlen;
u_int32_t rrr_ifid;
struct in6_addr rrr_prefix;
};
 
#include <sys/packoff.h>
 
#if BYTE_ORDER == BIG_ENDIAN
#define ICMP6_RR_RESULT_FLAGS_OOB 0x0002
#define ICMP6_RR_RESULT_FLAGS_FORBIDDEN 0x0001
#elif BYTE_ORDER == LITTLE_ENDIAN
#define ICMP6_RR_RESULT_FLAGS_OOB 0x0200
#define ICMP6_RR_RESULT_FLAGS_FORBIDDEN 0x0100
#endif
 
/*
* icmp6 filter structures.
*/
 
struct icmp6_filter {
u_int32_t icmp6_filt[8];
};
 
#define ICMP6_FILTER_SETPASSALL(filterp) \
memset(filterp, 0xff, sizeof(struct icmp6_filter))
#define ICMP6_FILTER_SETBLOCKALL(filterp) \
memset(filterp, 0x00, sizeof(struct icmp6_filter))
 
#define ICMP6_FILTER_SETPASS(type, filterp) \
(((filterp)->icmp6_filt[(type) >> 5]) |= (1 << ((type) & 31)))
#define ICMP6_FILTER_SETBLOCK(type, filterp) \
(((filterp)->icmp6_filt[(type) >> 5]) &= ~(1 << ((type) & 31)))
#define ICMP6_FILTER_WILLPASS(type, filterp) \
((((filterp)->icmp6_filt[(type) >> 5]) & (1 << ((type) & 31))) != 0)
#define ICMP6_FILTER_WILLBLOCK(type, filterp) \
((((filterp)->icmp6_filt[(type) >> 5]) & (1 << ((type) & 31))) == 0)
 
/*
* Variables related to this implementation
* of the internet control message protocol version 6.
*/
struct icmp6errstat {
u_quad_t icp6errs_dst_unreach_noroute;
u_quad_t icp6errs_dst_unreach_admin;
u_quad_t icp6errs_dst_unreach_beyondscope;
u_quad_t icp6errs_dst_unreach_addr;
u_quad_t icp6errs_dst_unreach_noport;
u_quad_t icp6errs_packet_too_big;
u_quad_t icp6errs_time_exceed_transit;
u_quad_t icp6errs_time_exceed_reassembly;
u_quad_t icp6errs_paramprob_header;
u_quad_t icp6errs_paramprob_nextheader;
u_quad_t icp6errs_paramprob_option;
u_quad_t icp6errs_redirect; /* we regard redirect as an error here */
u_quad_t icp6errs_unknown;
};
 
struct icmp6stat {
/* statistics related to icmp6 packets generated */
u_quad_t icp6s_error; /* # of calls to icmp6_error */
u_quad_t icp6s_canterror; /* no error 'cuz old was icmp */
u_quad_t icp6s_toofreq; /* no error 'cuz rate limitation */
u_quad_t icp6s_outhist[256];
 
/* statistics related to input message processed */
u_quad_t icp6s_badcode; /* icmp6_code out of range */
u_quad_t icp6s_tooshort; /* packet < sizeof(struct icmp6_hdr) */
u_quad_t icp6s_checksum; /* bad checksum */
u_quad_t icp6s_badlen; /* calculated bound mismatch */
/*
* number of responses: this member is inherited from netinet code, but
* for netinet6 code, it is already available in icp6s_outhist[].
*/
u_quad_t icp6s_reflect;
u_quad_t icp6s_inhist[256];
u_quad_t icp6s_nd_toomanyopt; /* too many ND options */
struct icmp6errstat icp6s_outerrhist;
#define icp6s_odst_unreach_noroute \
icp6s_outerrhist.icp6errs_dst_unreach_noroute
#define icp6s_odst_unreach_admin icp6s_outerrhist.icp6errs_dst_unreach_admin
#define icp6s_odst_unreach_beyondscope \
icp6s_outerrhist.icp6errs_dst_unreach_beyondscope
#define icp6s_odst_unreach_addr icp6s_outerrhist.icp6errs_dst_unreach_addr
#define icp6s_odst_unreach_noport icp6s_outerrhist.icp6errs_dst_unreach_noport
#define icp6s_opacket_too_big icp6s_outerrhist.icp6errs_packet_too_big
#define icp6s_otime_exceed_transit \
icp6s_outerrhist.icp6errs_time_exceed_transit
#define icp6s_otime_exceed_reassembly \
icp6s_outerrhist.icp6errs_time_exceed_reassembly
#define icp6s_oparamprob_header icp6s_outerrhist.icp6errs_paramprob_header
#define icp6s_oparamprob_nextheader \
icp6s_outerrhist.icp6errs_paramprob_nextheader
#define icp6s_oparamprob_option icp6s_outerrhist.icp6errs_paramprob_option
#define icp6s_oredirect icp6s_outerrhist.icp6errs_redirect
#define icp6s_ounknown icp6s_outerrhist.icp6errs_unknown
u_quad_t icp6s_pmtuchg; /* path MTU changes */
u_quad_t icp6s_nd_badopt; /* bad ND options */
u_quad_t icp6s_badns; /* bad neighbor solicitation */
u_quad_t icp6s_badna; /* bad neighbor advertisement */
u_quad_t icp6s_badrs; /* bad router advertisement */
u_quad_t icp6s_badra; /* bad router advertisement */
u_quad_t icp6s_badredirect; /* bad redirect message */
};
 
/*
* Names for ICMP sysctl objects
*/
#define ICMPV6CTL_STATS 1
#define ICMPV6CTL_REDIRACCEPT 2 /* accept/process redirects */
#define ICMPV6CTL_REDIRTIMEOUT 3 /* redirect cache time */
#define ICMPV6CTL_ND6_PRUNE 6
#define ICMPV6CTL_ND6_DELAY 8
#define ICMPV6CTL_ND6_UMAXTRIES 9
#define ICMPV6CTL_ND6_MMAXTRIES 10
#define ICMPV6CTL_ND6_USELOOPBACK 11
/*#define ICMPV6CTL_ND6_PROXYALL 12 obsoleted, do not reuse here */
#define ICMPV6CTL_NODEINFO 13
#define ICMPV6CTL_ERRPPSLIMIT 14 /* ICMPv6 error pps limitation */
#define ICMPV6CTL_ND6_MAXNUDHINT 15
#define ICMPV6CTL_MTUDISC_HIWAT 16
#define ICMPV6CTL_MTUDISC_LOWAT 17
#define ICMPV6CTL_ND6_DEBUG 18
#define ICMPV6CTL_ND6_DRLIST 19
#define ICMPV6CTL_ND6_PRLIST 20
#define ICMPV6CTL_MAXID 21
 
#define ICMPV6CTL_NAMES { \
{ 0, 0 }, \
{ 0, 0 }, \
{ "rediraccept", CTLTYPE_INT }, \
{ "redirtimeout", CTLTYPE_INT }, \
{ 0, 0 }, \
{ 0, 0 }, \
{ "nd6_prune", CTLTYPE_INT }, \
{ 0, 0 }, \
{ "nd6_delay", CTLTYPE_INT }, \
{ "nd6_umaxtries", CTLTYPE_INT }, \
{ "nd6_mmaxtries", CTLTYPE_INT }, \
{ "nd6_useloopback", CTLTYPE_INT }, \
{ 0, 0 }, \
{ "nodeinfo", CTLTYPE_INT }, \
{ "errppslimit", CTLTYPE_INT }, \
{ "nd6_maxnudhint", CTLTYPE_INT }, \
{ "mtudisc_hiwat", CTLTYPE_INT }, \
{ "mtudisc_lowat", CTLTYPE_INT }, \
{ "nd6_debug", CTLTYPE_INT }, \
{ 0, 0 }, \
{ 0, 0 }, \
}
 
#define RTF_PROBEMTU RTF_PROTO1
 
#ifdef _KERNEL
# ifdef __STDC__
struct rtentry;
struct rttimer;
struct in6_multi;
# endif
void icmp6_init(void);
void icmp6_paramerror(struct mbuf *, int);
void icmp6_error(struct mbuf *, int, int, int);
int icmp6_input(struct mbuf **, int *, int);
void icmp6_fasttimo(void);
void icmp6_reflect(struct mbuf *, size_t);
void icmp6_prepare(struct mbuf *);
void icmp6_redirect_input(struct mbuf *, int);
void icmp6_redirect_output(struct mbuf *, struct rtentry *);
 
struct ip6ctlparam;
void icmp6_mtudisc_update(struct ip6ctlparam *, int);
 
/* XXX: is this the right place for these macros? */
#define icmp6_ifstat_inc(ifp, tag) \
do { \
if ((ifp) && (ifp)->if_index <= if_index \
&& (ifp)->if_index < icmp6_ifstatmax \
&& icmp6_ifstat && icmp6_ifstat[(ifp)->if_index]) { \
icmp6_ifstat[(ifp)->if_index]->tag++; \
} \
} while (0)
 
#define icmp6_ifoutstat_inc(ifp, type, code) \
do { \
icmp6_ifstat_inc(ifp, ifs6_out_msg); \
if (type < ICMP6_INFOMSG_MASK) \
icmp6_ifstat_inc(ifp, ifs6_out_error); \
switch(type) { \
case ICMP6_DST_UNREACH: \
icmp6_ifstat_inc(ifp, ifs6_out_dstunreach); \
if (code == ICMP6_DST_UNREACH_ADMIN) \
icmp6_ifstat_inc(ifp, ifs6_out_adminprohib); \
break; \
case ICMP6_PACKET_TOO_BIG: \
icmp6_ifstat_inc(ifp, ifs6_out_pkttoobig); \
break; \
case ICMP6_TIME_EXCEEDED: \
icmp6_ifstat_inc(ifp, ifs6_out_timeexceed); \
break; \
case ICMP6_PARAM_PROB: \
icmp6_ifstat_inc(ifp, ifs6_out_paramprob); \
break; \
case ICMP6_ECHO_REQUEST: \
icmp6_ifstat_inc(ifp, ifs6_out_echo); \
break; \
case ICMP6_ECHO_REPLY: \
icmp6_ifstat_inc(ifp, ifs6_out_echoreply); \
break; \
case MLD_LISTENER_QUERY: \
icmp6_ifstat_inc(ifp, ifs6_out_mldquery); \
break; \
case MLD_LISTENER_REPORT: \
icmp6_ifstat_inc(ifp, ifs6_out_mldreport); \
break; \
case MLD_LISTENER_DONE: \
icmp6_ifstat_inc(ifp, ifs6_out_mlddone); \
break; \
case ND_ROUTER_SOLICIT: \
icmp6_ifstat_inc(ifp, ifs6_out_routersolicit); \
break; \
case ND_ROUTER_ADVERT: \
icmp6_ifstat_inc(ifp, ifs6_out_routeradvert); \
break; \
case ND_NEIGHBOR_SOLICIT: \
icmp6_ifstat_inc(ifp, ifs6_out_neighborsolicit); \
break; \
case ND_NEIGHBOR_ADVERT: \
icmp6_ifstat_inc(ifp, ifs6_out_neighboradvert); \
break; \
case ND_REDIRECT: \
icmp6_ifstat_inc(ifp, ifs6_out_redirect); \
break; \
} \
} while (0)
 
extern int icmp6_rediraccept; /* accept/process redirects */
extern int icmp6_redirtimeout; /* cache time for redirect routes */
#endif /* _KERNEL */
 
#endif /* not _NETINET_ICMP6_H_ */
/pkgnet/trunk/watt32/inc/netinet/icmp_var.h
0,0 → 1,86
/*!\file netinet/icmp_var.h
* Internal ICMP statistics.
*/
 
/*
* Copyright (c) 1982, 1986, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)icmp_var.h 8.1 (Berkeley) 6/10/93
* $Id: icmp_var.h,v 1.4 1995/02/16 00:27:40 wollman Exp $
*/
 
#ifndef __NETINET_ICMP_VAR_H
#define __NETINET_ICMP_VAR_H
 
#ifndef ICMP_MAXTYPE
#define ICMP_MAXTYPE 18
#endif
 
/*
* Variables related to this implementation
* of the internet control message protocol.
*/
struct icmpstat {
/* statistics related to icmp packets generated */
u_long icps_error; /* # of calls to icmp_error */
u_long icps_oldshort; /* no error 'cuz old ip too short */
u_long icps_oldicmp; /* no error 'cuz old was icmp */
u_long icps_outhist[ICMP_MAXTYPE + 1];
/* statistics related to input messages processed */
u_long icps_badcode; /* icmp_code out of range */
u_long icps_tooshort; /* packet < ICMP_MINLEN */
u_long icps_checksum; /* bad checksum */
u_long icps_badlen; /* calculated bound mismatch */
u_long icps_reflect; /* number of responses */
u_long icps_inhist[ICMP_MAXTYPE + 1];
u_long icps_bmcastecho; /* b/mcast echo requests dropped */
u_long icps_bmcasttstamp; /* b/mcast tstamp requests dropped */
u_long icps_badaddr; /* bad return address */
u_long icps_noroute; /* no route back */
};
 
/*
* Names for ICMP sysctl objects
*/
#define ICMPCTL_MASKREPL 1 /* allow replies to netmask requests */
#define ICMPCTL_STATS 2 /* statistics (read-only) */
#define ICMPCTL_ICMPLIM 3
#define ICMPCTL_MAXID 4
 
#define ICMPCTL_NAMES { \
{ 0, 0 }, \
{ "maskrepl", CTLTYPE_INT }, \
{ "stats", CTLTYPE_STRUCT }, \
{ "icmplim", CTLTYPE_INT }, \
}
 
#endif
/pkgnet/trunk/watt32/inc/netinet/if_ether.h
0,0 → 1,225
/*!\file inc/netinet/if_ether.h
* Ethernet definitions.
*/
 
/* Modified for emx by hv 1994
*
* Copyright (c) 1982, 1986 Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: @(#)if_ether.h 7.5 (Berkeley) 6/28/90
* $Id: if_ether.h,v 1.8 1994/02/02 05:58:54 hpeyerl Exp $
*/
 
#ifndef __NETINET_IF_ETHER_H
#define __NETINET_IF_ETHER_H
 
#include <sys/packon.h>
 
/*
* Ethernet address - 6 octets
* this is only used by the ethers(3) functions.
*/
struct ether_addr {
u_char ether_addr_octet[6];
};
 
/*
* Structure of a 10Mb/s Ethernet header.
*/
struct ether_header {
u_char ether_dhost[6];
u_char ether_shost[6];
u_short ether_type;
};
 
#define ETHERTYPE_PUP 0x0200 /* PUP protocol */
/* the IBM header corrects the following to 0x608 for OS/2 but I believe
* this is just a dirty hack
*/
#define ETHERTYPE_ARP 0x0806 /* address resolution protocol */
#define ETHERTYPE_IP 0x0800 /* IP protocol */
#define ETHERTYPE_REVARP 0x8035 /* reverse addr resolution protocol */
 
/*
* The ETHERTYPE_NTRAILER packet types starting at ETHERTYPE_TRAIL have
* (type-ETHERTYPE_TRAIL)*512 bytes of data followed
* by an ETHER type (as given above) and then the (variable-length) header.
*/
#define ETHERTYPE_TRAIL 0x1000 /* Trailer packet */
#define ETHERTYPE_NTRAILER 16
 
#define ETHERMTU 1500
#define ETHERMIN (60-14)
 
/*
* Macro to map an IP multicast address to an Ethernet multicast address.
* The high-order 25 bits of the Ethernet address are statically assigned,
* and the low-order 23 bits are taken from the low end of the IP address.
*/
#define ETHER_MAP_IP_MULTICAST(ipaddr, enaddr) \
/* struct in_addr *ipaddr; */ \
/* u_char enaddr[6]; */ \
{ \
(enaddr)[0] = 0x01; \
(enaddr)[1] = 0x00; \
(enaddr)[2] = 0x5e; \
(enaddr)[3] = ((u_char *)ipaddr)[1] & 0x7f; \
(enaddr)[4] = ((u_char *)ipaddr)[2]; \
(enaddr)[5] = ((u_char *)ipaddr)[3]; \
}
 
 
/*
* Ethernet Address Resolution Protocol.
*
* See RFC 826 for protocol description. Structure below is adapted
* to resolving internet addresses. Field names used correspond to
* RFC 826.
*/
struct ether_arp {
struct arphdr ea_hdr; /* fixed-size header */
u_char arp_sha[6]; /* sender hardware address */
u_char arp_spa[4]; /* sender protocol address */
u_char arp_tha[6]; /* target hardware address */
u_char arp_tpa[4]; /* target protocol address */
};
#define arp_hrd ea_hdr.ar_hrd
#define arp_pro ea_hdr.ar_pro
#define arp_hln ea_hdr.ar_hln
#define arp_pln ea_hdr.ar_pln
#define arp_op ea_hdr.ar_op
 
 
/*
* Structure shared between the ethernet driver modules and
* the address resolution code. For example, each ec_softc or il_softc
* begins with this structure.
*/
struct arpcom {
struct ifnet ac_if; /* network-visible interface */
u_char ac_enaddr[6]; /* ethernet hardware address */
struct in_addr ac_ipaddr; /* copy of ip address- XXX */
struct ether_multi *ac_multiaddrs; /* list of ether multicast addrs */
int ac_multicnt; /* length of ac_multiaddrs list */
};
 
/*
* Internet to ethernet address resolution table.
*/
 
struct arptab {
struct in_addr at_iaddr; /* internet address */
u_char at_enaddr[6]; /* ethernet address */
u_char at_timer; /* minutes since last reference */
u_char at_flags; /* flags */
struct mbuf *at_hold; /* last packet until resolved/timeout */
/* only os2 */
u_short at_rcf;
u_short at_rseg[8];
u_long at_millisec;
int at_interface;
};
 
 
extern u_char etherbroadcastaddr[6];
extern u_char ether_ipmulticast_min[6];
extern u_char ether_ipmulticast_max[6];
 
/*
* Ethernet multicast address structure. There is one of these for each
* multicast address or range of multicast addresses that we are supposed
* to listen to on a particular interface. They are kept in a linked list,
* rooted in the interface's arpcom structure. (This really has nothing to
* do with ARP, or with the Internet address family, but this appears to be
* the minimally-disrupting place to put it.)
*/
struct ether_multi {
u_char enm_addrlo[6]; /* low or only address of range */
u_char enm_addrhi[6]; /* high or only address of range */
struct arpcom *enm_ac; /* back pointer to arpcom */
u_int enm_refcount; /* no. claims to this addr/range */
struct ether_multi *enm_next; /* ptr to next ether_multi */
};
 
/*
* Structure used by macros below to remember position when stepping through
* all of the ether_multi records.
*/
struct ether_multistep {
struct ether_multi *e_enm;
};
 
#include <sys/packoff.h>
 
/*
* Macro for looking up the ether_multi record for a given range of Ethernet
* multicast addresses connected to a given arpcom structure. If no matching
* record is found, "enm" returns NULL.
*/
#define ETHER_LOOKUP_MULTI(addrlo, addrhi, ac, enm) \
/* u_char addrlo[6]; */ \
/* u_char addrhi[6]; */ \
/* struct arpcom *ac; */ \
/* struct ether_multi *enm; */ \
{ \
for ((enm) = (ac)->ac_multiaddrs; \
(enm) != NULL && \
(bcmp((enm)->enm_addrlo, (addrlo), 6) != 0 || \
bcmp((enm)->enm_addrhi, (addrhi), 6) != 0); \
(enm) = (enm)->enm_next); \
}
 
/*
* Macro to step through all of the ether_multi records, one at a time.
* The current position is remembered in "step", which the caller must
* provide. ETHER_FIRST_MULTI(), below, must be called to initialize "step"
* and get the first record. Both macros return a NULL "enm" when there
* are no remaining records.
*/
#define ETHER_NEXT_MULTI(step, enm) \
/* struct ether_multistep step; */ \
/* struct ether_multi *enm; */ \
{ \
if (((enm) = (step).e_enm) != NULL) \
(step).e_enm = (enm)->enm_next; \
}
 
#define ETHER_FIRST_MULTI(step, ac, enm) \
/* struct ether_multistep step; */ \
/* struct arpcom *ac; */ \
/* struct ether_multi *enm; */ \
{ \
(step).e_enm = (ac)->ac_multiaddrs; \
ETHER_NEXT_MULTI((step), (enm)); \
}
 
#endif
/pkgnet/trunk/watt32/inc/netinet/if_fddi.h
0,0 → 1,80
/*!\file inc/netinet/if_fddi.h
* FDDI header definition.
*/
 
/*
* Copyright (c) 1982, 1986, 1993
* The Regents of the University of California. All rights reserved.
* Copyright (c) 1995 Matt Thomas (thomas@lkg.dec.com)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)if_fddi.h 8.1 (Berkeley) 6/10/93
* $Id: if_fddi.h,v 1.3.4.1 1997/02/08 15:13:45 joerg Exp $
*/
 
#ifndef __NETINET_IF_FDDI_H
#define __NETINET_IF_FDDI_H
 
#include <sys/packon.h>
 
/*
* Structure of an 100Mb/s FDDI header.
*/
struct fddi_header {
u_char fddi_fc;
u_char fddi_dhost[6];
u_char fddi_shost[6];
};
 
#include <sys/packoff.h>
 
#define FDDIIPMTU 4352
#define FDDIMTU 4470
#define FDDIMIN 3
 
#define FDDIFC_C 0x80 /* 0b10000000 */
#define FDDIFC_L 0x40 /* 0b01000000 */
#define FDDIFC_F 0x30 /* 0b00110000 */
#define FDDIFC_Z 0x0F /* 0b00001111 */
 
#define FDDIFC_LLC_ASYNC 0x50
#define FDDIFC_LLC_PRIO0 0
#define FDDIFC_LLC_PRIO1 1
#define FDDIFC_LLC_PRIO2 2
#define FDDIFC_LLC_PRIO3 3
#define FDDIFC_LLC_PRIO4 4
#define FDDIFC_LLC_PRIO5 5
#define FDDIFC_LLC_PRIO6 6
#define FDDIFC_LLC_PRIO7 7
#define FDDIFC_LLC_SYNC 0xd0
#define FDDIFC_SMT 0x40
 
#endif
/pkgnet/trunk/watt32/inc/netinet/igmp.h
0,0 → 1,105
/*!\file netinet/igmp.h
* Internet Group Managment Protocol.
*/
 
/*
* Copyright (c) 1988 Stephen Deering.
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Stephen Deering of Stanford University.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)igmp.h 8.1 (Berkeley) 6/10/93
* $Id: igmp.h,v 1.7 1996/03/14 16:59:17 fenner Exp $
*/
 
#ifndef __NETINET_IGMP_H
#define __NETINET_IGMP_H
 
/*
* Internet Group Management Protocol (IGMP) definitions.
*
* Written by Steve Deering, Stanford, May 1988.
*
* MULTICAST Revision: 3.5.1.2
*/
 
/*
* IGMP packet format.
*/
 
#include <sys/packon.h>
 
struct igmp {
u_char igmp_type; /* version & type of IGMP message */
u_char igmp_code; /* subtype for routing msgs */
u_short igmp_cksum; /* IP-style checksum */
struct in_addr igmp_group; /* group address being reported */
}; /* (zero for queries) */
 
#include <sys/packoff.h>
 
#define IGMP_MINLEN 8
 
/*
* Message types, including version number.
*/
#define IGMP_MEMBERSHIP_QUERY 0x11 /* membership query */
#define IGMP_V1_MEMBERSHIP_REPORT 0x12 /* Ver. 1 membership report */
#define IGMP_V2_MEMBERSHIP_REPORT 0x16 /* Ver. 2 membership report */
#define IGMP_V2_LEAVE_GROUP 0x17 /* Leave-group message */
 
#define IGMP_DVMRP 0x13 /* DVMRP routing message */
#define IGMP_PIM 0x14 /* PIM routing message */
 
#define IGMP_MTRACE_RESP 0x1e /* traceroute resp.(to sender)*/
#define IGMP_MTRACE 0x1f /* mcast traceroute messages */
 
#define IGMP_MAX_HOST_REPORT_DELAY 10 /* max delay for response to */
/* query (in seconds) according */
/* to RFC1112 */
 
 
#define IGMP_TIMER_SCALE 10 /* denotes that the igmp code field */
/* specifies time in 10th of seconds*/
 
/*
* The following four defininitions are for backwards compatibility.
* They should be removed as soon as all applications are updated to
* use the new constant names.
*/
#define IGMP_HOST_MEMBERSHIP_QUERY IGMP_MEMBERSHIP_QUERY
#define IGMP_HOST_MEMBERSHIP_REPORT IGMP_V1_MEMBERSHIP_REPORT
#define IGMP_HOST_NEW_MEMBERSHIP_REPORT IGMP_V2_MEMBERSHIP_REPORT
#define IGMP_HOST_LEAVE_MESSAGE IGMP_V2_LEAVE_GROUP
 
#endif
/pkgnet/trunk/watt32/inc/netinet/igmp_var.h
0,0 → 1,82
/*!\file netinet/igmp_var.h
* Internal IGMP statistics.
*/
 
/*
* Copyright (c) 1988 Stephen Deering.
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Stephen Deering of Stanford University.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)igmp_var.h 8.1 (Berkeley) 7/19/93
* $Id: igmp_var.h,v 1.9 1996/03/14 16:59:18 fenner Exp $
*/
 
#ifndef __NETINET_IGMP_VAR_H
#define __NETINET_IGMP_VAR_H
 
/*
* Internet Group Management Protocol (IGMP),
* implementation-specific definitions.
*
* Written by Steve Deering, Stanford, May 1988.
*
* MULTICAST Revision: 3.5.1.3
*/
 
struct igmpstat {
u_int igps_rcv_total; /* total IGMP messages received */
u_int igps_rcv_tooshort; /* received with too few bytes */
u_int igps_rcv_badsum; /* received with bad checksum */
u_int igps_rcv_queries; /* received membership queries */
u_int igps_rcv_badqueries; /* received invalid queries */
u_int igps_rcv_reports; /* received membership reports */
u_int igps_rcv_badreports; /* received invalid reports */
u_int igps_rcv_ourreports; /* received reports for our groups */
u_int igps_snd_reports; /* sent membership reports */
};
 
/*
* Names for IGMP sysctl objects
*/
#define IGMPCTL_STATS 1 /* statistics (read-only) */
#define IGMPCTL_MAXID 2
 
#define IGMPCTL_NAMES { \
{ 0, 0 }, \
{ "stats", CTLTYPE_STRUCT }, \
}
 
#endif
 
 
/pkgnet/trunk/watt32/inc/netinet/in.h
0,0 → 1,440
/*!\file netinet/in.h
* IP address, options and definitions.
*/
 
/*
* Copyright (c) 1982, 1986, 1990, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)in.h 8.3 (Berkeley) 1/3/94
* $Id: in.h,v 1.22.2.1 1996/11/11 23:40:37 phk Exp $
*/
 
#ifndef __NETINET_IN_H
#define __NETINET_IN_H
 
#ifndef __SYS_SOCKET_H
#include <sys/socket.h>
#endif
 
/*
* Constants and structures defined by the internet system,
* Per RFC 790, September 1981, and numerous additions.
*/
 
/*
* Protocols
*/
#define IPPROTO_IP 0 /* dummy for IP */
#define IPPROTO_ICMP 1 /* control message protocol */
#define IPPROTO_IGMP 2 /* group mgmt protocol */
#define IPPROTO_GGP 3 /* gateway^2 (deprecated) */
#define IPPROTO_IPIP 4 /* IP encapsulation in IP */
#define IPPROTO_TCP 6 /* tcp */
#define IPPROTO_EGP 8 /* exterior gateway protocol */
#define IPPROTO_IGRP 9 /* interior gw routing protocol */
#define IPPROTO_PUP 12 /* pup */
#define IPPROTO_UDP 17 /* user datagram protocol */
#define IPPROTO_IDP 22 /* xns idp */
#define IPPROTO_TP 29 /* tp-4 w/ class negotiation */
#define IPPROTO_XTP 36 /* eXpress Transfer Protocol */
#define IPPROTO_RSVP 46 /* resource reservation */
#define IPPROTO_ESP 50
#define IPPROTO_AH 51 /* authenticate header */
#define IPPROTO_ICMPV6 58 /* ICMP v6 */
#define IPPROTO_NONE 59
#define IPPROTO_EON 80 /* ISO cnlp */
#define IPPROTO_ENCAP 98 /* encapsulation header */
#define IPPROTO_PIM 103
#define IPPROTO_VRRP 112
#define IPPROTO_SCTP 132
 
#define IPPROTO_DIVERT 254 /* divert pseudo-protocol */
#define IPPROTO_RAW 255 /* raw IP packet */
#define IPPROTO_MAX 256
 
 
/*
* Local port number conventions:
*
* When a user does a bind(2) or connect(2) with a port number of zero,
* a non-conflicting local port address is chosen.
* The default range is IPPORT_RESERVED through
* IPPORT_USERRESERVED, although that is settable by sysctl.
*
* A user may set the IPPROTO_IP option IP_PORTRANGE to change this
* default assignment range.
*
* The value IP_PORTRANGE_DEFAULT causes the default behavior.
*
* The value IP_PORTRANGE_HIGH changes the range of candidate port numbers
* into the "high" range. These are reserved for client outbound connections
* which do not want to be filtered by any firewalls.
*
* The value IP_PORTRANGE_LOW changes the range to the "low" are
* that is (by convention) restricted to privileged processes. This
* convention is based on "vouchsafe" principles only. It is only secure
* if you trust the remote host to restrict these ports.
*
* The default range of ports and the high range can be changed by
* sysctl(3). (net.inet.ip.port{hi,low}{first,last}_auto)
*
* Changing those values has bad security implications if you are
* using a a stateless firewall that is allowing packets outside of that
* range in order to allow transparent outgoing connections.
*
* Such a firewall configuration will generally depend on the use of these
* default values. If you change them, you may find your Security
* Administrator looking for you with a heavy object.
*/
 
/*
* Ports < IPPORT_RESERVED are reserved for
* privileged processes (e.g. root). (IP_PORTRANGE_LOW)
* Ports > IPPORT_USERRESERVED are reserved
* for servers, not necessarily privileged. (IP_PORTRANGE_DEFAULT)
*/
#define IPPORT_RESERVED 1024
#define IPPORT_USERRESERVED 5000
 
/*
* Default local port range to use by setting IP_PORTRANGE_HIGH
*/
#define IPPORT_HIFIRSTAUTO 40000
#define IPPORT_HILASTAUTO 44999
 
/*
* Scanning for a free reserved port return a value below IPPORT_RESERVED,
* but higher than IPPORT_RESERVEDSTART. Traditionally the start value was
* 512, but that conflicts with some well-known-services that firewalls may
* have a fit if we use.
*/
#define IPPORT_RESERVEDSTART 600
 
 
/*
* Internet address (a structure for historical reasons)
*/
struct in_addr {
u_long s_addr;
};
/*
* For IPv6 from RFC2133
*/
struct in6_addr {
u_int8_t s6_addr[16];
};
 
/*
* Definitions of bits in internet address integers.
* On subnets, the decomposition of addresses to host and net parts
* is done according to subnet mask, not the masks here.
*/
#define IN_CLASSA(i) (((long)(i) & 0x80000000) == 0)
#define IN_CLASSA_NET 0xff000000
#define IN_CLASSA_NSHIFT 24
#define IN_CLASSA_HOST 0x00ffffff
#define IN_CLASSA_MAX 128
 
#define IN_CLASSB(i) (((long)(i) & 0xC0000000) == 0x80000000)
#define IN_CLASSB_NET 0xffff0000
#define IN_CLASSB_NSHIFT 16
#define IN_CLASSB_HOST 0x0000ffff
#define IN_CLASSB_MAX 65536
 
#define IN_CLASSC(i) (((long)(i) & 0xE0000000) == 0xC0000000)
#define IN_CLASSC_NET 0xffffff00
#define IN_CLASSC_NSHIFT 8
#define IN_CLASSC_HOST 0x000000ff
 
#define IN_CLASSD(i) (((long)(i) & 0xF0000000) == 0xE0000000)
#define IN_CLASSD_NET 0xf0000000 /* These ones aren't really */
#define IN_CLASSD_NSHIFT 28 /* net and host fields, but */
#define IN_CLASSD_HOST 0x0fffffff /* routing needn't know. */
#define IN_MULTICAST(i) IN_CLASSD(i)
 
#define IN_EXPERIMENTAL(i) (((long)(i) & 0xF0000000) == 0xF0000000)
#define IN_BADCLASS(i) (((long)(i) & 0xF0000000) == 0xF0000000)
 
#define INADDR_ANY (u_long)0x00000000
#define INADDR_BROADCAST (u_long)0xFFFFFFFF /* must be masked */
#define INADDR_LOOPBACK (u_long)0x7F000001 /* 127.0.0.1 */
#define INADDR_NONE 0xFFFFFFFF /* -1 return */
 
#define INADDR_UNSPEC_GROUP (u_long)0xE0000000 /* 224.0.0.0 */
#define INADDR_ALLHOSTS_GROUP (u_long)0xE0000001 /* 224.0.0.1 */
#define INADDR_ALLRTRS_GROUP (u_long)0xE0000002 /* 224.0.0.2 */
#define INADDR_MAX_LOCAL_GROUP (u_long)0xE00000FF /* 224.0.0.255 */
 
#define IN_LOOPBACKNET 127 /* official! */
 
W32_DATA const struct in6_addr in6addr_any; /* :: */
W32_DATA const struct in6_addr in6addr_loopback; /* ::1 */
 
#define IN6ADDR_ANY_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } }
#define IN6ADDR_LOOPBACK_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } }
 
#define INET_ADDRSTRLEN 16
#define INET6_ADDRSTRLEN 46
 
 
/*
* Socket address, internet style.
*/
struct sockaddr_in {
u_short sin_family;
u_short sin_port;
struct in_addr sin_addr;
char sin_zero[8];
};
 
struct sockaddr_in6 {
u_int16_t sin6_family;
u_int16_t sin6_port;
u_int32_t sin6_flowinfo;
struct in6_addr sin6_addr;
u_int32_t sin6_scope_id; /* IPv6 scope-id */
};
 
/*
* Stolen from winsock2.h (hope this is portable)
* Portable IPv6/IPv4 version of sockaddr.
* Uses padding to force 8 byte alignment
* and maximum size of 128 bytes
*/
struct sockaddr_storage {
u_short ss_family;
u_short ss_len; /* !! added for BSD progs, gv Nov-2003 */
char __ss_pad1[6]; /* pad to 8 */
long __ss_align1, __ssalign2; /* force alignment */
char __ss_pad2[110]; /* pad to 128 */
};
 
 
/* IPv6 multicast request. */
struct ipv6_mreq {
/* IPv6 multicast address of group */
struct in6_addr ipv6mr_multiaddr;
 
/* local interface */
unsigned long ipv6mr_interface;
};
 
/*
* Structure used to describe IP options.
* Used to store options internally, to pass them to a process,
* or to restore options retrieved earlier.
* The ip_dst is used for the first-hop gateway when using a source route
* (this gets put into the header proper).
*/
struct ip_opts {
struct in_addr ip_dst; /* first hop, 0 w/o src rt */
char IP_opts[40]; /* actually variable in size */
};
 
/*
* Options for use with [gs]etsockopt at the IP level.
* First word of comment is data type; bool is stored in int.
*/
#define IP_OPTIONS 1 /* buf/ip_opts; set/get IP options */
#define IP_HDRINCL 2 /* int; header is included with data */
#define IP_TOS 3 /* int; IP type of service and preced. */
#define IP_TTL 4 /* int; IP time to live */
#define IP_RECVOPTS 5 /* bool; receive all IP opts w/dgram */
#define IP_RECVRETOPTS 6 /* bool; receive IP opts for response */
#define IP_RECVDSTADDR 7 /* bool; receive IP dst addr w/dgram */
#define IP_RETOPTS 8 /* ip_opts; set/get IP options */
#define IP_MULTICAST_IF 9 /* u_char; set/get IP multicast i/f */
#define IP_MULTICAST_TTL 10 /* u_char; set/get IP multicast ttl */
#define IP_MULTICAST_LOOP 11 /* u_char; set/get IP multicast loopback */
#define IP_ADD_MEMBERSHIP 12 /* ip_mreq; add an IP group membership */
#define IP_DROP_MEMBERSHIP 13 /* ip_mreq; drop an IP group membership */
#define IP_MULTICAST_VIF 14 /* set/get IP mcast virt. iface */
#define IP_RSVP_ON 15 /* enable RSVP in kernel */
#define IP_RSVP_OFF 16 /* disable RSVP in kernel */
#define IP_RSVP_VIF_ON 17 /* set RSVP per-vif socket */
#define IP_RSVP_VIF_OFF 18 /* unset RSVP per-vif socket */
#define IP_PORTRANGE 19 /* int; range to choose for unspec port */
#define IP_RECVIF 20 /* bool; receive reception if w/dgram */
 
#define IP_FW_ADD 50 /* add a firewall rule to chain */
#define IP_FW_DEL 51 /* delete a firewall rule from chain */
#define IP_FW_FLUSH 52 /* flush firewall rule chain */
#define IP_FW_ZERO 53 /* clear single/all firewall counter(s) */
#define IP_FW_GET 54 /* get entire firewall rule chain */
#define IP_NAT 55 /* set/get NAT opts */
 
/*
* Defaults and limits for options
*/
#define IP_DEFAULT_MULTICAST_TTL 1 /* normally limit m'casts to 1 hop */
#define IP_DEFAULT_MULTICAST_LOOP 1 /* normally hear sends if a member */
#define IP_MAX_MEMBERSHIPS 20 /* per socket */
 
/*
* Argument structure for IP_ADD_MEMBERSHIP and IP_DROP_MEMBERSHIP.
*/
struct ip_mreq {
struct in_addr imr_multiaddr; /* IP multicast address of group */
struct in_addr imr_interface; /* local IP address of interface */
};
 
/*
* Argument for IP_PORTRANGE:
* - which range to search when port is unspecified at bind() or connect()
*/
#define IP_PORTRANGE_DEFAULT 0 /* default range */
#define IP_PORTRANGE_HIGH 1 /* "high" - request firewall bypass */
#define IP_PORTRANGE_LOW 2 /* "low" - vouchsafe security */
 
/*
* Definitions for inet sysctl operations.
*
* Third level is protocol number.
* Fourth level is desired variable within that protocol.
*/
#define IPPROTO_MAXID (IPPROTO_IDP + 1) /* don't list to IPPROTO_MAX */
 
#define CTL_IPPROTO_NAMES { \
{ "ip", CTLTYPE_NODE }, \
{ "icmp", CTLTYPE_NODE }, \
{ "igmp", CTLTYPE_NODE }, \
{ "ggp", CTLTYPE_NODE }, \
{ 0, 0 }, \
{ 0, 0 }, \
{ "tcp", CTLTYPE_NODE }, \
{ 0, 0 }, \
{ "egp", CTLTYPE_NODE }, \
{ 0, 0 }, \
{ 0, 0 }, \
{ 0, 0 }, \
{ "pup", CTLTYPE_NODE }, \
{ 0, 0 }, \
{ 0, 0 }, \
{ 0, 0 }, \
{ 0, 0 }, \
{ "udp", CTLTYPE_NODE }, \
{ 0, 0 }, \
{ 0, 0 }, \
{ 0, 0 }, \
{ 0, 0 }, \
{ "idp", CTLTYPE_NODE }, \
}
 
/*
* Names for IP sysctl objects
*/
#define IPCTL_FORWARDING 1 /* act as router */
#define IPCTL_SENDREDIRECTS 2 /* may send redirects when forwarding */
#define IPCTL_DEFTTL 3 /* default TTL */
#define IPCTL_DEFMTU 4 /* default MTU */
#define IPCTL_RTEXPIRE 5 /* cloned route expiration time */
#define IPCTL_RTMINEXPIRE 6 /* min value for expiration time */
#define IPCTL_RTMAXCACHE 7 /* trigger level for dynamic expire */
#define IPCTL_SOURCEROUTE 8 /* may perform source routes */
#define IPCTL_DIRECTEDBROADCAST 9 /* may re-broadcast received packets */
#define IPCTL_INTRQMAXLEN 10 /* max length of netisr queue */
#define IPCTL_INTRQDROPS 11 /* number of netisr q drops */
#define IPCTL_MAXID 12
 
#define IPCTL_NAMES { \
{ 0, 0 }, \
{ "forwarding", CTLTYPE_INT }, \
{ "redirect", CTLTYPE_INT }, \
{ "ttl", CTLTYPE_INT }, \
{ "mtu", CTLTYPE_INT }, \
{ "rtexpire", CTLTYPE_INT }, \
{ "rtminexpire", CTLTYPE_INT }, \
{ "rtmaxcache", CTLTYPE_INT }, \
{ "sourceroute", CTLTYPE_INT }, \
{ "directed-broadcast", CTLTYPE_INT }, \
{ "intr-queue-maxlen", CTLTYPE_INT }, \
{ "intr-queue-drops", CTLTYPE_INT }, \
}
 
 
/*
* IPv6 address macros
*/
#define IN6_IS_ADDR_UNSPECIFIED(a) \
(((u_int32_t*)(a))[0] == 0 \
&& ((u_int32_t*)(a))[1] == 0 \
&& ((u_int32_t*)(a))[2] == 0 \
&& ((u_int32_t*)(a))[3] == 0)
 
#define IN6_IS_ADDR_LOOPBACK(a) \
(((u_int32_t*)(a))[0] == 0 \
&& ((u_int32_t*)(a))[1] == 0 \
&& ((u_int32_t*)(a))[2] == 0 \
&& ((u_int32_t*)(a))[3] == htonl (1))
 
#define IN6_IS_ADDR_MULTICAST(a) (((u_int8_t*) (a))[0] == 0xff)
 
#define IN6_IS_ADDR_LINKLOCAL(a) \
((((u_int32_t*)(a))[0] & htonl(0xffc00000)) == htonl(0xfe800000))
 
#define IN6_IS_ADDR_SITELOCAL(a) \
((((u_int32_t*)(a))[0] & htonl(0xffc00000)) == htonl(0xfec00000))
 
#define IN6_IS_ADDR_V4MAPPED(a) \
((((u_int32_t*)(a))[0] == 0) \
&& (((u_int32_t*)(a))[1] == 0) \
&& (((u_int32_t*)(a))[2] == htonl(0xffff)))
 
#define IN6_IS_ADDR_V4COMPAT(a) \
((((u_int32_t*)(a))[0] == 0) \
&& (((u_int32_t*)(a))[1] == 0) \
&& (((u_int32_t*)(a))[2] == 0) \
&& (ntohl(((u_int32_t*)(a))[3]) > 1))
 
#define IN6_ARE_ADDR_EQUAL(a,b) \
((((u_int32_t*)(a))[0] == ((u_int32_t*)(b))[0]) \
&& (((u_int32_t*)(a))[1] == ((u_int32_t*)(b))[1]) \
&& (((u_int32_t*)(a))[2] == ((u_int32_t*)(b))[2]) \
&& (((u_int32_t*)(a))[3] == ((u_int32_t*)(b))[3]))
 
#define IN6_IS_ADDR_MC_NODELOCAL(a) \
(IN6_IS_ADDR_MULTICAST(a) && ((((u_int8_t*)(a))[1] & 0xf) == 0x1))
 
#define IN6_IS_ADDR_MC_LINKLOCAL(a) \
(IN6_IS_ADDR_MULTICAST(a) && ((((u_int8_t*)(a))[1] & 0xf) == 0x2))
 
#define IN6_IS_ADDR_MC_SITELOCAL(a) \
(IN6_IS_ADDR_MULTICAST(a) && ((((u_int8_t*)(a))[1] & 0xf) == 0x5))
 
#define IN6_IS_ADDR_MC_ORGLOCAL(a) \
(IN6_IS_ADDR_MULTICAST(a) && ((((u_int8_t*)(a))[1] & 0xf) == 0x8))
 
#define IN6_IS_ADDR_MC_GLOBAL(a) \
(IN6_IS_ADDR_MULTICAST(a) && ((((u_int8_t*)(a))[1] & 0xf) == 0xe))
 
#endif /* __NETINET_IN_H */
 
/pkgnet/trunk/watt32/inc/netinet/in_pcb.h
0,0 → 1,100
/*!\file netinet/in_pcb.h
* Internal IP structures.
*/
 
/*
* Copyright (c) 1982, 1986, 1990, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)in_pcb.h 8.1 (Berkeley) 6/10/93
* $Id: in_pcb.h,v 1.14.2.2 1997/03/03 09:24:37 davidg Exp $
*/
 
#ifndef __NETINET_IN_PCB_H
#define __NETINET_IN_PCB_H
 
#include <sys/queue.h>
 
/*
* Common structure pcb for internet protocol implementation.
* Here are stored pointers to local and foreign host table
* entries, local and foreign socket numbers, and pointers
* up (to a socket structure) and down (to a protocol-specific)
* control block.
*/
LIST_HEAD(inpcbhead, inpcb);
 
struct inpcb {
LIST_ENTRY(inpcb) inp_list; /* list for all PCBs of this proto */
LIST_ENTRY(inpcb) inp_hash; /* hash list */
struct inpcbinfo *inp_pcbinfo;
struct in_addr inp_faddr; /* foreign host table entry */
u_short inp_fport; /* foreign port */
struct in_addr inp_laddr; /* local host table entry */
u_short inp_lport; /* local port */
struct socket *inp_socket; /* back pointer to socket */
caddr_t inp_ppcb; /* pointer to per-protocol pcb */
struct route inp_route; /* placeholder for routing entry */
int inp_flags; /* generic IP/datagram flags */
struct ip inp_ip; /* header prototype; should have more */
struct mbuf *inp_options; /* IP options */
struct ip_moptions *inp_moptions; /* IP multicast options */
};
 
struct inpcbinfo {
struct inpcbhead *listhead;
struct inpcbhead *hashbase;
unsigned long hashmask;
unsigned short lastport;
unsigned short lastlow;
unsigned short lasthi;
};
 
#define INP_PCBHASH(faddr, lport, fport, mask) \
(((faddr) ^ ((faddr) >> 16) ^ (lport) ^ (fport)) & (mask))
 
/* flags in inp_flags: */
#define INP_RECVOPTS 0x01 /* receive incoming IP options */
#define INP_RECVRETOPTS 0x02 /* receive IP options for reply */
#define INP_RECVDSTADDR 0x04 /* receive IP dst address */
#define INP_HDRINCL 0x08 /* user supplies entire IP header */
#define INP_HIGHPORT 0x10 /* user wants "high" port binding */
#define INP_LOWPORT 0x20 /* user wants "low" port binding */
#define INP_ANONPORT 0x40 /* port chosen for user */
#define INP_RECVIF 0x80 /* receive incoming interface */
#define INP_CONTROLOPTS (INP_RECVOPTS|INP_RECVRETOPTS|INP_RECVDSTADDR|\
INP_RECVIF)
 
#define INPLOOKUP_WILDCARD 1
 
#define sotoinpcb(so) ((struct inpcb *)(so)->so_pcb)
 
#endif
/pkgnet/trunk/watt32/inc/netinet/in_systm.h
0,0 → 1,62
/*!\file netinet/in_systm.h
* Various typedefs.
*/
 
/*
* Copyright (c) 1982, 1986, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)in_systm.h 8.1 (Berkeley) 6/10/93
* $Id: in_systm.h,v 1.3 1994/08/21 05:27:29 paul Exp $
*/
 
#ifndef __NETINET_IN_SYSTM_H
#define __NETINET_IN_SYSTM_H
 
/*
* Miscellaneous internetwork
* definitions for kernel.
*/
 
/*
* Network types.
*
* Internally the system keeps counters in the headers with the bytes
* swapped so that VAX instructions will work on them. It reverses
* the bytes before transmission at each protocol level. The n_ types
* represent the types with the bytes in ``high-ender'' order.
*/
typedef u_short n_short; /* short as received from the net */
typedef u_long n_long; /* long as received from the net */
 
typedef u_long n_time; /* ms since 00:00 GMT, byte rev */
 
#endif
/pkgnet/trunk/watt32/inc/netinet/in_var.h
0,0 → 1,118
/*!\file netinet/in_var.h
* IP interface address.
*/
 
/*
* Copyright (c) 1985, 1986, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)in_var.h 8.2 (Berkeley) 1/9/95
* $Id: in_var.h,v 1.17 1996/03/14 16:59:19 fenner Exp $
*/
 
#ifndef __NETINET_IN_VAR_H
#define __NETINET_IN_VAR_H
 
#include <sys/queue.h>
 
/*
* Interface address, Internet version. One of these structures
* is allocated for each interface with an Internet address.
* The ifaddr structure contains the protocol-independent part
* of the structure and is assumed to be first.
*/
struct in_ifaddr {
struct ifaddr ia_ifa; /* protocol-independent info */
#define ia_ifp ia_ifa.ifa_ifp
#define ia_flags ia_ifa.ifa_flags
/* ia_{,sub}net{,mask} in host order */
u_long ia_net; /* network number of interface */
u_long ia_netmask; /* mask of net part */
u_long ia_subnet; /* subnet number, including net */
u_long ia_subnetmask; /* mask of subnet part */
struct in_addr ia_netbroadcast; /* to recognize net broadcasts */
struct in_ifaddr *ia_next; /* next in list of internet addresses */
struct sockaddr_in ia_addr; /* reserve space for interface name */
struct sockaddr_in ia_dstaddr; /* reserve space for broadcast addr */
#define ia_broadaddr ia_dstaddr
struct sockaddr_in ia_sockmask; /* reserve space for general netmask */
LIST_HEAD(in_multihead, in_multi) ia_multiaddrs;
/* list of multicast addresses */
};
 
struct in_aliasreq {
char ifra_name[IFNAMSIZ]; /* if name, e.g. "en0" */
struct sockaddr_in ifra_addr;
struct sockaddr_in ifra_broadaddr;
#define ifra_dstaddr ifra_broadaddr
struct sockaddr_in ifra_mask;
};
/*
* Given a pointer to an in_ifaddr (ifaddr),
* return a pointer to the addr as a sockaddr_in.
*/
#define IA_SIN(ia) (&(((struct in_ifaddr *)(ia))->ia_addr))
#define IA_DSTSIN(ia) (&(((struct in_ifaddr *)(ia))->ia_dstaddr))
 
#define IN_LNAOF(in, ifa) \
((ntohl((in).s_addr) & ~((struct in_ifaddr *)(ifa)->ia_subnetmask))
 
 
/*
* This information should be part of the ifnet structure but we don't wish
* to change that - as it might break a number of things
*/
 
struct router_info {
struct ifnet *rti_ifp;
int rti_type; /* type of router which is querier on this interface */
int rti_time; /* # of slow timeouts since last old query */
struct router_info *rti_next;
};
 
/*
* Internet multicast address structure. There is one of these for each IP
* multicast group to which this host belongs on a given network interface.
* They are kept in a linked list, rooted in the interface's in_ifaddr
* structure.
*/
struct in_multi {
LIST_ENTRY(in_multi) inm_entry; /* list glue */
struct in_addr inm_addr; /* IP multicast address */
struct ifnet *inm_ifp; /* back pointer to ifnet */
struct in_ifaddr *inm_ia; /* back pointer to in_ifaddr */
u_int inm_refcount; /* no. membership claims by sockets */
u_int inm_timer; /* IGMP membership report timer */
u_int inm_state; /* state of the membership */
struct router_info *inm_rti; /* router info*/
};
 
#endif
/pkgnet/trunk/watt32/inc/netinet/ip.h
0,0 → 1,195
/*!\file netinet/ip.h
* IPv4 header and options.
*/
 
/*
* Copyright (c) 1982, 1986, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)ip.h 8.2 (Berkeley) 6/1/94
* $Id: ip.h,v 1.10 1996/10/23 18:35:49 wollman Exp $
*/
 
#ifndef __NETINET_IP_H
#define __NETINET_IP_H
 
#ifndef __NETINET_IN_SYSTM_H
#include <netinet/in_systm.h>
#endif
 
#if defined(__TURBOC__) || defined(__BORLANDC__)
#pragma warn -bbf- /* "Bitfields must be signed or unsigned int" warning */
#endif
 
/*
* Definitions for internet protocol version 4.
* Per RFC 791, September 1981.
*/
#define IPVERSION 4
 
#include <sys/packon.h>
 
/*
* Structure of an internet header, naked of options.
*
* We declare ip_len and ip_off to be short, rather than u_short
* pragmatically since otherwise unsigned comparisons can result
* against negative integers quite easily, and fail in subtle ways.
*/
struct ip {
#ifdef _IP_VHL
u_char ip_vhl; /* version << 4 | header length >> 2 */
#else
u_char ip_hl:4; /* header length */
u_char ip_v:4; /* version */
#endif
u_char ip_tos; /* type of service */
u_short ip_len; /* total length */
u_short ip_id; /* identification */
u_short ip_off; /* fragment offset field */
#define IP_DF 0x4000 /* dont fragment flag */
#define IP_MF 0x2000 /* more fragments flag */
#define IP_OFFMASK 0x1FFF /* mask for fragmenting bits */
u_char ip_ttl; /* time to live */
u_char ip_p; /* protocol */
u_short ip_sum; /* checksum */
struct in_addr ip_src,ip_dst; /* source and dest address */
};
 
#ifdef _IP_VHL
#define IP_MAKE_VHL(v,hl) ((v) << 4 | (hl))
#define IP_VHL_HL(vhl) ((vhl) & 0x0f)
#define IP_VHL_V(vhl) ((vhl) >> 4)
#define IP_VHL_BORING 0x45
#endif
 
#define IP_MAXPACKET 65535 /* maximum packet size */
 
/*
* Definitions for IP type of service (ip_tos)
*/
#define IPTOS_LOWDELAY 0x10
#define IPTOS_THROUGHPUT 0x08
#define IPTOS_RELIABILITY 0x04
#define IPTOS_MINCOST 0x02
 
/*
* Definitions for IP precedence (also in ip_tos) (hopefully unused)
*/
#define IPTOS_PREC_NETCONTROL 0xe0
#define IPTOS_PREC_INTERNETCONTROL 0xc0
#define IPTOS_PREC_CRITIC_ECP 0xa0
#define IPTOS_PREC_FLASHOVERRIDE 0x80
#define IPTOS_PREC_FLASH 0x60
#define IPTOS_PREC_IMMEDIATE 0x40
#define IPTOS_PREC_PRIORITY 0x20
#define IPTOS_PREC_ROUTINE 0x00
 
/*
* Definitions for options.
*/
#define IPOPT_COPIED(o) ((o)&0x80)
#define IPOPT_CLASS(o) ((o)&0x60)
#define IPOPT_NUMBER(o) ((o)&0x1f)
 
#define IPOPT_CONTROL 0x00
#define IPOPT_RESERVED1 0x20
#define IPOPT_DEBMEAS 0x40
#define IPOPT_RESERVED2 0x60
 
#define IPOPT_EOL 0 /* end of option list */
#define IPOPT_NOP 1 /* no operation */
 
#define IPOPT_RR 7 /* record packet route */
#define IPOPT_TS 68 /* timestamp */
#define IPOPT_SECURITY 130 /* provide s,c,h,tcc */
#define IPOPT_LSRR 131 /* loose source route */
#define IPOPT_SATID 136 /* satnet id */
#define IPOPT_SSRR 137 /* strict source route */
#define IPOPT_RA 148 /* router alert */
 
/*
* Offsets to fields in options other than EOL and NOP.
*/
#define IPOPT_OPTVAL 0 /* option ID */
#define IPOPT_OLEN 1 /* option length */
#define IPOPT_OFFSET 2 /* offset within option */
#define IPOPT_MINOFF 4 /* min value of above */
 
/*
* Time stamp option structure.
*/
struct ip_timestamp {
u_char ipt_code; /* IPOPT_TS */
u_char ipt_len; /* size of structure (variable) */
u_char ipt_ptr; /* index of current entry */
u_char ipt_flg:4; /* flags, see below */
u_char ipt_oflw:4; /* overflow counter */
union ipt_timestamp {
n_long ipt_time[1];
struct ipt_ta {
struct in_addr ipt_addr;
n_long ipt_time;
} ipt_ta[1];
} ipt_timestamp;
};
 
#include <sys/packoff.h>
 
/* flag bits for ipt_flg */
#define IPOPT_TS_TSONLY 0 /* timestamps only */
#define IPOPT_TS_TSANDADDR 1 /* timestamps and addresses */
#define IPOPT_TS_PRESPEC 3 /* specified modules only */
 
/* bits for security (not byte swapped) */
#define IPOPT_SECUR_UNCLASS 0x0000
#define IPOPT_SECUR_CONFID 0xf135
#define IPOPT_SECUR_EFTO 0x789a
#define IPOPT_SECUR_MMMM 0xbc4d
#define IPOPT_SECUR_RESTR 0xaf13
#define IPOPT_SECUR_SECRET 0xd788
#define IPOPT_SECUR_TOPSECRET 0x6bc5
 
/*
* Internet implementation parameters.
*/
#define MAXTTL 255 /* maximum time to live (seconds) */
#define IPDEFTTL 64 /* default ttl, from RFC 1340 */
#define IPFRAGTTL 60 /* time to live for frags, slowhz */
#define IPTTLDEC 1 /* subtracted when forwarding */
 
#define IP_MSS 576 /* default maximum segment size */
 
#if defined(__TURBOC__) || defined(__BORLANDC__)
#pragma warn -bbf.
#endif
 
#endif
/pkgnet/trunk/watt32/inc/netinet/ip6.h
0,0 → 1,321
/*!\file netinet/ip6.h
* IPv6 definitions.
*/
 
/* $FreeBSD: src/sys/netinet/ip6.h,v 1.5 2001/06/11 12:39:00 ume Exp $ */
/* $KAME: ip6.h,v 1.18 2001/03/29 05:34:30 itojun Exp $ */
 
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the project nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
 
/*
* Copyright (c) 1982, 1986, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)ip.h 8.1 (Berkeley) 6/10/93
*/
 
#ifndef _NETINET_IP6_H_
#define _NETINET_IP6_H_
 
/*
* Definition for internet protocol version 6.
* RFC 2460
*/
 
#ifndef __SYS_WTYPES_H
#include <sys/wtypes.h>
#endif
 
#include <sys/packon.h>
 
struct ip6_hdr {
union {
struct ip6_hdrctl {
u_int32_t ip6_un1_flow; /* 20 bits of flow-ID */
u_int16_t ip6_un1_plen; /* payload length */
u_int8_t ip6_un1_nxt; /* next header */
u_int8_t ip6_un1_hlim; /* hop limit */
} ip6_un1;
u_int8_t ip6_un2_vfc; /* 4 bits version, top 4 bits class */
} ip6_ctlun;
struct in6_addr ip6_src; /* source address */
struct in6_addr ip6_dst; /* destination address */
};
 
#define ip6_vfc ip6_ctlun.ip6_un2_vfc
#define ip6_flow ip6_ctlun.ip6_un1.ip6_un1_flow
#define ip6_plen ip6_ctlun.ip6_un1.ip6_un1_plen
#define ip6_nxt ip6_ctlun.ip6_un1.ip6_un1_nxt
#define ip6_hlim ip6_ctlun.ip6_un1.ip6_un1_hlim
#define ip6_hops ip6_ctlun.ip6_un1.ip6_un1_hlim
 
#define IPV6_VERSION 0x60
#define IPV6_VERSION_MASK 0xf0
 
#if BYTE_ORDER == BIG_ENDIAN
#define IPV6_FLOWINFO_MASK 0x0fffffff /* flow info (28 bits) */
#define IPV6_FLOWLABEL_MASK 0x000fffff /* flow label (20 bits) */
#else
#if BYTE_ORDER == LITTLE_ENDIAN
#define IPV6_FLOWINFO_MASK 0xffffff0f /* flow info (28 bits) */
#define IPV6_FLOWLABEL_MASK 0xffff0f00 /* flow label (20 bits) */
#endif /* LITTLE_ENDIAN */
#endif
 
#if 1
/* ECN bits proposed by Sally Floyd */
#define IP6TOS_CE 0x01 /* congestion experienced */
#define IP6TOS_ECT 0x02 /* ECN-capable transport */
#endif
 
/*
* Extension Headers
*/
 
struct ip6_ext {
u_int8_t ip6e_nxt;
u_int8_t ip6e_len;
};
 
/* Hop-by-Hop options header */
/* XXX should we pad it to force alignment on an 8-byte boundary? */
struct ip6_hbh {
u_int8_t ip6h_nxt; /* next header */
u_int8_t ip6h_len; /* length in units of 8 octets */
/* followed by options */
};
 
/* Destination options header */
/* XXX should we pad it to force alignment on an 8-byte boundary? */
struct ip6_dest {
u_int8_t ip6d_nxt; /* next header */
u_int8_t ip6d_len; /* length in units of 8 octets */
/* followed by options */
};
 
/* Option types and related macros */
#define IP6OPT_PAD1 0x00 /* 00 0 00000 */
#define IP6OPT_PADN 0x01 /* 00 0 00001 */
#define IP6OPT_JUMBO 0xC2 /* 11 0 00010 = 194 */
#define IP6OPT_NSAP_ADDR 0xC3 /* 11 0 00011 */
#define IP6OPT_TUNNEL_LIMIT 0x04 /* 00 0 00100 */
#define IP6OPT_RTALERT 0x05 /* 00 0 00101 (KAME definition) */
 
#define IP6OPT_RTALERT_LEN 4
#define IP6OPT_RTALERT_MLD 0 /* Datagram contains an MLD message */
#define IP6OPT_RTALERT_RSVP 1 /* Datagram contains an RSVP message */
#define IP6OPT_RTALERT_ACTNET 2 /* contains an Active Networks msg */
#define IP6OPT_MINLEN 2
 
#define IP6OPT_BINDING_UPDATE 0xc6 /* 11 0 00110 */
#define IP6OPT_BINDING_ACK 0x07 /* 00 0 00111 */
#define IP6OPT_BINDING_REQ 0x08 /* 00 0 01000 */
#define IP6OPT_HOME_ADDRESS 0xc9 /* 11 0 01001 */
#define IP6OPT_EID 0x8a /* 10 0 01010 */
 
#define IP6OPT_TYPE(o) ((o) & 0xC0)
#define IP6OPT_TYPE_SKIP 0x00
#define IP6OPT_TYPE_DISCARD 0x40
#define IP6OPT_TYPE_FORCEICMP 0x80
#define IP6OPT_TYPE_ICMP 0xC0
 
#define IP6OPT_MUTABLE 0x20
 
#define IP6OPT_JUMBO_LEN 6
 
/* Routing header */
struct ip6_rthdr {
u_int8_t ip6r_nxt; /* next header */
u_int8_t ip6r_len; /* length in units of 8 octets */
u_int8_t ip6r_type; /* routing type */
u_int8_t ip6r_segleft; /* segments left */
/* followed by routing type specific data */
};
 
/* Type 0 Routing header */
struct ip6_rthdr0 {
u_int8_t ip6r0_nxt; /* next header */
u_int8_t ip6r0_len; /* length in units of 8 octets */
u_int8_t ip6r0_type; /* always zero */
u_int8_t ip6r0_segleft; /* segments left */
u_int8_t ip6r0_reserved; /* reserved field */
u_int8_t ip6r0_slmap[3]; /* strict/loose bit map */
struct in6_addr ip6r0_addr[1]; /* up to 23 addresses */
};
 
/* Fragment header */
struct ip6_frag {
u_int8_t ip6f_nxt; /* next header */
u_int8_t ip6f_reserved; /* reserved field */
u_int16_t ip6f_offlg; /* offset, reserved, and flag */
u_int32_t ip6f_ident; /* identification */
};
 
#include <sys/packoff.h>
 
#if BYTE_ORDER == BIG_ENDIAN
#define IP6F_OFF_MASK 0xfff8 /* mask out offset from _offlg */
#define IP6F_RESERVED_MASK 0x0006 /* reserved bits in ip6f_offlg */
#define IP6F_MORE_FRAG 0x0001 /* more-fragments flag */
#else /* BYTE_ORDER == LITTLE_ENDIAN */
#define IP6F_OFF_MASK 0xf8ff /* mask out offset from _offlg */
#define IP6F_RESERVED_MASK 0x0600 /* reserved bits in ip6f_offlg */
#define IP6F_MORE_FRAG 0x0100 /* more-fragments flag */
#endif /* BYTE_ORDER == LITTLE_ENDIAN */
 
/*
* Internet implementation parameters.
*/
#define IPV6_MAXHLIM 255 /* maximun hoplimit */
#define IPV6_DEFHLIM 64 /* default hlim */
#define IPV6_FRAGTTL 120 /* ttl for fragment packets, in slowtimo tick */
#define IPV6_HLIMDEC 1 /* subtracted when forwaeding */
 
#define IPV6_MMTU 1280 /* minimal MTU and reassembly. 1024 + 256 */
#define IPV6_MAXPACKET 65535 /* ip6 max packet size without Jumbo payload*/
 
#ifdef _KERNEL
/*
* IP6_EXTHDR_CHECK ensures that region between the IP6 header and the
* target header (including IPv6 itself, extension headers and
* TCP/UDP/ICMP6 headers) are continuous. KAME requires drivers
* to store incoming data into one internal mbuf or one or more external
* mbufs(never into two or more internal mbufs). Thus, the third case is
* supposed to never be matched but is prepared just in case.
*/
 
#define IP6_EXTHDR_CHECK(m, off, hlen, ret) \
do { \
if ((m)->m_next != NULL) { \
if (((m)->m_flags & M_LOOP) && \
((m)->m_len < (off) + (hlen)) && \
(((m) = m_pullup((m), (off) + (hlen))) == NULL)) { \
ip6stat.ip6s_exthdrtoolong++; \
return ret; \
} else if ((m)->m_flags & M_EXT) { \
if ((m)->m_len < (off) + (hlen)) { \
ip6stat.ip6s_exthdrtoolong++; \
m_freem(m); \
return ret; \
} \
} else { \
if ((m)->m_len < (off) + (hlen)) { \
ip6stat.ip6s_exthdrtoolong++; \
m_freem(m); \
return ret; \
} \
} \
} else { \
if ((m)->m_len < (off) + (hlen)) { \
ip6stat.ip6s_tooshort++; \
in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_truncated); \
m_freem(m); \
return ret; \
} \
} \
} while (0)
 
/*
* IP6_EXTHDR_GET ensures that intermediate protocol header (from "off" to
* "len") is located in single mbuf, on contiguous memory region.
* The pointer to the region will be returned to pointer variable "val",
* with type "typ".
* IP6_EXTHDR_GET0 does the same, except that it aligns the structure at the
* very top of mbuf. GET0 is likely to make memory copy than GET.
*
* XXX we're now testing this, needs m_pulldown()
*/
#define IP6_EXTHDR_GET(val, typ, m, off, len) \
do { \
struct mbuf *t; \
int tmp; \
if ((m)->m_len >= (off) + (len)) \
(val) = (typ)(mtod((m), caddr_t) + (off)); \
else { \
t = m_pulldown((m), (off), (len), &tmp); \
if (t) { \
if (t->m_len < tmp + (len)) \
panic("m_pulldown malfunction"); \
(val) = (typ)(mtod(t, caddr_t) + tmp); \
} else { \
(val) = (typ)NULL; \
(m) = NULL; \
} \
} \
} while (0)
 
#define IP6_EXTHDR_GET0(val, typ, m, off, len) \
do { \
struct mbuf *t; \
if ((off) == 0) \
(val) = (typ)mtod(m, caddr_t); \
else { \
t = m_pulldown((m), (off), (len), NULL); \
if (t) { \
if (t->m_len < (len)) \
panic("m_pulldown malfunction"); \
(val) = (typ)mtod(t, caddr_t); \
} else { \
(val) = (typ)NULL; \
(m) = NULL; \
} \
} \
} while (0)
#endif /*_KERNEL*/
 
#endif /* not _NETINET_IP6_H_ */
/pkgnet/trunk/watt32/inc/netinet/ip_fw.h
0,0 → 1,123
/*!\file netinet/ip_fw.h
* IP firewall definitions.
*/
 
/*
* Copyright (c) 1993 Daniel Boulet
* Copyright (c) 1994 Ugen J.S.Antsilevich
*
* Redistribution and use in source forms, with and without modification,
* are permitted provided that this entire comment appears intact.
*
* Redistribution in binary form may occur without any restrictions.
* Obviously, it would be nice if you gave credit where credit is due
* but requiring it would be too onerous.
*
* This software is provided ``AS IS'' without any warranties of any kind.
*
* $Id: ip_fw.h,v 1.23.2.1 1997/01/29 13:15:43 adam Exp $
*/
 
/*
* Format of an IP firewall descriptor
*
* fw_src, fw_dst, fw_smsk, fw_dmsk are always stored in network byte order.
* fw_flg and fw_n*p are stored in host byte order (of course).
* Port numbers are stored in HOST byte order.
*/
 
#ifndef __NETINET_IP_FW_H
#define __NETINET_IP_FW_H
 
struct ip_fw {
u_long fw_pcnt,fw_bcnt; /* Packet and byte counters */
struct in_addr fw_src, fw_dst; /* Source and destination IP addr */
struct in_addr fw_smsk, fw_dmsk; /* Mask for src and dest IP addr */
union {
struct in_addr fu_via_ip; /* Specified by IP address */
struct { /* Specified by interface name */
#define FW_IFNLEN 6 /* To keep structure on 2^x boundary */
char fu_via_name[FW_IFNLEN];
short fu_via_unit;
} fu_via_if;
} fu_via_un;
#define fw_via_ip fu_via_un.fu_via_ip
#define fw_via_name fu_via_un.fu_via_if.fu_via_name
#define fw_via_unit fu_via_un.fu_via_if.fu_via_unit
u_short fw_number;
u_short fw_flg; /* Flags word */
u_short fw_nsp, fw_ndp; /* N'of src ports and # of dst ports */
/* in ports array (dst ports follow */
/* src ports; max of 10 ports in all; */
/* count of 0 means match all ports) */
#define IP_FW_MAX_PORTS 10 /* A reasonable maximum */
u_short fw_pts[IP_FW_MAX_PORTS]; /* Array of port numbers to match */
u_char fw_ipopt,fw_ipnopt; /* IP options set/unset */
u_char fw_tcpf,fw_tcpnf; /* TCP flags set/unset */
#define IP_FW_ICMPTYPES_DIM (256 / (sizeof(unsigned) * 8))
unsigned fw_icmptypes[IP_FW_ICMPTYPES_DIM]; /* ICMP types bitmap */
long timestamp; /* timestamp (tv_sec) of last match */
u_short fw_divert_port; /* Divert port (options IPDIVERT) */
u_char fw_prot; /* IP protocol */
};
 
struct ip_fw_chain {
LIST_ENTRY(ip_fw_chain) chain;
struct ip_fw *rule;
};
 
/*
* Values for "flags" field .
*/
#define IP_FW_F_INVSRC 0x0001 /* Invert sense of src check */
#define IP_FW_F_INVDST 0x0002 /* Invert sense of dst check */
#define IP_FW_F_IN 0x0004 /* Inbound */
#define IP_FW_F_OUT 0x0008 /* Outbound */
 
#define IP_FW_F_COMMAND 0x0030 /* Mask for type of chain entry: */
#define IP_FW_F_ACCEPT 0x0010 /* This is an accept rule */
#define IP_FW_F_COUNT 0x0020 /* This is a count rule */
#define IP_FW_F_DIVERT 0x0030 /* This is a divert rule */
#define IP_FW_F_DENY 0x0000 /* This is a deny rule */
 
#define IP_FW_F_PRN 0x0040 /* Print if this rule matches */
#define IP_FW_F_ICMPRPL 0x0080 /* Send back icmp unreachable packet */
 
#define IP_FW_F_SRNG 0x0100 /* The first two src ports are a min *
* and max range (stored in host byte *
* order). */
 
#define IP_FW_F_DRNG 0x0200 /* The first two dst ports are a min *
* and max range (stored in host byte *
* order). */
 
#define IP_FW_F_IFNAME 0x0400 /* Use interface name/unit (not IP) */
 
#define IP_FW_F_FRAG 0x0800 /* Fragment */
 
#define IP_FW_F_ICMPBIT 0x1000 /* ICMP type bitmap is valid */
 
#define IP_FW_F_IFUWILD 0x2000 /* Match all interface units */
 
#define IP_FW_F_MASK 0x3FFF /* All possible flag bits mask */
 
/*
* Definitions for IP option names.
*/
#define IP_FW_IPOPT_LSRR 0x01
#define IP_FW_IPOPT_SSRR 0x02
#define IP_FW_IPOPT_RR 0x04
#define IP_FW_IPOPT_TS 0x08
 
/*
* Definitions for TCP flags.
*/
#define IP_FW_TCPF_FIN TH_FIN
#define IP_FW_TCPF_SYN TH_SYN
#define IP_FW_TCPF_RST TH_RST
#define IP_FW_TCPF_PSH TH_PUSH
#define IP_FW_TCPF_ACK TH_ACK
#define IP_FW_TCPF_URG TH_URG
#define IP_FW_TCPF_ESTAB 0x40
 
#endif
/pkgnet/trunk/watt32/inc/netinet/ip_icmp.h
0,0 → 1,195
/*!\file netinet/ip_icmp.h
* ICMP definitions.
*/
 
/*
* Copyright (c) 1982, 1986, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)ip_icmp.h 8.1 (Berkeley) 6/10/93
* $Id: ip_icmp.h,v 1.9 1996/08/20 23:11:30 fenner Exp $
*/
 
#ifndef __NETINET_IP_ICMP_H
#define __NETINET_IP_ICMP_H
 
#include <sys/packon.h>
 
/*
* Interface Control Message Protocol Definitions.
* Per RFC 792, September 1981.
*/
 
/*
* Internal of an ICMP Router Advertisement
*/
struct icmp_ra_addr {
u_int32_t ira_addr;
u_int32_t ira_preference;
};
 
/*
* Structure of an icmp header.
*/
struct icmp {
u_char icmp_type; /* type of message, see below */
u_char icmp_code; /* type sub code */
u_short icmp_cksum; /* ones complement cksum of struct */
union {
u_char ih_pptr; /* ICMP_PARAMPROB */
struct in_addr ih_gwaddr; /* ICMP_REDIRECT */
struct ih_idseq {
n_short icd_id;
n_short icd_seq;
} ih_idseq;
u_int32_t ih_void; /* was 'int' */
 
/* ICMP_UNREACH_NEEDFRAG -- Path MTU Discovery (RFC1191) */
struct ih_pmtu {
n_short ipm_void;
n_short ipm_nextmtu;
} ih_pmtu;
 
struct ih_rtradv {
u_char irt_num_addrs;
u_char irt_wpa;
u_int16_t irt_lifetime;
} ih_rtradv;
} icmp_hun;
#define icmp_pptr icmp_hun.ih_pptr
#define icmp_gwaddr icmp_hun.ih_gwaddr
#define icmp_id icmp_hun.ih_idseq.icd_id
#define icmp_seq icmp_hun.ih_idseq.icd_seq
#define icmp_void icmp_hun.ih_void
#define icmp_pmvoid icmp_hun.ih_pmtu.ipm_void
#define icmp_nextmtu icmp_hun.ih_pmtu.ipm_nextmtu
#define icmp_num_addrs icmp_hun.ih_rtradv.irt_num_addrs
#define icmp_wpa icmp_hun.ih_rtradv.irt_wpa
#define icmp_lifetime icmp_hun.ih_rtradv.irt_lifetime
union {
struct id_ts {
n_time its_otime;
n_time its_rtime;
n_time its_ttime;
} id_ts;
struct id_ip {
struct ip idi_ip;
/* options and then 64 bits of data */
} id_ip;
struct icmp_ra_addr id_radv;
u_long id_mask;
char id_data[1];
} icmp_dun;
#define icmp_otime icmp_dun.id_ts.its_otime
#define icmp_rtime icmp_dun.id_ts.its_rtime
#define icmp_ttime icmp_dun.id_ts.its_ttime
#define icmp_ip icmp_dun.id_ip.idi_ip
#define icmp_radv icmp_dun.id_radv
#define icmp_mask icmp_dun.id_mask
#define icmp_data icmp_dun.id_data
};
 
#include <sys/packoff.h>
 
/*
* Lower bounds on packet lengths for various types.
* For the error advice packets must first insure that the
* packet is large enough to contain the returned ip header.
* Only then can we do the check to see if 64 bits of packet
* data have been returned, since we need to check the returned
* ip header length.
*/
#define ICMP_MINLEN 8 /* abs minimum */
#define ICMP_TSLEN (8 + 3 * sizeof (n_time)) /* timestamp */
#define ICMP_MASKLEN 12 /* address mask */
#define ICMP_ADVLENMIN (8 + sizeof (struct ip) + 8) /* min */
#ifndef _IP_VHL
#define ICMP_ADVLEN(p) (8 + ((p)->icmp_ip.ip_hl << 2) + 8)
/* N.B.: must separately check that ip_hl >= 5 */
#else
#define ICMP_ADVLEN(p) (8 + (IP_VHL_HL((p)->icmp_ip.ip_vhl) << 2) + 8)
/* N.B.: must separately check that header length >= 5 */
#endif
 
/*
* Definition of type and code field values.
*/
#define ICMP_ECHOREPLY 0 /* echo reply */
#define ICMP_UNREACH 3 /* dest unreachable, codes: */
#define ICMP_UNREACH_NET 0 /* bad net */
#define ICMP_UNREACH_HOST 1 /* bad host */
#define ICMP_UNREACH_PROTOCOL 2 /* bad protocol */
#define ICMP_UNREACH_PORT 3 /* bad port */
#define ICMP_UNREACH_NEEDFRAG 4 /* IP_DF caused drop */
#define ICMP_UNREACH_SRCFAIL 5 /* src route failed */
#define ICMP_UNREACH_NET_UNKNOWN 6 /* unknown net */
#define ICMP_UNREACH_HOST_UNKNOWN 7 /* unknown host */
#define ICMP_UNREACH_ISOLATED 8 /* src host isolated */
#define ICMP_UNREACH_NET_PROHIB 9 /* prohibited access */
#define ICMP_UNREACH_HOST_PROHIB 10 /* ditto */
#define ICMP_UNREACH_TOSNET 11 /* bad tos for net */
#define ICMP_UNREACH_TOSHOST 12 /* bad tos for host */
#define ICMP_UNREACH_FILTER_PROHIB 13 /* admin prohib */
#define ICMP_UNREACH_HOST_PRECEDENCE 14 /* host prec vio. */
#define ICMP_UNREACH_PRECEDENCE_CUTOFF 15 /* prec cutoff */
#define ICMP_SOURCEQUENCH 4 /* packet lost, slow down */
#define ICMP_REDIRECT 5 /* shorter route, codes: */
#define ICMP_REDIRECT_NET 0 /* for network */
#define ICMP_REDIRECT_HOST 1 /* for host */
#define ICMP_REDIRECT_TOSNET 2 /* for tos and net */
#define ICMP_REDIRECT_TOSHOST 3 /* for tos and host */
#define ICMP_ECHO 8 /* echo service */
#define ICMP_ROUTERADVERT 9 /* router advertisement */
#define ICMP_ROUTERSOLICIT 10 /* router solicitation */
#define ICMP_TIMXCEED 11 /* time exceeded, code: */
#define ICMP_TIMXCEED_INTRANS 0 /* ttl==0 in transit */
#define ICMP_TIMXCEED_REASS 1 /* ttl==0 in reass */
#define ICMP_PARAMPROB 12 /* ip header bad */
#define ICMP_PARAMPROB_OPTABSENT 1 /* req. opt. absent */
#define ICMP_TSTAMP 13 /* timestamp request */
#define ICMP_TSTAMPREPLY 14 /* timestamp reply */
#define ICMP_IREQ 15 /* information request */
#define ICMP_IREQREPLY 16 /* information reply */
#define ICMP_MASKREQ 17 /* address mask request */
#define ICMP_MASKREPLY 18 /* address mask reply */
 
#ifndef ICMP_MAXTYPE
#define ICMP_MAXTYPE 18
#endif
 
#define ICMP_INFOTYPE(type) \
((type) == ICMP_ECHOREPLY || (type) == ICMP_ECHO || \
(type) == ICMP_ROUTERADVERT || (type) == ICMP_ROUTERSOLICIT || \
(type) == ICMP_TSTAMP || (type) == ICMP_TSTAMPREPLY || \
(type) == ICMP_IREQ || (type) == ICMP_IREQREPLY || \
(type) == ICMP_MASKREQ || (type) == ICMP_MASKREPLY)
 
#endif
/pkgnet/trunk/watt32/inc/netinet/ip_mrout.h
0,0 → 1,253
/*!\file netinet/ip_mrout.h
* IP multicast forwarding.
*/
 
/*
* Copyright (c) 1989 Stephen Deering.
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Stephen Deering of Stanford University.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)ip_mroute.h 8.1 (Berkeley) 6/10/93
* $Id: ip_mroute.h,v 1.10.4.1 1997/02/22 19:47:28 joerg Exp $
*/
 
#ifndef __NETINET_IP_MROUTE_H
#define __NETINET_IP_MROUTE_H
 
/*
* Definitions for IP multicast forwarding.
*
* Written by David Waitzman, BBN Labs, August 1988.
* Modified by Steve Deering, Stanford, February 1989.
* Modified by Ajit Thyagarajan, PARC, August 1993.
* Modified by Ajit Thyagarajan, PARC, August 1994.
*
* MROUTING Revision: 3.3.1.3
*/
 
 
/*
* Multicast Routing set/getsockopt commands.
*/
#define MRT_INIT 100 /* initialize forwarder */
#define MRT_DONE 101 /* shut down forwarder */
#define MRT_ADD_VIF 102 /* create virtual interface */
#define MRT_DEL_VIF 103 /* delete virtual interface */
#define MRT_ADD_MFC 104 /* insert forwarding cache entry */
#define MRT_DEL_MFC 105 /* delete forwarding cache entry */
#define MRT_VERSION 106 /* get kernel version number */
#define MRT_ASSERT 107 /* enable PIM assert processing */
 
 
#define GET_TIME(t) microtime(&t)
 
/*
* Types and macros for handling bitmaps with one bit per virtual interface.
*/
#define MAXVIFS 32
typedef u_long vifbitmap_t;
typedef u_short vifi_t; /* type of a vif index */
#define ALL_VIFS (vifi_t)-1
 
#define VIFM_SET(n, m) ((m) |= (1 << (n)))
#define VIFM_CLR(n, m) ((m) &= ~(1 << (n)))
#define VIFM_ISSET(n, m) ((m) & (1 << (n)))
#define VIFM_CLRALL(m) ((m) = 0x00000000)
#define VIFM_COPY(mfrom, mto) ((mto) = (mfrom))
#define VIFM_SAME(m1, m2) ((m1) == (m2))
 
 
/*
* Argument structure for MRT_ADD_VIF.
* (MRT_DEL_VIF takes a single vifi_t argument.)
*/
struct vifctl {
vifi_t vifc_vifi; /* the index of the vif to be added */
u_char vifc_flags; /* VIFF_ flags defined below */
u_char vifc_threshold; /* min ttl required to forward on vif */
u_int vifc_rate_limit; /* max rate */
struct in_addr vifc_lcl_addr; /* local interface address */
struct in_addr vifc_rmt_addr; /* remote address (tunnels only) */
};
 
#define VIFF_TUNNEL 0x1 /* vif represents a tunnel end-point */
#define VIFF_SRCRT 0x2 /* tunnel uses IP source routing */
 
/*
* Argument structure for MRT_ADD_MFC and MRT_DEL_MFC
* (mfcc_tos to be added at a future point)
*/
struct mfcctl {
struct in_addr mfcc_origin; /* ip origin of mcasts */
struct in_addr mfcc_mcastgrp; /* multicast group associated*/
vifi_t mfcc_parent; /* incoming vif */
u_char mfcc_ttls[MAXVIFS]; /* forwarding ttls on vifs */
};
 
/*
* The kernel's multicast routing statistics.
*/
struct mrtstat {
u_long mrts_mfc_lookups; /* # forw. cache hash table hits */
u_long mrts_mfc_misses; /* # forw. cache hash table misses */
u_long mrts_upcalls; /* # calls to mrouted */
u_long mrts_no_route; /* no route for packet's origin */
u_long mrts_bad_tunnel; /* malformed tunnel options */
u_long mrts_cant_tunnel; /* no room for tunnel options */
u_long mrts_wrong_if; /* arrived on wrong interface */
u_long mrts_upq_ovflw; /* upcall Q overflow */
u_long mrts_cache_cleanups; /* # entries with no upcalls */
u_long mrts_drop_sel; /* pkts dropped selectively */
u_long mrts_q_overflow; /* pkts dropped - Q overflow */
u_long mrts_pkt2large; /* pkts dropped - size > BKT SIZE */
u_long mrts_upq_sockfull; /* upcalls dropped - socket full */
};
 
/*
* Argument structure used by mrouted to get src-grp pkt counts
*/
struct sioc_sg_req {
struct in_addr src;
struct in_addr grp;
u_long pktcnt;
u_long bytecnt;
u_long wrong_if;
};
 
/*
* Argument structure used by mrouted to get vif pkt counts
*/
struct sioc_vif_req {
vifi_t vifi; /* vif number */
u_long icount; /* Input packet count on vif */
u_long ocount; /* Output packet count on vif */
u_long ibytes; /* Input byte count on vif */
u_long obytes; /* Output byte count on vif */
};
 
/*
* The kernel's virtual-interface structure.
*/
struct vif {
u_char v_flags; /* VIFF_ flags defined above */
u_char v_threshold; /* min ttl required to forward on vif*/
u_int v_rate_limit; /* max rate */
struct tbf *v_tbf; /* token bucket structure at intf. */
struct in_addr v_lcl_addr; /* local interface address */
struct in_addr v_rmt_addr; /* remote address (tunnels only) */
struct ifnet *v_ifp; /* pointer to interface */
u_long v_pkt_in; /* # pkts in on interface */
u_long v_pkt_out; /* # pkts out on interface */
u_long v_bytes_in; /* # bytes in on interface */
u_long v_bytes_out; /* # bytes out on interface */
struct route v_route; /* cached route if this is a tunnel */
u_int v_rsvp_on; /* RSVP listening on this vif */
struct socket *v_rsvpd; /* RSVP daemon socket */
};
 
/*
* The kernel's multicast forwarding cache entry structure
* (A field for the type of service (mfc_tos) is to be added
* at a future point)
*/
struct mfc {
struct in_addr mfc_origin; /* IP origin of mcasts */
struct in_addr mfc_mcastgrp; /* multicast group associated*/
vifi_t mfc_parent; /* incoming vif */
u_char mfc_ttls[MAXVIFS]; /* forwarding ttls on vifs */
u_long mfc_pkt_cnt; /* pkt count for src-grp */
u_long mfc_byte_cnt; /* byte count for src-grp */
u_long mfc_wrong_if; /* wrong if for src-grp */
int mfc_expire; /* time to clean entry up */
struct timeval mfc_last_assert; /* last time I sent an assert*/
};
 
/*
* Struct used to communicate from kernel to multicast router
* note the convenient similarity to an IP packet
*/
struct igmpmsg {
u_long unused1;
u_long unused2;
u_char im_msgtype; /* what type of message */
#define IGMPMSG_NOCACHE 1
#define IGMPMSG_WRONGVIF 2
u_char im_mbz; /* must be zero */
u_char im_vif; /* vif rec'd on */
u_char unused3;
struct in_addr im_src, im_dst;
};
 
/*
* Argument structure used for pkt info. while upcall is made
*/
struct rtdetq {
struct mbuf *m; /* A copy of the packet */
struct ifnet *ifp; /* Interface pkt came in on */
vifi_t xmt_vif; /* Saved copy of imo_multicast_vif */
#ifdef UPCALL_TIMING
struct timeval t; /* Timestamp */
#endif
};
 
#define MFCTBLSIZ 256
#if (MFCTBLSIZ & (MFCTBLSIZ - 1)) == 0 /* from sys:route.h */
#define MFCHASHMOD(h) ((h) & (MFCTBLSIZ - 1))
#else
#define MFCHASHMOD(h) ((h) % MFCTBLSIZ)
#endif
 
#define MAX_UPQ 4 /* max. no of pkts in upcall Q */
 
/*
* Token Bucket filter code
*/
#define MAX_BKT_SIZE 10000 /* 10K bytes size */
#define MAXQSIZE 10 /* max # of pkts in queue */
 
/*
* the token bucket filter at each vif
*/
struct tbf
{
struct timeval tbf_last_pkt_t; /* arr. time of last pkt */
u_long tbf_n_tok; /* no of tokens in bucket */
u_long tbf_q_len; /* length of queue at this vif */
u_long tbf_max_q_len; /* max. queue length */
struct mbuf *tbf_q; /* Packet queue */
struct mbuf *tbf_t; /* tail-insertion pointer */
};
 
#endif
/pkgnet/trunk/watt32/inc/netinet/ip_var.h
0,0 → 1,164
/*!\file netinet/ip_var.h
* Internal IP definitions and statistics.
*/
 
/*
* Copyright (c) 1982, 1986, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)ip_var.h 8.2 (Berkeley) 1/9/95
* $Id: ip_var.h,v 1.24.2.2 1996/11/12 11:28:59 phk Exp $
*/
 
#ifndef __NETINET_IP_VAR_H
#define __NETINET_IP_VAR_H
 
#include <sys/packon.h>
 
#if defined(__TURBOC__) || defined(__BORLANDC__)
#pragma warn -bbf- /* "Bitfields must be signed or unsigned int" warning */
#endif
 
/*
* Overlay for ip header used by other protocols (tcp, udp).
*/
struct ipovly {
caddr_t ih_next, ih_prev; /* for protocol sequence q's */
u_char ih_x1; /* (unused) */
u_char ih_pr; /* protocol */
u_short ih_len; /* protocol length */
struct in_addr ih_src; /* source internet address */
struct in_addr ih_dst; /* destination internet address */
};
 
 
/*
* Ip header, when holding a fragment.
*
* Note: ipf_next must be at same offset as ipq_next above
*/
struct ipasfrag {
u_char ip_hl:4;
u_char ip_v:4;
u_char ipf_mff; /* XXX overlays ip_tos: use low bit
* to avoid destroying tos;
* copied from (ip_off&IP_MF) */
u_short ip_len;
u_short ip_id;
u_short ip_off;
u_char ip_ttl;
u_char ip_p;
u_short ip_sum;
struct ipasfrag *ipf_next; /* next fragment */
struct ipasfrag *ipf_prev; /* previous fragment */
};
 
#include <sys/packoff.h>
 
/*
* Ip reassembly queue structure. Each fragment
* being reassembled is attached to one of these structures.
* They are timed out after ipq_ttl drops to 0, and may also
* be reclaimed if memory becomes tight.
*/
struct ipq {
struct ipq *next,*prev; /* to other reass headers */
u_char ipq_ttl; /* time for reass q to live */
u_char ipq_p; /* protocol of this fragment */
u_short ipq_id; /* sequence id for reassembly */
struct ipasfrag *ipq_next,*ipq_prev;
/* to ip headers of fragments */
struct in_addr ipq_src,ipq_dst;
#ifdef IPDIVERT
u_short ipq_divert; /* divert protocol port */
#endif
};
 
/*
* Structure stored in mbuf in inpcb.ip_options
* and passed to ip_output when ip options are in use.
* The actual length of the options (including ipopt_dst)
* is in m_len.
*/
#define MAX_IPOPTLEN 40
 
struct ipoption {
struct in_addr ipopt_dst; /* first-hop dst if source routed */
char ipopt_list[MAX_IPOPTLEN]; /* options proper */
};
 
/*
* Structure attached to inpcb.ip_moptions and
* passed to ip_output when IP multicast options are in use.
*/
struct ip_moptions {
struct ifnet *imo_multicast_ifp; /* ifp for outgoing multicasts */
u_char imo_multicast_ttl; /* TTL for outgoing multicasts */
u_char imo_multicast_loop; /* 1 => hear sends if a member */
u_short imo_num_memberships; /* no. memberships this socket */
struct in_multi *imo_membership[IP_MAX_MEMBERSHIPS];
u_long imo_multicast_vif; /* vif num outgoing multicasts */
};
 
struct ipstat {
u_long ips_total; /* total packets received */
u_long ips_badsum; /* checksum bad */
u_long ips_tooshort; /* packet too short */
u_long ips_toosmall; /* not enough data */
u_long ips_badhlen; /* ip header length < data size */
u_long ips_badlen; /* ip length < ip header length */
u_long ips_fragments; /* fragments received */
u_long ips_fragdropped; /* frags dropped (dups, out of space) */
u_long ips_fragtimeout; /* fragments timed out */
u_long ips_forward; /* packets forwarded */
u_long ips_cantforward; /* packets rcvd for unreachable dest */
u_long ips_redirectsent; /* packets forwarded on same net */
u_long ips_noproto; /* unknown or unsupported protocol */
u_long ips_delivered; /* datagrams delivered to upper level*/
u_long ips_localout; /* total ip packets generated here */
u_long ips_odropped; /* lost out packets due to nobufs, etc. */
u_long ips_idropped; /*!! new, lost in packets due to nobufs, etc. */
u_long ips_reassembled; /* total packets reassembled ok */
u_long ips_fragmented; /* datagrams successfully fragmented */
u_long ips_ofragments; /* output fragments created */
u_long ips_cantfrag; /* don't fragment flag was set, etc. */
u_long ips_badoptions; /* error in option processing */
u_long ips_noroute; /* packets discarded due to no route */
u_long ips_badvers; /* ip version != 4 */
u_long ips_rawout; /* total raw ip packets generated */
u_long ips_toolong; /* ip length > max ip packet size */
};
 
#if defined(__TURBOC__) || defined(__BORLANDC__)
#pragma warn -bbf.
#endif
 
#endif
/pkgnet/trunk/watt32/inc/netinet/ipv6.h
0,0 → 1,175
/*!\file netinet/ipv6.h
* Linux IPv6 definitions.
*/
 
/*
* Linux INET6 implementation
*
* Authors:
* Pedro Roque <roque@di.fc.ul.pt>
*
* $Id: ipv6.h,v 1.6 1997/04/01 02:22:58 davem Exp $
*
* 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 (at your option) any later version.
*
* NB! Don't ue this file. Use <netinet/in.h> instread.
*/
 
#ifndef _NET_IPV6_H
#define _NET_IPV6_H
 
#ifndef __NETINET_IN_H
#include <netinet/in.h> /* in6_addr */
#endif
 
/*
* Advanced API
* source interface/address selection, source routing, etc...
* *under construction*
*/
 
#include <sys/packon.h>
 
/*
* IPv6 fixed header
*/
struct ipv6hdr {
unsigned char ipv6_priority:4;
unsigned char ipv6_version:4;
unsigned char ipv6_flow_lbl[3];
unsigned short ipv6_len;
unsigned char ipv6_nextheader;
unsigned char ipv6_hoplimit;
struct in6_addr ipv6_src;
struct in6_addr ipv6_dst;
};
 
 
 
/*
* The length of this struct cannot be greater than the length of
* the proto_priv field in a sk_buff which is currently
* defined to be 16 bytes.
* Pointers take upto 8 bytes (sizeof(void *) is 8 on the alpha).
*/
struct ipv6_options {
/* length of extension headers */
unsigned short opt_flen; /* after fragment hdr */
unsigned short opt_nflen; /* before fragment hdr */
/*
* protocol options
* usualy carried in IPv6 extension headers
*/
struct ipv6_rt_hdr *srcrt; /* Routing Header */
};
 
struct in6_pktinfo {
struct in6_addr ipi6_addr;
int ipi6_ifindex;
};
 
 
struct in6_ifreq {
struct in6_addr ifr6_addr;
unsigned long ifr6_prefixlen;
unsigned long ifr6_ifindex;
};
 
#define IPV6_SRCRT_STRICT 0x01 /* this hop must be a neighbor */
#define IPV6_SRCRT_TYPE_0 0 /* IPv6 type 0 Routing Header */
 
/*
* routing header
*/
struct ipv6_rt_hdr {
unsigned char nexthdr;
unsigned char hdrlen;
unsigned char type;
unsigned char segments_left;
/*
* type specific data
* variable length field
*/
};
 
/*
* routing header type 0 (used in cmsghdr struct)
*/
struct ipv6_rt0_hdr {
struct ipv6_rt_hdr rt_hdr;
unsigned long bitmap; /* strict/loose bit map */
#ifndef __WATCOMC__
struct in6_addr addr[0];
#endif
#define rt0_type rt_hdr.type;
};
 
/*
* NextHeader field of IPv6 header
*/
 
#define NEXTHDR_HOP 0 /* Hop-by-hop option header. */
#define NEXTHDR_TCP 6 /* TCP segment. */
#define NEXTHDR_UDP 17 /* UDP message. */
#define NEXTHDR_IPV6 41 /* IPv6 in IPv6 */
#define NEXTHDR_ROUTING 43 /* Routing header. */
#define NEXTHDR_FRAGMENT 44 /* Fragmentation/reassembly header. */
#define NEXTHDR_ESP 50 /* Encapsulating security payload. */
#define NEXTHDR_AUTH 51 /* Authentication header. */
#define NEXTHDR_ICMP 58 /* ICMP for IPv6. */
#define NEXTHDR_NONE 59 /* No next header */
#define NEXTHDR_DEST 60 /* Destination options header. */
 
#define NEXTHDR_MAX 255
 
 
#define IPV6_DEFAULT_HOPLIMIT 64
#define IPV6_DEFAULT_MCASTHOPS 1
 
/*
* Addr type
*
* type - unicast | multicast | anycast
* scope - local | site | global
* v4 - compat
* v4mapped
* any
* loopback
*/
 
#define IPV6_ADDR_ANY 0x0000U
 
#define IPV6_ADDR_UNICAST 0x0001U
#define IPV6_ADDR_MULTICAST 0x0002U
#define IPV6_ADDR_ANYCAST 0x0004U
 
#define IPV6_ADDR_LOOPBACK 0x0010U
#define IPV6_ADDR_LINKLOCAL 0x0020U
#define IPV6_ADDR_SITELOCAL 0x0040U
 
#define IPV6_ADDR_COMPATv4 0x0080U
 
#define IPV6_ADDR_SCOPE_MASK 0x00f0U
 
#define IPV6_ADDR_MAPPED 0x1000U
#define IPV6_ADDR_RESERVED 0x2000U /* reserved address space */
 
/*
* fragmentation header
*/
 
struct ipv6_fraghdr {
unsigned char nexthdr;
unsigned char reserved;
unsigned short frag_off;
unsigned long identification;
};
#define fraghdr ipv6_fraghdr
 
#include <sys/packoff.h>
 
#endif
 
/pkgnet/trunk/watt32/inc/netinet/tcp.h
0,0 → 1,138
/*!\file netinet/tcp.h
* TCP header and options.
*/
 
/* $NetBSD: tcp.h,v 1.8 1995/04/17 05:32:58 cgd Exp $ */
 
/*
* Copyright (c) 1982, 1986, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)tcp.h 8.1 (Berkeley) 6/10/93
*/
 
#ifndef __NETINET_TCP_H
#define __NETINET_TCP_H
 
typedef u_long tcp_seq;
typedef u_long tcp_cc; /* connection count per rfc1644 */
 
#include <sys/packon.h>
 
 
/*
* TCP header.
* Per RFC 793, September, 1981.
*/
struct tcphdr {
u_short th_sport; /* source port */
u_short th_dport; /* destination port */
tcp_seq th_seq; /* sequence number */
tcp_seq th_ack; /* acknowledgement number */
u_char th_x2:4; /* (unused) */
u_char th_off:4; /* data offset */
u_char th_flags;
#define TH_FIN 0x01
#define TH_SYN 0x02
#define TH_RST 0x04
#define TH_PUSH 0x08
#define TH_ACK 0x10
#define TH_URG 0x20
#define TH_FLAGS (TH_FIN|TH_SYN|TH_RST|TH_ACK|TH_URG)
 
u_short th_win; /* window */
u_short th_sum; /* checksum */
u_short th_urp; /* urgent pointer */
};
 
#include <sys/packoff.h>
 
#define TCPOPT_EOL 0
#define TCPOPT_NOP 1
#define TCPOPT_MAXSEG 2
#define TCPOLEN_MAXSEG 4
#define TCPOPT_WINDOW 3
#define TCPOLEN_WINDOW 3
#define TCPOPT_SACK_PERMITTED 4
#define TCPOLEN_SACK_PERMITTED 2
#define TCPOPT_SACK 5
#define TCPOPT_TIMESTAMP 8
#define TCPOLEN_TIMESTAMP 10
#define TCPOLEN_TSTAMP_APPA (TCPOLEN_TIMESTAMP+2) /* appendix A */
 
#define TCPOPT_TSTAMP_HDR \
(TCPOPT_NOP<<24|TCPOPT_NOP<<16|TCPOPT_TIMESTAMP<<8|TCPOLEN_TIMESTAMP)
 
#define TCPOPT_CC 11 /* CC options: RFC-1644 */
#define TCPOPT_CCNEW 12
#define TCPOPT_CCECHO 13
#define TCPOLEN_CC 6
#define TCPOLEN_CC_APPA (TCPOLEN_CC+2)
#define TCPOPT_CC_HDR(ccopt) \
(TCPOPT_NOP<<24|TCPOPT_NOP<<16|(ccopt)<<8|TCPOLEN_CC)
 
#define TCPOPT_SIGNATURE 19
#define TCP_SIGLEN 16
 
/*
* Default maximum segment size for TCP.
* With an IP MSS of 576, this is 536,
* but 512 is probably more convenient.
* This should be defined as MIN(512, IP_MSS - sizeof (struct tcpiphdr)).
*/
#define TCP_MSS 512
 
#define TCP_MAXWIN 65535 /* largest value for (unscaled) window */
#define TTCP_CLIENT_SND_WND 4096 /* dflt send window for T/TCP client */
 
#define TCP_MAX_WINSHIFT 14 /* maximum window shift */
 
#define TCP_MAXHLEN (0xf<<2) /* max length of header in bytes */
#define TCP_MAXOLEN (TCP_MAXHLEN - sizeof(struct tcphdr))
/* max space left for options */
 
/*
* User-settable options (used with setsockopt).
*/
#define TCP_NODELAY 0x01 /* don't delay send to coalesce packets */
#define TCP_MAXSEG 0x02 /* set maximum segment size */
#ifdef TCP_AUTO
#define TCP_AUTO_OP 0x03 /* 0 to disable autotuning, 1 to reenable */
#endif
#define TCP_NOPUSH 0x04 /* don't push last block of write */
#define TCP_NOOPT 0x08 /* don't use TCP options */
 
/* For PSC modifications */
#if defined(TCP_AUTO) || defined(TCP_SACK) || defined(TCP_FACK)
#define PSC_VERSION "0.8"
#endif
 
#endif
/pkgnet/trunk/watt32/inc/netinet/tcp_debu.h
0,0 → 1,122
/*!\file netinet/tcp_debu.h
* TCP debugging.
*/
 
/*
* Copyright (c) 1982, 1986, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)tcp_debug.h 8.1 (Berkeley) 6/10/93
* $Id: tcp_debug.h,v 1.5 1996/04/13 12:45:57 bde Exp $
*/
 
#ifndef __NETINET_TCP_DEBUG_H
#define __NETINET_TCP_DEBUG_H
 
struct tcp_debug {
n_time td_time;
short td_act;
short td_ostate;
caddr_t td_tcb;
struct tcpiphdr td_ti;
short td_req;
struct tcpcb td_cb;
};
 
#define TA_INPUT 0
#define TA_OUTPUT 1
#define TA_USER 2
#define TA_RESPOND 3
#define TA_DROP 4
 
#ifdef TANAMES
static char *tanames[] = {
"input", "output", "user", "respond", "drop"
};
#endif
 
#define TCP_NDEBUG 100
 
#ifdef TCP_AUTO_DEBUG
#include <sys/wtime.h>
 
/* The following table is used as a circular buffer in which TCP
* autotuning statistics can be kept.
* It is intended that these statistics will be periodically read
* by a debugging application using kvm.
*/
 
#define TAD_ENTRIES 1024 /* number of entries in monitor_table */
 
struct tad_entry {
u_long seq_no; /* tad entry number */
struct timeval time; /* time of entry */
u_long snd_cwnd; /* congestion window */
u_long sb_hiwat; /* send socket buffer hi water mark */
u_long sb_target_hiwat; /* target for same */
u_long sb_cc; /* space used in send socket buf */
u_long m_clused; /* m_clusters - m_clfree */
u_short lport; /* local port number */
u_short rport; /* remote port number */
u_long debug; /* used for debugging */
tcp_seq snd_max; /* highest sequence number sent */
} tad_table[TAD_ENTRIES];
 
extern struct tad_entry *tad_index; /* insert point */
extern u_long tad_seq;
extern u_long tad_debug;
 
/* increment the index into the table
*/
#define TAD_INDEX_INCR tad_index = (struct tad_entry*)((u_long)tad_index + \
sizeof(struct tad_entry)); \
if ((u_long) tad_index >= \
(u_long) &tad_table[TAD_ENTRIES]) \
tad_index = tad_table;
 
/* add a log entry to the table
*/
#define TAD_SNAPSHOT(tp, so) tad_index->seq_no = tad_seq++; \
microtime(&(tad_index->time)); \
tad_index->snd_cwnd = tp->snd_cwnd; \
tad_index->sb_hiwat = so->so_snd.sb_hiwat; \
tad_index->sb_target_hiwat = so->so_snd.sb_net_target; \
tad_index->sb_cc = so->so_snd.sb_cc; \
tad_index->m_clused = mbstat.m_clusters - mbstat.m_clfree;\
tad_index->lport = tp->t_inpcb->inp_lport; \
tad_index->rport = tp->t_inpcb->inp_fport; \
tad_index->debug = tad_debug; \
tad_index->snd_max = tp->snd_max; \
TAD_INDEX_INCR;
 
#endif /* TCP_AUTO_DEBUG */
 
#endif /* __NETINET_TCP_DEBUG_H */
/pkgnet/trunk/watt32/inc/netinet/tcp_fsm.h
0,0 → 1,96
/*!\file netinet/tcp_fsm.h
* TCP Finite State Machine.
*/
 
/*
* Copyright (c) 1982, 1986, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)tcp_fsm.h 8.1 (Berkeley) 6/10/93
* $Id: tcp_fsm.h,v 1.7 1995/11/14 20:34:34 phk Exp $
*/
 
#ifndef __NETINET_TCP_FSM_H
#define __NETINET_TCP_FSM_H
 
/*
* TCP FSM state definitions.
* Per RFC793, September, 1981.
*/
 
#define TCP_NSTATES 11
 
#define TCPS_CLOSED 0 /* closed */
#define TCPS_LISTEN 1 /* listening for connection */
#define TCPS_SYN_SENT 2 /* active, have sent syn */
#define TCPS_SYN_RECEIVED 3 /* have send and received syn */
/* states < TCPS_ESTABLISHED are those where connections not established */
#define TCPS_ESTABLISHED 4 /* established */
#define TCPS_CLOSE_WAIT 5 /* rcvd fin, waiting for close */
/* states > TCPS_CLOSE_WAIT are those where user has closed */
#define TCPS_FIN_WAIT_1 6 /* have closed, sent fin */
#define TCPS_CLOSING 7 /* closed xchd FIN; await FIN ACK */
#define TCPS_LAST_ACK 8 /* had fin and close; await FIN ACK */
/* states > TCPS_CLOSE_WAIT && < TCPS_FIN_WAIT_2 await ACK of FIN */
#define TCPS_FIN_WAIT_2 9 /* have closed, fin is acked */
#define TCPS_TIME_WAIT 10 /* in 2*msl quiet wait after close */
 
#define TCPS_HAVERCVDSYN(s) ((s) >= TCPS_SYN_RECEIVED)
#define TCPS_HAVEESTABLISHED(s) ((s) >= TCPS_ESTABLISHED)
#define TCPS_HAVERCVDFIN(s) ((s) >= TCPS_TIME_WAIT)
 
#ifdef TCPOUTFLAGS
/*
* Flags used when sending segments in tcp_output.
* Basic flags (TH_RST,TH_ACK,TH_SYN,TH_FIN) are totally
* determined by state, with the proviso that TH_FIN is sent only
* if all data queued for output is included in the segment.
*/
static u_char tcp_outflags[TCP_NSTATES] = {
TH_RST|TH_ACK, 0, TH_SYN, TH_SYN|TH_ACK,
TH_ACK, TH_ACK,
TH_FIN|TH_ACK, TH_FIN|TH_ACK, TH_FIN|TH_ACK, TH_ACK, TH_ACK,
};
#endif
 
#ifdef KPROF
int tcp_acounts[TCP_NSTATES][PRU_NREQ];
#endif
 
#ifdef TCPSTATES
char *tcpstates[] = {
"CLOSED", "LISTEN", "SYN_SENT", "SYN_RCVD",
"ESTABLISHED", "CLOSE_WAIT", "FIN_WAIT_1", "CLOSING",
"LAST_ACK", "FIN_WAIT_2", "TIME_WAIT",
};
#endif
 
#endif
/pkgnet/trunk/watt32/inc/netinet/tcp_scor.h
0,0 → 1,108
/*!\file netinet/tcp_scor.h
* TCP scoreboard definitions (SACK).
*/
 
/*
* Copyright (c) 1997, Pittsburgh Supercomputing Center,
* Jamshid Mahdavi, Matt Mathis, Jeffrey Semke
* All rights reserved.
*
* Permission to use, copy, modify, and distribute this software and
* its documentation for any purpose and without fee is hereby granted,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation.
*
* This is experimental software under active development and may
* potentially contain bugs. Use at your own risk.
*
*/
 
#ifndef __NETINET_TCP_SCOREBOARD_H
#define __NETINET_TCP_SCOREBOARD_H
 
/**********************************************************************
*
* Scoreboard module headers:
*
**********************************************************************/
 
/* Initialize the scoreboard
*/
#define scrb_init(tp) { LIST_INIT(&((tp)->scrb.head)); \
(tp)->scrb.last_ack=(tp)->snd_una; \
(tp)->snd_retran_data = 0; }
 
/*
* Check to see if the scoreboard is empty
* scrb_isempty(struct tcpcp *tp)
*/
#define scrb_isempty(tp) (! ((tp)->scrb.scrb_head))
 
/* This macro quickly takes care of the common case of an empty
* scoreboard. Otherwise it called scrb_getnextretran_func to hunt
* through the scoreboard and return the next block of data to be
* retransmitted. The start and end of the block are filled in to
* start_ptr and end_ptr, and the length of the block is returned. A
* zero return value indicates that there is no data to be
* retransmitted at this time. Note that end_ptr actually points to
* the first byte of data which is NOT to be retransmitted (or the
* first byte following the data to be retransmitted) similar in
* fashion to the rest of this code.
*
* scrb_getnextretran(struct tcpcp *tp, tcp_seq *start, tcp_seq *end)
*/
 
#define scrb_getnextretran(tp,start,end) \
(scrb_isempty(tp) ? \
(int)((tcp_seq*)*start = (tcp_seq*)*end = \
(tcp_seq*)0) \
: scrb_getnextretran_func(tp,start,end))
 
/* sender side -- tracks packets sent that WERE selectively acknowledged
* by the other end.
* Each sb_entry represents a hole (missing data) followed by
* consecutive received data.
*/
struct scrb_entry {
LIST_ENTRY(scrb_entry) ptrs; /* Next/Prev structure pointers */
tcp_seq start; /* Start of received data block */
tcp_seq end; /* End of received data block */
tcp_seq retran; /* End of subsequent data
retransmitted */
tcp_seq snd_max; /* Value of snd_max at the time of
retransmission */
int sack_cnt; /* FACK ONLY: Number of reports for
this hole */
};
 
#define scrb_next ptrs.le_next /* next element */
#define scrb_prev ptrs.le_prev /* previous element */
 
 
/* sender side -- tracks packets sent that were selectively
* acknowledged by the other end
*/
struct scoreboard {
tcp_seq last_ack; /* This value replicates snd_una,
but is needed for internal
scoreboard state. */
LIST_HEAD(scrb_head_internal, scrb_entry) head; /* Scoreboard list */
};
 
#define scrb_head head.lh_first /* first element of scoreboard */
 
/* return codes from routines that might have to clear the scoreboard
*/
#define E_SCRB_CLEAR -1
#define E_SCRB_NOERR 0
 
/* reason parameters for scrb_clear
*/
#define SCRB_INIT 0
#define SCRB_RENEGE 1
#define SCRB_NOMEM 2
#define SCRB_TIMEOUT 3
 
#endif /* __NETINET_TCP_SCOREBOARD_H */
/pkgnet/trunk/watt32/inc/netinet/tcp_seq.h
0,0 → 1,104
/*!\file netinet/tcp_seq.h
* TCP serquence number handling.
*/
 
/*
* Copyright (c) 1982, 1986, 1993, 1995
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)tcp_seq.h 8.3 (Berkeley) 6/21/95
* $Id: tcp_seq.h,v 1.6 1995/10/03 16:54:14 wollman Exp $
*/
 
#ifndef __NETINET_TCP_SEQ_H
#define __NETINET_TCP_SEQ_H
 
/*
* TCP sequence numbers are 32 bit integers operated
* on with modular arithmetic. These macros can be
* used to compare such integers.
*/
#define SEQ_LT(a,b) ((long)((a)-(b)) < 0)
#define SEQ_LEQ(a,b) ((long)((a)-(b)) <= 0)
#define SEQ_GT(a,b) ((long)((a)-(b)) > 0)
#define SEQ_GEQ(a,b) ((long)((a)-(b)) >= 0)
 
/* for modulo comparisons of timestamps */
#define TSTMP_LT(a,b) ((long)((a)-(b)) < 0)
#define TSTMP_GEQ(a,b) ((long)((a)-(b)) >= 0)
 
/*
* TCP connection counts are 32 bit integers operated
* on with modular arithmetic. These macros can be
* used to compare such integers.
*/
#define CC_LT(a,b) ((long)((a)-(b)) < 0)
#define CC_LEQ(a,b) ((long)((a)-(b)) <= 0)
#define CC_GT(a,b) ((long)((a)-(b)) > 0)
#define CC_GEQ(a,b) ((long)((a)-(b)) >= 0)
 
/* Macro to increment a CC: skip 0 which has a special meaning */
#define CC_INC(c) (++(c) == 0 ? ++(c) : (c))
 
/*
* Macros to initialize tcp sequence numbers for
* send and receive from initial send and receive
* sequence numbers.
*/
#define tcp_rcvseqinit(tp) \
(tp)->rcv_adv = (tp)->rcv_nxt = (tp)->irs + 1
 
#if defined(TCP_SACK)
#define tcp_sendseqinit(tp) \
(tp)->snd_una = (tp)->snd_nxt = (tp)->snd_max = (tp)->snd_up = \
(tp)->recover = (tp)->sb.last_ack = (tp)->iss
 
#elif defined(TCP_FACK)
#define tcp_sendseqinit(tp) \
(tp)->snd_una = (tp)->snd_nxt = (tp)->snd_max = (tp)->snd_up = \
(tp)->recover = (tp)->scrb.last_ack = (tp)->snd_fack = (tp)->iss
 
#else
#define tcp_sendseqinit(tp) \
(tp)->snd_una = (tp)->snd_nxt = (tp)->snd_max = (tp)->snd_up = \
(tp)->iss
#endif
 
#define TCP_PAWS_IDLE (24 * 24 * 60 * 60 * PR_SLOWHZ)
/* timestamp wrap-around time */
 
#define TCP_ISSINCR (125*1024) /* increment for tcp_iss each second */
 
#ifdef _KERNEL
tcp_seq tcp_iss; /* tcp initial send seq # */
#endif
 
#endif
/pkgnet/trunk/watt32/inc/netinet/tcp_time.h
0,0 → 1,133
/*!\file netinet/tcp_time.h
* TCP timer definitions.
*/
 
/*
* Copyright (c) 1982, 1986, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)tcp_timer.h 8.1 (Berkeley) 6/10/93
* $Id: tcp_timer.h,v 1.10 1996/09/13 23:51:43 pst Exp $
*/
 
#ifndef __NETINET_TCP_TIMER_H
#define __NETINET_TCP_TIMER_H
 
/*
* Definitions of the TCP timers. These timers are counted
* down PR_SLOWHZ times a second.
*/
#define TCPT_NTIMERS 4
 
#define TCPT_REXMT 0 /* retransmit */
#define TCPT_PERSIST 1 /* retransmit persistence */
#define TCPT_KEEP 2 /* keep alive */
#define TCPT_2MSL 3 /* 2*msl quiet time timer */
 
/*
* The TCPT_REXMT timer is used to force retransmissions.
* The TCP has the TCPT_REXMT timer set whenever segments
* have been sent for which ACKs are expected but not yet
* received. If an ACK is received which advances tp->snd_una,
* then the retransmit timer is cleared (if there are no more
* outstanding segments) or reset to the base value (if there
* are more ACKs expected). Whenever the retransmit timer goes off,
* we retransmit one unacknowledged segment, and do a backoff
* on the retransmit timer.
*
* The TCPT_PERSIST timer is used to keep window size information
* flowing even if the window goes shut. If all previous transmissions
* have been acknowledged (so that there are no retransmissions in progress),
* and the window is too small to bother sending anything, then we start
* the TCPT_PERSIST timer. When it expires, if the window is nonzero,
* we go to transmit state. Otherwise, at intervals send a single byte
* into the peer's window to force him to update our window information.
* We do this at most as often as TCPT_PERSMIN time intervals,
* but no more frequently than the current estimate of round-trip
* packet time. The TCPT_PERSIST timer is cleared whenever we receive
* a window update from the peer.
*
* The TCPT_KEEP timer is used to keep connections alive. If an
* connection is idle (no segments received) for TCPTV_KEEP_INIT amount of time,
* but not yet established, then we drop the connection. Once the connection
* is established, if the connection is idle for TCPTV_KEEP_IDLE time
* (and keepalives have been enabled on the socket), we begin to probe
* the connection. We force the peer to send us a segment by sending:
* <SEQ=SND.UNA-1><ACK=RCV.NXT><CTL=ACK>
* This segment is (deliberately) outside the window, and should elicit
* an ack segment in response from the peer. If, despite the TCPT_KEEP
* initiated segments we cannot elicit a response from a peer in TCPT_MAXIDLE
* amount of time probing, then we drop the connection.
*/
 
/*
* Time constants.
*/
#define TCPTV_MSL ( 30*PR_SLOWHZ) /* max seg lifetime (hah!) */
#define TCPTV_SRTTBASE 0 /* base roundtrip time;
if 0, no idea yet */
#define TCPTV_RTOBASE ( 3*PR_SLOWHZ) /* assumed RTO if no info */
#define TCPTV_SRTTDFLT ( 3*PR_SLOWHZ) /* assumed RTT if no info */
 
#define TCPTV_PERSMIN ( 5*PR_SLOWHZ) /* retransmit persistence */
#define TCPTV_PERSMAX ( 60*PR_SLOWHZ) /* maximum persist interval */
 
#define TCPTV_KEEP_INIT ( 75*PR_SLOWHZ) /* initial connect keep alive */
#define TCPTV_KEEP_IDLE (120*60*PR_SLOWHZ) /* dflt time before probing */
#define TCPTV_KEEPINTVL ( 75*PR_SLOWHZ) /* default probe interval */
#define TCPTV_KEEPCNT 8 /* max probes before drop */
 
#define TCPTV_MIN ( 1*PR_SLOWHZ) /* minimum allowable value */
#define TCPTV_REXMTMAX ( 64*PR_SLOWHZ) /* max allowable REXMT value */
 
#define TCPTV_TWTRUNC 8 /* RTO factor to truncate TW */
 
#define TCP_LINGERTIME 120 /* linger at most 2 minutes */
 
#define TCP_MAXRXTSHIFT 12 /* maximum retransmits */
 
#ifdef TCPTIMERS
static char *tcptimers[] =
{ "REXMT", "PERSIST", "KEEP", "2MSL" };
#endif
 
/*
* Force a time value to be in a certain range.
*/
#define TCPT_RANGESET(tv, value, tvmin, tvmax) { \
(tv) = (value); \
if ((u_long)(tv) < (u_long)(tvmin)) \
(tv) = (tvmin); \
else if ((u_long)(tv) > (u_long)(tvmax)) \
(tv) = (tvmax); \
}
 
#endif
/pkgnet/trunk/watt32/inc/netinet/tcp_var.h
0,0 → 1,403
/*!\file netinet/tcp_var.h
* Internal TCP structures and statistics.
*/
 
/*
* Copyright (c) 1982, 1986, 1993, 1994, 1995
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)tcp_var.h 8.4 (Berkeley) 5/24/95
* $Id: tcp_var.h,v 1.36 1996/09/13 23:54:03 pst Exp $
*/
 
#ifndef __NETINET_TCP_VAR_H
#define __NETINET_TCP_VAR_H
 
/*
* Kernel variables for tcp.
*/
 
#ifdef TCP_AUTO
/* AUTO_RCV_HITHRESH flush reassembly queue, drop incoming packets
*/
#define AUTO_RCV_HITHRESH (u_long)(0.95 * NMBCLUSTERS)
 
/* AUTO_RCV_LOWTHRESH drop incoming packets
*/
#define AUTO_RCV_LOWTHRESH (u_long)(0.9 * NMBCLUSTERS)
 
/* AUTO_SND_THRESH reduce so_snd.sb_hiwat by acked
*/
#define AUTO_SND_THRESH (u_long)(0.50 * NMBCLUSTERS)
#endif
 
#if defined(TCP_SACK) || defined(TCP_FACK)
#include <netinet/tcp_scor.h>
 
struct sackblock {
tcp_seq start;
tcp_seq end;
};
#endif
 
/*
* Tcp control block, one per tcp; fields:
*/
struct tcpcb {
struct tcpiphdr *seg_next; /* sequencing queue */
struct tcpiphdr *seg_prev;
/* !! struct ipqehead segq; */ /* sequencing queue */
int t_state; /* state of this connection */
int t_timer[TCPT_NTIMERS]; /* tcp timers */
int t_rxtshift; /* log(2) of rexmt exp. backoff */
int t_rxtcur; /* current retransmit value */
#ifdef TCP_FACK
short t_padd; /* filler to preserve alignment */
#else
short t_dupacks; /* consecutive dup acks recd */
#endif
u_int t_maxseg; /* maximum segment size */
u_int t_maxopd; /* mss plus options */
int t_force; /* 1 if forcing out a byte */
u_int t_flags;
#define TF_ACKNOW 0x0001 /* ack peer immediately */
#define TF_DELACK 0x0002 /* ack, but try to delay it */
#define TF_NODELAY 0x0004 /* don't delay packets to coalesce */
#define TF_NOOPT 0x0008 /* don't use tcp options */
#define TF_SENTFIN 0x0010 /* have sent FIN */
#define TF_REQ_SCALE 0x0020 /* have/will request window scaling */
#define TF_RCVD_SCALE 0x0040 /* other side has requested scaling */
#define TF_REQ_TSTMP 0x0080 /* have/will request timestamps */
#define TF_RCVD_TSTMP 0x0100 /* a timestamp was received in SYN */
#define TF_SACK_PERMIT 0x0200 /* other side said I could SACK */
#define TF_NEEDSYN 0x0400 /* send SYN (implicit state) */
#define TF_NEEDFIN 0x0800 /* send FIN (implicit state) */
#define TF_NOPUSH 0x1000 /* don't push */
#define TF_REQ_CC 0x2000 /* have/will request CC */
#define TF_RCVD_CC 0x4000 /* a CC was received in SYN */
#define TF_SENDCCNEW 0x8000 /* send CCnew instead of CC in SYN */
 
struct tcpiphdr *t_template; /* skeletal packet for transmit */
struct inpcb *t_inpcb; /* back pointer to internet pcb */
/*
* The following fields are used as in the protocol specification.
* See RFC783, Dec. 1981, page 21.
*/
/* send sequence variables */
tcp_seq snd_una; /* send unacknowledged */
tcp_seq snd_nxt; /* send next */
tcp_seq snd_up; /* send urgent pointer */
tcp_seq snd_wl1; /* window update seg seq number */
tcp_seq snd_wl2; /* window update seg ack number */
tcp_seq iss; /* initial send sequence number */
u_long snd_wnd; /* send window */
/* receive sequence variables */
u_long rcv_wnd; /* receive window */
tcp_seq rcv_nxt; /* receive next */
tcp_seq rcv_up; /* receive urgent pointer */
tcp_seq irs; /* initial receive sequence number */
/*
* Additional variables for this implementation.
*/
/* receive variables */
tcp_seq rcv_adv; /* advertised window */
/* retransmit variables */
tcp_seq snd_max; /* highest sequence number sent;
* used to recognize retransmits
*/
/* congestion control (for slow start, source quench, retransmit after loss) */
u_long snd_cwnd; /* congestion-controlled window */
u_long snd_ssthresh; /* snd_cwnd size threshold for
* for slow start exponential to
* linear switch
*/
/*
* transmit timing stuff. See below for scale of srtt and rttvar.
* "Variance" is actually smoothed difference.
*/
u_int t_idle; /* inactivity time */
int t_rtt; /* round trip time */
tcp_seq t_rtseq; /* sequence number being timed */
int t_srtt; /* smoothed round-trip time */
int t_rttvar; /* variance in round-trip time */
u_int t_rttmin; /* minimum rtt allowed */
u_long max_sndwnd; /* largest window peer has offered */
 
/* out-of-band data */
char t_oobflags; /* have some */
char t_iobc; /* input character */
#define TCPOOB_HAVEDATA 0x01
#define TCPOOB_HADDATA 0x02
int t_softerror; /* possible error not yet reported */
 
/* RFC 1323 variables */
u_char snd_scale; /* window scaling for send window */
u_char rcv_scale; /* window scaling for recv window */
u_char request_r_scale; /* pending window scaling */
u_char requested_s_scale;
u_long ts_recent; /* timestamp echo data */
u_long ts_recent_age; /* when last updated */
tcp_seq last_ack_sent;
/* RFC 1644 variables */
tcp_cc cc_send; /* send connection count */
tcp_cc cc_recv; /* receive connection count */
u_long t_duration; /* connection duration */
 
/* TUBA stuff */
caddr_t t_tuba_pcb; /* next level down pcb for TCP over z */
/* More RTT stuff */
u_long t_rttupdated; /* number of times rtt sampled */
 
#if defined(TCP_FACK) || defined(TCP_AUTO)
u_short t_alt_flags; /* experimental flags */
#define TAF_SACK_SEEN 0x0001 /* other side can send SACKs */
#define TAF_RECOVERY 0x0002 /* We are recovering from a lost segment */
#define TAF_RATEHALF 0x0004 /* We are reducing the window during recovery */
#define TAF_REPAIRED 0x0008 /* We have retransmitted something */
#define TAF_WHOLD 0x0010 /* we are in the window hold state */
#define TAF_TOGGLE 0x0020 /* divide by 2 toggle */
#define TAF_AUTO_OFF 0x0040 /* autotuning is forced off */
#endif
 
#if defined(TCP_SACK) || defined(TCP_FACK)
#define SACK_LIST_LEN 10
 
/* Needed for SACK and FACK: */
struct sackblock sack_list[SACK_LIST_LEN]; /* Hack, keep 5 most recent SACKs */
struct scoreboard scrb;
int snd_retran_data;
tcp_seq recover;
#endif
#ifdef TCP_SACK
int pipe;
#endif
#ifdef TCP_FACK
tcp_seq snd_fack;
#define TCP_FACK_REXMTTHRESH 3 /* number of SACKs before retransmitting a block */
u_long lothresh; /* recovery window floor */
u_long hithresh; /* maximum window following recovery */
#endif
};
 
/*
* Structure to hold TCP options that are only used during segment
* processing (in tcp_input), but not held in the tcpcb.
* It's basically used to reduce the number of parameters
* to tcp_dooptions.
*/
struct tcpopt {
u_long to_flag; /* which options are present */
#define TOF_TS 0x0001 /* timestamp */
#define TOF_CC 0x0002 /* CC and CCnew are exclusive */
#define TOF_CCNEW 0x0004
#define TOF_CCECHO 0x0008
u_long to_tsval;
u_long to_tsecr;
tcp_cc to_cc; /* holds CC or CCnew */
tcp_cc to_ccecho;
};
 
/*
* The TAO cache entry which is stored in the protocol family specific
* portion of the route metrics.
*/
struct rmxp_tao {
tcp_cc tao_cc; /* latest CC in valid SYN */
tcp_cc tao_ccsent; /* latest CC sent to peer */
u_short tao_mssopt; /* peer's cached MSS */
#ifdef notyet
u_short tao_flags; /* cache status flags */
#define TAOF_DONT 0x0001 /* peer doesn't understand rfc1644 */
#define TAOF_OK 0x0002 /* peer does understand rfc1644 */
#define TAOF_UNDEF 0 /* we don't know yet */
#endif /* notyet */
};
#define rmx_taop(r) ((struct rmxp_tao *)(r).rmx_filler)
 
#define intotcpcb(ip) ((struct tcpcb *)(ip)->inp_ppcb)
#define sototcpcb(so) (intotcpcb(sotoinpcb(so)))
 
/*
* The smoothed round-trip time and estimated variance
* are stored as fixed point numbers scaled by the values below.
* For convenience, these scales are also used in smoothing the average
* (smoothed = (1/scale)sample + ((scale-1)/scale)smoothed).
* With these scales, srtt has 3 bits to the right of the binary point,
* and thus an "ALPHA" of 0.875. rttvar has 2 bits to the right of the
* binary point, and is smoothed with an ALPHA of 0.75.
*/
#define TCP_RTT_SCALE 32 /* multiplier for srtt; 3 bits frac. */
#define TCP_RTT_SHIFT 5 /* shift for srtt; 3 bits frac. */
#define TCP_RTTVAR_SCALE 16 /* multiplier for rttvar; 2 bits */
#define TCP_RTTVAR_SHIFT 4 /* shift for rttvar; 2 bits */
#define TCP_DELTA_SHIFT 2 /* see tcp_input.c */
 
/*
* The initial retransmission should happen at rtt + 4 * rttvar.
* Because of the way we do the smoothing, srtt and rttvar
* will each average +1/2 tick of bias. When we compute
* the retransmit timer, we want 1/2 tick of rounding and
* 1 extra tick because of +-1/2 tick uncertainty in the
* firing of the timer. The bias will give us exactly the
* 1.5 tick we need. But, because the bias is
* statistical, we have to test that we don't drop below
* the minimum feasible timer (which is 2 ticks).
* This version of the macro adapted from a paper by Lawrence
* Brakmo and Larry Peterson which outlines a problem caused
* by insufficient precision in the original implementation,
* which results in inappropriately large RTO values for very
* fast networks.
*/
#define TCP_REXMTVAL(tp) \
((((tp)->t_srtt >> (TCP_RTT_SHIFT - TCP_DELTA_SHIFT)) \
+ (tp)->t_rttvar) >> TCP_DELTA_SHIFT)
 
/* XXX
* We want to avoid doing m_pullup on incoming packets but that
* means avoiding dtom on the tcp reassembly code. That in turn means
* keeping an mbuf pointer in the reassembly queue (since we might
* have a cluster). As a quick hack, the source & destination
* port numbers (which are no longer needed once we've located the
* tcpcb) are overlayed with an mbuf pointer.
*/
#define REASS_MBUF(ti) (*(struct mbuf **)&((ti)->ti_t))
 
/*
* TCP statistics.
* Many of these should be kept per connection,
* but that's inconvenient at the moment.
*/
struct tcpstat {
u_long tcps_connattempt; /* connections initiated */
u_long tcps_accepts; /* connections accepted */
u_long tcps_connects; /* connections established */
u_long tcps_drops; /* connections dropped */
u_long tcps_conndrops; /* embryonic connections dropped */
u_long tcps_closed; /* conn. closed (includes drops) */
u_long tcps_segstimed; /* segs where we tried to get rtt */
u_long tcps_rttupdated; /* times we succeeded */
u_long tcps_delack; /* delayed acks sent */
u_long tcps_timeoutdrop; /* conn. dropped in rxmt timeout */
u_long tcps_rexmttimeo; /* retransmit timeouts */
u_long tcps_persisttimeo; /* persist timeouts */
u_long tcps_keeptimeo; /* keepalive timeouts */
u_long tcps_keepprobe; /* keepalive probes sent */
u_long tcps_keepdrops; /* connections dropped in keepalive */
 
u_long tcps_sndtotal; /* total packets sent */
u_long tcps_sndpack; /* data packets sent */
u_long tcps_sndbyte; /* data bytes sent */
u_long tcps_sndrexmitpack; /* data packets retransmitted */
u_long tcps_sndrexmitbyte; /* data bytes retransmitted */
u_long tcps_sndacks; /* ack-only packets sent */
u_long tcps_sndprobe; /* window probes sent */
u_long tcps_sndurg; /* packets sent with URG only */
u_long tcps_sndwinup; /* window update-only packets sent */
u_long tcps_sndctrl; /* control (SYN|FIN|RST) packets sent */
 
u_long tcps_rcvtotal; /* total packets received */
u_long tcps_rcvpack; /* packets received in sequence */
u_long tcps_rcvbyte; /* bytes received in sequence */
u_long tcps_rcvbadsum; /* packets received with ccksum errs */
u_long tcps_rcvbadoff; /* packets received with bad offset */
u_long tcps_rcvshort; /* packets received too short */
u_long tcps_rcvduppack; /* duplicate-only packets received */
u_long tcps_rcvdupbyte; /* duplicate-only bytes received */
u_long tcps_rcvpartduppack; /* packets with some duplicate data */
u_long tcps_rcvpartdupbyte; /* dup. bytes in part-dup. packets */
u_long tcps_rcvoopack; /* out-of-order packets received */
u_long tcps_rcvoobyte; /* out-of-order bytes received */
u_long tcps_rcvpackafterwin; /* packets with data after window */
u_long tcps_rcvbyteafterwin; /* bytes rcvd after window */
u_long tcps_rcvafterclose; /* packets rcvd after "close" */
u_long tcps_rcvwinprobe; /* rcvd window probe packets */
u_long tcps_rcvdupack; /* rcvd duplicate acks */
u_long tcps_rcvacktoomuch; /* rcvd acks for unsent data */
u_long tcps_rcvackpack; /* rcvd ack packets */
u_long tcps_rcvackbyte; /* bytes acked by rcvd acks */
u_long tcps_rcvwinupd; /* rcvd window update packets */
u_long tcps_pawsdrop; /* segments dropped due to PAWS */
u_long tcps_predack; /* times hdr predict ok for acks */
u_long tcps_preddat; /* times hdr predict ok for data pkts */
u_long tcps_pcbcachemiss;
u_long tcps_cachedrtt; /* times cached RTT in route updated */
u_long tcps_cachedrttvar; /* times cached rttvar updated */
u_long tcps_cachedssthresh; /* times cached ssthresh updated */
u_long tcps_usedrtt; /* times RTT initialized from route */
u_long tcps_usedrttvar; /* times RTTVAR initialized from rt */
u_long tcps_usedssthresh; /* times ssthresh initialized from rt*/
u_long tcps_persistdrop; /* timeout in persist state */
u_long tcps_badsyn; /* bogus SYN, e.g. premature ACK */
u_long tcps_mturesent; /* resends due to MTU discovery */
u_long tcps_listendrop; /* listen queue overflows */
 
#ifdef TCP_FACK
/* NOTE: This may break some programs that rely on this structure
* being fixed length.
*/
u_long tcps_fack_recovery; /* fack: recovery episodes */
u_long tcps_fack_sndpack; /* fack: data packets sent */
u_long tcps_fack_sndbyte; /* fack: data bytes sent */
u_long tcps_fack_sndrexmitpack;/* fack: data packets retransmitted */
u_long tcps_fack_sndrexmitbyte;/* fack: data bytes retransmitted */
#endif
};
 
/*
* Names for TCP sysctl objects
*/
#define TCPCTL_DO_RFC1323 1 /* use RFC-1323 extensions */
#define TCPCTL_DO_RFC1644 2 /* use RFC-1644 extensions */
#define TCPCTL_MSSDFLT 3 /* MSS default */
#define TCPCTL_STATS 4 /* statistics (read-only) */
#define TCPCTL_RTTDFLT 5 /* default RTT estimate */
#define TCPCTL_KEEPIDLE 6 /* keepalive idle timer */
#define TCPCTL_KEEPINTVL 7 /* interval to send keepalives */
#define TCPCTL_SENDSPACE 8 /* send buffer space */
#define TCPCTL_RECVSPACE 9 /* receive buffer space */
#define TCPCTL_KEEPINIT 10 /* receive buffer space */
#define TCPCTL_MAXID 11
 
#define TCPCTL_NAMES { \
{ 0, 0 }, \
{ "rfc1323", CTLTYPE_INT }, \
{ "rfc1644", CTLTYPE_INT }, \
{ "mssdflt", CTLTYPE_INT }, \
{ "stats", CTLTYPE_STRUCT }, \
{ "rttdflt", CTLTYPE_INT }, \
{ "keepidle", CTLTYPE_INT }, \
{ "keepintvl", CTLTYPE_INT }, \
{ "sendspace", CTLTYPE_INT }, \
{ "recvspace", CTLTYPE_INT }, \
{ "keepinit", CTLTYPE_INT }, \
}
 
#endif
/pkgnet/trunk/watt32/inc/netinet/tcpip.h
0,0 → 1,85
/*!\file netinet/tcpip.h
* TCP header definitions.
*/
 
/*
* Copyright (c) 1982, 1986, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)tcpip.h 8.1 (Berkeley) 6/10/93
* $Id: tcpip.h,v 1.4 1995/02/08 20:18:48 wollman Exp $
*/
 
#ifndef __NETINET_TCPIP_H
#define __NETINET_TCPIP_H
 
#include <sys/packon.h>
 
/*
* Tcp+ip header, after ip options removed.
*/
struct tcpiphdr {
struct ipovly ti_i; /* overlaid ip structure */
struct tcphdr ti_t; /* tcp header */
};
 
#ifdef notyet
/*
* Tcp+ip header, after ip options removed but including TCP options.
*/
struct full_tcpiphdr {
struct ipovly ti_i; /* overlaid ip structure */
struct tcphdr ti_t; /* tcp header */
char ti_o[TCP_MAXOLEN]; /* space for tcp options */
};
#endif /* notyet */
 
#include <sys/packoff.h>
 
#define ti_next ti_i.ih_next
#define ti_prev ti_i.ih_prev
#define ti_x1 ti_i.ih_x1
#define ti_pr ti_i.ih_pr
#define ti_len ti_i.ih_len
#define ti_src ti_i.ih_src
#define ti_dst ti_i.ih_dst
#define ti_sport ti_t.th_sport
#define ti_dport ti_t.th_dport
#define ti_seq ti_t.th_seq
#define ti_ack ti_t.th_ack
#define ti_x2 ti_t.th_x2
#define ti_off ti_t.th_off
#define ti_flags ti_t.th_flags
#define ti_win ti_t.th_win
#define ti_sum ti_t.th_sum
#define ti_urp ti_t.th_urp
 
#endif
/pkgnet/trunk/watt32/inc/netinet/udp.h
0,0 → 1,54
/*!\file netinet/udp.h
* UDP header.
*/
/*
* Copyright (c) 1982, 1986, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)udp.h 8.1 (Berkeley) 6/10/93
* $FreeBSD: src/sys/netinet/udp.h,v 1.7 1999/08/28 00:49:34 peter Exp $
*/
 
#ifndef _NETINET_UDP_H_
#define _NETINET_UDP_H_
 
/*
* Udp protocol header.
* Per RFC 768, September, 1981.
*/
struct udphdr {
u_short uh_sport; /* source port */
u_short uh_dport; /* destination port */
u_short uh_ulen; /* udp length */
u_short uh_sum; /* udp checksum */
};
 
#endif
/pkgnet/trunk/watt32/inc/netinet/udp_var.h
0,0 → 1,100
/*!\file netinet/udp_var.h
* Internal UDP statistics.
*/
 
/*
* Copyright (c) 1982, 1986, 1989, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)udp_var.h 8.1 (Berkeley) 6/10/93
* $Id: udp_var.h,v 1.9 1996/06/05 17:20:35 wollman Exp $
*/
 
#ifndef __NETINET_UDP_VAR_H
#define __NETINET_UDP_VAR_H
 
/*
* UDP kernel structures and variables.
*/
#ifdef NOT_NEEDED
#include <sys/packon.h>
struct udpiphdr {
struct ipovly ui_i; /* overlaid ip structure */
struct udphdr ui_u; /* udp header */
};
#include <sys/packoff.h>
 
#define ui_next ui_i.ih_next
#define ui_prev ui_i.ih_prev
#define ui_x1 ui_i.ih_x1
#define ui_pr ui_i.ih_pr
#define ui_len ui_i.ih_len
#define ui_src ui_i.ih_src
#define ui_dst ui_i.ih_dst
#define ui_sport ui_u.uh_sport
#define ui_dport ui_u.uh_dport
#define ui_ulen ui_u.uh_ulen
#define ui_sum ui_u.uh_sum
#endif
 
struct udpstat {
/* input statistics: */
u_long udps_ipackets; /* total input packets */
u_long udps_hdrops; /* packet shorter than header */
u_long udps_badsum; /* checksum error */
u_long udps_badlen; /* data length larger than packet */
u_long udps_noport; /* no socket on port */
u_long udps_noportbcast; /* of above, arrived as broadcast */
u_long udps_fullsock; /* not delivered, input socket full */
u_long udpps_pcbcachemiss; /* input packets missing pcb cache */
u_long udpps_pcbhashmiss; /* input packets not for hashed pcb */
/* output statistics: */
u_long udps_opackets; /* total output packets */
};
 
/*
* Names for UDP sysctl objects
*/
#define UDPCTL_CHECKSUM 1 /* checksum UDP packets */
#define UDPCTL_STATS 2 /* statistics (read-only) */
#define UDPCTL_MAXDGRAM 3 /* max datagram size */
#define UDPCTL_RECVSPACE 4 /* default receive buffer space */
#define UDPCTL_MAXID 5
 
#define UDPCTL_NAMES { \
{ 0, 0 }, \
{ "checksum", CTLTYPE_INT }, \
{ "stats", CTLTYPE_STRUCT }, \
{ "maxdgram", CTLTYPE_INT }, \
{ "recvspace", CTLTYPE_INT }, \
}
 
#endif
/pkgnet/trunk/watt32/inc/netinet6/ah.h
0,0 → 1,98
/*!\file netinet6/ah.h
* Authentication Header.
*/
 
/* $FreeBSD: src/sys/netinet6/ah.h,v 1.7 2002/04/19 04:46:22 suz Exp $ */
/* $KAME: ah.h,v 1.16 2001/09/04 08:43:19 itojun Exp $ */
 
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the project nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
 
/*
* RFC1826/2402 authentication header.
*/
 
#ifndef _NETINET6_AH_H_
#define _NETINET6_AH_H_
 
#if defined(_KERNEL) && !defined(_LKM)
#include "opt_inet.h"
#endif
 
struct ah {
u_int8_t ah_nxt; /* Next Header */
u_int8_t ah_len; /* Length of data, in 32bit */
u_int16_t ah_reserve; /* Reserved for future use */
u_int32_t ah_spi; /* Security parameter index */
/* variable size, 32bit bound*/ /* Authentication data */
};
 
struct newah {
u_int8_t ah_nxt; /* Next Header */
u_int8_t ah_len; /* Length of data + 1, in 32bit */
u_int16_t ah_reserve; /* Reserved for future use */
u_int32_t ah_spi; /* Security parameter index */
u_int32_t ah_seq; /* Sequence number field */
/* variable size, 32bit bound*/ /* Authentication data */
};
 
#ifdef _KERNEL
struct secasvar;
 
struct ah_algorithm_state {
struct secasvar *sav;
void* foo; /* per algorithm data - maybe */
};
 
struct ah_algorithm {
int (*sumsiz) __P((struct secasvar *));
int (*mature) __P((struct secasvar *));
int keymin; /* in bits */
int keymax; /* in bits */
const char *name;
int (*init) __P((struct ah_algorithm_state *, struct secasvar *));
void (*update) __P((struct ah_algorithm_state *, caddr_t, size_t));
void (*result) __P((struct ah_algorithm_state *, caddr_t));
};
 
#define AH_MAXSUMSIZE 16
 
extern const struct ah_algorithm *ah_algorithm_lookup __P((int));
 
/* cksum routines */
extern int ah_hdrlen __P((struct secasvar *));
 
extern size_t ah_hdrsiz __P((struct ipsecrequest *));
extern void ah4_input __P((struct mbuf *, int));
extern int ah4_output __P((struct mbuf *, struct ipsecrequest *));
extern int ah4_calccksum __P((struct mbuf *, caddr_t, size_t,
const struct ah_algorithm *, struct secasvar *));
#endif /* _KERNEL */
 
#endif /* _NETINET6_AH_H_ */
/pkgnet/trunk/watt32/inc/netinet6/ah6.h
0,0 → 1,56
/*!\file netinet6/ah6.h
* IPv6 Authentication header.
*/
 
/* $FreeBSD: src/sys/netinet6/ah6.h,v 1.4 2001/06/11 12:39:03 ume Exp $ */
/* $KAME: ah.h,v 1.13 2000/10/18 21:28:00 itojun Exp $ */
 
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the project nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
 
/*
* RFC1826/2402 authentication header.
*/
 
#ifndef _NETINET6_AH6_H_
#define _NETINET6_AH6_H_
 
#ifdef _KERNEL
struct secasvar;
 
extern int ah6_input (struct mbuf **, int *, int));
extern int ah6_output (struct mbuf *, u_char *, struct mbuf *,
struct ipsecrequest *);
extern int ah6_calccksum (struct mbuf *, caddr_t, size_t,
const struct ah_algorithm *, struct secasvar *);
 
extern void ah6_ctlinput (int, struct sockaddr *, void *);
#endif
 
#endif /*_NETINET6_AH6_H_*/
/pkgnet/trunk/watt32/inc/netinet6/esp.h
0,0 → 1,113
/*!\file netinet6/esp.h
*
*/
 
/* $FreeBSD: src/sys/netinet6/esp.h,v 1.6 2002/04/19 04:46:22 suz Exp $ */
/* $KAME: esp.h,v 1.19 2001/09/04 08:43:19 itojun Exp $ */
 
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the project nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
 
/*
* RFC1827/2406 Encapsulated Security Payload.
*/
 
#ifndef _NETINET6_ESP_H_
#define _NETINET6_ESP_H_
 
#if defined(_KERNEL) && !defined(_LKM)
#include "opt_inet.h"
#endif
 
struct esp {
u_int32_t esp_spi; /* ESP */
/* variable size, 32bit bound *//* Initialization Vector */
/* variable size */ /* Payload data */
/* variable size */ /* padding */
/* 8bit */ /* pad size */
/* 8bit */ /* next header */
/* 8bit */ /* next header */
/* variable size, 32bit bound */ /* Authentication data (new IPsec) */
};
 
struct newesp {
u_int32_t esp_spi; /* ESP */
u_int32_t esp_seq; /* Sequence number */
/* variable size */ /* (IV and) Payload data */
/* variable size */ /* padding */
/* 8bit */ /* pad size */
/* 8bit */ /* next header */
/* 8bit */ /* next header */
/* variable size, 32bit bound *//* Authentication data */
};
 
struct esptail {
u_int8_t esp_padlen; /* pad length */
u_int8_t esp_nxt; /* Next header */
/* variable size, 32bit bound *//* Authentication data (new IPsec)*/
};
 
#ifdef _KERNEL
struct secasvar;
 
struct esp_algorithm {
size_t padbound; /* pad boundary, in byte */
int ivlenval; /* iv length, in byte */
int (*mature) (struct secasvar *);
int keymin; /* in bits */
int keymax; /* in bits */
int (*schedlen) (const struct esp_algorithm *);
const char *name;
int (*ivlen) (const struct esp_algorithm *, struct secasvar *);
int (*decrypt) (struct mbuf *, size_t,
struct secasvar *, const struct esp_algorithm *, int);
int (*encrypt) (struct mbuf *, size_t, size_t,
struct secasvar *, const struct esp_algorithm *, int);
/* not supposed to be called directly */
int (*schedule) (const struct esp_algorithm *, struct secasvar *);
int (*blockdecrypt) (const struct esp_algorithm *,
struct secasvar *, u_int8_t *, u_int8_t *);
int (*blockencrypt) (const struct esp_algorithm *,
struct secasvar *, u_int8_t *, u_int8_t *);
};
 
extern const struct esp_algorithm *esp_algorithm_lookup (int);
extern int esp_max_ivlen (void);
 
/* crypt routines */
extern int esp4_output (struct mbuf *, struct ipsecrequest *);
extern void esp4_input (struct mbuf *, int);
extern size_t esp_hdrsiz (struct ipsecrequest *);
 
extern int esp_schedule (const struct esp_algorithm *, struct secasvar *);
extern int esp_auth (struct mbuf *, size_t, size_t,
struct secasvar *, u_char *);
#endif /* _KERNEL */
 
#endif /* _NETINET6_ESP_H_ */
/pkgnet/trunk/watt32/inc/netinet6/esp6.h
0,0 → 1,52
/*!\file netinet6/esp6.h
*
*/
 
/* $FreeBSD: src/sys/netinet6/esp6.h,v 1.4 2001/06/11 12:39:04 ume Exp $ */
/* $KAME: esp.h,v 1.16 2000/10/18 21:28:00 itojun Exp $ */
 
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the project nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
 
/*
* RFC1827/2406 Encapsulated Security Payload.
*/
 
#ifndef _NETINET6_ESP6_H_
#define _NETINET6_ESP6_H_
 
#ifdef _KERNEL
extern int esp6_output __P((struct mbuf *, u_char *, struct mbuf *,
struct ipsecrequest *));
extern int esp6_input __P((struct mbuf **, int *, int));
 
extern void esp6_ctlinput __P((int, struct sockaddr *, void *));
#endif /*_KERNEL*/
 
#endif /*_NETINET6_ESP6_H_*/
/pkgnet/trunk/watt32/inc/netinet6/esp_rijn.h
0,0 → 1,43
/*!\file netinet6/esp_rijn.h
*
*/
 
/* $FreeBSD: src/sys/netinet6/esp_rijndael.h,v 1.1 2001/06/11 12:39:05 ume Exp $ */
/* $KAME: esp_rijndael.h,v 1.1 2000/09/20 18:15:22 itojun Exp $ */
 
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the project nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
 
int esp_rijndael_schedlen __P((const struct esp_algorithm *));
int esp_rijndael_schedule __P((const struct esp_algorithm *,
struct secasvar *));
int esp_rijndael_blockdecrypt __P((const struct esp_algorithm *,
struct secasvar *, u_int8_t *, u_int8_t *));
int esp_rijndael_blockencrypt __P((const struct esp_algorithm *,
struct secasvar *, u_int8_t *, u_int8_t *));
/pkgnet/trunk/watt32/inc/netinet6/in6.h
0,0 → 1,666
/*!\file netinet6/in6.h
*
*/
 
/* $FreeBSD: src/sys/netinet6/in6.h,v 1.22 2002/07/25 20:40:09 ume Exp $ */
/* $KAME: in6.h,v 1.89 2001/05/27 13:28:35 itojun Exp $ */
 
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the project nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
 
/*
* Copyright (c) 1982, 1986, 1990, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)in.h 8.3 (Berkeley) 1/3/94
*/
 
#ifndef _NETINET6_IN6_H_
#define _NETINET6_IN6_H_
 
/*
* Identification of the network protocol stack
* for *BSD-current/release: http://www.kame.net/dev/cvsweb.cgi/kame/COVERAGE
* has the table of implementation/integration differences.
*/
#define __KAME__
#define __KAME_VERSION "20010528/FreeBSD"
 
/*
* Local port number conventions:
*
* Ports < IPPORT_RESERVED are reserved for privileged processes (e.g. root),
* unless a kernel is compiled with IPNOPRIVPORTS defined.
*
* When a user does a bind(2) or connect(2) with a port number of zero,
* a non-conflicting local port address is chosen.
*
* The default range is IPPORT_ANONMIN to IPPORT_ANONMAX, although
* that is settable by sysctl(3); net.inet.ip.anonportmin and
* net.inet.ip.anonportmax respectively.
*
* A user may set the IPPROTO_IP option IP_PORTRANGE to change this
* default assignment range.
*
* The value IP_PORTRANGE_DEFAULT causes the default behavior.
*
* The value IP_PORTRANGE_HIGH is the same as IP_PORTRANGE_DEFAULT,
* and exists only for FreeBSD compatibility purposes.
*
* The value IP_PORTRANGE_LOW changes the range to the "low" are
* that is (by convention) restricted to privileged processes.
* This convention is based on "vouchsafe" principles only.
* It is only secure if you trust the remote host to restrict these ports.
* The range is IPPORT_RESERVEDMIN to IPPORT_RESERVEDMAX.
*/
#if __BSD_VISIBLE
#define IPV6PORT_RESERVED 1024
#define IPV6PORT_ANONMIN 49152
#define IPV6PORT_ANONMAX 65535
#define IPV6PORT_RESERVEDMIN 600
#define IPV6PORT_RESERVEDMAX (IPV6PORT_RESERVED-1)
#endif
 
/*
* IPv6 address
*/
struct in6_addr {
union {
uint8_t __u6_addr8[16];
uint16_t __u6_addr16[8];
uint32_t __u6_addr32[4];
} __u6_addr; /* 128-bit IP6 address */
};
 
#define s6_addr __u6_addr.__u6_addr8
#ifdef _KERNEL /* XXX nonstandard */
#define s6_addr8 __u6_addr.__u6_addr8
#define s6_addr16 __u6_addr.__u6_addr16
#define s6_addr32 __u6_addr.__u6_addr32
#endif
 
#define INET6_ADDRSTRLEN 46
 
/*
* XXX missing POSIX.1-2001 macro IPPROTO_IPV6.
*/
 
/*
* Socket address for IPv6
*/
#if __BSD_VISIBLE
#define SIN6_LEN
#endif
 
struct sockaddr_in6 {
uint8_t sin6_len; /* length of this struct */
sa_family_t sin6_family; /* AF_INET6 */
in_port_t sin6_port; /* Transport layer port # */
uint32_t sin6_flowinfo; /* IP6 flow information */
struct in6_addr sin6_addr; /* IP6 address */
uint32_t sin6_scope_id; /* scope zone index */
};
 
/*
* Local definition for masks
*/
#ifdef _KERNEL /* XXX nonstandard */
#define IN6MASK0 {{{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }}}
#define IN6MASK32 {{{ 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, \
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}}
#define IN6MASK64 {{{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}}
#define IN6MASK96 {{{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \
0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 }}}
#define IN6MASK128 {{{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }}}
#endif
 
#ifdef _KERNEL
extern const struct sockaddr_in6 sa6_any;
 
extern const struct in6_addr in6mask0;
extern const struct in6_addr in6mask32;
extern const struct in6_addr in6mask64;
extern const struct in6_addr in6mask96;
extern const struct in6_addr in6mask128;
#endif /* _KERNEL */
 
/*
* Macros started with IPV6_ADDR is KAME local
*/
#ifdef _KERNEL /* XXX nonstandard */
#if _BYTE_ORDER == _BIG_ENDIAN
#define IPV6_ADDR_INT32_ONE 1
#define IPV6_ADDR_INT32_TWO 2
#define IPV6_ADDR_INT32_MNL 0xff010000
#define IPV6_ADDR_INT32_MLL 0xff020000
#define IPV6_ADDR_INT32_SMP 0x0000ffff
#define IPV6_ADDR_INT16_ULL 0xfe80
#define IPV6_ADDR_INT16_USL 0xfec0
#define IPV6_ADDR_INT16_MLL 0xff02
#elif _BYTE_ORDER == _LITTLE_ENDIAN
#define IPV6_ADDR_INT32_ONE 0x01000000
#define IPV6_ADDR_INT32_TWO 0x02000000
#define IPV6_ADDR_INT32_MNL 0x000001ff
#define IPV6_ADDR_INT32_MLL 0x000002ff
#define IPV6_ADDR_INT32_SMP 0xffff0000
#define IPV6_ADDR_INT16_ULL 0x80fe
#define IPV6_ADDR_INT16_USL 0xc0fe
#define IPV6_ADDR_INT16_MLL 0x02ff
#endif
#endif
 
/*
* Definition of some useful macros to handle IP6 addresses
*/
#if __BSD_VISIBLE
#define IN6ADDR_ANY_INIT \
{{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}}
#define IN6ADDR_LOOPBACK_INIT \
{{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}}
#define IN6ADDR_NODELOCAL_ALLNODES_INIT \
{{{ 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}}
#define IN6ADDR_LINKLOCAL_ALLNODES_INIT \
{{{ 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}}
#define IN6ADDR_LINKLOCAL_ALLROUTERS_INIT \
{{{ 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02 }}}
#endif
 
extern const struct in6_addr in6addr_any;
extern const struct in6_addr in6addr_loopback;
#if __BSD_VISIBLE
extern const struct in6_addr in6addr_nodelocal_allnodes;
extern const struct in6_addr in6addr_linklocal_allnodes;
extern const struct in6_addr in6addr_linklocal_allrouters;
#endif
 
/*
* Equality
* NOTE: Some of kernel programming environment (for example, openbsd/sparc)
* does not supply memcmp(). For userland memcmp() is preferred as it is
* in ANSI standard.
*/
#ifdef _KERNEL
#define IN6_ARE_ADDR_EQUAL(a, b) \
(bcmp(&(a)->s6_addr[0], &(b)->s6_addr[0], sizeof(struct in6_addr)) == 0)
#else
#if __BSD_VISIBLE
#define IN6_ARE_ADDR_EQUAL(a, b) \
(memcmp(&(a)->s6_addr[0], &(b)->s6_addr[0], sizeof(struct in6_addr)) == 0)
#endif
#endif
 
#ifdef _KERNEL /* non standard */
/* see if two addresses are equal in a scope-conscious manner. */
#define SA6_ARE_ADDR_EQUAL(a, b) \
(((a)->sin6_scope_id == 0 || (b)->sin6_scope_id == 0 || \
((a)->sin6_scope_id == (b)->sin6_scope_id)) && \
(bcmp(&(a)->sin6_addr, &(b)->sin6_addr, sizeof(struct in6_addr)) == 0))
#endif
 
/*
* Unspecified
*/
#define IN6_IS_ADDR_UNSPECIFIED(a) \
((*(const u_int32_t *)(const void *)(&(a)->s6_addr[0]) == 0) && \
(*(const u_int32_t *)(const void *)(&(a)->s6_addr[4]) == 0) && \
(*(const u_int32_t *)(const void *)(&(a)->s6_addr[8]) == 0) && \
(*(const u_int32_t *)(const void *)(&(a)->s6_addr[12]) == 0))
 
/*
* Loopback
*/
#define IN6_IS_ADDR_LOOPBACK(a) \
((*(const u_int32_t *)(const void *)(&(a)->s6_addr[0]) == 0) && \
(*(const u_int32_t *)(const void *)(&(a)->s6_addr[4]) == 0) && \
(*(const u_int32_t *)(const void *)(&(a)->s6_addr[8]) == 0) && \
(*(const u_int32_t *)(const void *)(&(a)->s6_addr[12]) == ntohl(1)))
 
/*
* IPv4 compatible
*/
#define IN6_IS_ADDR_V4COMPAT(a) \
((*(const u_int32_t *)(const void *)(&(a)->s6_addr[0]) == 0) && \
(*(const u_int32_t *)(const void *)(&(a)->s6_addr[4]) == 0) && \
(*(const u_int32_t *)(const void *)(&(a)->s6_addr[8]) == 0) && \
(*(const u_int32_t *)(const void *)(&(a)->s6_addr[12]) != 0) && \
(*(const u_int32_t *)(const void *)(&(a)->s6_addr[12]) != ntohl(1)))
 
/*
* Mapped
*/
#define IN6_IS_ADDR_V4MAPPED(a) \
((*(const u_int32_t *)(const void *)(&(a)->s6_addr[0]) == 0) && \
(*(const u_int32_t *)(const void *)(&(a)->s6_addr[4]) == 0) && \
(*(const u_int32_t *)(const void *)(&(a)->s6_addr[8]) == ntohl(0x0000ffff)))
 
/*
* KAME Scope Values
*/
 
#ifdef _KERNEL /* XXX nonstandard */
#define IPV6_ADDR_SCOPE_NODELOCAL 0x01
#define IPV6_ADDR_SCOPE_LINKLOCAL 0x02
#define IPV6_ADDR_SCOPE_SITELOCAL 0x05
#define IPV6_ADDR_SCOPE_ORGLOCAL 0x08 /* just used in this file */
#define IPV6_ADDR_SCOPE_GLOBAL 0x0e
#else
#define __IPV6_ADDR_SCOPE_NODELOCAL 0x01
#define __IPV6_ADDR_SCOPE_LINKLOCAL 0x02
#define __IPV6_ADDR_SCOPE_SITELOCAL 0x05
#define __IPV6_ADDR_SCOPE_ORGLOCAL 0x08 /* just used in this file */
#define __IPV6_ADDR_SCOPE_GLOBAL 0x0e
#endif
 
/*
* Unicast Scope
* Note that we must check topmost 10 bits only, not 16 bits (see RFC2373).
*/
#define IN6_IS_ADDR_LINKLOCAL(a) \
(((a)->s6_addr[0] == 0xfe) && (((a)->s6_addr[1] & 0xc0) == 0x80))
#define IN6_IS_ADDR_SITELOCAL(a) \
(((a)->s6_addr[0] == 0xfe) && (((a)->s6_addr[1] & 0xc0) == 0xc0))
 
/*
* Multicast
*/
#define IN6_IS_ADDR_MULTICAST(a) ((a)->s6_addr[0] == 0xff)
 
#ifdef _KERNEL /* XXX nonstandard */
#define IPV6_ADDR_MC_SCOPE(a) ((a)->s6_addr[1] & 0x0f)
#else
#define __IPV6_ADDR_MC_SCOPE(a) ((a)->s6_addr[1] & 0x0f)
#endif
 
/*
* Multicast Scope
*/
#ifdef _KERNEL /* refers nonstandard items */
#define IN6_IS_ADDR_MC_NODELOCAL(a) \
(IN6_IS_ADDR_MULTICAST(a) && \
(IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_NODELOCAL))
#define IN6_IS_ADDR_MC_LINKLOCAL(a) \
(IN6_IS_ADDR_MULTICAST(a) && \
(IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_LINKLOCAL))
#define IN6_IS_ADDR_MC_SITELOCAL(a) \
(IN6_IS_ADDR_MULTICAST(a) && \
(IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_SITELOCAL))
#define IN6_IS_ADDR_MC_ORGLOCAL(a) \
(IN6_IS_ADDR_MULTICAST(a) && \
(IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_ORGLOCAL))
#define IN6_IS_ADDR_MC_GLOBAL(a) \
(IN6_IS_ADDR_MULTICAST(a) && \
(IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_GLOBAL))
#else
#define IN6_IS_ADDR_MC_NODELOCAL(a) \
(IN6_IS_ADDR_MULTICAST(a) && \
(__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_NODELOCAL))
#define IN6_IS_ADDR_MC_LINKLOCAL(a) \
(IN6_IS_ADDR_MULTICAST(a) && \
(__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_LINKLOCAL))
#define IN6_IS_ADDR_MC_SITELOCAL(a) \
(IN6_IS_ADDR_MULTICAST(a) && \
(__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_SITELOCAL))
#define IN6_IS_ADDR_MC_ORGLOCAL(a) \
(IN6_IS_ADDR_MULTICAST(a) && \
(__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_ORGLOCAL))
#define IN6_IS_ADDR_MC_GLOBAL(a) \
(IN6_IS_ADDR_MULTICAST(a) && \
(__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_GLOBAL))
#endif
 
#ifdef _KERNEL /* nonstandard */
/*
* KAME Scope
*/
#define IN6_IS_SCOPE_LINKLOCAL(a) \
((IN6_IS_ADDR_LINKLOCAL(a)) || \
(IN6_IS_ADDR_MC_LINKLOCAL(a)))
 
#define IFA6_IS_DEPRECATED(a) \
((a)->ia6_lifetime.ia6t_preferred != 0 && \
(a)->ia6_lifetime.ia6t_preferred < time_second)
#define IFA6_IS_INVALID(a) \
((a)->ia6_lifetime.ia6t_expire != 0 && \
(a)->ia6_lifetime.ia6t_expire < time_second)
#endif /* _KERNEL */
 
/*
* IP6 route structure
*/
struct route_in6 {
struct rtentry *ro_rt;
struct sockaddr_in6 ro_dst;
};
 
/*
* Options for use with [gs]etsockopt at the IPV6 level.
* First word of comment is data type; bool is stored in int.
*/
#define IPV6_JOIN_GROUP 12 /* ip6_mreq; join a group membership */
#define IPV6_LEAVE_GROUP 13 /* ip6_mreq; leave a group membership */
#define IPV6_MULTICAST_HOPS 10 /* int; set/get IP6 multicast hops */
#define IPV6_MULTICAST_IF 9 /* u_int; set/get IP6 multicast i/f */
#define IPV6_MULTICAST_LOOP 11 /* u_int; set/get IP6 multicast loopback */
#define IPV6_UNICAST_HOPS 4 /* int; IP6 hops */
#define IPV6_V6ONLY 27 /* bool; only bind INET6 at wildcard bind */
 
#if __BSD_VISIBLE
/* no hdrincl */
#if 0 /* the followings are relic in IPv4 and hence are disabled */
#define IPV6_OPTIONS 1 /* buf/ip6_opts; set/get IP6 options */
#define IPV6_RECVOPTS 5 /* bool; receive all IP6 opts w/dgram */
#define IPV6_RECVRETOPTS 6 /* bool; receive IP6 opts for response */
#define IPV6_RECVDSTADDR 7 /* bool; receive IP6 dst addr w/dgram */
#define IPV6_RETOPTS 8 /* ip6_opts; set/get IP6 options */
#endif
#define IPV6_SOCKOPT_RESERVED1 3 /* reserved for future use */
#define IPV6_PORTRANGE 14 /* int; range to choose for unspec port */
#define ICMP6_FILTER 18 /* icmp6_filter; icmp6 filter */
/* RFC2292 options */
#define IPV6_PKTINFO 19 /* bool; send/recv if, src/dst addr */
#define IPV6_HOPLIMIT 20 /* bool; hop limit */
#define IPV6_NEXTHOP 21 /* bool; next hop addr */
#define IPV6_HOPOPTS 22 /* bool; hop-by-hop option */
#define IPV6_DSTOPTS 23 /* bool; destination option */
#define IPV6_RTHDR 24 /* bool; routing header */
#define IPV6_PKTOPTIONS 25 /* buf/cmsghdr; set/get IPv6 options */
 
#define IPV6_CHECKSUM 26 /* int; checksum offset for raw socket */
#ifndef _KERNEL
#define IPV6_BINDV6ONLY IPV6_V6ONLY
#endif
 
#if 1 /* IPSEC */
#define IPV6_IPSEC_POLICY 28 /* struct; get/set security policy */
#endif
#define IPV6_FAITH 29 /* bool; accept FAITH'ed connections */
 
#if 1 /* IPV6FIREWALL */
#define IPV6_FW_ADD 30 /* add a firewall rule to chain */
#define IPV6_FW_DEL 31 /* delete a firewall rule from chain */
#define IPV6_FW_FLUSH 32 /* flush firewall rule chain */
#define IPV6_FW_ZERO 33 /* clear single/all firewall counter(s) */
#define IPV6_FW_GET 34 /* get entire firewall rule chain */
#endif
 
/* to define items, should talk with KAME guys first, for *BSD compatibility */
 
#define IPV6_RTHDR_LOOSE 0 /* this hop need not be a neighbor. XXX old spec */
#define IPV6_RTHDR_STRICT 1 /* this hop must be a neighbor. XXX old spec */
#define IPV6_RTHDR_TYPE_0 0 /* IPv6 routing header type 0 */
 
/*
* Defaults and limits for options
*/
#define IPV6_DEFAULT_MULTICAST_HOPS 1 /* normally limit m'casts to 1 hop */
#define IPV6_DEFAULT_MULTICAST_LOOP 1 /* normally hear sends if a member */
 
/*
* Argument structure for IPV6_JOIN_GROUP and IPV6_LEAVE_GROUP.
*/
struct ipv6_mreq {
struct in6_addr ipv6mr_multiaddr;
unsigned int ipv6mr_interface;
};
 
/*
* IPV6_PKTINFO: Packet information(RFC2292 sec 5)
*/
struct in6_pktinfo {
struct in6_addr ipi6_addr; /* src/dst IPv6 address */
unsigned int ipi6_ifindex; /* send/recv interface index */
};
 
/*
* Argument for IPV6_PORTRANGE:
* - which range to search when port is unspecified at bind() or connect()
*/
#define IPV6_PORTRANGE_DEFAULT 0 /* default range */
#define IPV6_PORTRANGE_HIGH 1 /* "high" - request firewall bypass */
#define IPV6_PORTRANGE_LOW 2 /* "low" - vouchsafe security */
 
/*
* Definitions for inet6 sysctl operations.
*
* Third level is protocol number.
* Fourth level is desired variable within that protocol.
*/
#define IPV6PROTO_MAXID (IPPROTO_PIM + 1) /* don't list to IPV6PROTO_MAX */
 
#define CTL_IPV6PROTO_NAMES { \
{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
{ 0, 0 }, \
{ "tcp6", CTLTYPE_NODE }, \
{ 0, 0 }, \
{ 0, 0 }, \
{ 0, 0 }, \
{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
{ 0, 0 }, \
{ 0, 0 }, \
{ "udp6", CTLTYPE_NODE }, \
{ 0, 0 }, \
{ 0, 0 }, \
{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
{ 0, 0 }, \
{ "ip6", CTLTYPE_NODE }, \
{ 0, 0 }, \
{ 0, 0 }, \
{ 0, 0 }, \
{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
{ 0, 0 }, \
{ "ipsec6", CTLTYPE_NODE }, \
{ 0, 0 }, \
{ 0, 0 }, \
{ 0, 0 }, \
{ 0, 0 }, \
{ 0, 0 }, \
{ 0, 0 }, \
{ "icmp6", CTLTYPE_NODE }, \
{ 0, 0 }, \
{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
{ 0, 0 }, \
{ 0, 0 }, \
{ 0, 0 }, \
{ "pim6", CTLTYPE_NODE }, \
}
 
/*
* Names for IP sysctl objects
*/
#define IPV6CTL_FORWARDING 1 /* act as router */
#define IPV6CTL_SENDREDIRECTS 2 /* may send redirects when forwarding*/
#define IPV6CTL_DEFHLIM 3 /* default Hop-Limit */
#ifdef notyet
#define IPV6CTL_DEFMTU 4 /* default MTU */
#endif
#define IPV6CTL_FORWSRCRT 5 /* forward source-routed dgrams */
#define IPV6CTL_STATS 6 /* stats */
#define IPV6CTL_MRTSTATS 7 /* multicast forwarding stats */
#define IPV6CTL_MRTPROTO 8 /* multicast routing protocol */
#define IPV6CTL_MAXFRAGPACKETS 9 /* max packets reassembly queue */
#define IPV6CTL_SOURCECHECK 10 /* verify source route and intf */
#define IPV6CTL_SOURCECHECK_LOGINT 11 /* minimume logging interval */
#define IPV6CTL_ACCEPT_RTADV 12
#define IPV6CTL_KEEPFAITH 13
#define IPV6CTL_LOG_INTERVAL 14
#define IPV6CTL_HDRNESTLIMIT 15
#define IPV6CTL_DAD_COUNT 16
#define IPV6CTL_AUTO_FLOWLABEL 17
#define IPV6CTL_DEFMCASTHLIM 18
#define IPV6CTL_GIF_HLIM 19 /* default HLIM for gif encap packet */
#define IPV6CTL_KAME_VERSION 20
#define IPV6CTL_USE_DEPRECATED 21 /* use deprecated addr (RFC2462 5.5.4) */
#define IPV6CTL_RR_PRUNE 22 /* walk timer for router renumbering */
#if 0 /* obsolete */
#define IPV6CTL_MAPPED_ADDR 23
#endif
#define IPV6CTL_V6ONLY 24
#define IPV6CTL_RTEXPIRE 25 /* cloned route expiration time */
#define IPV6CTL_RTMINEXPIRE 26 /* min value for expiration time */
#define IPV6CTL_RTMAXCACHE 27 /* trigger level for dynamic expire */
 
#define IPV6CTL_USETEMPADDR 32 /* use temporary addresses (RFC3041) */
#define IPV6CTL_TEMPPLTIME 33 /* preferred lifetime for tmpaddrs */
#define IPV6CTL_TEMPVLTIME 34 /* valid lifetime for tmpaddrs */
#define IPV6CTL_AUTO_LINKLOCAL 35 /* automatic link-local addr assign */
#define IPV6CTL_RIP6STATS 36 /* raw_ip6 stats */
 
/* New entries should be added here from current IPV6CTL_MAXID value. */
/* to define items, should talk with KAME guys first, for *BSD compatibility */
#define IPV6CTL_MAXID 37
 
/*
* Redefinition of mbuf flags
*/
#define M_AUTHIPHDR M_PROTO2
#define M_DECRYPTED M_PROTO3
#define M_LOOP M_PROTO4
#define M_AUTHIPDGM M_PROTO5
 
#ifdef _KERNEL
struct cmsghdr;
 
int in6_cksum __P((struct mbuf *, u_int8_t, u_int32_t, u_int32_t));
int in6_localaddr __P((struct in6_addr *));
int in6_addrscope __P((struct in6_addr *));
struct in6_ifaddr *in6_ifawithscope __P((struct ifnet *, struct in6_addr *));
struct in6_ifaddr *in6_ifawithifp __P((struct ifnet *, struct in6_addr *));
extern void in6_if_up __P((struct ifnet *));
struct sockaddr;
extern u_char ip6_protox[];
 
void in6_sin6_2_sin __P((struct sockaddr_in *sin,
struct sockaddr_in6 *sin6));
void in6_sin_2_v4mapsin6 __P((struct sockaddr_in *sin,
struct sockaddr_in6 *sin6));
void in6_sin6_2_sin_in_sock __P((struct sockaddr *nam));
void in6_sin_2_v4mapsin6_in_sock __P((struct sockaddr **nam));
 
#define satosin6(sa) ((struct sockaddr_in6 *)(sa))
#define sin6tosa(sin6) ((struct sockaddr *)(sin6))
#define ifatoia6(ifa) ((struct in6_ifaddr *)(ifa))
 
extern int (*faithprefix_p)(struct in6_addr *);
#endif /* _KERNEL */
 
#ifdef _BSD_SIZE_T_
typedef _BSD_SIZE_T_ size_t;
#undef _BSD_SIZE_T_
#endif
 
__BEGIN_DECLS
struct cmsghdr;
 
extern int inet6_option_space __P((int));
extern int inet6_option_init __P((void *, struct cmsghdr **, int));
extern int inet6_option_append __P((struct cmsghdr *, const uint8_t *,
int, int));
extern uint8_t *inet6_option_alloc __P((struct cmsghdr *, int, int, int));
extern int inet6_option_next __P((const struct cmsghdr *, uint8_t **));
extern int inet6_option_find __P((const struct cmsghdr *, uint8_t **, int));
 
extern size_t inet6_rthdr_space __P((int, int));
extern struct cmsghdr *inet6_rthdr_init __P((void *, int));
extern int inet6_rthdr_add __P((struct cmsghdr *, const struct in6_addr *,
unsigned int));
extern int inet6_rthdr_lasthop __P((struct cmsghdr *, unsigned int));
#if 0 /* not implemented yet */
extern int inet6_rthdr_reverse __P((const struct cmsghdr *, struct cmsghdr *));
#endif
extern int inet6_rthdr_segments __P((const struct cmsghdr *));
extern struct in6_addr *inet6_rthdr_getaddr __P((struct cmsghdr *, int));
extern int inet6_rthdr_getflags __P((const struct cmsghdr *, int));
 
extern int inet6_opt_init __P((void *, size_t));
extern int inet6_opt_append __P((void *, size_t, int, uint8_t,
size_t, uint8_t, void **));
extern int inet6_opt_finish __P((void *, size_t, int));
extern int inet6_opt_set_val __P((void *, size_t, void *, int));
 
extern int inet6_opt_next __P((void *, size_t, int, uint8_t *,
size_t *, void **));
extern int inet6_opt_find __P((void *, size_t, int, uint8_t,
size_t *, void **));
extern int inet6_opt_get_val __P((void *, size_t, void *, int));
extern size_t inet6_rth_space __P((int, int));
extern void *inet6_rth_init __P((void *, int, int, int));
extern int inet6_rth_add __P((void *, const struct in6_addr *));
extern int inet6_rth_reverse __P((const void *, void *));
extern int inet6_rth_segments __P((const void *));
extern struct in6_addr *inet6_rth_getaddr __P((const void *, int));
__END_DECLS
 
#endif /* __BSD_VISIBLE */
 
#endif /* !_NETINET6_IN6_H_ */
/pkgnet/trunk/watt32/inc/netinet6/in6_gif.h
0,0 → 1,46
/*!\file netinet6/in6_gif.h
*
*/
 
/* $FreeBSD: src/sys/netinet6/in6_gif.h,v 1.3 2000/07/04 16:35:09 itojun Exp $ */
/* $KAME: in6_gif.h,v 1.5 2000/04/14 08:36:03 itojun Exp $ */
 
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the project nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
 
#ifndef _NETINET6_IN6_GIF_H_
#define _NETINET6_IN6_GIF_H_
 
#define GIF_HLIM 30
 
int in6_gif_input __P((struct mbuf **, int *, int));
int in6_gif_output __P((struct ifnet *, int, struct mbuf *, struct rtentry *));
int gif_encapcheck6 __P((const struct mbuf *, int, int, void *));
 
#endif /*_NETINET6_IN6_GIF_H_*/
/pkgnet/trunk/watt32/inc/netinet6/in6_ifat.h
0,0 → 1,50
/*!\file netinet6/in6_ifat.h
*
*/
 
/* $FreeBSD: src/sys/netinet6/in6_ifattach.h,v 1.3 2001/06/11 12:39:05 ume Exp $ */
/* $KAME: in6_ifattach.h,v 1.14 2001/02/08 12:48:39 jinmei Exp $ */
 
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the project nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
 
#ifndef _NETINET6_IN6_IFATTACH_H_
#define _NETINET6_IN6_IFATTACH_H_
 
#ifdef _KERNEL
void in6_nigroup_attach __P((const char *, int));
void in6_nigroup_detach __P((const char *, int));
void in6_ifattach __P((struct ifnet *, struct ifnet *));
void in6_ifdetach __P((struct ifnet *));
void in6_get_tmpifid __P((struct ifnet *, u_int8_t *, const u_int8_t *, int));
void in6_tmpaddrtimer __P((void *));
int in6_nigroup __P((struct ifnet *, const char *, int, struct in6_addr *));
#endif /* _KERNEL */
 
#endif /* _NETINET6_IN6_IFATTACH_H_ */
/pkgnet/trunk/watt32/inc/netinet6/in6_pcb.h
0,0 → 1,116
/*!\file netinet6/in6_pcb.h
*
*/
 
/* $FreeBSD: src/sys/netinet6/in6_pcb.h,v 1.8 2002/06/14 08:35:21 hsu Exp $ */
/* $KAME: in6_pcb.h,v 1.13 2001/02/06 09:16:53 itojun Exp $ */
 
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the project nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
*/
 
/*
* Copyright (c) 1982, 1986, 1990, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)in_pcb.h 8.1 (Berkeley) 6/10/93
*/
 
#ifndef _NETINET6_IN6_PCB_H_
#define _NETINET6_IN6_PCB_H_
 
#ifdef _KERNEL
#define satosin6(sa) ((struct sockaddr_in6 *)(sa))
#define sin6tosa(sin6) ((struct sockaddr *)(sin6))
#define ifatoia6(ifa) ((struct in6_ifaddr *)(ifa))
 
void in6_pcbpurgeif0 __P((struct in6pcb *, struct ifnet *));
void in6_losing __P((struct inpcb *));
int in6_pcballoc __P((struct socket *, struct inpcbinfo *, struct thread *));
int in6_pcbbind __P((struct inpcb *, struct sockaddr *, struct thread *));
int in6_pcbconnect __P((struct inpcb *, struct sockaddr *, struct thread *));
void in6_pcbdetach __P((struct inpcb *));
void in6_pcbdisconnect __P((struct inpcb *));
int in6_pcbladdr __P((struct inpcb *, struct sockaddr *,
struct in6_addr **));
struct inpcb *
in6_pcblookup_local __P((struct inpcbinfo *,
struct in6_addr *, u_int, int));
struct inpcb *
in6_pcblookup_hash __P((struct inpcbinfo *,
struct in6_addr *, u_int, struct in6_addr *,
u_int, int, struct ifnet *));
void in6_pcbnotify __P((struct inpcbhead *, struct sockaddr *,
u_int, const struct sockaddr *, u_int, int,
struct inpcb *(*)(struct inpcb *, int)));
struct inpcb *
in6_rtchange __P((struct inpcb *, int));
int in6_setpeeraddr __P((struct socket *so, struct sockaddr **nam));
int in6_setsockaddr __P((struct socket *so, struct sockaddr **nam));
int in6_mapped_sockaddr __P((struct socket *so, struct sockaddr **nam));
int in6_mapped_peeraddr __P((struct socket *so, struct sockaddr **nam));
struct in6_addr *in6_selectsrc __P((struct sockaddr_in6 *,
struct ip6_pktopts *,
struct ip6_moptions *,
struct route_in6 *,
struct in6_addr *, int *));
int in6_selecthlim __P((struct in6pcb *, struct ifnet *));
int in6_pcbsetport __P((struct in6_addr *, struct inpcb *, struct thread *));
void init_sin6 __P((struct sockaddr_in6 *sin6, struct mbuf *m));
#endif /* _KERNEL */
 
#endif /* !_NETINET6_IN6_PCB_H_ */
/pkgnet/trunk/watt32/inc/netinet6/in6_pref.h
0,0 → 1,95
/*!\file netinet6/in6_pref.h
*
*/
 
/* $FreeBSD: src/sys/netinet6/in6_prefix.h,v 1.5 2001/06/11 12:39:05 ume Exp $ */
/* $KAME: in6_prefix.h,v 1.10 2001/02/08 16:30:30 itojun Exp $ */
 
/*
* Copyright (C) 1995, 1996, 1997, 1998 and 1999 WIDE Project.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the project nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
 
#include <sys/callout.h>
 
struct rr_prefix {
struct ifprefix rp_ifpr;
LIST_ENTRY(rr_prefix) rp_entry;
LIST_HEAD(rp_addrhead, rp_addr) rp_addrhead;
struct sockaddr_in6 rp_prefix; /* prefix */
u_int32_t rp_vltime; /* advertised valid lifetime */
u_int32_t rp_pltime; /* advertised preferred lifetime */
time_t rp_expire; /* expiration time of the prefix */
time_t rp_preferred; /* preferred time of the prefix */
struct in6_prflags rp_flags;
u_char rp_origin; /* from where this prefix info is obtained */
struct rp_stateflags {
/* if some prefix should be added to this prefix */
u_char addmark : 1;
u_char delmark : 1; /* if this prefix will be deleted */
} rp_stateflags;
};
 
#define rp_type rp_ifpr.ifpr_type
#define rp_ifp rp_ifpr.ifpr_ifp
#define rp_plen rp_ifpr.ifpr_plen
 
#define rp_raf rp_flags.prf_ra
#define rp_raf_onlink rp_flags.prf_ra.onlink
#define rp_raf_auto rp_flags.prf_ra.autonomous
 
#define rp_statef_addmark rp_stateflags.addmark
#define rp_statef_delmark rp_stateflags.delmark
 
#define rp_rrf rp_flags.prf_rr
#define rp_rrf_decrvalid rp_flags.prf_rr.decrvalid
#define rp_rrf_decrprefd rp_flags.prf_rr.decrprefd
 
struct rp_addr {
LIST_ENTRY(rp_addr) ra_entry;
struct in6_addr ra_ifid;
struct in6_ifaddr *ra_addr;
struct ra_flags {
u_char anycast : 1;
} ra_flags;
};
 
#define ifpr2rp(ifpr) ((struct rr_prefix *)(ifpr))
#define rp2ifpr(rp) ((struct ifprefix *)(rp))
 
#define RP_IN6(rp) (&(rp)->rp_prefix.sin6_addr)
 
#define RR_INFINITE_LIFETIME 0xffffffff
 
 
LIST_HEAD(rr_prhead, rr_prefix);
 
extern struct rr_prhead rr_prefix;
 
void in6_rr_timer __P((void *));
extern struct callout in6_rr_timer_ch;
int delete_each_prefix __P((struct rr_prefix *rpp, u_char origin));
/pkgnet/trunk/watt32/inc/netinet6/in6_var.h
0,0 → 1,612
/*!\file netinet6/in6_var.h
*
*/
 
/* $FreeBSD: src/sys/netinet6/in6_var.h,v 1.10 2002/04/19 04:46:22 suz Exp $ */
/* $KAME: in6_var.h,v 1.56 2001/03/29 05:34:31 itojun Exp $ */
 
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the project nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
 
/*
* Copyright (c) 1985, 1986, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)in_var.h 8.1 (Berkeley) 6/10/93
*/
 
#ifndef _NETINET6_IN6_VAR_H_
#define _NETINET6_IN6_VAR_H_
 
/*
* Interface address, Internet version. One of these structures
* is allocated for each interface with an Internet address.
* The ifaddr structure contains the protocol-independent part
* of the structure and is assumed to be first.
*/
 
/*
* pltime/vltime are just for future reference (required to implements 2
* hour rule for hosts). they should never be modified by nd6_timeout or
* anywhere else.
* userland -> kernel: accept pltime/vltime
* kernel -> userland: throw up everything
* in kernel: modify preferred/expire only
*/
struct in6_addrlifetime {
time_t ia6t_expire; /* valid lifetime expiration time */
time_t ia6t_preferred; /* preferred lifetime expiration time */
u_int32_t ia6t_vltime; /* valid lifetime */
u_int32_t ia6t_pltime; /* prefix lifetime */
};
 
struct in6_ifaddr {
struct ifaddr ia_ifa; /* protocol-independent info */
#define ia_ifp ia_ifa.ifa_ifp
#define ia_flags ia_ifa.ifa_flags
struct sockaddr_in6 ia_addr; /* interface address */
struct sockaddr_in6 ia_net; /* network number of interface */
struct sockaddr_in6 ia_dstaddr; /* space for destination addr */
struct sockaddr_in6 ia_prefixmask; /* prefix mask */
u_int32_t ia_plen; /* prefix length */
struct in6_ifaddr *ia_next; /* next in6 list of IP6 addresses */
int ia6_flags;
 
struct in6_addrlifetime ia6_lifetime;
struct ifprefix *ia6_ifpr; /* back pointer to ifprefix */
 
struct nd_prefix *ia6_ndpr; /* back pointer to the ND prefix
* (for autoconfigured addresses only)
*/
};
 
/*
* IPv6 interface statistics, as defined in RFC2465 Ipv6IfStatsEntry (p12).
*/
struct in6_ifstat {
u_quad_t ifs6_in_receive; /* # of total input datagram */
u_quad_t ifs6_in_hdrerr; /* # of datagrams with invalid hdr */
u_quad_t ifs6_in_toobig; /* # of datagrams exceeded MTU */
u_quad_t ifs6_in_noroute; /* # of datagrams with no route */
u_quad_t ifs6_in_addrerr; /* # of datagrams with invalid dst */
u_quad_t ifs6_in_protounknown; /* # of datagrams with unknown proto */
/* NOTE: increment on final dst if */
u_quad_t ifs6_in_truncated; /* # of truncated datagrams */
u_quad_t ifs6_in_discard; /* # of discarded datagrams */
/* NOTE: fragment timeout is not here */
u_quad_t ifs6_in_deliver; /* # of datagrams delivered to ULP */
/* NOTE: increment on final dst if */
u_quad_t ifs6_out_forward; /* # of datagrams forwarded */
/* NOTE: increment on outgoing if */
u_quad_t ifs6_out_request; /* # of outgoing datagrams from ULP */
/* NOTE: does not include forwrads */
u_quad_t ifs6_out_discard; /* # of discarded datagrams */
u_quad_t ifs6_out_fragok; /* # of datagrams fragmented */
u_quad_t ifs6_out_fragfail; /* # of datagrams failed on fragment */
u_quad_t ifs6_out_fragcreat; /* # of fragment datagrams */
/* NOTE: this is # after fragment */
u_quad_t ifs6_reass_reqd; /* # of incoming fragmented packets */
/* NOTE: increment on final dst if */
u_quad_t ifs6_reass_ok; /* # of reassembled packets */
/* NOTE: this is # after reass */
/* NOTE: increment on final dst if */
u_quad_t ifs6_reass_fail; /* # of reass failures */
/* NOTE: may not be packet count */
/* NOTE: increment on final dst if */
u_quad_t ifs6_in_mcast; /* # of inbound multicast datagrams */
u_quad_t ifs6_out_mcast; /* # of outbound multicast datagrams */
};
 
/*
* ICMPv6 interface statistics, as defined in RFC2466 Ipv6IfIcmpEntry.
* XXX: I'm not sure if this file is the right place for this structure...
*/
struct icmp6_ifstat {
/*
* Input statistics
*/
/* ipv6IfIcmpInMsgs, total # of input messages */
u_quad_t ifs6_in_msg;
/* ipv6IfIcmpInErrors, # of input error messages */
u_quad_t ifs6_in_error;
/* ipv6IfIcmpInDestUnreachs, # of input dest unreach errors */
u_quad_t ifs6_in_dstunreach;
/* ipv6IfIcmpInAdminProhibs, # of input administratively prohibited errs */
u_quad_t ifs6_in_adminprohib;
/* ipv6IfIcmpInTimeExcds, # of input time exceeded errors */
u_quad_t ifs6_in_timeexceed;
/* ipv6IfIcmpInParmProblems, # of input parameter problem errors */
u_quad_t ifs6_in_paramprob;
/* ipv6IfIcmpInPktTooBigs, # of input packet too big errors */
u_quad_t ifs6_in_pkttoobig;
/* ipv6IfIcmpInEchos, # of input echo requests */
u_quad_t ifs6_in_echo;
/* ipv6IfIcmpInEchoReplies, # of input echo replies */
u_quad_t ifs6_in_echoreply;
/* ipv6IfIcmpInRouterSolicits, # of input router solicitations */
u_quad_t ifs6_in_routersolicit;
/* ipv6IfIcmpInRouterAdvertisements, # of input router advertisements */
u_quad_t ifs6_in_routeradvert;
/* ipv6IfIcmpInNeighborSolicits, # of input neighbor solicitations */
u_quad_t ifs6_in_neighborsolicit;
/* ipv6IfIcmpInNeighborAdvertisements, # of input neighbor advertisements */
u_quad_t ifs6_in_neighboradvert;
/* ipv6IfIcmpInRedirects, # of input redirects */
u_quad_t ifs6_in_redirect;
/* ipv6IfIcmpInGroupMembQueries, # of input MLD queries */
u_quad_t ifs6_in_mldquery;
/* ipv6IfIcmpInGroupMembResponses, # of input MLD reports */
u_quad_t ifs6_in_mldreport;
/* ipv6IfIcmpInGroupMembReductions, # of input MLD done */
u_quad_t ifs6_in_mlddone;
 
/*
* Output statistics. We should solve unresolved routing problem...
*/
/* ipv6IfIcmpOutMsgs, total # of output messages */
u_quad_t ifs6_out_msg;
/* ipv6IfIcmpOutErrors, # of output error messages */
u_quad_t ifs6_out_error;
/* ipv6IfIcmpOutDestUnreachs, # of output dest unreach errors */
u_quad_t ifs6_out_dstunreach;
/* ipv6IfIcmpOutAdminProhibs, # of output administratively prohibited errs */
u_quad_t ifs6_out_adminprohib;
/* ipv6IfIcmpOutTimeExcds, # of output time exceeded errors */
u_quad_t ifs6_out_timeexceed;
/* ipv6IfIcmpOutParmProblems, # of output parameter problem errors */
u_quad_t ifs6_out_paramprob;
/* ipv6IfIcmpOutPktTooBigs, # of output packet too big errors */
u_quad_t ifs6_out_pkttoobig;
/* ipv6IfIcmpOutEchos, # of output echo requests */
u_quad_t ifs6_out_echo;
/* ipv6IfIcmpOutEchoReplies, # of output echo replies */
u_quad_t ifs6_out_echoreply;
/* ipv6IfIcmpOutRouterSolicits, # of output router solicitations */
u_quad_t ifs6_out_routersolicit;
/* ipv6IfIcmpOutRouterAdvertisements, # of output router advertisements */
u_quad_t ifs6_out_routeradvert;
/* ipv6IfIcmpOutNeighborSolicits, # of output neighbor solicitations */
u_quad_t ifs6_out_neighborsolicit;
/* ipv6IfIcmpOutNeighborAdvertisements, # of output neighbor advertisements */
u_quad_t ifs6_out_neighboradvert;
/* ipv6IfIcmpOutRedirects, # of output redirects */
u_quad_t ifs6_out_redirect;
/* ipv6IfIcmpOutGroupMembQueries, # of output MLD queries */
u_quad_t ifs6_out_mldquery;
/* ipv6IfIcmpOutGroupMembResponses, # of output MLD reports */
u_quad_t ifs6_out_mldreport;
/* ipv6IfIcmpOutGroupMembReductions, # of output MLD done */
u_quad_t ifs6_out_mlddone;
};
 
struct in6_ifreq {
char ifr_name[IFNAMSIZ];
union {
struct sockaddr_in6 ifru_addr;
struct sockaddr_in6 ifru_dstaddr;
short ifru_flags;
int ifru_flags6;
int ifru_metric;
caddr_t ifru_data;
struct in6_addrlifetime ifru_lifetime;
struct in6_ifstat ifru_stat;
struct icmp6_ifstat ifru_icmp6stat;
u_int32_t ifru_scope_id[16];
} ifr_ifru;
};
 
struct in6_aliasreq {
char ifra_name[IFNAMSIZ];
struct sockaddr_in6 ifra_addr;
struct sockaddr_in6 ifra_dstaddr;
struct sockaddr_in6 ifra_prefixmask;
int ifra_flags;
struct in6_addrlifetime ifra_lifetime;
};
 
/* prefix type macro */
#define IN6_PREFIX_ND 1
#define IN6_PREFIX_RR 2
 
/*
* prefix related flags passed between kernel(NDP related part) and
* user land command(ifconfig) and daemon(rtadvd).
*/
struct in6_prflags {
struct prf_ra {
u_char onlink : 1;
u_char autonomous : 1;
u_char reserved : 6;
} prf_ra;
u_char prf_reserved1;
u_short prf_reserved2;
/* want to put this on 4byte offset */
struct prf_rr {
u_char decrvalid : 1;
u_char decrprefd : 1;
u_char reserved : 6;
} prf_rr;
u_char prf_reserved3;
u_short prf_reserved4;
};
 
struct in6_prefixreq {
char ipr_name[IFNAMSIZ];
u_char ipr_origin;
u_char ipr_plen;
u_int32_t ipr_vltime;
u_int32_t ipr_pltime;
struct in6_prflags ipr_flags;
struct sockaddr_in6 ipr_prefix;
};
 
#define PR_ORIG_RA 0
#define PR_ORIG_RR 1
#define PR_ORIG_STATIC 2
#define PR_ORIG_KERNEL 3
 
#define ipr_raf_onlink ipr_flags.prf_ra.onlink
#define ipr_raf_auto ipr_flags.prf_ra.autonomous
 
#define ipr_statef_onlink ipr_flags.prf_state.onlink
 
#define ipr_rrf_decrvalid ipr_flags.prf_rr.decrvalid
#define ipr_rrf_decrprefd ipr_flags.prf_rr.decrprefd
 
struct in6_rrenumreq {
char irr_name[IFNAMSIZ];
u_char irr_origin;
u_char irr_m_len; /* match len for matchprefix */
u_char irr_m_minlen; /* minlen for matching prefix */
u_char irr_m_maxlen; /* maxlen for matching prefix */
u_char irr_u_uselen; /* uselen for adding prefix */
u_char irr_u_keeplen; /* keeplen from matching prefix */
struct irr_raflagmask {
u_char onlink : 1;
u_char autonomous : 1;
u_char reserved : 6;
} irr_raflagmask;
u_int32_t irr_vltime;
u_int32_t irr_pltime;
struct in6_prflags irr_flags;
struct sockaddr_in6 irr_matchprefix;
struct sockaddr_in6 irr_useprefix;
};
 
#define irr_raf_mask_onlink irr_raflagmask.onlink
#define irr_raf_mask_auto irr_raflagmask.autonomous
#define irr_raf_mask_reserved irr_raflagmask.reserved
 
#define irr_raf_onlink irr_flags.prf_ra.onlink
#define irr_raf_auto irr_flags.prf_ra.autonomous
 
#define irr_statef_onlink irr_flags.prf_state.onlink
 
#define irr_rrf irr_flags.prf_rr
#define irr_rrf_decrvalid irr_flags.prf_rr.decrvalid
#define irr_rrf_decrprefd irr_flags.prf_rr.decrprefd
 
/*
* Given a pointer to an in6_ifaddr (ifaddr),
* return a pointer to the addr as a sockaddr_in6
*/
#define IA6_IN6(ia) (&((ia)->ia_addr.sin6_addr))
#define IA6_DSTIN6(ia) (&((ia)->ia_dstaddr.sin6_addr))
#define IA6_MASKIN6(ia) (&((ia)->ia_prefixmask.sin6_addr))
#define IA6_SIN6(ia) (&((ia)->ia_addr))
#define IA6_DSTSIN6(ia) (&((ia)->ia_dstaddr))
#define IFA_IN6(x) (&((struct sockaddr_in6 *)((x)->ifa_addr))->sin6_addr)
#define IFA_DSTIN6(x) (&((struct sockaddr_in6 *)((x)->ifa_dstaddr))->sin6_addr)
 
#define IFPR_IN6(x) (&((struct sockaddr_in6 *)((x)->ifpr_prefix))->sin6_addr)
 
#ifdef _KERNEL
#define IN6_ARE_MASKED_ADDR_EQUAL(d, a, m) ( \
(((d)->s6_addr32[0] ^ (a)->s6_addr32[0]) & (m)->s6_addr32[0]) == 0 && \
(((d)->s6_addr32[1] ^ (a)->s6_addr32[1]) & (m)->s6_addr32[1]) == 0 && \
(((d)->s6_addr32[2] ^ (a)->s6_addr32[2]) & (m)->s6_addr32[2]) == 0 && \
(((d)->s6_addr32[3] ^ (a)->s6_addr32[3]) & (m)->s6_addr32[3]) == 0 )
#endif
 
#define SIOCSIFADDR_IN6 _IOW('i', 12, struct in6_ifreq)
#define SIOCGIFADDR_IN6 _IOWR('i', 33, struct in6_ifreq)
 
#ifdef _KERNEL
/*
* SIOCSxxx ioctls should be unused (see comments in in6.c), but
* we do not shift numbers for binary compatibility.
*/
#define SIOCSIFDSTADDR_IN6 _IOW('i', 14, struct in6_ifreq)
#define SIOCSIFNETMASK_IN6 _IOW('i', 22, struct in6_ifreq)
#endif
 
#define SIOCGIFDSTADDR_IN6 _IOWR('i', 34, struct in6_ifreq)
#define SIOCGIFNETMASK_IN6 _IOWR('i', 37, struct in6_ifreq)
 
#define SIOCDIFADDR_IN6 _IOW('i', 25, struct in6_ifreq)
#define SIOCAIFADDR_IN6 _IOW('i', 26, struct in6_aliasreq)
 
#define SIOCSIFPHYADDR_IN6 _IOW('i', 70, struct in6_aliasreq)
#define SIOCGIFPSRCADDR_IN6 _IOWR('i', 71, struct in6_ifreq)
#define SIOCGIFPDSTADDR_IN6 _IOWR('i', 72, struct in6_ifreq)
 
#define SIOCGIFAFLAG_IN6 _IOWR('i', 73, struct in6_ifreq)
 
#define SIOCGDRLST_IN6 _IOWR('i', 74, struct in6_drlist)
#define SIOCGPRLST_IN6 _IOWR('i', 75, struct in6_prlist)
#ifdef _KERNEL
#define OSIOCGIFINFO_IN6 _IOWR('i', 76, struct in6_ondireq)
#endif
#define SIOCGIFINFO_IN6 _IOWR('i', 108, struct in6_ndireq)
#define SIOCSNDFLUSH_IN6 _IOWR('i', 77, struct in6_ifreq)
#define SIOCGNBRINFO_IN6 _IOWR('i', 78, struct in6_nbrinfo)
#define SIOCSPFXFLUSH_IN6 _IOWR('i', 79, struct in6_ifreq)
#define SIOCSRTRFLUSH_IN6 _IOWR('i', 80, struct in6_ifreq)
 
#define SIOCGIFALIFETIME_IN6 _IOWR('i', 81, struct in6_ifreq)
#define SIOCSIFALIFETIME_IN6 _IOWR('i', 82, struct in6_ifreq)
#define SIOCGIFSTAT_IN6 _IOWR('i', 83, struct in6_ifreq)
#define SIOCGIFSTAT_ICMP6 _IOWR('i', 84, struct in6_ifreq)
 
#define SIOCSDEFIFACE_IN6 _IOWR('i', 85, struct in6_ndifreq)
#define SIOCGDEFIFACE_IN6 _IOWR('i', 86, struct in6_ndifreq)
 
#define SIOCSIFINFO_FLAGS _IOWR('i', 87, struct in6_ndireq) /* XXX */
 
#define SIOCSSCOPE6 _IOW('i', 88, struct in6_ifreq)
#define SIOCGSCOPE6 _IOWR('i', 89, struct in6_ifreq)
#define SIOCGSCOPE6DEF _IOWR('i', 90, struct in6_ifreq)
 
#define SIOCSIFPREFIX_IN6 _IOW('i', 100, struct in6_prefixreq) /* set */
#define SIOCGIFPREFIX_IN6 _IOWR('i', 101, struct in6_prefixreq) /* get */
#define SIOCDIFPREFIX_IN6 _IOW('i', 102, struct in6_prefixreq) /* del */
#define SIOCAIFPREFIX_IN6 _IOW('i', 103, struct in6_rrenumreq) /* add */
#define SIOCCIFPREFIX_IN6 _IOW('i', 104, \
struct in6_rrenumreq) /* change */
#define SIOCSGIFPREFIX_IN6 _IOW('i', 105, \
struct in6_rrenumreq) /* set global */
 
#define SIOCGETSGCNT_IN6 _IOWR('u', 106, \
struct sioc_sg_req6) /* get s,g pkt cnt */
#define SIOCGETMIFCNT_IN6 _IOWR('u', 107, \
struct sioc_mif_req6) /* get pkt cnt per if */
 
#define IN6_IFF_ANYCAST 0x01 /* anycast address */
#define IN6_IFF_TENTATIVE 0x02 /* tentative address */
#define IN6_IFF_DUPLICATED 0x04 /* DAD detected duplicate */
#define IN6_IFF_DETACHED 0x08 /* may be detached from the link */
#define IN6_IFF_DEPRECATED 0x10 /* deprecated address */
#define IN6_IFF_NODAD 0x20 /* don't perform DAD on this address
* (used only at first SIOC* call)
*/
#define IN6_IFF_AUTOCONF 0x40 /* autoconfigurable address. */
#define IN6_IFF_TEMPORARY 0x80 /* temporary (anonymous) address. */
#define IN6_IFF_NOPFX 0x8000 /* skip kernel prefix management.
* XXX: this should be temporary.
*/
 
/* do not input/output */
#define IN6_IFF_NOTREADY (IN6_IFF_TENTATIVE|IN6_IFF_DUPLICATED)
 
#ifdef _KERNEL
#define IN6_ARE_SCOPE_CMP(a,b) ((a)-(b))
#define IN6_ARE_SCOPE_EQUAL(a,b) ((a)==(b))
#endif
 
#ifdef _KERNEL
extern struct in6_ifaddr *in6_ifaddr;
 
extern struct in6_ifstat **in6_ifstat;
extern size_t in6_ifstatmax;
extern struct icmp6stat icmp6stat;
extern struct icmp6_ifstat **icmp6_ifstat;
extern size_t icmp6_ifstatmax;
#define in6_ifstat_inc(ifp, tag) \
do { \
if ((ifp) && (ifp)->if_index <= if_index \
&& (ifp)->if_index < in6_ifstatmax \
&& in6_ifstat && in6_ifstat[(ifp)->if_index]) { \
in6_ifstat[(ifp)->if_index]->tag++; \
} \
} while (0)
 
extern struct ifqueue ip6intrq; /* IP6 packet input queue */
extern struct in6_addr zeroin6_addr;
extern u_char inet6ctlerrmap[];
extern unsigned long in6_maxmtu;
#ifdef MALLOC_DECLARE
MALLOC_DECLARE(M_IPMADDR);
#endif
 
/*
* Macro for finding the internet address structure (in6_ifaddr) corresponding
* to a given interface (ifnet structure).
*/
 
#define IFP_TO_IA6(ifp, ia) \
/* struct ifnet *ifp; */ \
/* struct in6_ifaddr *ia; */ \
do { \
struct ifaddr *ifa; \
for (ifa = (ifp)->if_addrlist.tqh_first; ifa; ifa = ifa->ifa_list.tqe_next) { \
if (!ifa->ifa_addr) \
continue; \
if (ifa->ifa_addr->sa_family == AF_INET6) \
break; \
} \
(ia) = (struct in6_ifaddr *)ifa; \
} while (0)
 
#endif /* _KERNEL */
 
/*
* Multi-cast membership entry. One for each group/ifp that a PCB
* belongs to.
*/
struct in6_multi_mship {
struct in6_multi *i6mm_maddr; /* Multicast address pointer */
LIST_ENTRY(in6_multi_mship) i6mm_chain; /* multicast options chain */
};
 
struct in6_multi {
LIST_ENTRY(in6_multi) in6m_entry; /* list glue */
struct in6_addr in6m_addr; /* IP6 multicast address */
struct ifnet *in6m_ifp; /* back pointer to ifnet */
struct ifmultiaddr *in6m_ifma; /* back pointer to ifmultiaddr */
u_int in6m_refcount; /* # membership claims by sockets */
u_int in6m_state; /* state of the membership */
u_int in6m_timer; /* MLD6 listener report timer */
};
 
#ifdef _KERNEL
extern LIST_HEAD(in6_multihead, in6_multi) in6_multihead;
 
/*
* Structure used by macros below to remember position when stepping through
* all of the in6_multi records.
*/
struct in6_multistep {
struct in6_ifaddr *i_ia;
struct in6_multi *i_in6m;
};
 
/*
* Macros for looking up the in6_multi record for a given IP6 multicast
* address on a given interface. If no matching record is found, "in6m"
* returns NLL.
*/
 
#define IN6_LOOKUP_MULTI(addr, ifp, in6m) \
/* struct in6_addr addr; */ \
/* struct ifnet *ifp; */ \
/* struct in6_multi *in6m; */ \
do { \
struct ifmultiaddr *ifma; \
TAILQ_FOREACH(ifma, &(ifp)->if_multiaddrs, ifma_link) { \
if (ifma->ifma_addr->sa_family == AF_INET6 \
&& IN6_ARE_ADDR_EQUAL(&((struct sockaddr_in6 *)ifma->ifma_addr)->sin6_addr, \
&(addr))) \
break; \
} \
(in6m) = (struct in6_multi *)(ifma ? ifma->ifma_protospec : 0); \
} while(0)
 
/*
* Macro to step through all of the in6_multi records, one at a time.
* The current position is remembered in "step", which the caller must
* provide. IN6_FIRST_MULTI(), below, must be called to initialize "step"
* and get the first record. Both macros return a NULL "in6m" when there
* are no remaining records.
*/
#define IN6_NEXT_MULTI(step, in6m) \
/* struct in6_multistep step; */ \
/* struct in6_multi *in6m; */ \
do { \
if (((in6m) = (step).i_in6m) != NULL) \
(step).i_in6m = (step).i_in6m->in6m_entry.le_next; \
} while(0)
 
#define IN6_FIRST_MULTI(step, in6m) \
/* struct in6_multistep step; */ \
/* struct in6_multi *in6m */ \
do { \
(step).i_in6m = in6_multihead.lh_first; \
IN6_NEXT_MULTI((step), (in6m)); \
} while(0)
 
struct in6_multi *in6_addmulti __P((struct in6_addr *, struct ifnet *,
int *));
void in6_delmulti __P((struct in6_multi *));
extern int in6_ifindex2scopeid __P((int));
extern int in6_mask2len __P((struct in6_addr *, u_char *));
extern void in6_len2mask __P((struct in6_addr *, int));
int in6_control __P((struct socket *,
u_long, caddr_t, struct ifnet *, struct thread *));
int in6_update_ifa __P((struct ifnet *, struct in6_aliasreq *,
struct in6_ifaddr *));
void in6_purgeaddr __P((struct ifaddr *));
int in6if_do_dad __P((struct ifnet *));
void in6_purgeif __P((struct ifnet *));
void in6_savemkludge __P((struct in6_ifaddr *));
void in6_setmaxmtu __P((void));
void in6_restoremkludge __P((struct in6_ifaddr *, struct ifnet *));
void in6_purgemkludge __P((struct ifnet *));
struct in6_ifaddr *in6ifa_ifpforlinklocal __P((struct ifnet *, int));
struct in6_ifaddr *in6ifa_ifpwithaddr __P((struct ifnet *,
struct in6_addr *));
char *ip6_sprintf __P((const struct in6_addr *));
int in6_addr2scopeid __P((struct ifnet *, struct in6_addr *));
int in6_matchlen __P((struct in6_addr *, struct in6_addr *));
int in6_are_prefix_equal __P((struct in6_addr *p1, struct in6_addr *p2,
int len));
void in6_prefixlen2mask __P((struct in6_addr *maskp, int len));
int in6_prefix_ioctl __P((struct socket *so, u_long cmd, caddr_t data,
struct ifnet *ifp));
int in6_prefix_add_ifid __P((int iilen, struct in6_ifaddr *ia));
void in6_prefix_remove_ifid __P((int iilen, struct in6_ifaddr *ia));
void in6_purgeprefix __P((struct ifnet *));
 
int in6_is_addr_deprecated __P((struct sockaddr_in6 *));
struct inpcb;
int in6_embedscope __P((struct in6_addr *, const struct sockaddr_in6 *,
struct inpcb *, struct ifnet **));
int in6_recoverscope __P((struct sockaddr_in6 *, const struct in6_addr *,
struct ifnet *));
void in6_clearscope __P((struct in6_addr *));
#endif /* _KERNEL */
 
#endif /* _NETINET6_IN6_VAR_H_ */
/pkgnet/trunk/watt32/inc/netinet6/ip6.h
0,0 → 1,8
/*!\file netinet6/ip6.h
* \note Obsolete. Use netinet/ip6.h.
*/
 
/* $FreeBSD: src/sys/netinet6/ip6.h,v 1.5 2000/07/04 16:35:09 itojun Exp $ */
/* $KAME: ip6.h,v 1.7 2000/03/25 07:23:36 sumikawa Exp $ */
 
#error "netinet6/ip6.h is obsolete. use netinet/ip6.h"
/pkgnet/trunk/watt32/inc/netinet6/ip6_ecn.h
0,0 → 1,45
/*!\file netinet6/ip6_ecn.h
*
*/
 
/* $FreeBSD: src/sys/netinet6/ip6_ecn.h,v 1.4 2001/06/11 12:39:05 ume Exp $ */
/* $KAME: ip_ecn.h,v 1.5 2000/03/27 04:58:38 sumikawa Exp $ */
 
/*
* Copyright (C) 1999 WIDE Project.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the project nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
*/
/*
* ECN consideration on tunnel ingress/egress operation.
* http://www.aciri.org/floyd/papers/draft-ipsec-ecn-00.txt
*/
 
#ifdef _KERNEL
extern void ip6_ecn_ingress __P((int, u_int32_t *, const u_int32_t *));
extern void ip6_ecn_egress __P((int, const u_int32_t *, u_int32_t *));
#endif
/pkgnet/trunk/watt32/inc/netinet6/ip6_fw.h
0,0 → 1,235
/*!\file netinet6/ip6_fw.h
*
*/
 
/* $FreeBSD: src/sys/netinet6/ip6_fw.h,v 1.12 2002/04/19 04:46:22 suz Exp $ */
/* $KAME: ip6_fw.h,v 1.9 2001/08/01 04:29:57 sumikawa Exp $ */
 
/*
* Copyright (C) 1998, 1999, 2000 and 2001 WIDE Project.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the project nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
 
/*
* Copyright (c) 1993 Daniel Boulet
* Copyright (c) 1994 Ugen J.S.Antsilevich
*
* Redistribution and use in source forms, with and without modification,
* are permitted provided that this entire comment appears intact.
*
* Redistribution in binary form may occur without any restrictions.
* Obviously, it would be nice if you gave credit where credit is due
* but requiring it would be too onerous.
*
* This software is provided ``AS IS'' without any warranties of any kind.
*
*/
 
#ifndef _IP6_FW_H
#define _IP6_FW_H
 
#include <net/if.h>
 
/*
* This union structure identifies an interface, either explicitly
* by name or implicitly by IP address. The flags IP_FW_F_IIFNAME
* and IP_FW_F_OIFNAME say how to interpret this structure. An
* interface unit number of -1 matches any unit number, while an
* IP address of 0.0.0.0 indicates matches any interface.
*
* The receive and transmit interfaces are only compared against the
* the packet if the corresponding bit (IP_FW_F_IIFACE or IP_FW_F_OIFACE)
* is set. Note some packets lack a receive or transmit interface
* (in which case the missing "interface" never matches).
*/
 
union ip6_fw_if {
struct in6_addr fu_via_ip6; /* Specified by IPv6 address */
struct { /* Specified by interface name */
#define IP6FW_IFNLEN IFNAMSIZ
char name[IP6FW_IFNLEN];
short unit; /* -1 means match any unit */
} fu_via_if;
};
 
/*
* Format of an IP firewall descriptor
*
* fw_src, fw_dst, fw_smsk, fw_dmsk are always stored in network byte order.
* fw_flg and fw_n*p are stored in host byte order (of course).
* Port numbers are stored in HOST byte order.
* Warning: setsockopt() will fail if sizeof(struct ip_fw) > MLEN (108)
*/
 
struct ip6_fw {
u_long fw_pcnt,fw_bcnt; /* Packet and byte counters */
struct in6_addr fw_src, fw_dst; /* Source and destination IPv6 addr */
struct in6_addr fw_smsk, fw_dmsk; /* Mask for src and dest IPv6 addr */
u_short fw_number; /* Rule number */
u_short fw_flg; /* Flags word */
#define IPV6_FW_MAX_PORTS 10 /* A reasonable maximum */
u_int fw_ipflg; /* IP flags word */
u_short fw_pts[IPV6_FW_MAX_PORTS]; /* Array of port numbers to match */
u_char fw_ip6opt,fw_ip6nopt; /* IPv6 options set/unset */
u_char fw_tcpf,fw_tcpnf; /* TCP flags set/unset */
#define IPV6_FW_ICMPTYPES_DIM (256 / (sizeof(unsigned) * 8))
unsigned fw_icmp6types[IPV6_FW_ICMPTYPES_DIM]; /* ICMP types bitmap */
long timestamp; /* timestamp (tv_sec) of last match */
union ip6_fw_if fw_in_if, fw_out_if;/* Incoming and outgoing interfaces */
union {
u_short fu_divert_port; /* Divert/tee port (options IP6DIVERT) */
u_short fu_skipto_rule; /* SKIPTO command rule number */
u_short fu_reject_code; /* REJECT response code */
} fw_un;
u_char fw_prot; /* IPv6 protocol */
u_char fw_nports; /* N'of src ports and # of dst ports */
/* in ports array (dst ports follow */
/* src ports; max of 10 ports in all; */
/* count of 0 means match all ports) */
};
 
#define IPV6_FW_GETNSRCP(rule) ((rule)->fw_nports & 0x0f)
#define IPV6_FW_SETNSRCP(rule, n) do { \
(rule)->fw_nports &= ~0x0f; \
(rule)->fw_nports |= (n); \
} while (0)
#define IPV6_FW_GETNDSTP(rule) ((rule)->fw_nports >> 4)
#define IPV6_FW_SETNDSTP(rule, n) do { \
(rule)->fw_nports &= ~0xf0; \
(rule)->fw_nports |= (n) << 4;\
} while (0)
 
#define fw_divert_port fw_un.fu_divert_port
#define fw_skipto_rule fw_un.fu_skipto_rule
#define fw_reject_code fw_un.fu_reject_code
 
struct ip6_fw_chain {
LIST_ENTRY(ip6_fw_chain) chain;
struct ip6_fw *rule;
};
 
/*
* Values for "flags" field .
*/
#define IPV6_FW_F_IN 0x0001 /* Check inbound packets */
#define IPV6_FW_F_OUT 0x0002 /* Check outbound packets */
#define IPV6_FW_F_IIFACE 0x0004 /* Apply inbound interface test */
#define IPV6_FW_F_OIFACE 0x0008 /* Apply outbound interface test */
 
#define IPV6_FW_F_COMMAND 0x0070 /* Mask for type of chain entry: */
#define IPV6_FW_F_DENY 0x0000 /* This is a deny rule */
#define IPV6_FW_F_REJECT 0x0010 /* Deny and send a response packet */
#define IPV6_FW_F_ACCEPT 0x0020 /* This is an accept rule */
#define IPV6_FW_F_COUNT 0x0030 /* This is a count rule */
#define IPV6_FW_F_DIVERT 0x0040 /* This is a divert rule */
#define IPV6_FW_F_TEE 0x0050 /* This is a tee rule */
#define IPV6_FW_F_SKIPTO 0x0060 /* This is a skipto rule */
 
#define IPV6_FW_F_PRN 0x0080 /* Print if this rule matches */
 
#define IPV6_FW_F_SRNG 0x0100 /* The first two src ports are a min *
* and max range (stored in host byte *
* order). */
 
#define IPV6_FW_F_DRNG 0x0200 /* The first two dst ports are a min *
* and max range (stored in host byte *
* order). */
 
#define IPV6_FW_F_IIFNAME 0x0400 /* In interface by name/unit (not IP) */
#define IPV6_FW_F_OIFNAME 0x0800 /* Out interface by name/unit (not IP) */
 
#define IPV6_FW_F_INVSRC 0x1000 /* Invert sense of src check */
#define IPV6_FW_F_INVDST 0x2000 /* Invert sense of dst check */
 
#define IPV6_FW_F_FRAG 0x4000 /* Fragment */
 
#define IPV6_FW_F_ICMPBIT 0x8000 /* ICMP type bitmap is valid */
 
#define IPV6_FW_F_MASK 0xFFFF /* All possible flag bits mask */
 
/*
* Flags for the 'fw_ipflg' field, for comparing values of ip and its protocols. */
#define IPV6_FW_IF_TCPEST 0x00000020 /* established TCP connection */
#define IPV6_FW_IF_TCPMSK 0x00000020 /* mask of all TCP values */
 
/*
* For backwards compatibility with rules specifying "via iface" but
* not restricted to only "in" or "out" packets, we define this combination
* of bits to represent this configuration.
*/
 
#define IF6_FW_F_VIAHACK (IPV6_FW_F_IN|IPV6_FW_F_OUT|IPV6_FW_F_IIFACE|IPV6_FW_F_OIFACE)
 
/*
* Definitions for REJECT response codes.
* Values less than 256 correspond to ICMP unreachable codes.
*/
#define IPV6_FW_REJECT_RST 0x0100 /* TCP packets: send RST */
 
/*
* Definitions for IPv6 option names.
*/
#define IPV6_FW_IP6OPT_HOPOPT 0x01
#define IPV6_FW_IP6OPT_ROUTE 0x02
#define IPV6_FW_IP6OPT_FRAG 0x04
#define IPV6_FW_IP6OPT_ESP 0x08
#define IPV6_FW_IP6OPT_AH 0x10
#define IPV6_FW_IP6OPT_NONXT 0x20
#define IPV6_FW_IP6OPT_OPTS 0x40
 
/*
* Definitions for TCP flags.
*/
#define IPV6_FW_TCPF_FIN TH_FIN
#define IPV6_FW_TCPF_SYN TH_SYN
#define IPV6_FW_TCPF_RST TH_RST
#define IPV6_FW_TCPF_PSH TH_PUSH
#define IPV6_FW_TCPF_ACK TH_ACK
#define IPV6_FW_TCPF_URG TH_URG
 
/*
* Main firewall chains definitions and global var's definitions.
*/
#ifdef _KERNEL
 
/*
* Function definitions.
*/
void ip6_fw_init(void);
 
/* Firewall hooks */
struct ip6_hdr;
typedef int ip6_fw_chk_t __P((struct ip6_hdr**, struct ifnet*,
u_short *, struct mbuf**));
typedef int ip6_fw_ctl_t __P((int, struct mbuf**));
extern ip6_fw_chk_t *ip6_fw_chk_ptr;
extern ip6_fw_ctl_t *ip6_fw_ctl_ptr;
extern int ip6_fw_enable;
 
#endif /* _KERNEL */
 
#endif /* _IP6_FW_H */
/pkgnet/trunk/watt32/inc/netinet6/ip6_mrou.h
0,0 → 1,281
/*!\file netinet6/ip6_mrou.h
*
*/
 
/* $FreeBSD: src/sys/netinet6/ip6_mroute.h,v 1.5 2002/04/19 04:46:23 suz Exp $ */
/* $KAME: ip6_mroute.h,v 1.19 2001/06/14 06:12:55 suz Exp $ */
 
/*
* Copyright (C) 1998 WIDE Project.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the project nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
 
/* BSDI ip_mroute.h,v 2.5 1996/10/11 16:01:48 pjd Exp */
 
/*
* Definitions for IP multicast forwarding.
*
* Written by David Waitzman, BBN Labs, August 1988.
* Modified by Steve Deering, Stanford, February 1989.
* Modified by Ajit Thyagarajan, PARC, August 1993.
* Modified by Ajit Thyagarajan, PARC, August 1994.
* Modified by Ahmed Helmy, USC, September 1996.
*
* MROUTING Revision: 1.2
*/
 
#ifndef _NETINET6_IP6_MROUTE_H_
#define _NETINET6_IP6_MROUTE_H_
 
/*
* Multicast Routing set/getsockopt commands.
*/
#ifdef _KERNEL
#define MRT6_OINIT 100 /* initialize forwarder (omrt6msg) */
#endif
#define MRT6_DONE 101 /* shut down forwarder */
#define MRT6_ADD_MIF 102 /* add multicast interface */
#define MRT6_DEL_MIF 103 /* delete multicast interface */
#define MRT6_ADD_MFC 104 /* insert forwarding cache entry */
#define MRT6_DEL_MFC 105 /* delete forwarding cache entry */
#define MRT6_PIM 107 /* enable pim code */
#define MRT6_INIT 108 /* initialize forwarder (mrt6msg) */
 
#if BSD >= 199103
#define GET_TIME(t) microtime(&t)
#elif defined(sun)
#define GET_TIME(t) uniqtime(&t)
#else
#define GET_TIME(t) ((t) = time)
#endif
 
/*
* Types and macros for handling bitmaps with one bit per multicast interface.
*/
typedef u_short mifi_t; /* type of a mif index */
#define MAXMIFS 64
 
#ifndef IF_SETSIZE
#define IF_SETSIZE 256
#endif
 
typedef u_int32_t if_mask;
#define NIFBITS (sizeof(if_mask) * NBBY) /* bits per mask */
 
#ifndef howmany
#define howmany(x, y) (((x) + ((y) - 1)) / (y))
#endif
 
typedef struct if_set {
if_mask ifs_bits[howmany(IF_SETSIZE, NIFBITS)];
} if_set;
 
#define IF_SET(n, p) ((p)->ifs_bits[(n)/NIFBITS] |= (1 << ((n) % NIFBITS)))
#define IF_CLR(n, p) ((p)->ifs_bits[(n)/NIFBITS] &= ~(1 << ((n) % NIFBITS)))
#define IF_ISSET(n, p) ((p)->ifs_bits[(n)/NIFBITS] & (1 << ((n) % NIFBITS)))
#define IF_COPY(f, t) bcopy(f, t, sizeof(*(f)))
#define IF_ZERO(p) bzero(p, sizeof(*(p)))
 
/*
* Argument structure for MRT6_ADD_IF.
*/
struct mif6ctl {
mifi_t mif6c_mifi; /* the index of the mif to be added */
u_char mif6c_flags; /* MIFF_ flags defined below */
u_short mif6c_pifi; /* the index of the physical IF */
#ifdef notyet
u_int mif6c_rate_limit; /* max rate */
#endif
};
 
#define MIFF_REGISTER 0x1 /* mif represents a register end-point */
 
/*
* Argument structure for MRT6_ADD_MFC and MRT6_DEL_MFC
*/
struct mf6cctl {
struct sockaddr_in6 mf6cc_origin; /* IPv6 origin of mcasts */
struct sockaddr_in6 mf6cc_mcastgrp; /* multicast group associated */
mifi_t mf6cc_parent; /* incoming ifindex */
struct if_set mf6cc_ifset; /* set of forwarding ifs */
};
 
/*
* The kernel's multicast routing statistics.
*/
struct mrt6stat {
u_quad_t mrt6s_mfc_lookups; /* # forw. cache hash table hits */
u_quad_t mrt6s_mfc_misses; /* # forw. cache hash table misses */
u_quad_t mrt6s_upcalls; /* # calls to mrouted */
u_quad_t mrt6s_no_route; /* no route for packet's origin */
u_quad_t mrt6s_bad_tunnel; /* malformed tunnel options */
u_quad_t mrt6s_cant_tunnel; /* no room for tunnel options */
u_quad_t mrt6s_wrong_if; /* arrived on wrong interface */
u_quad_t mrt6s_upq_ovflw; /* upcall Q overflow */
u_quad_t mrt6s_cache_cleanups; /* # entries with no upcalls */
u_quad_t mrt6s_drop_sel; /* pkts dropped selectively */
u_quad_t mrt6s_q_overflow; /* pkts dropped - Q overflow */
u_quad_t mrt6s_pkt2large; /* pkts dropped - size > BKT SIZE */
u_quad_t mrt6s_upq_sockfull; /* upcalls dropped - socket full */
};
 
#ifdef MRT6_OINIT
/*
* Struct used to communicate from kernel to multicast router
* note the convenient similarity to an IPv6 header.
* XXX old version, superseded by mrt6msg.
*/
struct omrt6msg {
u_long unused1;
u_char im6_msgtype; /* what type of message */
#if 0
#define MRT6MSG_NOCACHE 1
#define MRT6MSG_WRONGMIF 2
#define MRT6MSG_WHOLEPKT 3 /* used for user level encap*/
#endif
u_char im6_mbz; /* must be zero */
u_char im6_mif; /* mif rec'd on */
u_char unused2;
struct in6_addr im6_src, im6_dst;
};
#endif
 
/*
* Structure used to communicate from kernel to multicast router.
* We'll overlay the structure onto an MLD header (not an IPv6 header
* like igmpmsg{} used for IPv4 implementation). This is because this
* structure will be passed via an IPv6 raw socket, on which an application
* will only receive the payload i.e. the data after the IPv6 header and all
* the extension headers. (see Section 3 of draft-ietf-ipngwg-2292bis-01)
*/
struct mrt6msg {
#define MRT6MSG_NOCACHE 1
#define MRT6MSG_WRONGMIF 2
#define MRT6MSG_WHOLEPKT 3 /* used for user level encap*/
u_char im6_mbz; /* must be zero */
u_char im6_msgtype; /* what type of message */
u_int16_t im6_mif; /* mif rec'd on */
u_int32_t im6_pad; /* padding for 64bit arch */
struct in6_addr im6_src, im6_dst;
};
 
/*
* Argument structure used by multicast routing daemon to get src-grp
* packet counts
*/
struct sioc_sg_req6 {
struct sockaddr_in6 src;
struct sockaddr_in6 grp;
u_quad_t pktcnt;
u_quad_t bytecnt;
u_quad_t wrong_if;
};
 
/*
* Argument structure used by mrouted to get mif pkt counts
*/
struct sioc_mif_req6 {
mifi_t mifi; /* mif number */
u_quad_t icount; /* Input packet count on mif */
u_quad_t ocount; /* Output packet count on mif */
u_quad_t ibytes; /* Input byte count on mif */
u_quad_t obytes; /* Output byte count on mif */
};
 
#if defined(_KERNEL) || defined(KERNEL)
/*
* The kernel's multicast-interface structure.
*/
struct mif6 {
u_char m6_flags; /* MIFF_ flags defined above */
u_int m6_rate_limit; /* max rate */
#ifdef notyet
struct tbf *m6_tbf; /* token bucket structure at intf. */
#endif
struct in6_addr m6_lcl_addr; /* local interface address */
struct ifnet *m6_ifp; /* pointer to interface */
u_quad_t m6_pkt_in; /* # pkts in on interface */
u_quad_t m6_pkt_out; /* # pkts out on interface */
u_quad_t m6_bytes_in; /* # bytes in on interface */
u_quad_t m6_bytes_out; /* # bytes out on interface */
struct route_in6 m6_route;/* cached route if this is a tunnel */
#ifdef notyet
u_int m6_rsvp_on; /* RSVP listening on this vif */
struct socket *m6_rsvpd; /* RSVP daemon socket */
#endif
};
 
/*
* The kernel's multicast forwarding cache entry structure
*/
struct mf6c {
struct sockaddr_in6 mf6c_origin; /* IPv6 origin of mcasts */
struct sockaddr_in6 mf6c_mcastgrp; /* multicast group associated*/
mifi_t mf6c_parent; /* incoming IF */
struct if_set mf6c_ifset; /* set of outgoing IFs */
 
u_quad_t mf6c_pkt_cnt; /* pkt count for src-grp */
u_quad_t mf6c_byte_cnt; /* byte count for src-grp */
u_quad_t mf6c_wrong_if; /* wrong if for src-grp */
int mf6c_expire; /* time to clean entry up */
struct timeval mf6c_last_assert; /* last time I sent an assert*/
struct rtdetq *mf6c_stall; /* pkts waiting for route */
struct mf6c *mf6c_next; /* hash table linkage */
};
 
#define MF6C_INCOMPLETE_PARENT ((mifi_t)-1)
 
/*
* Argument structure used for pkt info. while upcall is made
*/
#ifndef _NETINET_IP_MROUTE_H_
struct rtdetq { /* XXX: rtdetq is also defined in ip_mroute.h */
struct mbuf *m; /* A copy of the packet */
struct ifnet *ifp; /* Interface pkt came in on */
#ifdef UPCALL_TIMING
struct timeval t; /* Timestamp */
#endif /* UPCALL_TIMING */
struct rtdetq *next;
};
#endif /* _NETINET_IP_MROUTE_H_ */
 
#define MF6CTBLSIZ 256
#if (MF6CTBLSIZ & (MF6CTBLSIZ - 1)) == 0 /* from sys:route.h */
#define MF6CHASHMOD(h) ((h) & (MF6CTBLSIZ - 1))
#else
#define MF6CHASHMOD(h) ((h) % MF6CTBLSIZ)
#endif
 
#define MAX_UPQ6 4 /* max. no of pkts in upcall Q */
 
int ip6_mrouter_set __P((struct socket *so, struct sockopt *sopt));
int ip6_mrouter_get __P((struct socket *so, struct sockopt *sopt));
int ip6_mrouter_done __P((void));
int mrt6_ioctl __P((int, caddr_t));
#endif /* _KERNEL */
 
#endif /* !_NETINET6_IP6_MROUTE_H_ */
/pkgnet/trunk/watt32/inc/netinet6/ip6_var.h
0,0 → 1,370
/*!\file netinet6/ip6_var.h
*
*/
 
/* $FreeBSD: src/sys/netinet6/ip6_var.h,v 1.9 2002/07/25 17:40:45 ume Exp $ */
/* $KAME: ip6_var.h,v 1.62 2001/05/03 14:51:48 itojun Exp $ */
 
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the project nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
 
/*
* Copyright (c) 1982, 1986, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)ip_var.h 8.1 (Berkeley) 6/10/93
*/
 
#ifndef _NETINET6_IP6_VAR_H_
#define _NETINET6_IP6_VAR_H_
 
#include <sys/queue.h>
 
#if !defined(__BORLANDC__) /* stop warnings for undefined structs */
/*
* IP6 reassembly queue structure. Each fragment
* being reassembled is attached to one of these structures.
*/
struct ip6q {
u_int32_t ip6q_head;
u_int16_t ip6q_len;
u_int8_t ip6q_nxt; /* ip6f_nxt in first fragment */
u_int8_t ip6q_hlim;
struct ip6asfrag *ip6q_down;
struct ip6asfrag *ip6q_up;
u_int32_t ip6q_ident;
u_int8_t ip6q_arrive;
u_int8_t ip6q_ttl;
struct in6_addr ip6q_src, ip6q_dst;
struct ip6q *ip6q_next;
struct ip6q *ip6q_prev;
int ip6q_unfrglen; /* len of unfragmentable part */
#ifdef notyet
u_char *ip6q_nxtp;
#endif
};
 
struct ip6asfrag {
u_int32_t ip6af_head;
u_int16_t ip6af_len;
u_int8_t ip6af_nxt;
u_int8_t ip6af_hlim;
/* must not override the above members during reassembling */
struct ip6asfrag *ip6af_down;
struct ip6asfrag *ip6af_up;
struct mbuf *ip6af_m;
int ip6af_offset; /* offset in ip6af_m to next header */
int ip6af_frglen; /* fragmentable part length */
int ip6af_off; /* fragment offset */
u_int16_t ip6af_mff; /* more fragment bit in frag off */
};
 
#define IP6_REASS_MBUF(ip6af) (*(struct mbuf **)&((ip6af)->ip6af_m))
 
struct ip6_moptions {
struct ifnet *im6o_multicast_ifp; /* ifp for outgoing multicasts */
u_char im6o_multicast_hlim; /* hoplimit for outgoing multicasts */
u_char im6o_multicast_loop; /* 1 >= hear sends if a member */
LIST_HEAD(dummy, in6_multi_mship) im6o_memberships;
};
#endif /* __BORLANDC__ */
 
#ifndef _NETINET6_IN6_H_
struct route_in6 {
struct rtentry *ro_rt;
struct sockaddr_in6 ro_dst;
};
#endif
 
/*
* Control options for outgoing packets
*/
 
/* Routing header related info */
#if !defined(__BORLANDC__)
struct ip6po_rhinfo {
struct ip6_rthdr *ip6po_rhi_rthdr; /* Routing header */
struct route_in6 ip6po_rhi_route; /* Route to the 1st hop */
};
#define ip6po_rthdr ip6po_rhinfo.ip6po_rhi_rthdr
#define ip6po_route ip6po_rhinfo.ip6po_rhi_route
 
struct ip6_pktopts {
struct mbuf *ip6po_m; /* Pointer to mbuf storing the data */
int ip6po_hlim; /* Hoplimit for outgoing packets */
 
/* Outgoing IF/address information */
struct in6_pktinfo *ip6po_pktinfo;
 
struct sockaddr *ip6po_nexthop; /* Next-hop address */
struct ip6_hbh *ip6po_hbh; /* Hop-by-Hop options header */
 
/* Destination options header (before a routing header) */
struct ip6_dest *ip6po_dest1;
 
/* Routing header related info. */
struct ip6po_rhinfo ip6po_rhinfo;
 
/* Destination options header (after a routing header) */
struct ip6_dest *ip6po_dest2;
};
#endif /* __BORLANDC__ */
 
/*
* Control options for incoming packets
*/
 
struct ip6stat {
u_quad_t ip6s_total; /* total packets received */
u_quad_t ip6s_tooshort; /* packet too short */
u_quad_t ip6s_toosmall; /* not enough data */
u_quad_t ip6s_fragments; /* fragments received */
u_quad_t ip6s_fragdropped; /* frags dropped(dups, out of space) */
u_quad_t ip6s_fragtimeout; /* fragments timed out */
u_quad_t ip6s_fragoverflow; /* fragments that exceeded limit */
u_quad_t ip6s_forward; /* packets forwarded */
u_quad_t ip6s_cantforward; /* packets rcvd for unreachable dest */
u_quad_t ip6s_redirectsent; /* packets forwarded on same net */
u_quad_t ip6s_delivered; /* datagrams delivered to upper level*/
u_quad_t ip6s_localout; /* total ip packets generated here */
u_quad_t ip6s_odropped; /* lost packets due to nobufs, etc. */
u_quad_t ip6s_reassembled; /* total packets reassembled ok */
u_quad_t ip6s_fragmented; /* datagrams sucessfully fragmented */
u_quad_t ip6s_ofragments; /* output fragments created */
u_quad_t ip6s_cantfrag; /* don't fragment flag was set, etc. */
u_quad_t ip6s_badoptions; /* error in option processing */
u_quad_t ip6s_noroute; /* packets discarded due to no route */
u_quad_t ip6s_badvers; /* ip6 version != 6 */
u_quad_t ip6s_rawout; /* total raw ip packets generated */
u_quad_t ip6s_badscope; /* scope error */
u_quad_t ip6s_notmember; /* don't join this multicast group */
u_quad_t ip6s_nxthist[256]; /* next header history */
u_quad_t ip6s_m1; /* one mbuf */
u_quad_t ip6s_m2m[32]; /* two or more mbuf */
u_quad_t ip6s_mext1; /* one ext mbuf */
u_quad_t ip6s_mext2m; /* two or more ext mbuf */
u_quad_t ip6s_exthdrtoolong; /* ext hdr are not continuous */
u_quad_t ip6s_nogif; /* no match gif found */
u_quad_t ip6s_toomanyhdr; /* discarded due to too many headers */
 
/*
* statistics for improvement of the source address selection
* algorithm:
* XXX: hardcoded 16 = # of ip6 multicast scope types + 1
*/
/* number of times that address selection fails */
u_quad_t ip6s_sources_none;
/* number of times that an address on the outgoing I/F is chosen */
u_quad_t ip6s_sources_sameif[16];
/* number of times that an address on a non-outgoing I/F is chosen */
u_quad_t ip6s_sources_otherif[16];
/*
* number of times that an address that has the same scope
* from the destination is chosen.
*/
u_quad_t ip6s_sources_samescope[16];
/*
* number of times that an address that has a different scope
* from the destination is chosen.
*/
u_quad_t ip6s_sources_otherscope[16];
/* number of times that an deprecated address is chosen */
u_quad_t ip6s_sources_deprecated[16];
 
u_quad_t ip6s_forward_cachehit;
u_quad_t ip6s_forward_cachemiss;
};
 
#ifdef _KERNEL
/*
* IPv6 onion peeling state.
* it will be initialized when we come into ip6_input().
* XXX do not make it a kitchen sink!
*/
struct ip6aux {
u_int32_t ip6a_flags;
#define IP6A_SWAP 0x01 /* swapped home/care-of on packet */
#define IP6A_HASEEN 0x02 /* HA was present */
#define IP6A_BRUID 0x04 /* BR Unique Identifier was present */
#define IP6A_RTALERTSEEN 0x08 /* rtalert present */
 
/* ip6.ip6_src */
struct in6_addr ip6a_careof; /* care-of address of the peer */
struct in6_addr ip6a_home; /* home address of the peer */
u_int16_t ip6a_bruid; /* BR unique identifier */
 
/* ip6.ip6_dst */
struct in6_ifaddr *ip6a_dstia6; /* my ifaddr that matches ip6_dst */
 
/* rtalert */
u_int16_t ip6a_rtalert; /* rtalert option value */
 
/*
* decapsulation history will be here.
* with IPsec it may not be accurate.
*/
};
#endif
 
#ifdef _KERNEL
/* flags passed to ip6_output as last parameter */
#define IPV6_DADOUTPUT 0x01 /* DAD */
#define IPV6_FORWARDING 0x02 /* most of IPv6 header exists */
#define IPV6_MINMTU 0x04 /* use minimum MTU (IPV6_USE_MIN_MTU) */
 
extern struct ip6stat ip6stat; /* statistics */
extern u_int32_t ip6_id; /* fragment identifier */
extern int ip6_defhlim; /* default hop limit */
extern int ip6_defmcasthlim; /* default multicast hop limit */
extern int ip6_forwarding; /* act as router? */
extern int ip6_forward_srcrt; /* forward src-routed? */
extern int ip6_gif_hlim; /* Hop limit for gif encap packet */
extern int ip6_use_deprecated; /* allow deprecated addr as source */
extern int ip6_rr_prune; /* router renumbering prefix
* walk list every 5 sec. */
extern int ip6_v6only;
 
extern struct socket *ip6_mrouter; /* multicast routing daemon */
extern int ip6_sendredirects; /* send IP redirects when forwarding? */
extern int ip6_maxfragpackets; /* Maximum packets in reassembly queue */
extern int ip6_sourcecheck; /* Verify source interface */
extern int ip6_sourcecheck_interval; /* Interval between log messages */
extern int ip6_accept_rtadv; /* Acts as a host not a router */
extern int ip6_keepfaith; /* Firewall Aided Internet Translator */
extern int ip6_log_interval;
extern time_t ip6_log_time;
extern int ip6_hdrnestlimit; /* upper limit of # of extension headers */
extern int ip6_dad_count; /* DupAddrDetectionTransmits */
 
extern u_int32_t ip6_flow_seq;
extern int ip6_auto_flowlabel;
extern int ip6_auto_linklocal;
 
extern int ip6_anonportmin; /* minimum ephemeral port */
extern int ip6_anonportmax; /* maximum ephemeral port */
extern int ip6_lowportmin; /* minimum reserved port */
extern int ip6_lowportmax; /* maximum reserved port */
 
extern int ip6_use_tempaddr; /* whether to use temporary addresses. */
 
extern struct pr_usrreqs rip6_usrreqs;
struct sockopt;
 
struct inpcb;
 
int icmp6_ctloutput __P((struct socket *, struct sockopt *sopt));
 
struct in6_ifaddr;
void ip6_init __P((void));
void ip6intr __P((void));
void ip6_input __P((struct mbuf *));
struct in6_ifaddr *ip6_getdstifaddr __P((struct mbuf *));
void ip6_freepcbopts __P((struct ip6_pktopts *));
void ip6_freemoptions __P((struct ip6_moptions *));
int ip6_unknown_opt __P((u_int8_t *, struct mbuf *, int));
char * ip6_get_prevhdr __P((struct mbuf *, int));
int ip6_nexthdr __P((struct mbuf *, int, int, int *));
int ip6_lasthdr __P((struct mbuf *, int, int, int *));
 
struct mbuf *ip6_addaux __P((struct mbuf *));
struct mbuf *ip6_findaux __P((struct mbuf *));
void ip6_delaux __P((struct mbuf *));
 
int ip6_mforward __P((struct ip6_hdr *, struct ifnet *, struct mbuf *));
int ip6_process_hopopts __P((struct mbuf *, u_int8_t *, int, u_int32_t *,
u_int32_t *));
void ip6_savecontrol __P((struct inpcb *, struct mbuf **, struct ip6_hdr *,
struct mbuf *));
void ip6_notify_pmtu __P((struct inpcb *, struct sockaddr_in6 *,
u_int32_t *));
int ip6_sysctl __P((int *, u_int, void *, size_t *, void *, size_t));
 
void ip6_forward __P((struct mbuf *, int));
 
void ip6_mloopback __P((struct ifnet *, struct mbuf *, struct sockaddr_in6 *));
int ip6_output __P((struct mbuf *, struct ip6_pktopts *,
struct route_in6 *,
int,
struct ip6_moptions *, struct ifnet **));
int ip6_ctloutput __P((struct socket *, struct sockopt *sopt));
void init_ip6pktopts __P((struct ip6_pktopts *));
int ip6_setpktoptions __P((struct mbuf *, struct ip6_pktopts *, int, int));
void ip6_clearpktopts __P((struct ip6_pktopts *, int, int));
struct ip6_pktopts *ip6_copypktopts __P((struct ip6_pktopts *, int));
int ip6_optlen __P((struct inpcb *));
 
int route6_input __P((struct mbuf **, int *, int));
 
void frag6_init __P((void));
int frag6_input __P((struct mbuf **, int *, int));
void frag6_slowtimo __P((void));
void frag6_drain __P((void));
 
void rip6_init __P((void));
int rip6_input __P((struct mbuf **mp, int *offp, int proto));
void rip6_ctlinput __P((int, struct sockaddr *, void *));
int rip6_ctloutput __P((struct socket *so, struct sockopt *sopt));
int rip6_output __P((struct mbuf *, ...));
int rip6_usrreq __P((struct socket *,
int, struct mbuf *, struct mbuf *, struct mbuf *, struct thread *));
 
int dest6_input __P((struct mbuf **, int *, int));
int none_input __P((struct mbuf **, int *, int));
#endif /* _KERNEL */
 
#endif /* !_NETINET6_IP6_VAR_H_ */
/pkgnet/trunk/watt32/inc/netinet6/ip6proto.h
0,0 → 1,167
/*!\file netinet6/ip6proto.h
*
*/
 
/* $FreeBSD: src/sys/netinet6/ip6protosw.h,v 1.9 2002/04/19 04:46:23 suz Exp $ */
/* $KAME: ip6protosw.h,v 1.25 2001/09/26 06:13:03 keiichi Exp $ */
 
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the project nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
*/
 
/* BSDI protosw.h,v 2.3 1996/10/11 16:02:40 pjd Exp */
 
/*-
* Copyright (c) 1982, 1986, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)protosw.h 8.1 (Berkeley) 6/2/93
*/
 
#ifndef _NETINET6_IP6PROTOSW_H_
#define _NETINET6_IP6PROTOSW_H_
 
/*
* For pfil_head structure.
*/
#include <net/pfil.h>
 
/*
* Protocol switch table for IPv6.
* All other definitions should refer to sys/protosw.h
*/
 
struct mbuf;
struct sockaddr;
struct socket;
struct domain;
struct thread;
struct ip6_hdr;
struct icmp6_hdr;
struct in6_addr;
struct pr_usrreqs;
 
/*
* argument type for the last arg of pr_ctlinput().
* should be consulted only with AF_INET6 family.
*
* IPv6 ICMP IPv6 [exthdrs] finalhdr paylaod
* ^ ^ ^ ^
* | | ip6c_ip6 ip6c_off
* | ip6c_icmp6
* ip6c_m
*
* ip6c_finaldst usually points to ip6c_ip6->ip6_dst. if the original
* (internal) packet carries a routing header, it may point the final
* dstination address in the routing header.
*
* ip6c_src: ip6c_ip6->ip6_src + scope info + flowlabel in ip6c_ip6
* (beware of flowlabel, if you try to compare it against others)
* ip6c_dst: ip6c_finaldst + scope info
*/
struct ip6ctlparam {
struct mbuf *ip6c_m; /* start of mbuf chain */
struct icmp6_hdr *ip6c_icmp6; /* icmp6 header of target packet */
struct ip6_hdr *ip6c_ip6; /* ip6 header of target packet */
int ip6c_off; /* offset of the target proto header */
struct sockaddr_in6 *ip6c_src; /* srcaddr w/ additional info */
struct sockaddr_in6 *ip6c_dst; /* (final) dstaddr w/ additional info */
struct in6_addr *ip6c_finaldst; /* final destination address */
void *ip6c_cmdarg; /* control command dependent data */
u_int8_t ip6c_nxt; /* final next header field */
};
 
struct ip6protosw {
short pr_type; /* socket type used for */
struct domain *pr_domain; /* domain protocol a member of */
short pr_protocol; /* protocol number */
short pr_flags; /* see below */
 
/* protocol-protocol hooks */
int (*pr_input) /* input to protocol (from below) */
__P((struct mbuf **, int *, int));
int (*pr_output) /* output to protocol (from above) */
__P((struct mbuf *, ...));
void (*pr_ctlinput) /* control input (from below) */
__P((int, struct sockaddr *, void *));
int (*pr_ctloutput) /* control output (from above) */
__P((struct socket *, struct sockopt *));
 
/* user-protocol hook */
int (*pr_usrreq) /* user request: see list below */
__P((struct socket *, int, struct mbuf *,
struct mbuf *, struct mbuf *, struct thread *));
 
/* utility hooks */
void (*pr_init) /* initialization hook */
__P((void));
 
void (*pr_fasttimo) /* fast timeout (200ms) */
__P((void));
void (*pr_slowtimo) /* slow timeout (500ms) */
__P((void));
void (*pr_drain) /* flush any excess space possible */
__P((void));
struct pr_usrreqs *pr_usrreqs; /* supersedes pr_usrreq() */
struct pfil_head pr_pfh;
};
 
#ifdef _KERNEL
extern struct ip6protosw inet6sw[];
#endif
 
#endif /* !_NETINET6_IP6PROTOSW_H_ */
/pkgnet/trunk/watt32/inc/netinet6/ipcomp.h
0,0 → 1,75
/*!\file netinet6/ipcomp.h
*
*/
 
/* $FreeBSD: src/sys/netinet6/ipcomp.h,v 1.4 2002/04/19 04:46:23 suz Exp $ */
/* $KAME: ipcomp.h,v 1.11 2001/09/04 08:43:19 itojun Exp $ */
 
/*
* Copyright (C) 1999 WIDE Project.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the project nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
 
/*
* RFC2393 IP payload compression protocol (IPComp).
*/
 
#ifndef _NETINET6_IPCOMP_H_
#define _NETINET6_IPCOMP_H_
 
#if defined(_KERNEL) && !defined(_LKM)
#include "opt_inet.h"
#endif
 
struct ipcomp {
u_int8_t comp_nxt; /* Next Header */
u_int8_t comp_flags; /* reserved, must be zero */
u_int16_t comp_cpi; /* Compression parameter index */
};
 
/* well-known algorithm number (in CPI), from RFC2409 */
#define IPCOMP_OUI 1 /* vendor specific */
#define IPCOMP_DEFLATE 2 /* RFC2394 */
#define IPCOMP_LZS 3 /* RFC2395 */
#define IPCOMP_MAX 4
 
#define IPCOMP_CPI_NEGOTIATE_MIN 256
 
#ifdef _KERNEL
struct ipcomp_algorithm {
int (*compress) __P((struct mbuf *, struct mbuf *, size_t *));
int (*decompress) __P((struct mbuf *, struct mbuf *, size_t *));
size_t minplen; /* minimum required length for compression */
};
 
struct ipsecrequest;
extern const struct ipcomp_algorithm *ipcomp_algorithm_lookup __P((int));
extern void ipcomp4_input __P((struct mbuf *, int));
extern int ipcomp4_output __P((struct mbuf *, struct ipsecrequest *));
#endif /* KERNEL */
 
#endif /* _NETINET6_IPCOMP_H_ */
/pkgnet/trunk/watt32/inc/netinet6/ipcomp6.h
0,0 → 1,50
/*!\file netinet6/ipcomp6.h
*
*/
 
/* $FreeBSD: src/sys/netinet6/ipcomp6.h,v 1.2 2001/06/11 12:39:06 ume Exp $ */
/* $KAME: ipcomp.h,v 1.8 2000/09/26 07:55:14 itojun Exp $ */
 
/*
* Copyright (C) 1999 WIDE Project.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the project nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
 
/*
* RFC2393 IP payload compression protocol (IPComp).
*/
 
#ifndef _NETINET6_IPCOMP6_H_
#define _NETINET6_IPCOMP6_H_
 
#ifdef _KERNEL
extern int ipcomp6_input __P((struct mbuf **, int *, int));
extern int ipcomp6_output __P((struct mbuf *, u_char *, struct mbuf *,
struct ipsecrequest *));
#endif /*KERNEL*/
 
#endif /*_NETINET6_IPCOMP6_H_*/
/pkgnet/trunk/watt32/inc/netinet6/ipsec.h
0,0 → 1,358
/*!\file netinet6/ipsec.h
*
*/
 
/* $FreeBSD: src/sys/netinet6/ipsec.h,v 1.9 2002/04/19 04:46:23 suz Exp $ */
/* $KAME: ipsec.h,v 1.53 2001/11/20 08:32:38 itojun Exp $ */
 
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the project nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
 
/*
* IPsec controller part.
*/
 
#ifndef _NETINET6_IPSEC_H_
#define _NETINET6_IPSEC_H_
 
#if defined(_KERNEL) && !defined(_LKM) && !defined(KLD_MODULE)
#include "opt_inet.h"
#include "opt_ipsec.h"
#endif
 
#include <net/pfkeyv2.h>
#include <netkey/keydb.h>
 
#ifdef _KERNEL
 
/*
* Security Policy Index
* Ensure that both address families in the "src" and "dst" are same.
* When the value of the ul_proto is ICMPv6, the port field in "src"
* specifies ICMPv6 type, and the port field in "dst" specifies ICMPv6 code.
*/
struct secpolicyindex {
u_int8_t dir; /* direction of packet flow, see blow */
struct sockaddr_storage src; /* IP src address for SP */
struct sockaddr_storage dst; /* IP dst address for SP */
u_int8_t prefs; /* prefix length in bits for src */
u_int8_t prefd; /* prefix length in bits for dst */
u_int16_t ul_proto; /* upper layer Protocol */
#ifdef notyet
uid_t uids;
uid_t uidd;
gid_t gids;
gid_t gidd;
#endif
};
 
/* Security Policy Data Base */
struct secpolicy {
LIST_ENTRY(secpolicy) chain;
 
int refcnt; /* reference count */
struct secpolicyindex spidx; /* selector */
u_int32_t id; /* It's unique number on the system. */
u_int state; /* 0: dead, others: alive */
#define IPSEC_SPSTATE_DEAD 0
#define IPSEC_SPSTATE_ALIVE 1
 
u_int policy; /* DISCARD, NONE or IPSEC, see keyv2.h */
struct ipsecrequest *req;
/* pointer to the ipsec request tree, */
/* if policy == IPSEC else this value == NULL.*/
 
/*
* lifetime handler.
* the policy can be used without limitiation if both lifetime and
* validtime are zero.
* "lifetime" is passed by sadb_lifetime.sadb_lifetime_addtime.
* "validtime" is passed by sadb_lifetime.sadb_lifetime_usetime.
*/
long created; /* time created the policy */
long lastused; /* updated every when kernel sends a packet */
long lifetime; /* duration of the lifetime of this policy */
long validtime; /* duration this policy is valid without use */
};
 
/* Request for IPsec */
struct ipsecrequest {
struct ipsecrequest *next;
/* pointer to next structure */
/* If NULL, it means the end of chain. */
struct secasindex saidx;/* hint for search proper SA */
/* if __ss_len == 0 then no address specified.*/
u_int level; /* IPsec level defined below. */
 
struct secasvar *sav; /* place holder of SA for use */
struct secpolicy *sp; /* back pointer to SP */
};
 
/* security policy in PCB */
struct inpcbpolicy {
struct secpolicy *sp_in;
struct secpolicy *sp_out;
int priv; /* privileged socket ? */
};
 
/* SP acquiring list table. */
struct secspacq {
LIST_ENTRY(secspacq) chain;
 
struct secpolicyindex spidx;
 
long created; /* for lifetime */
int count; /* for lifetime */
/* XXX: here is mbuf place holder to be sent ? */
};
#endif /* _KERNEL */
 
/* according to IANA assignment, port 0x0000 and proto 0xff are reserved. */
#define IPSEC_PORT_ANY 0
#define IPSEC_ULPROTO_ANY 255
#define IPSEC_PROTO_ANY 255
 
/* mode of security protocol */
/* NOTE: DON'T use IPSEC_MODE_ANY at SPD. It's only use in SAD */
#define IPSEC_MODE_ANY 0 /* i.e. wildcard. */
#define IPSEC_MODE_TRANSPORT 1
#define IPSEC_MODE_TUNNEL 2
 
/*
* Direction of security policy.
* NOTE: Since INVALID is used just as flag.
* The other are used for loop counter too.
*/
#define IPSEC_DIR_ANY 0
#define IPSEC_DIR_INBOUND 1
#define IPSEC_DIR_OUTBOUND 2
#define IPSEC_DIR_MAX 3
#define IPSEC_DIR_INVALID 4
 
/* Policy level */
/*
* IPSEC, ENTRUST and BYPASS are allowed for setsockopt() in PCB,
* DISCARD, IPSEC and NONE are allowed for setkey() in SPD.
* DISCARD and NONE are allowed for system default.
*/
#define IPSEC_POLICY_DISCARD 0 /* discarding packet */
#define IPSEC_POLICY_NONE 1 /* through IPsec engine */
#define IPSEC_POLICY_IPSEC 2 /* do IPsec */
#define IPSEC_POLICY_ENTRUST 3 /* consulting SPD if present. */
#define IPSEC_POLICY_BYPASS 4 /* only for privileged socket. */
 
/* Security protocol level */
#define IPSEC_LEVEL_DEFAULT 0 /* reference to system default */
#define IPSEC_LEVEL_USE 1 /* use SA if present. */
#define IPSEC_LEVEL_REQUIRE 2 /* require SA. */
#define IPSEC_LEVEL_UNIQUE 3 /* unique SA. */
 
#define IPSEC_MANUAL_REQID_MAX 0x3fff
/*
* if security policy level == unique, this id
* indicate to a relative SA for use, else is
* zero.
* 1 - 0x3fff are reserved for manual keying.
* 0 are reserved for above reason. Others is
* for kernel use.
* Note that this id doesn't identify SA
* by only itself.
*/
#define IPSEC_REPLAYWSIZE 32
 
/* statistics for ipsec processing */
struct ipsecstat {
u_quad_t in_success; /* succeeded inbound process */
u_quad_t in_polvio;
/* security policy violation for inbound process */
u_quad_t in_nosa; /* inbound SA is unavailable */
u_quad_t in_inval; /* inbound processing failed due to EINVAL */
u_quad_t in_nomem; /* inbound processing failed due to ENOBUFS */
u_quad_t in_badspi; /* failed getting a SPI */
u_quad_t in_ahreplay; /* AH replay check failed */
u_quad_t in_espreplay; /* ESP replay check failed */
u_quad_t in_ahauthsucc; /* AH authentication success */
u_quad_t in_ahauthfail; /* AH authentication failure */
u_quad_t in_espauthsucc; /* ESP authentication success */
u_quad_t in_espauthfail; /* ESP authentication failure */
u_quad_t in_esphist[256];
u_quad_t in_ahhist[256];
u_quad_t in_comphist[256];
u_quad_t out_success; /* succeeded outbound process */
u_quad_t out_polvio;
/* security policy violation for outbound process */
u_quad_t out_nosa; /* outbound SA is unavailable */
u_quad_t out_inval; /* outbound process failed due to EINVAL */
u_quad_t out_nomem; /* inbound processing failed due to ENOBUFS */
u_quad_t out_noroute; /* there is no route */
u_quad_t out_esphist[256];
u_quad_t out_ahhist[256];
u_quad_t out_comphist[256];
};
 
/*
* Definitions for IPsec & Key sysctl operations.
*/
/*
* Names for IPsec & Key sysctl objects
*/
#define IPSECCTL_STATS 1 /* stats */
#define IPSECCTL_DEF_POLICY 2
#define IPSECCTL_DEF_ESP_TRANSLEV 3 /* int; ESP transport mode */
#define IPSECCTL_DEF_ESP_NETLEV 4 /* int; ESP tunnel mode */
#define IPSECCTL_DEF_AH_TRANSLEV 5 /* int; AH transport mode */
#define IPSECCTL_DEF_AH_NETLEV 6 /* int; AH tunnel mode */
#if 0 /* obsolete, do not reuse */
#define IPSECCTL_INBOUND_CALL_IKE 7
#endif
#define IPSECCTL_AH_CLEARTOS 8
#define IPSECCTL_AH_OFFSETMASK 9
#define IPSECCTL_DFBIT 10
#define IPSECCTL_ECN 11
#define IPSECCTL_DEBUG 12
#define IPSECCTL_ESP_RANDPAD 13
#define IPSECCTL_MAXID 14
 
#define IPSECCTL_NAMES { \
{ 0, 0 }, \
{ 0, 0 }, \
{ "def_policy", CTLTYPE_INT }, \
{ "esp_trans_deflev", CTLTYPE_INT }, \
{ "esp_net_deflev", CTLTYPE_INT }, \
{ "ah_trans_deflev", CTLTYPE_INT }, \
{ "ah_net_deflev", CTLTYPE_INT }, \
{ 0, 0 }, \
{ "ah_cleartos", CTLTYPE_INT }, \
{ "ah_offsetmask", CTLTYPE_INT }, \
{ "dfbit", CTLTYPE_INT }, \
{ "ecn", CTLTYPE_INT }, \
{ "debug", CTLTYPE_INT }, \
{ "esp_randpad", CTLTYPE_INT }, \
}
 
#define IPSEC6CTL_NAMES { \
{ 0, 0 }, \
{ 0, 0 }, \
{ "def_policy", CTLTYPE_INT }, \
{ "esp_trans_deflev", CTLTYPE_INT }, \
{ "esp_net_deflev", CTLTYPE_INT }, \
{ "ah_trans_deflev", CTLTYPE_INT }, \
{ "ah_net_deflev", CTLTYPE_INT }, \
{ 0, 0 }, \
{ 0, 0 }, \
{ 0, 0 }, \
{ 0, 0 }, \
{ "ecn", CTLTYPE_INT }, \
{ "debug", CTLTYPE_INT }, \
{ "esp_randpad", CTLTYPE_INT }, \
}
 
#ifdef _KERNEL
struct ipsec_output_state {
struct mbuf *m;
struct route *ro;
struct sockaddr *dst;
};
 
struct ipsec_history {
int ih_proto;
u_int32_t ih_spi;
};
 
extern int ipsec_debug;
 
extern struct ipsecstat ipsecstat;
extern struct secpolicy ip4_def_policy;
extern int ip4_esp_trans_deflev;
extern int ip4_esp_net_deflev;
extern int ip4_ah_trans_deflev;
extern int ip4_ah_net_deflev;
extern int ip4_ah_cleartos;
extern int ip4_ah_offsetmask;
extern int ip4_ipsec_dfbit;
extern int ip4_ipsec_ecn;
extern int ip4_esp_randpad;
 
#define ipseclog(x) do { if (ipsec_debug) log x; } while (0)
 
extern struct secpolicy *ipsec4_getpolicybysock
__P((struct mbuf *, u_int, struct socket *, int *));
extern struct secpolicy *ipsec4_getpolicybyaddr
__P((struct mbuf *, u_int, int, int *));
 
struct inpcb;
extern int ipsec_init_policy __P((struct socket *so, struct inpcbpolicy **));
extern int ipsec_copy_policy
__P((struct inpcbpolicy *, struct inpcbpolicy *));
extern u_int ipsec_get_reqlevel __P((struct ipsecrequest *));
 
extern int ipsec4_set_policy __P((struct inpcb *inp, int optname,
caddr_t request, size_t len, int priv));
extern int ipsec4_get_policy __P((struct inpcb *inpcb, caddr_t request,
size_t len, struct mbuf **mp));
extern int ipsec4_delete_pcbpolicy __P((struct inpcb *));
extern int ipsec4_in_reject_so __P((struct mbuf *, struct socket *));
extern int ipsec4_in_reject __P((struct mbuf *, struct inpcb *));
 
struct secas;
struct tcpcb;
extern int ipsec_chkreplay __P((u_int32_t, struct secasvar *));
extern int ipsec_updatereplay __P((u_int32_t, struct secasvar *));
 
extern size_t ipsec4_hdrsiz __P((struct mbuf *, u_int, struct inpcb *));
extern size_t ipsec_hdrsiz_tcp __P((struct tcpcb *));
 
struct ip;
extern const char *ipsec4_logpacketstr __P((struct ip *, u_int32_t));
extern const char *ipsec_logsastr __P((struct secasvar *));
 
extern void ipsec_dumpmbuf __P((struct mbuf *));
 
extern int ipsec4_output __P((struct ipsec_output_state *, struct secpolicy *,
int));
extern int ipsec4_tunnel_validate __P((struct mbuf *, int, u_int,
struct secasvar *));
extern struct mbuf *ipsec_copypkt __P((struct mbuf *));
extern void ipsec_delaux __P((struct mbuf *));
extern int ipsec_setsocket __P((struct mbuf *, struct socket *));
extern struct socket *ipsec_getsocket __P((struct mbuf *));
extern int ipsec_addhist __P((struct mbuf *, int, u_int32_t));
extern struct ipsec_history *ipsec_gethist __P((struct mbuf *, int *));
extern void ipsec_clearhist __P((struct mbuf *));
#endif /* _KERNEL */
 
#ifndef _KERNEL
extern caddr_t ipsec_set_policy __P((char *, int));
extern int ipsec_get_policylen __P((caddr_t));
extern char *ipsec_dump_policy __P((caddr_t, char *));
 
extern const char *ipsec_strerror __P((void));
#endif /* !_KERNEL */
 
#endif /* _NETINET6_IPSEC_H_ */
/pkgnet/trunk/watt32/inc/netinet6/ipsec6.h
0,0 → 1,87
/*!\file netinet6/ipsec6.h
*
*/
 
/* $FreeBSD: src/sys/netinet6/ipsec6.h,v 1.5 2001/06/11 12:39:06 ume Exp $ */
/* $KAME: ipsec.h,v 1.44 2001/03/23 08:08:47 itojun Exp $ */
 
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the project nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
 
/*
* IPsec controller part.
*/
 
#ifndef _NETINET6_IPSEC6_H_
#define _NETINET6_IPSEC6_H_
 
#include <net/pfkeyv2.h>
#include <netkey/keydb.h>
 
#ifdef _KERNEL
extern struct ipsecstat ipsec6stat;
extern struct secpolicy ip6_def_policy;
extern int ip6_esp_trans_deflev;
extern int ip6_esp_net_deflev;
extern int ip6_ah_trans_deflev;
extern int ip6_ah_net_deflev;
extern int ip6_ipsec_ecn;
extern int ip6_esp_randpad;
 
extern struct secpolicy *ipsec6_getpolicybysock
__P((struct mbuf *, u_int, struct socket *, int *));
extern struct secpolicy *ipsec6_getpolicybyaddr
__P((struct mbuf *, u_int, int, int *));
 
struct inpcb;
 
extern int ipsec6_in_reject_so __P((struct mbuf *, struct socket *));
extern int ipsec6_delete_pcbpolicy __P((struct inpcb *));
extern int ipsec6_set_policy __P((struct inpcb *inp, int optname,
caddr_t request, size_t len, int priv));
extern int ipsec6_get_policy
__P((struct inpcb *inp, caddr_t request, size_t len, struct mbuf **mp));
extern int ipsec6_in_reject __P((struct mbuf *, struct inpcb *));
 
struct tcp6cb;
 
extern size_t ipsec6_hdrsiz __P((struct mbuf *, u_int, struct inpcb *));
 
struct ip6_hdr;
extern const char *ipsec6_logpacketstr __P((struct ip6_hdr *, u_int32_t));
 
extern int ipsec6_output_trans __P((struct ipsec_output_state *, u_char *,
struct mbuf *, struct secpolicy *, int, int *));
extern int ipsec6_output_tunnel __P((struct ipsec_output_state *,
struct secpolicy *, int));
extern int ipsec6_tunnel_validate __P((struct mbuf *, int, u_int,
struct secasvar *));
#endif /*_KERNEL*/
 
#endif /*_NETINET6_IPSEC6_H_*/
/pkgnet/trunk/watt32/inc/netinet6/mld6_var.h
0,0 → 1,57
/*!\file netinet6/mld6_var.h
*
*/
 
/* $FreeBSD: src/sys/netinet6/mld6_var.h,v 1.2 2000/07/04 16:35:10 itojun Exp $ */
/* $KAME: mld6_var.h,v 1.4 2000/03/25 07:23:54 sumikawa Exp $ */
 
/*
* Copyright (C) 1998 WIDE Project.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the project nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
 
#ifndef _NETINET6_MLD6_VAR_H_
#define _NETINET6_MLD6_VAR_H_
 
#ifdef _KERNEL
 
#define MLD6_RANDOM_DELAY(X) (random() % (X) + 1)
 
/*
* States for MLD stop-listening processing
*/
#define MLD6_OTHERLISTENER 0
#define MLD6_IREPORTEDLAST 1
 
void mld6_init __P((void));
void mld6_input __P((struct mbuf *, int));
void mld6_start_listening __P((struct in6_multi *));
void mld6_stop_listening __P((struct in6_multi *));
void mld6_fasttimeo __P((void));
#endif /* _KERNEL */
 
#endif /* _NETINET6_MLD6_VAR_H_ */
/pkgnet/trunk/watt32/inc/netinet6/nd6.h
0,0 → 1,408
/*!\file netinet6/nd6.h
* IPv6 Neighbor Discovery.
*/
 
/* $FreeBSD: src/sys/netinet6/nd6.h,v 1.10 2002/04/19 04:46:23 suz Exp $ */
/* $KAME: nd6.h,v 1.76 2001/12/18 02:10:31 itojun Exp $ */
 
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the project nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
 
#ifndef _NETINET6_ND6_H_
#define _NETINET6_ND6_H_
 
/* see net/route.h, or net/if_inarp.h */
#ifndef RTF_ANNOUNCE
#define RTF_ANNOUNCE RTF_PROTO2
#endif
 
#include <sys/queue.h>
#include <sys/callout.h>
 
struct llinfo_nd6 {
struct llinfo_nd6 *ln_next;
struct llinfo_nd6 *ln_prev;
struct rtentry *ln_rt;
struct mbuf *ln_hold; /* last packet until resolved/timeout */
long ln_asked; /* number of queries already sent for this addr */
u_long ln_expire; /* lifetime for NDP state transition */
short ln_state; /* reachability state */
short ln_router; /* 2^0: ND6 router bit */
int ln_byhint; /* # of times we made it reachable by UL hint */
};
 
#define ND6_LLINFO_NOSTATE -2
/*
* We don't need the WAITDELETE state any more, but we keep the definition
* in a comment line instead of removing it. This is necessary to avoid
* unintentionally reusing the value for another purpose, which might
* affect backward compatibility with old applications.
* (20000711 jinmei@kame.net)
*/
/* #define ND6_LLINFO_WAITDELETE -1 */
#define ND6_LLINFO_INCOMPLETE 0
#define ND6_LLINFO_REACHABLE 1
#define ND6_LLINFO_STALE 2
#define ND6_LLINFO_DELAY 3
#define ND6_LLINFO_PROBE 4
 
#define ND6_IS_LLINFO_PROBREACH(n) ((n)->ln_state > ND6_LLINFO_INCOMPLETE)
 
struct nd_ifinfo {
u_int32_t linkmtu; /* LinkMTU */
u_int32_t maxmtu; /* Upper bound of LinkMTU */
u_int32_t basereachable; /* BaseReachableTime */
u_int32_t reachable; /* Reachable Time */
u_int32_t retrans; /* Retrans Timer */
u_int32_t flags; /* Flags */
int recalctm; /* BaseReacable re-calculation timer */
u_int8_t chlim; /* CurHopLimit */
u_int8_t receivedra;
/* the following 3 members are for privacy extension for addrconf */
u_int8_t randomseed0[8]; /* upper 64 bits of MD5 digest */
u_int8_t randomseed1[8]; /* lower 64 bits (usually the EUI64 IFID) */
u_int8_t randomid[8]; /* current random ID */
};
 
#define ND6_IFF_PERFORMNUD 0x1
 
struct in6_nbrinfo {
char ifname[IFNAMSIZ]; /* if name, e.g. "en0" */
struct in6_addr addr; /* IPv6 address of the neighbor */
long asked; /* number of queries already sent for this addr */
int isrouter; /* if it acts as a router */
int state; /* reachability state */
int expire; /* lifetime for NDP state transition */
};
 
#define DRLSTSIZ 10
#define PRLSTSIZ 10
struct in6_drlist {
char ifname[IFNAMSIZ];
struct {
struct in6_addr rtaddr;
u_char flags;
u_short rtlifetime;
u_long expire;
u_short if_index;
} defrouter[DRLSTSIZ];
};
 
struct in6_defrouter {
struct sockaddr_in6 rtaddr;
u_char flags;
u_short rtlifetime;
u_long expire;
u_short if_index;
};
 
struct in6_prlist {
char ifname[IFNAMSIZ];
struct {
struct in6_addr prefix;
struct prf_ra raflags;
u_char prefixlen;
u_char origin;
u_int32_t vltime;
u_int32_t pltime;
time_t expire;
u_short if_index;
u_short advrtrs; /* number of advertisement routers */
struct in6_addr advrtr[DRLSTSIZ]; /* XXX: explicit limit */
} prefix[PRLSTSIZ];
};
 
struct in6_prefix {
struct sockaddr_in6 prefix;
struct prf_ra raflags;
u_char prefixlen;
u_char origin;
u_long vltime;
u_long pltime;
u_long expire;
u_int32_t flags;
int refcnt;
u_short if_index;
u_short advrtrs; /* number of advertisement routers */
/* struct sockaddr_in6 advrtr[] */
};
 
#ifdef _KERNEL
struct in6_ondireq {
char ifname[IFNAMSIZ];
struct {
u_int32_t linkmtu; /* LinkMTU */
u_int32_t maxmtu; /* Upper bound of LinkMTU */
u_int32_t basereachable; /* BaseReachableTime */
u_int32_t reachable; /* Reachable Time */
u_int32_t retrans; /* Retrans Timer */
u_int32_t flags; /* Flags */
int recalctm; /* BaseReacable re-calculation timer */
u_int8_t chlim; /* CurHopLimit */
u_int8_t receivedra;
} ndi;
};
#endif
 
struct in6_ndireq {
char ifname[IFNAMSIZ];
struct nd_ifinfo ndi;
};
 
struct in6_ndifreq {
char ifname[IFNAMSIZ];
u_long ifindex;
};
 
/* Prefix status */
#define NDPRF_ONLINK 0x1
#define NDPRF_DETACHED 0x2
 
/* protocol constants */
#define MAX_RTR_SOLICITATION_DELAY 1 /* 1sec */
#define RTR_SOLICITATION_INTERVAL 4 /* 4sec */
#define MAX_RTR_SOLICITATIONS 3
 
#define ND6_INFINITE_LIFETIME 0xffffffff
 
#ifdef _KERNEL
/* node constants */
#define MAX_REACHABLE_TIME 3600000 /* msec */
#define REACHABLE_TIME 30000 /* msec */
#define RETRANS_TIMER 1000 /* msec */
#define MIN_RANDOM_FACTOR 512 /* 1024 * 0.5 */
#define MAX_RANDOM_FACTOR 1536 /* 1024 * 1.5 */
#define DEF_TEMP_VALID_LIFETIME 604800 /* 1 week */
#define DEF_TEMP_PREFERRED_LIFETIME 86400 /* 1 day */
#define TEMPADDR_REGEN_ADVANCE 5 /* sec */
#define MAX_TEMP_DESYNC_FACTOR 600 /* 10 min */
#define ND_COMPUTE_RTIME(x) \
(((MIN_RANDOM_FACTOR * (x >> 10)) + (random() & \
((MAX_RANDOM_FACTOR - MIN_RANDOM_FACTOR) * (x >> 10)))) /1000)
 
TAILQ_HEAD(nd_drhead, nd_defrouter);
struct nd_defrouter {
TAILQ_ENTRY(nd_defrouter) dr_entry;
struct in6_addr rtaddr;
u_char flags; /* flags on RA message */
u_short rtlifetime;
u_long expire;
u_long advint; /* Mobile IPv6 addition (milliseconds) */
u_long advint_expire; /* Mobile IPv6 addition */
int advints_lost; /* Mobile IPv6 addition */
struct ifnet *ifp;
};
 
struct nd_prefix {
struct ifnet *ndpr_ifp;
LIST_ENTRY(nd_prefix) ndpr_entry;
struct sockaddr_in6 ndpr_prefix; /* prefix */
struct in6_addr ndpr_mask; /* netmask derived from the prefix */
struct in6_addr ndpr_addr; /* address that is derived from the prefix */
u_int32_t ndpr_vltime; /* advertised valid lifetime */
u_int32_t ndpr_pltime; /* advertised preferred lifetime */
time_t ndpr_expire; /* expiration time of the prefix */
time_t ndpr_preferred; /* preferred time of the prefix */
struct prf_ra ndpr_flags;
u_int32_t ndpr_stateflags; /* actual state flags */
/* list of routers that advertise the prefix: */
LIST_HEAD(pr_rtrhead, nd_pfxrouter) ndpr_advrtrs;
u_char ndpr_plen;
int ndpr_refcnt; /* reference couter from addresses */
};
 
#define ndpr_next ndpr_entry.le_next
 
#define ndpr_raf ndpr_flags
#define ndpr_raf_onlink ndpr_flags.onlink
#define ndpr_raf_auto ndpr_flags.autonomous
 
/*
* We keep expired prefix for certain amount of time, for validation purposes.
* 1800s = MaxRtrAdvInterval
*/
#define NDPR_KEEP_EXPIRED (1800 * 2)
 
/*
* Message format for use in obtaining information about prefixes
* from inet6 sysctl function
*/
struct inet6_ndpr_msghdr {
u_short inpm_msglen; /* to skip over non-understood messages */
u_char inpm_version; /* future binary compatibility */
u_char inpm_type; /* message type */
struct in6_addr inpm_prefix;
u_long prm_vltim;
u_long prm_pltime;
u_long prm_expire;
u_long prm_preferred;
struct in6_prflags prm_flags;
u_short prm_index; /* index for associated ifp */
u_char prm_plen; /* length of prefix in bits */
};
 
#define prm_raf_onlink prm_flags.prf_ra.onlink
#define prm_raf_auto prm_flags.prf_ra.autonomous
 
#define prm_statef_onlink prm_flags.prf_state.onlink
 
#define prm_rrf_decrvalid prm_flags.prf_rr.decrvalid
#define prm_rrf_decrprefd prm_flags.prf_rr.decrprefd
 
#define ifpr2ndpr(ifpr) ((struct nd_prefix *)(ifpr))
#define ndpr2ifpr(ndpr) ((struct ifprefix *)(ndpr))
 
struct nd_pfxrouter {
LIST_ENTRY(nd_pfxrouter) pfr_entry;
#define pfr_next pfr_entry.le_next
struct nd_defrouter *router;
};
 
LIST_HEAD(nd_prhead, nd_prefix);
 
/* nd6.c */
extern int nd6_prune;
extern int nd6_delay;
extern int nd6_umaxtries;
extern int nd6_mmaxtries;
extern int nd6_useloopback;
extern int nd6_maxnudhint;
extern int nd6_gctimer;
extern struct llinfo_nd6 llinfo_nd6;
extern struct nd_ifinfo *nd_ifinfo;
extern struct nd_drhead nd_defrouter;
extern struct nd_prhead nd_prefix;
extern int nd6_debug;
 
#define nd6log(x) do { if (nd6_debug) log x; } while (0)
 
extern struct callout nd6_timer_ch;
 
/* nd6_rtr.c */
extern int nd6_defifindex;
extern int ip6_desync_factor; /* seconds */
extern u_int32_t ip6_temp_preferred_lifetime; /* seconds */
extern u_int32_t ip6_temp_valid_lifetime; /* seconds */
extern int ip6_temp_regen_advance; /* seconds */
 
union nd_opts {
struct nd_opt_hdr *nd_opt_array[9]; /* max = home agent info */
struct {
struct nd_opt_hdr *zero;
struct nd_opt_hdr *src_lladdr;
struct nd_opt_hdr *tgt_lladdr;
struct nd_opt_prefix_info *pi_beg; /* multiple opts, start */
struct nd_opt_rd_hdr *rh;
struct nd_opt_mtu *mtu;
struct nd_opt_hdr *six;
struct nd_opt_advint *adv;
struct nd_opt_hai *hai;
struct nd_opt_hdr *search; /* multiple opts */
struct nd_opt_hdr *last; /* multiple opts */
int done;
struct nd_opt_prefix_info *pi_end;/* multiple opts, end */
} nd_opt_each;
};
#define nd_opts_src_lladdr nd_opt_each.src_lladdr
#define nd_opts_tgt_lladdr nd_opt_each.tgt_lladdr
#define nd_opts_pi nd_opt_each.pi_beg
#define nd_opts_pi_end nd_opt_each.pi_end
#define nd_opts_rh nd_opt_each.rh
#define nd_opts_mtu nd_opt_each.mtu
#define nd_opts_adv nd_opt_each.adv
#define nd_opts_hai nd_opt_each.hai
#define nd_opts_search nd_opt_each.search
#define nd_opts_last nd_opt_each.last
#define nd_opts_done nd_opt_each.done
 
/* XXX: need nd6_var.h?? */
/* nd6.c */
void nd6_init __P((void));
void nd6_ifattach __P((struct ifnet *));
int nd6_is_addr_neighbor __P((struct sockaddr_in6 *, struct ifnet *));
void nd6_option_init __P((void *, int, union nd_opts *));
struct nd_opt_hdr *nd6_option __P((union nd_opts *));
int nd6_options __P((union nd_opts *));
struct rtentry *nd6_lookup __P((struct in6_addr *, int, struct ifnet *));
void nd6_setmtu __P((struct ifnet *));
void nd6_timer __P((void *));
void nd6_purge __P((struct ifnet *));
struct llinfo_nd6 *nd6_free __P((struct rtentry *));
void nd6_nud_hint __P((struct rtentry *, struct in6_addr *, int));
int nd6_resolve __P((struct ifnet *, struct rtentry *,
struct mbuf *, struct sockaddr *, u_char *));
void nd6_rtrequest __P((int, struct rtentry *, struct rt_addrinfo *));
int nd6_ioctl __P((u_long, caddr_t, struct ifnet *));
struct rtentry *nd6_cache_lladdr __P((struct ifnet *, struct in6_addr *,
char *, int, int, int));
int nd6_output __P((struct ifnet *, struct ifnet *, struct mbuf *,
struct sockaddr_in6 *, struct rtentry *));
int nd6_storelladdr __P((struct ifnet *, struct rtentry *, struct mbuf *,
struct sockaddr *, u_char *));
int nd6_need_cache __P((struct ifnet *));
 
/* nd6_nbr.c */
void nd6_na_input __P((struct mbuf *, int, int));
void nd6_na_output __P((struct ifnet *, const struct in6_addr *,
const struct in6_addr *, u_long, int, struct sockaddr *));
void nd6_ns_input __P((struct mbuf *, int, int));
void nd6_ns_output __P((struct ifnet *, const struct in6_addr *,
const struct in6_addr *, struct llinfo_nd6 *, int));
caddr_t nd6_ifptomac __P((struct ifnet *));
void nd6_dad_start __P((struct ifaddr *, int *));
void nd6_dad_stop __P((struct ifaddr *));
void nd6_dad_duplicated __P((struct ifaddr *));
 
/* nd6_rtr.c */
void nd6_rs_input __P((struct mbuf *, int, int));
void nd6_ra_input __P((struct mbuf *, int, int));
void prelist_del __P((struct nd_prefix *));
void defrouter_addreq __P((struct nd_defrouter *));
void defrouter_delreq __P((struct nd_defrouter *, int));
void defrouter_select __P((void));
void defrtrlist_del __P((struct nd_defrouter *));
void prelist_remove __P((struct nd_prefix *));
int prelist_update __P((struct nd_prefix *, struct nd_defrouter *,
struct mbuf *));
int nd6_prelist_add __P((struct nd_prefix *, struct nd_defrouter *,
struct nd_prefix **));
int nd6_prefix_onlink __P((struct nd_prefix *));
int nd6_prefix_offlink __P((struct nd_prefix *));
void pfxlist_onlink_check __P((void));
struct nd_defrouter *defrouter_lookup __P((struct in6_addr *,
struct ifnet *));
struct nd_prefix *nd6_prefix_lookup __P((struct nd_prefix *));
int in6_init_prefix_ltimes __P((struct nd_prefix *ndpr));
void rt6_flush __P((struct in6_addr *, struct ifnet *));
int nd6_setdefaultiface __P((int));
int in6_tmpifadd __P((const struct in6_ifaddr *, int));
 
#endif /* _KERNEL */
 
#endif /* _NETINET6_ND6_H_ */
/pkgnet/trunk/watt32/inc/netinet6/pim6.h
0,0 → 1,73
/*!\file netinet6/pim6.h
*
*/
 
/* $FreeBSD: src/sys/netinet6/pim6.h,v 1.2 2000/07/04 16:35:10 itojun Exp $ */
/* $KAME: pim6.h,v 1.3 2000/03/25 07:23:58 sumikawa Exp $ */
 
/*
* Copyright (C) 1998 WIDE Project.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the project nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/*
* Protocol Independent Multicast (PIM) definitions
*
* Written by Ahmed Helmy, SGI, July 1996
*
* MULTICAST
*/
 
/*
* PIM packet header
*/
#define PIM_VERSION 2
struct pim {
#if defined(BYTE_ORDER) && (BYTE_ORDER == LITTLE_ENDIAN)
u_char pim_type:4, /* the PIM message type, currently they are:
* Hello, Register, Register-Stop, Join/Prune,
* Bootstrap, Assert, Graft (PIM-DM only),
* Graft-Ack (PIM-DM only), C-RP-Adv
*/
pim_ver:4; /* PIM version number; 2 for PIMv2 */
#else
u_char pim_ver:4, /* PIM version */
pim_type:4; /* PIM type */
#endif
u_char pim_rsv; /* Reserved */
u_short pim_cksum; /* IP style check sum */
};
 
#define PIM_MINLEN 8 /* The header min. length is 8 */
#define PIM6_REG_MINLEN (PIM_MINLEN+40) /* Register message + inner IP6 header */
 
/*
* Message types
*/
#define PIM_REGISTER 1 /* PIM Register type is 1 */
 
/* second bit in reg_head is the null bit */
#define PIM_NULL_REGISTER 0x40000000
/pkgnet/trunk/watt32/inc/netinet6/pim6_var.h
0,0 → 1,74
/*!\file netinet6/pim6_var.h
*
*/
 
/* $FreeBSD: src/sys/netinet6/pim6_var.h,v 1.3 2000/07/04 16:35:10 itojun Exp $ */
/* $KAME: pim6_var.h,v 1.8 2000/06/06 08:07:43 jinmei Exp $ */
 
/*
* Copyright (C) 1998 WIDE Project.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the project nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
 
#ifndef _NETINET6_PIM6_VAR_H_
#define _NETINET6_PIM6_VAR_H_
 
/*
* Protocol Independent Multicast (PIM),
* implementation-specific definitions.
*
* Written by George Edmond Eddy (Rusty), ISI, February 1998
* Modified by Pavlin Ivanov Radoslavov, USC/ISI, May 1998
*/
 
struct pim6stat {
u_quad_t pim6s_rcv_total; /* total PIM messages received */
u_quad_t pim6s_rcv_tooshort; /* received with too few bytes */
u_quad_t pim6s_rcv_badsum; /* received with bad checksum */
u_quad_t pim6s_rcv_badversion; /* received bad PIM version */
u_quad_t pim6s_rcv_registers; /* received registers */
u_quad_t pim6s_rcv_badregisters; /* received invalid registers */
u_quad_t pim6s_snd_registers; /* sent registers */
};
 
#if (defined(KERNEL)) || (defined(_KERNEL))
extern struct pim6stat pim6stat;
 
int pim6_input __P((struct mbuf **, int*, int));
#endif /* KERNEL */
 
/*
* Names for PIM sysctl objects
*/
#define PIM6CTL_STATS 1 /* statistics (read-only) */
#define PIM6CTL_MAXID 2
 
#define PIM6CTL_NAMES { \
{ 0, 0 }, \
{ 0, 0 }, \
}
#endif /* _NETINET6_PIM6_VAR_H_ */
/pkgnet/trunk/watt32/inc/netinet6/raw_ip6.h
0,0 → 1,58
/*!\file netinet6/raw_ip6.h
*
*/
 
/* $FreeBSD: src/sys/netinet6/raw_ip6.h,v 1.1 2001/06/11 12:39:06 ume Exp $ */
/* $KAME: raw_ip6.h,v 1.2 2001/05/27 13:28:35 itojun Exp $ */
 
/*
* Copyright (C) 2001 WIDE Project.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the project nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
 
#ifndef _NETINET6_RAW_IP6_H_
#define _NETINET6_RAW_IP6_H_
 
/*
* ICMPv6 stat is counted separately. see netinet/icmp6.h
*/
struct rip6stat {
u_quad_t rip6s_ipackets; /* total input packets */
u_quad_t rip6s_isum; /* input checksum computations */
u_quad_t rip6s_badsum; /* of above, checksum error */
u_quad_t rip6s_nosock; /* no matching socket */
u_quad_t rip6s_nosockmcast; /* of above, arrived as multicast */
u_quad_t rip6s_fullsock; /* not delivered, input socket full */
 
u_quad_t rip6s_opackets; /* total output packets */
};
 
#ifdef _KERNEL
extern struct rip6stat rip6stat;
#endif
 
#endif
/pkgnet/trunk/watt32/inc/netinet6/scope6_v.h
0,0 → 1,50
/*!\file netinet6/scope6_v.h
*
*/
 
/* $FreeBSD: src/sys/netinet6/scope6_var.h,v 1.1 2000/07/04 16:35:10 itojun Exp $ */
/* $KAME: scope6_var.h,v 1.4 2000/05/18 15:03:27 jinmei Exp $ */
 
/*
* Copyright (C) 2000 WIDE Project.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the project nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
 
#ifndef _NETINET6_SCOPE6_VAR_H_
#define _NETINET6_SCOPE6_VAR_H_
 
#ifdef _KERNEL
void scope6_ifattach __P((struct ifnet *));
int scope6_set __P((struct ifnet *, u_int32_t *));
int scope6_get __P((struct ifnet *, u_int32_t *));
void scope6_setdefault __P((struct ifnet *));
int scope6_get_default __P((u_int32_t *));
u_int32_t scope6_in6_addrscope __P((struct in6_addr *));
u_int32_t scope6_addr2default __P((struct in6_addr *));
#endif /* _KERNEL */
 
#endif /* _NETINET6_SCOPE6_VAR_H_ */
/pkgnet/trunk/watt32/inc/netinet6/tcp6_var.h
0,0 → 1,91
/*!\file netinet6/tcp6_var.h
*
*/
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the project nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD: src/sys/netinet6/tcp6_var.h,v 1.5 2001/11/22 04:50:44 jlemon Exp $
*/
 
/*
* Copyright (c) 1982, 1986, 1993, 1994, 1995
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)tcp_var.h 8.4 (Berkeley) 5/24/95
* $FreeBSD: src/sys/netinet6/tcp6_var.h,v 1.5 2001/11/22 04:50:44 jlemon Exp $
*/
 
#ifndef _NETINET_TCP6_VAR_H_
#define _NETINET_TCP6_VAR_H_
 
#ifdef _KERNEL
#ifdef SYSCTL_DECL
SYSCTL_DECL(_net_inet6_tcp6);
#endif
 
extern int tcp_v6mssdflt; /* XXX */
 
struct ip6_hdr;
void tcp6_ctlinput __P((int, struct sockaddr *, void *));
void tcp6_init __P((void));
int tcp6_input __P((struct mbuf **, int *, int));
struct rtentry *tcp_rtlookup6(struct in_conninfo *);
 
extern struct pr_usrreqs tcp6_usrreqs;
 
#endif /* _KERNEL */
 
#endif /* _NETINET_TCP6_VAR_H_ */
/pkgnet/trunk/watt32/inc/netinet6/udp6_var.h
0,0 → 1,86
/*!\file netinet6/udp6_var.h
* UDP in/out handling for IPv6.
*/
 
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the project nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD: src/sys/netinet6/udp6_var.h,v 1.5 2001/09/12 08:37:55 julian Exp $
*/
 
/*
* Copyright (c) 1982, 1986, 1989, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)udp_var.h 8.1 (Berkeley) 6/10/93
*/
 
#ifndef _NETINET6_UDP6_VAR_H_
#define _NETINET6_UDP6_VAR_H_
 
#ifdef _KERNEL
SYSCTL_DECL(_net_inet6_udp6);
 
extern struct pr_usrreqs udp6_usrreqs;
 
void udp6_ctlinput __P((int, struct sockaddr *, void *));
int udp6_input __P((struct mbuf **, int *, int));
int udp6_output __P((struct inpcb *inp, struct mbuf *m,
struct sockaddr *addr, struct mbuf *control,
struct thread *td));
#endif
 
#endif /*_NETINET6_UDP6_VAR_H_*/
/pkgnet/trunk/watt32/inc/protocol/dumprest.h
0,0 → 1,123
/*!\file protocol/dumprest.h
* Dump/restore protocol definitions.
*/
 
/* $NetBSD: dumprestore.h,v 1.7 1996/11/30 18:01:52 cgd Exp $ */
 
/*
* Copyright (c) 1980, 1993
* The Regents of the University of California. All rights reserved.
* (c) UNIX System Laboratories, Inc.
* All or some portions of this file are derived from material licensed
* to the University of California by American Telephone and Telegraph
* Co. or Unix System Laboratories, Inc. and are reproduced herein with
* the permission of UNIX System Laboratories, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)dumprestore.h 8.2 (Berkeley) 1/21/94
*/
 
#ifndef __PROTOCOL_DUMPRESTORE_H
#define __PROTOCOL_DUMPRESTORE_H
 
/*
* TP_BSIZE is the size of file blocks on the dump tapes.
* Note that TP_BSIZE must be a multiple of DEV_BSIZE.
*
* NTREC is the number of TP_BSIZE blocks that are written
* in each tape record. HIGHDENSITYTREC is the number of
* TP_BSIZE blocks that are written in each tape record on
* 6250 BPI or higher density tapes.
*
* TP_NINDIR is the number of indirect pointers in a TS_INODE
* or TS_ADDR record. Note that it must be a power of two.
*/
#define TP_BSIZE 1024
#define NTREC 10
#define HIGHDENSITYTREC 32
#define TP_NINDIR (TP_BSIZE/2)
#define LBLSIZE 16
#define NAMELEN 64
 
#define OFS_MAGIC (int)60011
#define NFS_MAGIC (int)60012
#define CHECKSUM (int)84446
 
#include <sys/packon.h>
 
union u_spcl {
char dummy[TP_BSIZE];
struct s_spcl {
int32_t c_type; /* record type (see below) */
time_t c_date; /* date of this dump */
time_t c_ddate; /* date of previous dump */
int32_t c_volume; /* dump volume number */
daddr_t c_tapea; /* logical block of this record */
ino_t c_inumber; /* number of inode */
int32_t c_magic; /* magic number (see above) */
int32_t c_checksum; /* record checksum */
struct dinode c_dinode; /* ownership and mode of inode */
int32_t c_count; /* number of valid c_addr entries */
char c_addr[TP_NINDIR]; /* 1 => data; 0 => hole in inode */
char c_label[LBLSIZE]; /* dump label */
int32_t c_level; /* level of this dump */
char c_filesys[NAMELEN]; /* name of dumpped file system */
char c_dev[NAMELEN]; /* name of dumpped device */
char c_host[NAMELEN]; /* name of dumpped host */
int32_t c_flags; /* additional information */
int32_t c_firstrec; /* first record on volume */
int32_t c_spare[32]; /* reserved for future uses */
} s_spcl;
} u_spcl;
 
#include <sys/packoff.h>
 
#define spcl u_spcl.s_spcl
/*
* special record types
*/
#define TS_TAPE 1 /* dump tape header */
#define TS_INODE 2 /* beginning of file record */
#define TS_ADDR 4 /* continuation of file record */
#define TS_BITS 3 /* map of inodes on tape */
#define TS_CLRI 6 /* map of inodes deleted since last dump */
#define TS_END 5 /* end of volume marker */
 
/*
* flag values
*/
#define DR_NEWHEADER 0x0001 /* new format tape header */
#define DR_NEWINODEFMT 0x0002 /* new format inodes on tape */
 
#define DUMPOUTFMT "%-16s %c %s" /* for printf */
/* name, level, ctime(date) */
#define DUMPINFMT "%16s %c %[^\n]\n" /* inverse for scanf */
 
#endif
/pkgnet/trunk/watt32/inc/protocol/routed.h
0,0 → 1,179
/*!\file protocol/routed.h
* Route Daeamon definitions.
*/
 
/* $NetBSD: routed.h,v 1.10 1997/02/03 22:20:38 christos Exp $ */
 
/*-
* Copyright (c) 1983, 1989, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)routed.h 8.1 (Berkeley) 6/2/93
*/
 
#ifndef __PROTOCOL_ROUTED_H
#define __PROTOCOL_ROUTED_H
 
/*
* Routing Information Protocol
*
* Derived from Xerox NS Routing Information Protocol
* by changing 32-bit net numbers to sockaddr's and
* padding stuff to 32-bit boundaries.
*/
 
#define RIP_VERSION_0 0
#define RIP_VERSION_1 1
#define RIP_VERSION_2 2
 
#define RIPv1 RIP_VERSION_1
#define RIPv2 RIP_VERSION_2
#ifndef RIPVERSION
#define RIPVERSION RIPv1
#endif
 
#define RIP_PORT 520
 
#include <sys/packon.h>
 
#if RIPVERSION == 1
/* We include the V2 fields to get the right size */
struct netinfo {
u_int16_t rip_family;
u_int16_t rip_tag;
u_int32_t rip_dst; /* destination net/host */
u_int32_t rip_dst_mask; /* destination mask (V2 only) */
u_int32_t rip_router; /* next host (V2 only) */
u_int32_t rip_metric; /* cost of route */
};
#else
struct netinfo {
u_int16_t n_family;
#define RIP_AF_INET htons(AF_INET)
#define RIP_AF_UNSPEC 0
#define RIP_AF_AUTH 0xffff
u_int16_t n_tag; /* optional in RIPv2 */
u_int32_t n_dst; /* destination net or host */
#define RIP_DEFAULT 0
u_int32_t n_mask; /* netmask in RIPv2 */
u_int32_t n_nhop; /* optional next hop in RIPv2 */
u_int32_t n_metric; /* cost of route */
};
#endif
 
/* RIPv2 authentication */
struct netauth {
u_int16_t a_family; /* always RIP_AF_AUTH */
u_int16_t a_type;
#define RIP_AUTH_NONE 0
#define RIP_AUTH_PW htons(2) /* password type */
#define RIP_AUTH_MD5 htons(3) /* Keyed MD5 */
union {
#define RIP_AUTH_PW_LEN 16
u_int8_t au_pw[RIP_AUTH_PW_LEN];
struct a_md5 {
int16_t md5_pkt_len; /* RIP-II packet length */
int8_t md5_keyid; /* key ID and auth data len */
int8_t md5_auth_len; /* 16 */
u_int32_t md5_seqno; /* sequence number */
u_int32_t rsvd[2]; /* must be 0 */
#define RIP_AUTH_MD5_LEN RIP_AUTH_PW_LEN
} a_md5;
} au;
};
 
struct rip {
u_int8_t rip_cmd; /* request/response */
u_int8_t rip_vers; /* protocol version # */
u_int16_t rip_res1; /* pad to 32-bit boundary */
union { /* variable length... */
struct netinfo ru_nets[1];
int8_t ru_tracefile[1];
struct netauth ru_auth[1];
} ripun;
#define rip_nets ripun.ru_nets
#define rip_auths ripun.ru_auth
#define rip_tracefile ripun.ru_tracefile
};
 
#include <sys/packoff.h>
 
/* Packet types.
*/
#define RIPCMD_REQUEST 1 /* want info */
#define RIPCMD_RESPONSE 2 /* responding to request */
#define RIPCMD_TRACEON 3 /* turn tracing on */
#define RIPCMD_TRACEOFF 4 /* turn it off */
 
/* Gated extended RIP to include a "poll" command instead of using
* RIPCMD_REQUEST with (RIP_AF_UNSPEC, RIP_DEFAULT). RFC 1058 says
* command 5 is used by Sun Microsystems for its own purposes.
*/
#define RIPCMD_POLL 5
 
#define RIPCMD_MAX 6
 
#ifdef RIPCMDS
char *ripcmds[RIPCMD_MAX] = {
"#0", "REQUEST", "RESPONSE", "TRACEON", "TRACEOFF"
};
#endif
 
#define HOPCNT_INFINITY 16
#define MAXPACKETSIZE 512 /* max broadcast size */
#define NETS_LEN ((MAXPACKETSIZE-sizeof(struct rip)) \
/ sizeof(struct netinfo) +1)
 
#define INADDR_RIP_GROUP (u_int32_t)0xe0000009 /* 224.0.0.9 */
 
 
/* Timer values used in managing the routing table.
*
* Complete tables are broadcast every SUPPLY_INTERVAL seconds.
* If changes occur between updates, dynamic updates containing only changes
* may be sent. When these are sent, a timer is set for a random value
* between MIN_WAITTIME and MAX_WAITTIME, and no additional dynamic updates
* are sent until the timer expires.
*
* Every update of a routing entry forces an entry's timer to be reset.
* After EXPIRE_TIME without updates, the entry is marked invalid,
* but held onto until GARBAGE_TIME so that others may see it, to
* "poison" the bad route.
*/
#define SUPPLY_INTERVAL 30 /* time to supply tables */
#define MIN_WAITTIME 2 /* min sec until next flash updates */
#define MAX_WAITTIME 5 /* max sec until flash update */
 
#define STALE_TIME 90 /* switch to a new gateway */
#define EXPIRE_TIME 180 /* time to mark entry invalid */
#define GARBAGE_TIME 240 /* time to garbage collect */
 
#endif
/pkgnet/trunk/watt32/inc/protocol/rwhod.h
0,0 → 1,78
/*!\file protocol/rwhod.h
* Remote WHO daemon.
*/
 
/* $NetBSD: rwhod.h,v 1.4 1996/09/23 05:01:08 mycroft Exp $ */
 
/*
* Copyright (c) 1983 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)rwhod.h 5.6 (Berkeley) 4/3/91
*/
 
#ifndef __PROTOCOL_RWHOD_H
#define __PROTOCOL_RWHOD_H
 
#include <sys/packon.h>
 
/*
* rwho protocol packet format.
*/
struct outmp {
char out_line[8]; /* tty name */
char out_name[8]; /* user id */
int32_t out_time; /* time on */
};
 
struct whod {
char wd_vers; /* protocol version # */
char wd_type; /* packet type, see below */
char wd_pad[2];
int32_t wd_sendtime; /* time stamp by sender */
int32_t wd_recvtime; /* time stamp applied by receiver */
char wd_hostname[32]; /* hosts's name */
int32_t wd_loadav[3]; /* load average as in uptime */
int32_t wd_boottime; /* time system booted */
struct whoent {
struct outmp we_utmp; /* active tty info */
int32_t we_idle; /* tty idle time */
} wd_we[1024 / sizeof (struct whoent)];
};
 
#include <sys/packoff.h>
 
#define WHODVERSION 1
#define WHODTYPE_STATUS 1 /* host status */
 
#define _PATH_RWHODIR "/var/rwho"
 
#endif
/pkgnet/trunk/watt32/inc/protocol/talkd.h
0,0 → 1,124
/*!\file protocol/talkd.h
* Talk server/client definitions.
*/
 
/* $NetBSD: talkd.h,v 1.5 1995/03/04 07:59:30 cgd Exp $ */
 
/*
* Copyright (c) 1983 Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)talkd.h 5.7 (Berkeley) 4/3/91
*/
 
#ifndef __PROTOCOL_TALKD_H
#define __PROTOCOL_TALKD_H
 
/*
* This describes the protocol used by the talk server and clients.
*
* The talk server acts a repository of invitations, responding to
* requests by clients wishing to rendezvous for the purpose of
* holding a conversation. In normal operation, a client, the caller,
* initiates a rendezvous by sending a CTL_MSG to the server of
* type LOOK_UP. This causes the server to search its invitation
* tables to check if an invitation currently exists for the caller
* (to speak to the callee specified in the message). If the lookup
* fails, the caller then sends an ANNOUNCE message causing the server
* to broadcast an announcement on the callee's login ports requesting
* contact. When the callee responds, the local server uses the
* recorded invitation to respond with the appropriate rendezvous
* address and the caller and callee client programs establish a
* stream connection through which the conversation takes place.
*/
 
#include <sys/packon.h>
 
/*
* Client->server request message format.
*/
typedef struct {
u_char vers; /* protocol version */
u_char type; /* request type, see below */
u_char answer; /* not used */
u_char pad;
u_int32_t id_num; /* message id */
struct osockaddr addr; /* old (4.3) style */
struct osockaddr ctl_addr; /* old (4.3) style */
int32_t pid; /* caller's process id */
#define NAME_SIZE 12
char l_name[NAME_SIZE]; /* caller's name */
char r_name[NAME_SIZE]; /* callee's name */
#define TTY_SIZE 16
char r_tty[TTY_SIZE]; /* callee's tty name */
} CTL_MSG;
 
/*
* Server->client response message format.
*/
typedef struct {
u_char vers; /* protocol version */
u_char type; /* type of request message, see below */
u_char answer; /* respose to request message, see below */
u_char pad;
u_int32_t id_num; /* message id */
struct osockaddr addr; /* address for establishing conversation */
} CTL_RESPONSE;
 
#include <sys/packoff.h>
 
#define TALK_VERSION 1 /* protocol version */
 
/* message type values */
#define LEAVE_INVITE 0 /* leave invitation with server */
#define LOOK_UP 1 /* check for invitation by callee */
#define DELETE 2 /* delete invitation by caller */
#define ANNOUNCE 3 /* announce invitation by caller */
 
/* answer values */
#define SUCCESS 0 /* operation completed properly */
#define NOT_HERE 1 /* callee not logged in */
#define FAILED 2 /* operation failed for unexplained reason */
#define MACHINE_UNKNOWN 3 /* caller's machine name unknown */
#define PERMISSION_DENIED 4 /* callee's tty doesn't permit announce */
#define UNKNOWN_REQUEST 5 /* request has invalid type value */
#define BADVERSION 6 /* request has invalid protocol version */
#define BADADDR 7 /* request has invalid addr value */
#define BADCTLADDR 8 /* request has invalid ctl_addr value */
 
/*
* Operational parameters.
*/
#define MAX_LIFE 60 /* max time daemon saves invitations */
/* RING_WAIT should be 10's of seconds less than MAX_LIFE */
#define RING_WAIT 30 /* time to wait before resending invitation */
 
#endif
/pkgnet/trunk/watt32/inc/protocol/timed.h
0,0 → 1,113
/*!\file protocol/timed.h
* Time Synchronisation Daemon.
*/
 
/* $NetBSD: timed.h,v 1.5 1996/04/09 20:40:32 cgd Exp $ */
 
/*
* Copyright (c) 1983 Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)timed.h 1.10 (Berkeley) 4/3/91
*/
 
#ifndef __PROTOCOL_TIMED_H
#define __PROTOCOL_TIMED_H
 
/*
* Time Synchronization Protocol
*/
 
#define TSPVERSION 1
#define ANYADDR NULL
 
#include <sys/packon.h>
 
struct tsp {
u_int8_t tsp_type;
u_int8_t tsp_vers;
u_int16_t tsp_seq;
union {
struct {
int32_t tv_sec;
int32_t tv_usec;
} tspu_time;
char tspu_hopcnt;
} tsp_u;
char tsp_name[MAXHOSTNAMELEN];
};
 
#include <sys/packoff.h>
 
#define tsp_time tsp_u.tspu_time
#define tsp_hopcnt tsp_u.tspu_hopcnt
/*
* Command types.
*/
#define TSP_ANY 0 /* match any types */
#define TSP_ADJTIME 1 /* send adjtime */
#define TSP_ACK 2 /* generic acknowledgement */
#define TSP_MASTERREQ 3 /* ask for master's name */
#define TSP_MASTERACK 4 /* acknowledge master request */
#define TSP_SETTIME 5 /* send network time */
#define TSP_MASTERUP 6 /* inform slaves that master is up */
#define TSP_SLAVEUP 7 /* slave is up but not polled */
#define TSP_ELECTION 8 /* advance candidature for master */
#define TSP_ACCEPT 9 /* support candidature of master */
#define TSP_REFUSE 10 /* reject candidature of master */
#define TSP_CONFLICT 11 /* two or more masters present */
#define TSP_RESOLVE 12 /* masters' conflict resolution */
#define TSP_QUIT 13 /* reject candidature if master is up */
#define TSP_DATE 14 /* reset the time (date command) */
#define TSP_DATEREQ 15 /* remote request to reset the time */
#define TSP_DATEACK 16 /* acknowledge time setting */
#define TSP_TRACEON 17 /* turn tracing on */
#define TSP_TRACEOFF 18 /* turn tracing off */
#define TSP_MSITE 19 /* find out master's site */
#define TSP_MSITEREQ 20 /* remote master's site request */
#define TSP_TEST 21 /* for testing election algo */
#define TSP_SETDATE 22 /* New from date command */
#define TSP_SETDATEREQ 23 /* New remote for above */
#define TSP_LOOP 24 /* loop detection packet */
 
#define TSPTYPENUMBER 25
 
#ifdef TSPTYPES
char *tsptype[TSPTYPENUMBER] = {
"ANY", "ADJTIME", "ACK", "MASTERREQ", "MASTERACK", "SETTIME", "MASTERUP",
"SLAVEUP", "ELECTION", "ACCEPT", "REFUSE", "CONFLICT", "RESOLVE", "QUIT",
"DATE", "DATEREQ", "DATEACK", "TRACEON", "TRACEOFF", "MSITE", "MSITEREQ",
"TEST", "SETDATE", "SETDATEREQ", "LOOP"
};
#endif
 
#endif
/pkgnet/trunk/watt32/inc/resolv.h
0,0 → 1,277
/*!\file resolv.h
* Resolver API.
*/
 
/*-
* Copyright (c) 1983, 1987, 1989, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* -
* Portions Copyright (c) 1993 by Digital Equipment Corporation.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies, and that
* the name of Digital Equipment Corporation not be used in advertising or
* publicity pertaining to distribution of the document or software without
* specific, written prior permission.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
* CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
* -
* --Copyright--
*
* @(#)resolv.h 8.1 (Berkeley) 6/2/93
* From Id: resolv.h,v 4.9.1.2 1993/05/17 09:59:01 vixie Exp
* $Id: resolv.h,v 1.7 1996/08/29 20:00:58 peter Exp $
*/
 
#ifndef _RESOLV_H_
#define _RESOLV_H_
 
#include <stdio.h>
 
#ifndef __SYS_W32API_H
#include <sys/w32api.h>
#endif
 
#ifndef __SYS_PARAM_H
#include <sys/param.h>
#endif
 
#ifndef __SYS_WTYPES_H
#include <sys/wtypes.h>
#endif
 
#ifndef __SYS_CDEFS_H
#include <sys/cdefs.h>
#endif
 
 
/*
* revision information. this is the release date in YYYYMMDD format.
* it can change every day so the right thing to do with it is use it
* in preprocessor commands such as "#if (__RES > 19931104)". do not
* compare for equality; rather, use it to determine whether your resolver
* is new enough to contain a certain feature.
*/
 
#define __RES 19960229
 
/*
* Resolver configuration file.
* Normally not present, but may contain the address of the
* inital name server(s) to query and the domain search list.
*/
 
#ifndef _PATH_RESCONF
#define _PATH_RESCONF "/etc/resolv.conf"
#endif
 
/*
* Global defines and variables for resolver stub.
*/
#define MAXNS 3 /* max # name servers we'll track */
#define MAXDFLSRCH 3 /* # default domain levels to try */
#define MAXDNSRCH 6 /* max # domains in search path */
#define LOCALDOMAINPARTS 2 /* min levels in name that is "local" */
 
#define RES_TIMEOUT 5 /* min. seconds between retries */
#define MAXRESOLVSORT 10 /* number of net to sort on */
#define RES_MAXNDOTS 15 /* should reflect bit field size */
 
struct __res_state {
int retrans; /* retransmition time interval */
int retry; /* number of times to retransmit */
u_long options; /* option flags - see below. */
int nscount; /* number of name servers */
struct sockaddr_in
nsaddr_list[MAXNS]; /* address of name server */
#define nsaddr nsaddr_list[0] /* for backward compatibility */
u_short id; /* current packet id */
char *dnsrch[MAXDNSRCH+1]; /* components of domain to search */
char defdname[MAXDNAME]; /* default domain */
u_long pfcode; /* RES_PRF_ flags - see below. */
unsigned ndots:4; /* threshold for initial abs. query */
unsigned nsort:4; /* number of elements in sort_list[] */
char unused[3];
struct {
struct in_addr addr;
u_long mask;
} sort_list[MAXRESOLVSORT];
char pad[72]; /* On an i386 this means 512b total. */
};
 
/*
* Resolver options (keep these in synch with res_debug.c, please)
*/
#define RES_INIT 0x00000001 /* address initialized */
#define RES_DEBUG 0x00000002 /* print debug messages */
#define RES_AAONLY 0x00000004 /* authoritative answers only (!IMPL)*/
#define RES_USEVC 0x00000008 /* use virtual circuit */
#define RES_PRIMARY 0x00000010 /* query primary server only (!IMPL) */
#define RES_IGNTC 0x00000020 /* ignore truncation errors */
#define RES_RECURSE 0x00000040 /* recursion desired */
#define RES_DEFNAMES 0x00000080 /* use default domain name */
#define RES_STAYOPEN 0x00000100 /* Keep TCP socket open */
#define RES_DNSRCH 0x00000200 /* search up local domain tree */
#define RES_INSECURE1 0x00000400 /* type 1 security disabled */
#define RES_INSECURE2 0x00000800 /* type 2 security disabled */
#define RES_NOALIASES 0x00001000 /* shuts off HOSTALIASES feature */
#define RES_USE_INET6 0x00002000 /* use/map IPv6 in gethostbyname() */
 
#define RES_DEFAULT (RES_RECURSE | RES_DEFNAMES | RES_DNSRCH)
 
/*
* Resolver "pfcode" values. Used by dig.
*/
#define RES_PRF_STATS 0x00000001
/* 0x00000002 */
#define RES_PRF_CLASS 0x00000004
#define RES_PRF_CMD 0x00000008
#define RES_PRF_QUES 0x00000010
#define RES_PRF_ANS 0x00000020
#define RES_PRF_AUTH 0x00000040
#define RES_PRF_ADD 0x00000080
#define RES_PRF_HEAD1 0x00000100
#define RES_PRF_HEAD2 0x00000200
#define RES_PRF_TTLID 0x00000400
#define RES_PRF_HEADX 0x00000800
#define RES_PRF_QUERY 0x00001000
#define RES_PRF_REPLY 0x00002000
#define RES_PRF_INIT 0x00004000
/* 0x00008000 */
 
/* hooks are still experimental as of 4.9.2 */
typedef enum {
res_goahead,
res_nextns,
res_modified,
res_done,
res_error
} res_sendhookact;
 
typedef res_sendhookact (*res_send_qhook)(struct sockaddr_in * const *ns,
const u_char **query,
int *querylen,
u_char *ans,
int anssiz,
int *resplen);
 
typedef res_sendhookact (*res_send_rhook)(const struct sockaddr_in *ns,
const u_char *query,
int querylen,
u_char *ans,
int anssiz,
int *resplen);
 
W32_DATA struct __res_state _res;
 
W32_DATA int h_errno;
 
/* Private routines shared between libc/net, named, nslookup and others. */
#define res_hnok __res_hnok
#define res_ownok __res_ownok
#define res_mailok __res_mailok
#define res_dnok __res_dnok
#define loc_ntoa __loc_ntoa
#define loc_aton __loc_aton
#define dn_skipname __dn_skipname
#define fp_query __fp_query
#define fp_nquery __fp_nquery
#define hostalias __hostalias
#define putlong __putlong
#define putshort __putshort
#define p_class __p_class
#define p_time __p_time
#define p_type __p_type
#define p_cdnname __p_cdnname
#define p_cdname __p_cdname
#define p_fqname __p_fqname
#define p_rr __p_rr
#define p_option __p_option
#define res_randomid __res_randomid
#define res_isourserver __res_isourserver
#define res_nameinquery __res_nameinquery
#define res_queriesmatch __res_queriesmatch
 
__BEGIN_DECLS
 
W32_FUNC int __res_hnok (const char *);
W32_FUNC int __res_ownok (const char *);
W32_FUNC int __res_mailok (const char *);
W32_FUNC int __res_dnok (const char *);
W32_FUNC int __loc_aton (const char *ascii, u_char *binary);
W32_FUNC char * __loc_ntoa (const u_char *binary, char *ascii);
W32_FUNC int __dn_skipname(const u_char *, const u_char *);
W32_FUNC void __fp_resstat (struct __res_state *, FILE *);
W32_FUNC void __fp_query (const u_char *, FILE *);
W32_FUNC void __fp_nquery (const u_char *, int, FILE *);
W32_FUNC char *__hostalias (const char *);
W32_FUNC void __putlong (u_long, u_char *);
W32_FUNC void __putshort (u_short, u_char *);
W32_FUNC char *__p_time (u_long);
W32_FUNC void __p_query (const u_char *);
 
W32_FUNC const u_char *__p_cdnname (const u_char *, const u_char *, int, FILE *);
W32_FUNC const u_char *__p_cdname (const u_char *, const u_char *, FILE *);
W32_FUNC const u_char *__p_fqname (const u_char *, const u_char *, FILE *);
W32_FUNC const u_char *__p_rr (const u_char *, const u_char *, FILE *);
W32_FUNC const char *__p_type (int);
W32_FUNC const char *__p_class (int);
W32_FUNC const char *__p_option (u_long option);
 
W32_FUNC int dn_comp (const char *, u_char *, int, u_char **, u_char **);
W32_FUNC int dn_expand (const u_char *, const u_char *, const u_char *, char *, int);
 
W32_FUNC int res_init (void);
W32_FUNC u_short res_randomid (void);
W32_FUNC int res_query (const char *, int, int, u_char *, int);
W32_FUNC int res_search (const char *, int, int, u_char *, int);
W32_FUNC int res_querydomain (const char *, const char *, int, int, u_char *, int);
W32_FUNC int res_mkquery (int, const char *, int, int, const u_char *, int, const u_char *, u_char *, int);
W32_FUNC int res_send (const u_char *, int, u_char *, int);
W32_FUNC int res_isourserver (const struct sockaddr_in *);
W32_FUNC int res_nameinquery (const char *, int, int, const u_char *, const u_char *);
W32_FUNC int res_queriesmatch(const u_char *, const u_char *, const u_char *, const u_char *);
 
W32_FUNC void res_send_setqhook (res_send_qhook hook);
W32_FUNC void res_send_setrhook (res_send_rhook hook);
 
__END_DECLS
 
#endif /* !_RESOLV_H_ */
/pkgnet/trunk/watt32/inc/rpc/auth.h
0,0 → 1,180
/*!\file rpc/auth.h
* RPC authentication interface.
*/
 
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
* unrestricted use provided that this legend is included on all tape
* media and as a part of the software program in whole or part. Users
* may copy or modify Sun RPC without charge, but are not authorized
* to license or distribute it to anyone else except as part of a product or
* program developed by the user.
*
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
* WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
*
* Sun RPC is provided with no support and without any obligation on the
* part of Sun Microsystems, Inc. to assist in its use, correction,
* modification or enhancement.
*
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
* OR ANY PART THEREOF.
*
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
* or profits or other special, indirect and consequential damages, even if
* Sun has been advised of the possibility of such damages.
*
* Sun Microsystems, Inc.
* 2550 Garcia Avenue
* Mountain View, California 94043
*
* from: @(#)auth.h 1.17 88/02/08 SMI
* from: @(#)auth.h 2.3 88/08/07 4.0 RPCSRC
* $Id: auth.h,v 1.5 1996/01/31 08:02:11 hsu Exp $
*/
 
/*
* auth.h, Authentication interface.
*
* Copyright (C) 1984, Sun Microsystems, Inc.
*
* The data structures are completely opaque to the client. The client
* is required to pass a AUTH * to routines that create rpc
* "sessions".
*/
 
#ifndef __RPC_AUTH_H
#define __RPC_AUTH_H
 
#ifndef __SYS_CDEFS_H
#include <sys/cdefs.h>
#endif
 
#ifndef __SYS_SOCKET_H
#include <sys/socket.h>
#endif
 
#define MAX_AUTH_BYTES 400
#define MAXNETNAMELEN 255 /* maximum length of network user's name */
 
/*
* Status returned from authentication check
*/
enum auth_stat {
AUTH_OK=0,
/*
* failed at remote end
*/
AUTH_BADCRED=1, /* bogus credentials (seal broken) */
AUTH_REJECTEDCRED=2, /* client should begin new session */
AUTH_BADVERF=3, /* bogus verifier (seal broken) */
AUTH_REJECTEDVERF=4, /* verifier expired or was replayed */
AUTH_TOOWEAK=5, /* rejected due to security reasons */
/*
* failed locally
*/
AUTH_INVALIDRESP=6, /* bogus response verifier */
AUTH_FAILED=7 /* some unknown reason */
};
 
union des_block {
struct {
u_long high;
u_long low;
} key;
char c[8];
};
 
typedef union des_block des_block;
 
__BEGIN_DECLS
 
extern bool_t xdr_des_block (XDR *, des_block *);
 
__END_DECLS
 
/*
* Authentication info. Opaque to client.
*/
struct opaque_auth {
enum_t oa_flavor; /* flavor of auth */
caddr_t oa_base; /* address of more auth stuff */
u_int oa_length; /* not to exceed MAX_AUTH_BYTES */
};
 
/*
* Auth handle, interface to client side authenticators.
*/
typedef struct {
struct opaque_auth ah_cred;
struct opaque_auth ah_verf;
union des_block ah_key;
struct auth_ops {
void (*ah_nextverf)();
int (*ah_marshal)(); /* nextverf & serialize */
int (*ah_validate)(); /* validate verifier */
int (*ah_refresh)(); /* refresh credentials */
void (*ah_destroy)(); /* destroy this structure */
} *ah_ops;
caddr_t ah_private;
} AUTH;
 
 
/*
* Authentication ops.
* The ops and the auth handle provide the interface to the authenticators.
*
* AUTH *auth;
* XDR *xdrs;
* struct opaque_auth verf;
*/
#define AUTH_NEXTVERF(auth) ((*((auth)->ah_ops->ah_nextverf))(auth))
#define auth_nextverf(auth) ((*((auth)->ah_ops->ah_nextverf))(auth))
 
#define AUTH_MARSHALL(auth,xdrs) ((*((auth)->ah_ops->ah_marshal))(auth, xdrs))
#define auth_marshall(auth,xdrs) ((*((auth)->ah_ops->ah_marshal))(auth, xdrs))
 
#define AUTH_VALIDATE(auth,verfp) ((*((auth)->ah_ops->ah_validate))((auth), verfp))
#define auth_validate(auth,verfp) ((*((auth)->ah_ops->ah_validate))((auth), verfp))
 
#define AUTH_REFRESH(auth) ((*((auth)->ah_ops->ah_refresh))(auth))
#define auth_refresh(auth) ((*((auth)->ah_ops->ah_refresh))(auth))
 
#define AUTH_DESTROY(auth) ((*((auth)->ah_ops->ah_destroy))(auth))
#define auth_destroy(auth) ((*((auth)->ah_ops->ah_destroy))(auth))
 
extern struct opaque_auth _null_auth;
 
 
/*
* These are the various implementations of client side authenticators.
*/
 
/*
* Unix style authentication
* AUTH *authunix_create(machname, uid, gid, len, aup_gids)
* char *machname;
* int uid;
* int gid;
* int len;
* int *aup_gids;
*/
 
__BEGIN_DECLS
 
extern AUTH *authunix_create (char *, int, int, int, int *);
extern AUTH *authunix_create_default(void);
extern AUTH *authnone_create (void);
extern AUTH *authdes_create (char*, u_int, struct sockaddr*, des_block*);
 
__END_DECLS
 
#define AUTH_NONE 0 /* no authentication */
#define AUTH_NULL 0 /* backward compatibility */
#define AUTH_UNIX 1 /* unix style (uid, gids) */
#define AUTH_SHORT 2 /* short hand unix style */
#define AUTH_DES 3 /* des style (encrypted timestamps) */
 
#endif
/pkgnet/trunk/watt32/inc/rpc/auth_des.h
0,0 → 1,109
/*!\file rpc/auth_des.h
* RPC authentication.
*/
 
/* @(#)auth_des.h 2.2 88/07/29 4.0 RPCSRC; from 1.3 88/02/08 SMI */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
* unrestricted use provided that this legend is included on all tape
* media and as a part of the software program in whole or part. Users
* may copy or modify Sun RPC without charge, but are not authorized
* to license or distribute it to anyone else except as part of a product or
* program developed by the user.
*
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
* WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
*
* Sun RPC is provided with no support and without any obligation on the
* part of Sun Microsystems, Inc. to assist in its use, correction,
* modification or enhancement.
*
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
* OR ANY PART THEREOF.
*
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
* or profits or other special, indirect and consequential damages, even if
* Sun has been advised of the possibility of such damages.
*
* Sun Microsystems, Inc.
* 2550 Garcia Avenue
* Mountain View, California 94043
*/
 
/*
* Copyright (c) 1988 by Sun Microsystems, Inc.
*/
 
/*
* auth_des.h, Protocol for DES style authentication for RPC
*/
 
#ifndef __AUTH_DES_H
#define __AUTH_DES_H
 
/*
* There are two kinds of "names": fullnames and nicknames
*/
enum authdes_namekind {
ADN_FULLNAME,
ADN_NICKNAME
};
 
/*
* A fullname contains the network name of the client,
* a conversation key and the window
*/
struct authdes_fullname {
char *name; /* network name of client, up to MAXNETNAMELEN */
des_block key; /* conversation key */
u_long window; /* associated window */
};
 
 
/*
* A credential
*/
struct authdes_cred {
enum authdes_namekind adc_namekind;
struct authdes_fullname adc_fullname;
u_long adc_nickname;
};
 
 
 
/*
* A des authentication verifier
*/
struct authdes_verf {
union {
struct timeval adv_ctime; /* clear time */
des_block adv_xtime; /* crypt time */
} adv_time_u;
u_long adv_int_u;
};
 
/*
* des authentication verifier: client variety
*
* adv_timestamp is the current time.
* adv_winverf is the credential window + 1.
* Both are encrypted using the conversation key.
*/
#define adv_timestamp adv_time_u.adv_ctime
#define adv_xtimestamp adv_time_u.adv_xtime
#define adv_winverf adv_int_u
 
/*
* des authentication verifier: server variety
*
* adv_timeverf is the client's timestamp + client's window
* adv_nickname is the server's nickname for the client.
* adv_timeverf is encrypted using the conversation key.
*/
#define adv_timeverf adv_time_u.adv_ctime
#define adv_xtimeverf adv_time_u.adv_xtime
#define adv_nickname adv_int_u
 
#endif /* !__AUTH_DES_H */
/pkgnet/trunk/watt32/inc/rpc/auth_uni.h
0,0 → 1,89
/*!\file rpc/auth_uni.h
* RPC authentication.
*/
 
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
* unrestricted use provided that this legend is included on all tape
* media and as a part of the software program in whole or part. Users
* may copy or modify Sun RPC without charge, but are not authorized
* to license or distribute it to anyone else except as part of a product or
* program developed by the user.
*
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
* WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
*
* Sun RPC is provided with no support and without any obligation on the
* part of Sun Microsystems, Inc. to assist in its use, correction,
* modification or enhancement.
*
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
* OR ANY PART THEREOF.
*
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
* or profits or other special, indirect and consequential damages, even if
* Sun has been advised of the possibility of such damages.
*
* Sun Microsystems, Inc.
* 2550 Garcia Avenue
* Mountain View, California 94043
*
* from: @(#)auth_unix.h 1.8 88/02/08 SMI
* from: @(#)auth_unix.h 2.2 88/07/29 4.0 RPCSRC
* $Id: auth_unix.h,v 1.4 1996/01/30 23:31:42 mpp Exp $
*/
 
/*
* auth_unix.h, Protocol for UNIX style authentication parameters for RPC
*
* Copyright (C) 1984, Sun Microsystems, Inc.
*/
 
/*
* The system is very weak. The client uses no encryption for it
* credentials and only sends null verifiers. The server sends backs
* null verifiers or optionally a verifier that suggests a new short hand
* for the credentials.
*/
 
#ifndef __RPC_AUTH_UNIX_H
#define __RPC_AUTH_UNIX_H
 
#include <sys/cdefs.h>
 
/* The machine name is part of a credential; it may not exceed 255 bytes */
#define MAX_MACHINE_NAME 255
 
/* gids compose part of a credential; there may not be more than 16 of them */
#define NGRPS 16
 
/*
* Unix style credentials.
*/
struct authunix_parms {
u_long aup_time;
char *aup_machname;
int aup_uid;
int aup_gid;
u_int aup_len;
int *aup_gids;
};
 
__BEGIN_DECLS
 
extern bool_t xdr_authunix_parms (XDR *, struct authunix_parms *);
 
__END_DECLS
 
/*
* If a response verifier has flavor AUTH_SHORT,
* then the body of the response verifier encapsulates the following structure;
* again it is serialized in the obvious fashion.
*/
struct short_hand_verf {
struct opaque_auth new_cred;
};
 
#endif
/pkgnet/trunk/watt32/inc/rpc/clnt.h
0,0 → 1,356
/*!\file rpc/clnt.h
* RPC client-side interface.
*/
 
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
* unrestricted use provided that this legend is included on all tape
* media and as a part of the software program in whole or part. Users
* may copy or modify Sun RPC without charge, but are not authorized
* to license or distribute it to anyone else except as part of a product or
* program developed by the user.
*
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
* WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
*
* Sun RPC is provided with no support and without any obligation on the
* part of Sun Microsystems, Inc. to assist in its use, correction,
* modification or enhancement.
*
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
* OR ANY PART THEREOF.
*
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
* or profits or other special, indirect and consequential damages, even if
* Sun has been advised of the possibility of such damages.
*
* Sun Microsystems, Inc.
* 2550 Garcia Avenue
* Mountain View, California 94043
*
* from: @(#)clnt.h 1.31 88/02/08 SMI
* from: @(#)clnt.h 2.1 88/07/29 4.0 RPCSRC
* $Id: clnt.h,v 1.4 1996/01/30 23:31:48 mpp Exp $
*/
 
/*
* clnt.h - Client side remote procedure call interface.
*
* Copyright (C) 1984, Sun Microsystems, Inc.
*/
 
#ifndef __RPC_CLIENT_H
#define __RPC_CLIENT_H
 
#include <sys/cdefs.h>
#include <rpc/types.h>
#include <rpc/xdr.h>
 
/*
* Rpc calls return an enum clnt_stat. This should be looked at more,
* since each implementation is required to live with this (implementation
* independent) list of errors.
*/
enum clnt_stat {
RPC_SUCCESS=0, /* call succeeded */
/*
* local errors
*/
RPC_CANTENCODEARGS=1, /* can't encode arguments */
RPC_CANTDECODERES=2, /* can't decode results */
RPC_CANTSEND=3, /* failure in sending call */
RPC_CANTRECV=4, /* failure in receiving result */
RPC_TIMEDOUT=5, /* call timed out */
/*
* remote errors
*/
RPC_VERSMISMATCH=6, /* rpc versions not compatible */
RPC_AUTHERROR=7, /* authentication error */
RPC_PROGUNAVAIL=8, /* program not available */
RPC_PROGVERSMISMATCH=9, /* program version mismatched */
RPC_PROCUNAVAIL=10, /* procedure unavailable */
RPC_CANTDECODEARGS=11, /* decode arguments error */
RPC_SYSTEMERROR=12, /* generic "other problem" */
 
/*
* callrpc & clnt_create errors
*/
RPC_UNKNOWNHOST=13, /* unknown host name */
RPC_UNKNOWNPROTO=17, /* unkown protocol */
 
/*
* _ create errors
*/
RPC_PMAPFAILURE=14, /* the pmapper failed in its call */
RPC_PROGNOTREGISTERED=15, /* remote program is not registered */
/*
* unspecified error
*/
RPC_FAILED=16
};
 
 
/*
* Error info.
*/
struct rpc_err {
enum clnt_stat re_status;
union {
int RE_errno; /* related system error */
enum auth_stat RE_why; /* why the auth error occurred */
struct {
u_long low; /* lowest verion supported */
u_long high; /* highest verion supported */
} RE_vers;
struct { /* maybe meaningful if RPC_FAILED */
long s1;
long s2;
} RE_lb; /* life boot & debugging only */
} ru;
#define re_errno ru.RE_errno
#define re_why ru.RE_why
#define re_vers ru.RE_vers
#define re_lb ru.RE_lb
};
 
 
/*
* Client rpc handle.
* Created by individual implementations, see e.g. rpc_udp.c.
* Client is responsible for initializing auth, see e.g. auth_none.c.
*/
typedef struct {
AUTH *cl_auth; /* authenticator */
struct clnt_ops {
enum clnt_stat(*cl_call)(); /* call remote procedure */
void (*cl_abort)(); /* abort a call */
void (*cl_geterr)(); /* get specific error code */
bool_t (*cl_freeres)(); /* frees results */
void (*cl_destroy)(); /* destroy this structure */
bool_t (*cl_control)(); /* the ioctl() of rpc */
} *cl_ops;
caddr_t cl_private; /* private stuff */
} CLIENT;
 
 
/*
* client side rpc interface ops
*
* Parameter types are:
*
*/
 
/*
* enum clnt_stat
* CLNT_CALL(rh, proc, xargs, argsp, xres, resp, timeout)
* CLIENT *rh;
* u_long proc;
* xdrproc_t xargs;
* caddr_t argsp;
* xdrproc_t xres;
* caddr_t resp;
* struct timeval timeout;
*/
#define CLNT_CALL(rh, proc, xargs, argsp, xres, resp, secs) \
((*(rh)->cl_ops->cl_call)(rh, proc, xargs, argsp, xres, resp, secs))
#define clnt_call(rh, proc, xargs, argsp, xres, resp, secs) \
((*(rh)->cl_ops->cl_call)(rh, proc, xargs, argsp, xres, resp, secs))
 
/*
* void
* CLNT_ABORT(rh);
* CLIENT *rh;
*/
#define CLNT_ABORT(rh) ((*(rh)->cl_ops->cl_abort)(rh))
#define clnt_abort(rh) ((*(rh)->cl_ops->cl_abort)(rh))
 
/*
* struct rpc_err
* CLNT_GETERR(rh);
* CLIENT *rh;
*/
#define CLNT_GETERR(rh,errp) ((*(rh)->cl_ops->cl_geterr)(rh, errp))
#define clnt_geterr(rh,errp) ((*(rh)->cl_ops->cl_geterr)(rh, errp))
 
 
/*
* bool_t
* CLNT_FREERES(rh, xres, resp);
* CLIENT *rh;
* xdrproc_t xres;
* caddr_t resp;
*/
#define CLNT_FREERES(rh,xres,resp) ((*(rh)->cl_ops->cl_freeres)(rh,xres,resp))
#define clnt_freeres(rh,xres,resp) ((*(rh)->cl_ops->cl_freeres)(rh,xres,resp))
 
/*
* bool_t
* CLNT_CONTROL(cl, request, info)
* CLIENT *cl;
* u_int request;
* char *info;
*/
#define CLNT_CONTROL(cl,rq,in) ((*(cl)->cl_ops->cl_control)(cl,rq,in))
#define clnt_control(cl,rq,in) ((*(cl)->cl_ops->cl_control)(cl,rq,in))
 
/*
* control operations that apply to both udp and tcp transports
*/
#define CLSET_TIMEOUT 1 /* set timeout (timeval) */
#define CLGET_TIMEOUT 2 /* get timeout (timeval) */
#define CLGET_SERVER_ADDR 3 /* get server's address (sockaddr) */
/*
* udp only control operations
*/
#define CLSET_RETRY_TIMEOUT 4 /* set retry timeout (timeval) */
#define CLGET_RETRY_TIMEOUT 5 /* get retry timeout (timeval) */
 
/*
* void
* CLNT_DESTROY(rh);
* CLIENT *rh;
*/
#define CLNT_DESTROY(rh) ((*(rh)->cl_ops->cl_destroy)(rh))
#define clnt_destroy(rh) ((*(rh)->cl_ops->cl_destroy)(rh))
 
 
/*
* RPCTEST is a test program which is accessible on every rpc
* transport/port. It is used for testing, performance evaluation,
* and network administration.
*/
 
#define RPCTEST_PROGRAM ((u_long)1)
#define RPCTEST_VERSION ((u_long)1)
#define RPCTEST_NULL_PROC ((u_long)2)
#define RPCTEST_NULL_BATCH_PROC ((u_long)3)
 
/*
* By convention, procedure 0 takes null arguments and returns them
*/
 
#define NULLPROC ((u_long)0)
 
__BEGIN_DECLS
 
/*
* Below are the client handle creation routines for the various
* implementations of client side rpc. They can return NULL if a
* creation failure occurs.
*/
 
/*
* Memory based rpc (for speed check and testing)
* CLIENT *
* clntraw_create(prog, vers)
* u_long prog;
* u_long vers;
*/
extern CLIENT *clntraw_create (u_long, u_long);
 
/*
* Generic client creation routine. Supported protocols are "udp" and "tcp"
* CLIENT *
* clnt_create(host, prog, vers, prot);
* char *host; -- hostname
* u_long prog; -- program number
* u_long vers; -- version number
* char *prot; -- protocol
*/
extern CLIENT *clnt_create (char *, u_long, u_long, char *);
 
 
/*
* TCP based rpc
* CLIENT *
* clnttcp_create(raddr, prog, vers, sockp, sendsz, recvsz)
* struct sockaddr_in *raddr;
* u_long prog;
* u_long version;
* register int *sockp;
* u_int sendsz;
* u_int recvsz;
*/
 
extern CLIENT *clnttcp_create (struct sockaddr_in *, u_long, u_long,
int *, u_int, u_int);
 
/*
* UDP based rpc.
* CLIENT *
* clntudp_create(raddr, program, version, wait, sockp)
* struct sockaddr_in *raddr;
* u_long program;
* u_long version;
* struct timeval wait;
* int *sockp;
*
* Same as above, but you specify max packet sizes.
* CLIENT *
* clntudp_bufcreate(raddr, program, version, wait, sockp, sendsz, recvsz)
* struct sockaddr_in *raddr;
* u_long program;
* u_long version;
* struct timeval wait;
* int *sockp;
* u_int sendsz;
* u_int recvsz;
*/
 
extern CLIENT *clntudp_create (struct sockaddr_in *, u_long, u_long,
struct timeval, int *);
extern CLIENT *clntudp_bufcreate(struct sockaddr_in *, u_long, u_long,
struct timeval, int *, u_int, u_int);
 
 
/*
* Print why creation failed
*/
 
extern void clnt_pcreateerror (char *); /* stderr */
extern char *clnt_spcreateerror (char *); /* string */
 
/*
* Like clnt_perror(), but is more verbose in its output
*/
 
extern void clnt_perrno (enum clnt_stat); /* stderr */
extern char *clnt_sperrno(enum clnt_stat); /* string */
 
/*
* Print an English error message, given the client error code
*/
 
extern void clnt_perror (CLIENT *, char *); /* stderr */
extern char *clnt_sperror(CLIENT *, char *); /* string */
 
/*
* Call routine on remote host
*/
 
extern int callrpc (char *host, u_long prognum, u_long versnum, u_long procnum,
xdrproc_t inproc, char *in,
xdrproc_t outproc, char *out);
 
__END_DECLS
 
 
/*
* If a creation fails, the following allows the user to figure out why.
*/
struct rpc_createerr {
enum clnt_stat cf_stat;
struct rpc_err cf_error; /* useful when cf_stat == RPC_PMAPFAILURE */
const char *cf_file; /* failed file + line */
unsigned cf_line;
};
 
extern struct rpc_createerr rpc_createerr;
 
 
#define UDPMSGSIZE 8800 /* rpc imposed limit on udp msg size */
#define RPCSMALLMSGSIZE 400 /* a more reasonable packet size */
 
#endif
/pkgnet/trunk/watt32/inc/rpc/key_prot.h
0,0 → 1,99
/*!\file rpc/key_prot.h
* RPC key exchange protocol.
*/
 
/*
* This is a RPCGEN generated file. Do not edit.
*
* Generated: Sun Mar 14 19:22:40 1999
*/
 
#ifndef __KEY_PROT_H
#define __KEY_PROT_H
 
 
/*
* Copyright (c) 1988 by Sun Microsystems, Inc.
*/
#define PROOT 3
#define HEXMODULUS "d4a0ba0250b6fd2ec626e7efd637df76c716e22d0944b88b"
#define HEXKEYBYTES 48
#define KEYSIZE 192
#define KEYBYTES 24
#define KEYCHECKSUMSIZE 16
 
typedef enum keystatus {
KEY_SUCCESS = 0,
KEY_NOSECRET = 1,
KEY_UNKNOWN = 2,
KEY_SYSTEMERR = 3,
} keystatus;
bool_t xdr_keystatus();
 
#ifndef KERNEL
 
typedef char keybuf[HEXKEYBYTES];
bool_t xdr_keybuf();
 
#endif
 
typedef char *netnamestr;
bool_t xdr_netnamestr();
 
 
typedef struct cryptkeyarg {
netnamestr remotename;
des_block deskey;
} cryptkeyarg;
bool_t xdr_cryptkeyarg();
 
 
typedef struct cryptkeyres {
keystatus status;
union {
des_block deskey;
} cryptkeyres_u;
} cryptkeyres;
bool_t xdr_cryptkeyres();
 
#define MAXGIDS 16
 
typedef struct unixcred {
long uid;
long gid;
struct {
u_long gids_len;
long *gids_val;
} gids;
} unixcred;
bool_t xdr_unixcred();
 
 
typedef struct getcredres {
keystatus status;
union {
unixcred cred;
} getcredres_u;
} getcredres;
bool_t xdr_getcredres();
 
 
#define KEY_PROG 100029UL
#define KEY_VERS 1UL
#define KEY_SET 1UL
extern long *key_set_1();
 
#define KEY_ENCRYPT 2UL
extern cryptkeyres *key_encrypt_1();
 
#define KEY_DECRYPT 3UL
extern cryptkeyres *key_decrypt_1();
 
#define KEY_GEN 4UL
extern des_block *key_gen_1();
 
#define KEY_GETCRED 5UL
extern getcredres *key_getcred_1();
 
 
#endif /* !__KEY_PROT_H */
/pkgnet/trunk/watt32/inc/rpc/pmap_cln.h
0,0 → 1,86
/*!\file rpc/pmap_cln.h
* RPC portmapper (client-side).
*/
 
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
* unrestricted use provided that this legend is included on all tape
* media and as a part of the software program in whole or part. Users
* may copy or modify Sun RPC without charge, but are not authorized
* to license or distribute it to anyone else except as part of a product or
* program developed by the user.
*
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
* WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
*
* Sun RPC is provided with no support and without any obligation on the
* part of Sun Microsystems, Inc. to assist in its use, correction,
* modification or enhancement.
*
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
* OR ANY PART THEREOF.
*
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
* or profits or other special, indirect and consequential damages, even if
* Sun has been advised of the possibility of such damages.
*
* Sun Microsystems, Inc.
* 2550 Garcia Avenue
* Mountain View, California 94043
*
* from: @(#)pmap_clnt.h 1.11 88/02/08 SMI
* from: @(#)pmap_clnt.h 2.1 88/07/29 4.0 RPCSRC
* $Id: pmap_clnt.h,v 1.4 1996/01/30 23:31:59 mpp Exp $
*/
 
/*
* pmap_clnt.h
* Supplies C routines to get to portmap services.
*
* Copyright (C) 1984, Sun Microsystems, Inc.
*/
 
/*
* Usage:
* success = pmap_set(program, version, protocol, port);
* success = pmap_unset(program, version);
* port = pmap_getport(address, program, version, protocol);
* head = pmap_getmaps(address);
* clnt_stat = pmap_rmtcall(address, program, version, procedure,
* xdrargs, argsp, xdrres, resp, tout, port_ptr)
* (works for udp only.)
* clnt_stat = clnt_broadcast(program, version, procedure,
* xdrargs, argsp, xdrres, resp, eachresult)
* (like pmap_rmtcall, except the call is broadcasted to all
* locally connected nets. For each valid response received,
* the procedure eachresult is called. Its form is:
* done = eachresult(resp, raddr)
* bool_t done;
* caddr_t resp;
* struct sockaddr_in raddr;
* where resp points to the results of the call and raddr is the
* address if the responder to the broadcast.
*/
 
#ifndef __RPC_PMAP_CLIENT_H
#define __RPC_PMAP_CLIENT_H
 
#include <sys/cdefs.h>
 
__BEGIN_DECLS
 
extern bool_t pmap_set (u_long, u_long, int, int);
extern bool_t pmap_unset (u_long, u_long);
extern struct pmaplist *pmap_getmaps (struct sockaddr_in *);
extern enum clnt_stat pmap_rmtcall (struct sockaddr_in *, u_long, u_long,
u_long, xdrproc_t, caddr_t, xdrproc_t,
caddr_t, struct timeval, u_long *);
extern enum clnt_stat clnt_broadcast(u_long, u_long, u_long, xdrproc_t,
char *, xdrproc_t, char *, bool_t (*)());
extern u_short pmap_getport (struct sockaddr_in *, u_long, u_long, u_int);
 
__END_DECLS
 
#endif
/pkgnet/trunk/watt32/inc/rpc/pmap_pro.h
0,0 → 1,111
/*!\file rpc/pmap_pro.h
* RPC portmappper.
*/
 
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
* unrestricted use provided that this legend is included on all tape
* media and as a part of the software program in whole or part. Users
* may copy or modify Sun RPC without charge, but are not authorized
* to license or distribute it to anyone else except as part of a product or
* program developed by the user.
*
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
* WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
*
* Sun RPC is provided with no support and without any obligation on the
* part of Sun Microsystems, Inc. to assist in its use, correction,
* modification or enhancement.
*
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
* OR ANY PART THEREOF.
*
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
* or profits or other special, indirect and consequential damages, even if
* Sun has been advised of the possibility of such damages.
*
* Sun Microsystems, Inc.
* 2550 Garcia Avenue
* Mountain View, California 94043
*
* from: @(#)pmap_prot.h 1.14 88/02/08 SMI
* from: @(#)pmap_prot.h 2.1 88/07/29 4.0 RPCSRC
* $Id: pmap_prot.h,v 1.4 1996/01/30 23:32:08 mpp Exp $
*/
 
/*
* pmap_prot.h
* Protocol for the local binder service, or pmap.
*
* Copyright (C) 1984, Sun Microsystems, Inc.
*
* The following procedures are supported by the protocol:
*
* PMAPPROC_NULL() returns ()
* takes nothing, returns nothing
*
* PMAPPROC_SET(struct pmap) returns (bool_t)
* TRUE is success, FALSE is failure. Registers the tuple
* [prog, vers, prot, port].
*
* PMAPPROC_UNSET(struct pmap) returns (bool_t)
* TRUE is success, FALSE is failure. Un-registers pair
* [prog, vers]. prot and port are ignored.
*
* PMAPPROC_GETPORT(struct pmap) returns (long unsigned).
* 0 is failure. Otherwise returns the port number where the pair
* [prog, vers] is registered. It may lie!
*
* PMAPPROC_DUMP() RETURNS (struct pmaplist *)
*
* PMAPPROC_CALLIT(unsigned, unsigned, unsigned, string<>)
* RETURNS (port, string<>);
* usage: encapsulatedresults = PMAPPROC_CALLIT(prog, vers, proc, encapsulatedargs);
* Calls the procedure on the local machine. If it is not registered,
* this procedure is quite; ie it does not return error information!!!
* This procedure only is supported on rpc/udp and calls via
* rpc/udp. This routine only passes null authentication parameters.
* This file has no interface to xdr routines for PMAPPROC_CALLIT.
*
* The service supports remote procedure calls on udp/ip or tcp/ip socket 111.
*/
 
#ifndef __RPC_PMAP_PROT_H
#define __RPC_PMAP_PROT_H
 
#include <sys/cdefs.h>
 
#define PMAPPORT ((u_short)111)
#define PMAPPROG ((u_long)100000)
#define PMAPVERS ((u_long)2)
#define PMAPVERS_PROTO ((u_long)2)
#define PMAPVERS_ORIG ((u_long)1)
#define PMAPPROC_NULL ((u_long)0)
#define PMAPPROC_SET ((u_long)1)
#define PMAPPROC_UNSET ((u_long)2)
#define PMAPPROC_GETPORT ((u_long)3)
#define PMAPPROC_DUMP ((u_long)4)
#define PMAPPROC_CALLIT ((u_long)5)
 
struct pmap {
long unsigned pm_prog;
long unsigned pm_vers;
long unsigned pm_prot;
long unsigned pm_port;
};
 
struct pmaplist {
struct pmap pml_map;
struct pmaplist *pml_next;
};
 
__BEGIN_DECLS
 
extern bool_t xdr_pmap (XDR *, struct pmap *);
extern bool_t xdr_pmaplist(XDR *, struct pmaplist **);
 
__END_DECLS
 
#endif
/pkgnet/trunk/watt32/inc/rpc/pmap_rmt.h
0,0 → 1,70
/*!\file rpc/pmap_rmt.h
* RPC portmapper definitions.
*/
 
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
* unrestricted use provided that this legend is included on all tape
* media and as a part of the software program in whole or part. Users
* may copy or modify Sun RPC without charge, but are not authorized
* to license or distribute it to anyone else except as part of a product or
* program developed by the user.
*
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
* WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
*
* Sun RPC is provided with no support and without any obligation on the
* part of Sun Microsystems, Inc. to assist in its use, correction,
* modification or enhancement.
*
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
* OR ANY PART THEREOF.
*
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
* or profits or other special, indirect and consequential damages, even if
* Sun has been advised of the possibility of such damages.
*
* Sun Microsystems, Inc.
* 2550 Garcia Avenue
* Mountain View, California 94043
*
* from: @(#)pmap_rmt.h 1.2 88/02/08 SMI
* from: @(#)pmap_rmt.h 2.1 88/07/29 4.0 RPCSRC
* $Id: pmap_rmt.h,v 1.4 1996/01/30 23:32:12 mpp Exp $
*/
 
/*
* Structures and XDR routines for parameters to and replies from
* the portmapper remote-call-service.
*
* Copyright (C) 1986, Sun Microsystems, Inc.
*/
 
#ifndef __RPC_PMAP_REMOTE_H
#define __RPC_PMAP_REMOTE_H
 
#include <sys/cdefs.h>
 
struct rmtcallargs {
u_long prog, vers, proc, arglen;
caddr_t args_ptr;
xdrproc_t xdr_args;
};
 
struct rmtcallres {
u_long *port_ptr;
u_long resultslen;
caddr_t results_ptr;
xdrproc_t xdr_results;
};
 
__BEGIN_DECLS
 
extern bool_t xdr_rmtcall_args (XDR *, struct rmtcallargs *);
extern bool_t xdr_rmtcallres (XDR *, struct rmtcallres *);
 
__END_DECLS
 
#endif
/pkgnet/trunk/watt32/inc/rpc/rpc.h
0,0 → 1,111
/*!\file rpc/rpc.h
* Main RPC header.
*/
 
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
* unrestricted use provided that this legend is included on all tape
* media and as a part of the software program in whole or part. Users
* may copy or modify Sun RPC without charge, but are not authorized
* to license or distribute it to anyone else except as part of a product or
* program developed by the user.
*
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
* WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
*
* Sun RPC is provided with no support and without any obligation on the
* part of Sun Microsystems, Inc. to assist in its use, correction,
* modification or enhancement.
*
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
* OR ANY PART THEREOF.
*
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
* or profits or other special, indirect and consequential damages, even if
* Sun has been advised of the possibility of such damages.
*
* Sun Microsystems, Inc.
* 2550 Garcia Avenue
* Mountain View, California 94043
*
* from: @(#)rpc.h 1.9 88/02/08 SMI
* from: @(#)rpc.h 2.4 89/07/11 4.0 RPCSRC
* $Id: rpc.h,v 1.5 1996/01/30 23:32:20 mpp Exp $
*/
 
/*
* rpc.h, Just includes the billions of rpc header files necessary to
* do remote procedure calling.
*
* Copyright (C) 1984, Sun Microsystems, Inc.
*/
#ifndef __RPC_RPC_H
#define __RPC_RPC_H
 
#include <rpc/types.h> /* some typedefs */
 
/* external data representation interfaces */
#include <rpc/xdr.h> /* generic (de)serializer */
 
/* Client side only authentication */
#include <rpc/auth.h> /* generic authenticator (client side) */
 
/* Client side (mostly) remote procedure call */
#include <rpc/clnt.h> /* generic rpc stuff */
 
/* semi-private protocol headers */
#include <rpc/rpc_msg.h> /* protocol for rpc messages */
#include <rpc/auth_uni.h> /* protocol for unix style cred */
 
/*
* Uncomment-out the next line if you are building the rpc library with
* DES Authentication (see the README file in the secure_rpc/ directory).
*/
#if 1
#include <rpc/auth_des.h> /* protocol for des style cred */
#endif
 
/* Server side only remote procedure callee */
#include <rpc/svc.h> /* service manager and multiplexer */
#include <rpc/svc_auth.h> /* service side authenticator */
 
/*
* COMMENT OUT THE NEXT INCLUDE (or add to the #ifndef) IF RUNNING ON
* A VERSION OF UNIX THAT USES SUN'S NFS SOURCE. These systems will
* already have the structures defined by <rpc/netdb.h> included in <netdb.h>.
*/
/* routines for parsing /etc/rpc */
 
struct rpcent {
char *r_name; /* name of server for this rpc program */
char **r_aliases; /* alias list */
long r_number; /* rpc program number. */
}; /* Must be 32-bit for small/large model */
 
__BEGIN_DECLS
 
extern struct rpcent *getrpcbyname (char *);
extern struct rpcent *getrpcbynumber(long);
extern struct rpcent *getrpcent (void);
extern void setrpcent (int);
extern void endrpcent (void);
 
#if defined(__MSDOS__) || defined(__TURBOC__) || defined(__HIGHC__) || \
defined(__DJGPP__) || defined(__WATCOMC__)
 
/* from RPC-DOS v0.1Alpha by Mike Durkin <mdurkin@tsoft.net> */
/* updated by G.Vanem <giva@bgnett.no> */
 
extern void rpc_init (void);
extern void set_user_id (u_long uid);
extern void set_group_id (u_long gid);
 
extern u_long __geteuid (void);
extern u_long __getegid (void);
#endif
 
__END_DECLS
 
#endif
/pkgnet/trunk/watt32/inc/rpc/rpc_msg.h
0,0 → 1,208
/*!\file rpc/rpc_msg.h
* RPC message definitions.
*/
 
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
* unrestricted use provided that this legend is included on all tape
* media and as a part of the software program in whole or part. Users
* may copy or modify Sun RPC without charge, but are not authorized
* to license or distribute it to anyone else except as part of a product or
* program developed by the user.
*
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
* WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
*
* Sun RPC is provided with no support and without any obligation on the
* part of Sun Microsystems, Inc. to assist in its use, correction,
* modification or enhancement.
*
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
* OR ANY PART THEREOF.
*
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
* or profits or other special, indirect and consequential damages, even if
* Sun has been advised of the possibility of such damages.
*
* Sun Microsystems, Inc.
* 2550 Garcia Avenue
* Mountain View, California 94043
*
* from: @(#)rpc_msg.h 1.7 86/07/16 SMI
* from: @(#)rpc_msg.h 2.1 88/07/29 4.0 RPCSRC
* $Id: rpc_msg.h,v 1.5 1996/01/30 23:32:24 mpp Exp $
*/
 
/*
* rpc_msg.h
* rpc message definition
*
* Copyright (C) 1984, Sun Microsystems, Inc.
*/
 
#ifndef __RPC_RPC_MSG_H
#define __RPC_RPCM_SG_H
 
#include <sys/cdefs.h>
 
#define RPC_MSG_VERSION ((u_long) 2)
#define RPC_SERVICE_PORT ((u_short) 2048)
 
/*
* Bottom up definition of an rpc message.
* NOTE: call and reply use the same overall stuct but
* different parts of unions within it.
*/
 
enum msg_type {
CALL=0,
REPLY=1
};
 
enum reply_stat {
MSG_ACCEPTED=0,
MSG_DENIED=1
};
 
enum accept_stat {
SUCCESS=0,
PROG_UNAVAIL=1,
PROG_MISMATCH=2,
PROC_UNAVAIL=3,
GARBAGE_ARGS=4,
SYSTEM_ERR=5
};
 
enum reject_stat {
RPC_MISMATCH=0,
AUTH_ERROR=1
};
 
/*
* Reply part of an rpc exchange
*/
 
#include <sys/packon.h>
 
/*
* Reply to an rpc request that was accepted by the server.
* Note: there could be an error even though the request was
* accepted.
*/
struct accepted_reply {
struct opaque_auth ar_verf;
enum accept_stat ar_stat;
union {
struct {
u_long low;
u_long high;
} AR_versions;
struct {
caddr_t where;
xdrproc_t proc;
} AR_results;
/* and many other null cases */
} ru;
#define ar_results ru.AR_results
#define ar_vers ru.AR_versions
};
 
/*
* Reply to an rpc request that was rejected by the server.
*/
struct rejected_reply {
enum reject_stat rj_stat;
union {
struct {
u_long low;
u_long high;
} RJ_versions;
enum auth_stat RJ_why; /* why authentication did not work */
} ru;
#define rj_vers ru.RJ_versions
#define rj_why ru.RJ_why
};
 
/*
* Body of a reply to an rpc request.
*/
struct reply_body {
enum reply_stat rp_stat;
union {
struct accepted_reply RP_ar;
struct rejected_reply RP_dr;
} ru;
#define rp_acpt ru.RP_ar
#define rp_rjct ru.RP_dr
};
 
/*
* Body of an rpc request call.
*/
struct call_body {
u_long cb_rpcvers; /* must be equal to two */
u_long cb_prog;
u_long cb_vers;
u_long cb_proc;
struct opaque_auth cb_cred;
struct opaque_auth cb_verf; /* protocol specific - provided by client */
};
 
/*
* The rpc message
*/
struct rpc_msg {
u_long rm_xid;
enum msg_type rm_direction;
union {
struct call_body RM_cmb;
struct reply_body RM_rmb;
} ru;
#define rm_call ru.RM_cmb
#define rm_reply ru.RM_rmb
};
#define acpted_rply ru.RM_rmb.ru.RP_ar
#define rjcted_rply ru.RM_rmb.ru.RP_dr
 
#include <sys/packoff.h>
 
__BEGIN_DECLS
 
/*
* XDR routine to handle a rpc message.
* xdr_callmsg(xdrs, cmsg)
* XDR *xdrs;
* struct rpc_msg *cmsg;
*/
extern bool_t xdr_callmsg (XDR *, struct rpc_msg *);
 
/*
* XDR routine to pre-serialize the static part of a rpc message.
* xdr_callhdr(xdrs, cmsg)
* XDR *xdrs;
* struct rpc_msg *cmsg;
*/
extern bool_t xdr_callhdr (XDR *, struct rpc_msg *);
 
/*
* XDR routine to handle a rpc reply.
* xdr_replymsg(xdrs, rmsg)
* XDR *xdrs;
* struct rpc_msg *rmsg;
*/
extern bool_t xdr_replymsg (XDR *, struct rpc_msg *);
 
/*
* Fills in the error part of a reply message.
* _seterr_reply(msg, error)
* struct rpc_msg *msg;
* struct rpc_err *error;
*/
struct rpc_err;
extern void _seterr_reply (struct rpc_msg *, struct rpc_err *);
 
__END_DECLS
 
#endif
/pkgnet/trunk/watt32/inc/rpc/svc.h
0,0 → 1,291
/*!\file rpc/svc.h
* RPC server-side interface.
*/
 
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
* unrestricted use provided that this legend is included on all tape
* media and as a part of the software program in whole or part. Users
* may copy or modify Sun RPC without charge, but are not authorized
* to license or distribute it to anyone else except as part of a product or
* program developed by the user.
*
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
* WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
*
* Sun RPC is provided with no support and without any obligation on the
* part of Sun Microsystems, Inc. to assist in its use, correction,
* modification or enhancement.
*
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
* OR ANY PART THEREOF.
*
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
* or profits or other special, indirect and consequential damages, even if
* Sun has been advised of the possibility of such damages.
*
* Sun Microsystems, Inc.
* 2550 Garcia Avenue
* Mountain View, California 94043
*
* from: @(#)svc.h 1.20 88/02/08 SMI
* from: @(#)svc.h 2.2 88/07/29 4.0 RPCSRC
* $Id: svc.h,v 1.5 1996/01/30 23:32:29 mpp Exp $
*/
 
/*
* svc.h, Server-side remote procedure call interface.
*
* Copyright (C) 1984, Sun Microsystems, Inc.
*/
 
#ifndef __RPC_SVC_H
#define __RPC_SVC_H
 
#ifndef __SYS_CDEFS_H
#include <sys/cdefs.h>
#endif
 
/*
* This interface must manage two items concerning remote procedure calling:
*
* 1) An arbitrary number of transport connections upon which rpc requests
* are received. The two most notable transports are TCP and UDP; they are
* created and registered by routines in svc_tcp.c and svc_udp.c, respectively;
* they in turn call xprt_register and xprt_unregister.
*
* 2) An arbitrary number of locally registered services. Services are
* described by the following four data: program number, version number,
* "service dispatch" function, a transport handle, and a boolean that
* indicates whether or not the exported program should be registered with a
* local binder service; if true the program's number and version and the
* port number from the transport handle are registered with the binder.
* These data are registered with the rpc svc system via svc_register.
*
* A service's dispatch function is called whenever an rpc request comes in
* on a transport. The request's program and version numbers must match
* those of the registered service. The dispatch function is passed two
* parameters, struct svc_req * and SVCXPRT *, defined below.
*/
 
enum xprt_stat {
XPRT_DIED,
XPRT_MOREREQS,
XPRT_IDLE
};
 
/*
* Server side transport handle
*/
typedef struct {
int xp_sock;
u_short xp_port; /* associated port number */
struct xp_ops {
bool_t (*xp_recv)(); /* receive incoming requests */
enum xprt_stat (*xp_stat)(); /* get transport status */
bool_t (*xp_getargs)(); /* get arguments */
bool_t (*xp_reply)(); /* send reply */
bool_t (*xp_freeargs)();/* free mem allocated for args */
void (*xp_destroy)(); /* destroy this struct */
} *xp_ops;
int xp_addrlen; /* length of remote address */
struct sockaddr_in xp_raddr; /* remote address */
struct opaque_auth xp_verf; /* raw response verifier */
caddr_t xp_p1; /* private */
caddr_t xp_p2; /* private */
} SVCXPRT;
 
/*
* Approved way of getting address of caller
*/
#define svc_getcaller(x) (&(x)->xp_raddr)
 
/*
* Operations defined on an SVCXPRT handle
*
* SVCXPRT *xprt;
* struct rpc_msg *msg;
* xdrproc_t xargs;
* caddr_t argsp;
*/
#define SVC_RECV(xprt, msg) \
(*(xprt)->xp_ops->xp_recv)((xprt), (msg))
#define svc_recv(xprt, msg) \
(*(xprt)->xp_ops->xp_recv)((xprt), (msg))
 
#define SVC_STAT(xprt) \
(*(xprt)->xp_ops->xp_stat)(xprt)
#define svc_stat(xprt) \
(*(xprt)->xp_ops->xp_stat)(xprt)
 
#define SVC_GETARGS(xprt, xargs, argsp) \
(*(xprt)->xp_ops->xp_getargs)((xprt), (xargs), (argsp))
#define svc_getargs(xprt, xargs, argsp) \
(*(xprt)->xp_ops->xp_getargs)((xprt), (xargs), (argsp))
 
#define SVC_REPLY(xprt, msg) \
(*(xprt)->xp_ops->xp_reply) ((xprt), (msg))
#define svc_reply(xprt, msg) \
(*(xprt)->xp_ops->xp_reply) ((xprt), (msg))
 
#define SVC_FREEARGS(xprt, xargs, argsp) \
(*(xprt)->xp_ops->xp_freeargs)((xprt), (xargs), (argsp))
#define svc_freeargs(xprt, xargs, argsp) \
(*(xprt)->xp_ops->xp_freeargs)((xprt), (xargs), (argsp))
 
#define SVC_DESTROY(xprt) \
(*(xprt)->xp_ops->xp_destroy)(xprt)
#define svc_destroy(xprt) \
(*(xprt)->xp_ops->xp_destroy)(xprt)
 
 
/*
* Service request
*/
struct svc_req {
u_long rq_prog; /* service program number */
u_long rq_vers; /* service protocol version */
u_long rq_proc; /* the desired procedure */
struct opaque_auth rq_cred; /* raw creds from the wire */
caddr_t rq_clntcred; /* read only cooked cred */
SVCXPRT *rq_xprt; /* associated transport */
};
 
__BEGIN_DECLS
 
/*
* Service registration
*
* svc_register(xprt, prog, vers, dispatch, protocol)
* SVCXPRT *xprt;
* u_long prog;
* u_long vers;
* void (*dispatch)();
* int protocol; // like TCP or UDP, zero means do not register
*/
extern bool_t svc_register (SVCXPRT *, u_long, u_long, void (*)(), int);
 
/*
* Service un-registration
*
* svc_unregister(prog, vers)
* u_long prog;
* u_long vers;
*/
extern void svc_unregister (u_long, u_long);
 
/*
* Transport registration.
*
* xprt_register(xprt)
* SVCXPRT *xprt;
*/
extern void xprt_register (SVCXPRT *);
 
/*
* Transport un-register
*
* xprt_unregister(xprt)
* SVCXPRT *xprt;
*/
extern void xprt_unregister (SVCXPRT *);
 
 
 
/*
* When the service routine is called, it must first check to see if it
* knows about the procedure; if not, it should call svcerr_noproc
* and return. If so, it should deserialize its arguments via
* SVC_GETARGS (defined above). If the deserialization does not work,
* svcerr_decode should be called followed by a return. Successful
* decoding of the arguments should be followed the execution of the
* procedure's code and a call to svc_sendreply.
*
* Also, if the service refuses to execute the procedure due to too-
* weak authentication parameters, svcerr_weakauth should be called.
* Note: do not confuse access-control failure with weak authentication!
*
* NB: In pure implementations of rpc, the caller always waits for a reply
* msg. This message is sent when svc_sendreply is called.
* Therefore pure service implementations should always call
* svc_sendreply even if the function logically returns void; use
* xdr.h - xdr_void for the xdr routine. HOWEVER, tcp based rpc allows
* for the abuse of pure rpc via batched calling or pipelining. In the
* case of a batched call, svc_sendreply should NOT be called since
* this would send a return message, which is what batching tries to avoid.
* It is the service/protocol writer's responsibility to know which calls are
* batched and which are not. Warning: responding to batch calls may
* deadlock the caller and server processes!
*/
 
extern bool_t svc_sendreply (SVCXPRT *, xdrproc_t, char *);
extern void svcerr_decode (SVCXPRT *);
extern void svcerr_weakauth (SVCXPRT *);
extern void svcerr_noproc (SVCXPRT *);
extern void svcerr_progvers (SVCXPRT *, u_long, u_long);
extern void svcerr_auth (SVCXPRT *, enum auth_stat);
extern void svcerr_noprog (SVCXPRT *);
extern void svcerr_systemerr(SVCXPRT *);
 
/*
* Lowest level dispatching -OR- who owns this process anyway.
* Somebody has to wait for incoming requests and then call the correct
* service routine. The routine svc_run does infinite waiting; i.e.,
* svc_run never returns.
* Since another (co-existant) package may wish to selectively wait for
* incoming calls or other events outside of the rpc architecture, the
* routine svc_getreq is provided. It must be passed readfds, the
* "in-place" results of a select system call (see select, section 2).
*/
 
/*
* Global keeper of rpc service descriptors in use
* dynamic; must be inspected before each call to select
*/
#ifdef FD_SETSIZE
extern void svc_getreqset (fd_set *);
extern fd_set svc_fdset;
#define svc_fds svc_fdset.fds_bits[0] /* compatibility */
#else
extern int svc_fds;
#endif
 
/*
* a small program implemented by the svc_rpc implementation itself;
* also see clnt.h for protocol numbers.
*/
extern void rpctest_service();
extern void svc_getreq (int);
extern void svc_run (void);
 
/*
* Socket to use on svcxxx_create call to get default socket
*/
#define RPC_ANYSOCK -1
 
/*
* These are the existing service side transport implementations
*/
 
/*
* Memory based rpc for testing and timing.
*/
extern SVCXPRT *svcraw_create (void);
 
 
/*
* Udp based rpc.
*/
extern SVCXPRT *svcudp_create (int);
extern SVCXPRT *svcudp_bufcreate (int, u_int, u_int);
 
/*
* Tcp based rpc.
*/
extern SVCXPRT *svctcp_create (int, u_int, u_int);
 
__END_DECLS
 
#endif
/pkgnet/trunk/watt32/inc/rpc/svc_auth.h
0,0 → 1,56
/*!\file rpc/svc_auth.h
* RPC authentication (server-side).
*/
 
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
* unrestricted use provided that this legend is included on all tape
* media and as a part of the software program in whole or part. Users
* may copy or modify Sun RPC without charge, but are not authorized
* to license or distribute it to anyone else except as part of a product or
* program developed by the user.
*
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
* WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
*
* Sun RPC is provided with no support and without any obligation on the
* part of Sun Microsystems, Inc. to assist in its use, correction,
* modification or enhancement.
*
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
* OR ANY PART THEREOF.
*
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
* or profits or other special, indirect and consequential damages, even if
* Sun has been advised of the possibility of such damages.
*
* Sun Microsystems, Inc.
* 2550 Garcia Avenue
* Mountain View, California 94043
*
* from: @(#)svc_auth.h 1.6 86/07/16 SMI
* from: @(#)svc_auth.h 2.1 88/07/29 4.0 RPCSRC
* $Id: svc_auth.h,v 1.4 1996/01/30 23:32:36 mpp Exp $
*/
 
/*
* svc_auth.h, Service side of rpc authentication.
*
* Copyright (C) 1984, Sun Microsystems, Inc.
*/
 
#ifndef __RPC_SVC_AUTH_H
#define __RPC_SVC_AUTH_H
 
/*
* Server side authenticator
*/
__BEGIN_DECLS
 
extern enum auth_stat _authenticate (struct svc_req *, struct rpc_msg *);
 
__END_DECLS
 
#endif
/pkgnet/trunk/watt32/inc/rpc/types.h
0,0 → 1,70
/*!\file rpc/types.h
* RPC type definitions.
*/
 
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
* unrestricted use provided that this legend is included on all tape
* media and as a part of the software program in whole or part. Users
* may copy or modify Sun RPC without charge, but are not authorized
* to license or distribute it to anyone else except as part of a product or
* program developed by the user.
*
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
* WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
*
* Sun RPC is provided with no support and without any obligation on the
* part of Sun Microsystems, Inc. to assist in its use, correction,
* modification or enhancement.
*
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
* OR ANY PART THEREOF.
*
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
* or profits or other special, indirect and consequential damages, even if
* Sun has been advised of the possibility of such damages.
*
* Sun Microsystems, Inc.
* 2550 Garcia Avenue
* Mountain View, California 94043
*
* from: @(#)types.h 1.18 87/07/24 SMI
* from: @(#)types.h 2.3 88/08/15 4.0 RPCSRC
* $Id: types.h,v 1.4 1996/01/30 23:32:39 mpp Exp $
*/
 
/*
* Rpc additions to <sys/wtypes.h>
*/
#ifndef __RPC_TYPES_H
#define __RPC_TYPES_H
 
#define bool_t int
#define enum_t int
#define __dontcare__ -1
 
#ifndef FALSE
# define FALSE (0)
#endif
#ifndef TRUE
# define TRUE (1)
#endif
 
#define mem_alloc(bsize) malloc(bsize)
#define mem_free(ptr, bsize) free(ptr)
 
#include <sys/wtypes.h>
#include <sys/wtime.h>
#include <netinet/in.h>
 
#ifndef INADDR_LOOPBACK
#define INADDR_LOOPBACK (u_long)0x7F000001
#endif
 
#ifndef MAXHOSTNAMELEN
#define MAXHOSTNAMELEN 64
#endif
 
#endif
/pkgnet/trunk/watt32/inc/rpc/xdr.h
0,0 → 1,311
/*!\file rpc/xdr.h
* eXternal Data Representation.
*/
 
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
* unrestricted use provided that this legend is included on all tape
* media and as a part of the software program in whole or part. Users
* may copy or modify Sun RPC without charge, but are not authorized
* to license or distribute it to anyone else except as part of a product or
* program developed by the user.
*
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
* WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
*
* Sun RPC is provided with no support and without any obligation on the
* part of Sun Microsystems, Inc. to assist in its use, correction,
* modification or enhancement.
*
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
* OR ANY PART THEREOF.
*
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
* or profits or other special, indirect and consequential damages, even if
* Sun has been advised of the possibility of such damages.
*
* Sun Microsystems, Inc.
* 2550 Garcia Avenue
* Mountain View, California 94043
*
* from: @(#)xdr.h 1.19 87/04/22 SMI
* from: @(#)xdr.h 2.2 88/07/29 4.0 RPCSRC
* $Id: xdr.h,v 1.4 1996/01/30 23:32:45 mpp Exp $
*/
 
/*
* xdr.h, External Data Representation Serialization Routines.
*
* Copyright (C) 1984, Sun Microsystems, Inc.
*/
 
#ifndef __RPC_XDR_H
#define __RPC_XDR_H
 
#ifndef __SYS_CDEFS_H
#include <sys/cdefs.h>
#endif
 
/*
* XDR provides a conventional way for converting between C data
* types and an external bit-string representation. Library supplied
* routines provide for the conversion on built-in C data types. These
* routines and utility routines defined here are used to help implement
* a type encode/decode routine for each user-defined type.
*
* Each data type provides a single procedure which takes two arguments:
*
* bool_t
* xdrproc(xdrs, argresp)
* XDR *xdrs;
* <type> *argresp;
*
* xdrs is an instance of a XDR handle, to which or from which the data
* type is to be converted. argresp is a pointer to the structure to be
* converted. The XDR handle contains an operation field which indicates
* which of the operations (ENCODE, DECODE * or FREE) is to be performed.
*
* XDR_DECODE may allocate space if the pointer argresp is null. This
* data can be freed with the XDR_FREE operation.
*
* We write only one procedure per data type to make it easy
* to keep the encode and decode procedures for a data type consistent.
* In many cases the same code performs all operations on a user defined type,
* because all the hard work is done in the component type routines.
* decode as a series of calls on the nested data types.
*/
 
/*
* Xdr operations. XDR_ENCODE causes the type to be encoded into the
* stream. XDR_DECODE causes the type to be extracted from the stream.
* XDR_FREE can be used to release the space allocated by an XDR_DECODE
* request.
*/
enum xdr_op {
XDR_ENCODE = 0,
XDR_DECODE = 1,
XDR_FREE = 2
};
 
/*
* This is the number of bytes per unit of external data.
*/
#define BYTES_PER_XDR_UNIT (4)
#define RNDUP(x) ((((x) + BYTES_PER_XDR_UNIT - 1) / BYTES_PER_XDR_UNIT) \
* BYTES_PER_XDR_UNIT)
 
/*
* A xdrproc_t exists for each data type which is to be encoded or decoded.
*
* The second argument to the xdrproc_t is a pointer to an opaque pointer.
* The opaque pointer generally points to a structure of the data type
* to be decoded. If this pointer is 0, then the type routines should
* allocate dynamic storage of the appropriate size and return it.
* bool_t (*xdrproc_t)(XDR *, caddr_t *);
*/
typedef bool_t (*xdrproc_t)();
 
/*
* The XDR handle.
* Contains operation which is being applied to the stream,
* an operations vector for the particular implementation (e.g. see xdr_mem.c),
* and two private fields for the use of the particular implementation.
*/
typedef struct {
enum xdr_op x_op; /* operation; fast additional param */
struct xdr_ops {
bool_t (*x_getlong)(); /* get a long from underlying stream */
bool_t (*x_putlong)(); /* put a long to " */
bool_t (*x_getbytes)();/* get some bytes from " */
bool_t (*x_putbytes)();/* put some bytes to " */
u_int (*x_getpostn)();/* returns bytes off from beginning */
bool_t (*x_setpostn)();/* lets you reposition the stream */
long * (*x_inline)(); /* buf quick ptr to buffered data */
void (*x_destroy)(); /* free privates of this xdr_stream */
} *x_ops;
caddr_t x_public; /* users' data */
caddr_t x_private; /* pointer to private data */
caddr_t x_base; /* private used for position info */
int x_handy; /* extra private word */
} XDR;
 
/*
* Operations defined on a XDR handle
*
* XDR *xdrs;
* long *longp;
* caddr_t addr;
* u_int len;
* u_int pos;
*/
#define XDR_GETLONG(xdrs, longp) \
(*(xdrs)->x_ops->x_getlong)(xdrs, longp)
#define xdr_getlong(xdrs, longp) \
(*(xdrs)->x_ops->x_getlong)(xdrs, longp)
 
#define XDR_PUTLONG(xdrs, longp) \
(*(xdrs)->x_ops->x_putlong)(xdrs, longp)
#define xdr_putlong(xdrs, longp) \
(*(xdrs)->x_ops->x_putlong)(xdrs, longp)
 
#define XDR_GETBYTES(xdrs, addr, len) \
(*(xdrs)->x_ops->x_getbytes)(xdrs, addr, len)
#define xdr_getbytes(xdrs, addr, len) \
(*(xdrs)->x_ops->x_getbytes)(xdrs, addr, len)
 
#define XDR_PUTBYTES(xdrs, addr, len) \
(*(xdrs)->x_ops->x_putbytes)(xdrs, addr, len)
#define xdr_putbytes(xdrs, addr, len) \
(*(xdrs)->x_ops->x_putbytes)(xdrs, addr, len)
 
#define XDR_GETPOS(xdrs) \
(*(xdrs)->x_ops->x_getpostn)(xdrs)
#define xdr_getpos(xdrs) \
(*(xdrs)->x_ops->x_getpostn)(xdrs)
 
#define XDR_SETPOS(xdrs, pos) \
(*(xdrs)->x_ops->x_setpostn)(xdrs, pos)
#define xdr_setpos(xdrs, pos) \
(*(xdrs)->x_ops->x_setpostn)(xdrs, pos)
 
#define XDR_INLINE(xdrs, len) \
(*(xdrs)->x_ops->x_inline)(xdrs, len)
#define xdr_inline(xdrs, len) \
(*(xdrs)->x_ops->x_inline)(xdrs, len)
 
#define XDR_DESTROY(xdrs) \
if ((xdrs)->x_ops->x_destroy) \
(*(xdrs)->x_ops->x_destroy)(xdrs)
#define xdr_destroy(xdrs) \
if ((xdrs)->x_ops->x_destroy) \
(*(xdrs)->x_ops->x_destroy)(xdrs)
 
/*
* Support struct for discriminated unions.
* You create an array of xdrdiscrim structures, terminated with
* a entry with a null procedure pointer. The xdr_union routine gets
* the discriminant value and then searches the array of structures
* for a matching value. If a match is found the associated xdr routine
* is called to handle that part of the union. If there is
* no match, then a default routine may be called.
* If there is no match and no default routine it is an error.
*/
#define NULL_xdrproc_t ((xdrproc_t)0L)
struct xdr_discrim {
int value;
xdrproc_t proc;
};
 
/*
* In-line routines for fast encode/decode of primitive data types.
* Caveat emptor: these use single memory cycles to get the
* data from the underlying buffer, and will fail to operate
* properly if the data is not aligned. The standard way to use these
* is to say:
* if ((buf = XDR_INLINE(xdrs, count)) == NULL)
* return (FALSE);
* <<< macro calls >>>
* where ``count'' is the number of bytes of data occupied
* by the primitive data types.
*
* N.B. and frozen for all time: each data type here uses 4 bytes
* of external representation.
*/
#define IXDR_GET_LONG(buf) ((long)ntohl((u_long)*(buf)++))
#define IXDR_PUT_LONG(buf, v) (*(buf)++ = (long)htonl((u_long)v))
 
#define IXDR_GET_BOOL(buf) ((bool_t)IXDR_GET_LONG(buf))
#define IXDR_GET_ENUM(buf, t) ((t)IXDR_GET_LONG(buf))
#define IXDR_GET_U_LONG(buf) ((u_long)IXDR_GET_LONG(buf))
#define IXDR_GET_SHORT(buf) ((short)IXDR_GET_LONG(buf))
#define IXDR_GET_U_SHORT(buf) ((u_short)IXDR_GET_LONG(buf))
 
#define IXDR_PUT_BOOL(buf, v) IXDR_PUT_LONG((buf), ((long)(v)))
#define IXDR_PUT_ENUM(buf, v) IXDR_PUT_LONG((buf), ((long)(v)))
#define IXDR_PUT_U_LONG(buf, v) IXDR_PUT_LONG((buf), ((long)(v)))
#define IXDR_PUT_SHORT(buf, v) IXDR_PUT_LONG((buf), ((long)(v)))
#define IXDR_PUT_U_SHORT(buf, v) IXDR_PUT_LONG((buf), ((long)(v)))
 
/*
* These are the "generic" xdr routines.
*/
 
__BEGIN_DECLS
 
extern bool_t xdr_void (XDR *, caddr_t);
extern bool_t xdr_int (XDR *, int *);
extern bool_t xdr_u_int (XDR *, u_int *);
extern bool_t xdr_long (XDR *, long *);
extern bool_t xdr_u_long (XDR *, u_long *);
extern bool_t xdr_short (XDR *, short *);
extern bool_t xdr_u_short (XDR *, u_short *);
extern bool_t xdr_bool (XDR *, bool_t *);
extern bool_t xdr_enum (XDR *, enum_t *);
extern bool_t xdr_array (XDR *, char **, u_int *, u_int, u_int, xdrproc_t);
extern bool_t xdr_bytes (XDR *, char **, u_int *, u_int);
extern bool_t __xdr_opaque (XDR *, caddr_t, u_int);
extern bool_t xdr_string (XDR *, char **, u_int);
extern bool_t xdr_union (XDR *, enum_t *, char *, struct xdr_discrim *, xdrproc_t);
extern bool_t xdr_char (XDR *, char *);
extern bool_t xdr_u_char (XDR *, char *);
extern bool_t xdr_vector (XDR *, char *, u_int, u_int, xdrproc_t);
extern bool_t xdr_float (XDR *, float *);
extern bool_t xdr_double (XDR *, double *);
extern bool_t xdr_reference (XDR *, caddr_t *, u_int, xdrproc_t);
extern bool_t xdr_pointer (XDR *, caddr_t *, u_int, xdrproc_t);
extern bool_t xdr_wrapstring (XDR *, char **);
extern void xdr_free (xdrproc_t, char *);
 
/*
* Hack to avoid missing typecast from rpcgen when
* producing xdr_opaque()
*/
#define xdr_opaque(xdr,obj,size) __xdr_opaque(xdr,(caddr_t)obj,size)
 
__END_DECLS
 
/*
* Common opaque bytes objects used by many rpc protocols;
* declared here due to commonality.
*/
#define MAX_NETOBJ_SZ 1024
struct netobj {
u_int n_len;
char *n_bytes;
};
typedef struct netobj netobj;
 
/*
* These are the public routines for the various implementations of
* xdr streams.
*/
 
__BEGIN_DECLS
 
extern bool_t xdr_netobj (XDR *, struct netobj *);
 
/* XDR using memory buffers */
extern void xdrmem_create (XDR *, char *, u_int, enum xdr_op);
 
#if defined(__STDIO_H) || defined(_STDIO_H) || defined(__dj_include_stdio_h_)
/* XDR using stdio library */
extern void xdrstdio_create (XDR *, FILE *, enum xdr_op);
#endif
 
/* XDR pseudo records for tcp */
extern void xdrrec_create (XDR *, u_int, u_int, char *, int (*)(), int (*)());
 
/* make end of xdr record */
extern bool_t xdrrec_endofrecord (XDR *, int);
 
/* move to beginning of next record */
extern bool_t xdrrec_skiprecord (XDR *);
 
/* true if no more input */
extern bool_t xdrrec_eof (XDR *);
 
__END_DECLS
 
#endif
/pkgnet/trunk/watt32/inc/rpcsvc/yp_prot.h
0,0 → 1,334
/*!\file rpcsvc/yp_prot.h
* RPC service - Yellow Pages protocol definitions.
*/
 
/*
* Copyright (c) 1992/3 Theo de Raadt <deraadt@fsa.ca>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote
* products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: yp_prot.h,v 1.3 1996/01/30 23:33:04 mpp Exp $
*/
 
#ifndef __RPCSVC_YP_PROT_H
#define __RPCSVC_YP_PROT_H
 
/*
* YPSERV PROTOCOL:
*
* ypserv supports the following procedures:
*
* YPPROC_NULL takes (void), returns (void).
* called to check if server is alive.
* YPPROC_DOMAIN takes (char *), returns (bool_t).
* true if ypserv serves the named domain.
* YPPROC_DOMAIN_NOACK takes (char *), returns (bool_t).
* true if ypserv serves the named domain.
* used for broadcasts, does not ack if ypserv
* doesn't handle named domain.
* YPPROC_MATCH takes (struct ypreq_key), returns (struct ypresp_val)
* does a lookup.
* YPPROC_FIRST takes (struct ypreq_nokey) returns (ypresp_key_val).
* gets the first key/datum from the map.
* YPPROC_NEXT takes (struct ypreq_key) returns (ypresp_key_val).
* gets the next key/datum from the map.
* YPPROC_XFR takes (struct ypreq_xfr), returns (void).
* tells ypserv to check if there is a new version of
* the map.
* YPPROC_CLEAR takes (void), returns (void).
* tells ypserv to flush it's file cache, so that
* newly transferred files will get read.
* YPPROC_ALL takes (struct ypreq_nokey), returns (bool_t and
* struct ypresp_key_val).
* returns an array of data, with the bool_t being
* false on the last datum. read the source, it's
* convoluted.
* YPPROC_MASTER takes (struct ypreq_nokey), returns (ypresp_master).
* YPPROC_ORDER takes (struct ypreq_nokey), returns (ypresp_order).
* YPPROC_MAPLIST takes (char *), returns (struct ypmaplist *).
*/
 
#ifndef BOOL_DEFINED
typedef u_int bool;
#define BOOL_DEFINED
#endif
 
bool_t xdr_datum();
bool_t xdr_ypdomain_wrap_string();
bool_t xdr_ypmap_wrap_string();
bool_t xdr_ypreq_key();
bool_t xdr_ypreq_nokey();
bool_t xdr_ypreq_xfr();
bool_t xdr_ypresp_val();
bool_t xdr_ypresp_key_val();
bool_t xdr_ypbind_resp();
bool_t xdr_ypbind_setdom();
bool_t xdr_yp_inaddr();
bool_t xdr_ypmap_parms();
bool_t xdr_ypowner_wrap_string();
bool_t xdr_yppushresp_xfr();
bool_t xdr_ypresp_order();
bool_t xdr_ypresp_master();
bool_t xdr_ypall();
bool_t xdr_ypresp_maplist();
 
/* Program and version symbols, magic numbers */
 
#define YPPROG ((u_long)100004)
#define YPVERS ((u_long)2)
#define YPVERS_ORIG ((u_long)1)
#define YPMAXRECORD ((u_long)1024)
#define YPMAXDOMAIN ((u_long)64)
#define YPMAXMAP ((u_long)64)
#define YPMAXPEER ((u_long)256)
 
/*
* I don't know if anything of sun's depends on this, or if they
* simply defined it so that their own code wouldn't try to send
* packets over the ethernet MTU. This YP code doesn't use it.
*/
#define YPMSGSZ 1600
 
#ifndef DATUM
typedef struct {
char *dptr;
int dsize;
} datum;
#define DATUM
#endif
 
struct ypmap_parms {
char *domain;
char *map;
u_long ordernum;
char *owner;
};
 
struct ypreq_key {
char *domain;
char *map;
datum keydat;
};
 
struct ypreq_nokey {
char *domain;
char *map;
};
 
struct ypreq_xfr {
struct ypmap_parms map_parms;
u_long transid;
u_long proto;
u_short port;
};
#define ypxfr_domain map_parms.domain
#define ypxfr_map map_parms.map
#define ypxfr_ordernum map_parms.ordernum
#define ypxfr_owner map_parms.owner
 
struct ypresp_val {
u_long status;
datum valdat;
};
 
struct ypresp_key_val {
u_long status;
datum keydat;
datum valdat;
};
 
struct ypresp_master {
u_long status;
char *master;
};
 
struct ypresp_order {
u_long status;
u_long ordernum;
};
 
struct ypmaplist {
char ypml_name[YPMAXMAP + 1];
struct ypmaplist *ypml_next;
};
 
struct ypresp_maplist {
u_long status;
struct ypmaplist *list;
};
 
/* ypserv procedure numbers */
#define YPPROC_NULL ((u_long)0)
#define YPPROC_DOMAIN ((u_long)1)
#define YPPROC_DOMAIN_NONACK ((u_long)2)
#define YPPROC_MATCH ((u_long)3)
#define YPPROC_FIRST ((u_long)4)
#define YPPROC_NEXT ((u_long)5)
#define YPPROC_XFR ((u_long)6)
#define YPPROC_CLEAR ((u_long)7)
#define YPPROC_ALL ((u_long)8)
#define YPPROC_MASTER ((u_long)9)
#define YPPROC_ORDER ((u_long)10)
#define YPPROC_MAPLIST ((u_long)11)
 
/* ypserv procedure return status values */
#define YP_TRUE ((long)1) /* general purpose success code */
#define YP_NOMORE ((long)2) /* no more entries in map */
#define YP_FALSE ((long)0) /* general purpose failure code */
#define YP_NOMAP ((long)-1) /* no such map in domain */
#define YP_NODOM ((long)-2) /* domain not supported */
#define YP_NOKEY ((long)-3) /* no such key in map */
#define YP_BADOP ((long)-4) /* invalid operation */
#define YP_BADDB ((long)-5) /* server data base is bad */
#define YP_YPERR ((long)-6) /* YP server error */
#define YP_BADARGS ((long)-7) /* request arguments bad */
#define YP_VERS ((long)-8) /* YP server version mismatch */
 
/*
* Sun's header file says:
* "Domain binding data structure, used by ypclnt package and ypserv modules.
* Users of the ypclnt package (or of this protocol) don't HAVE to know about
* it, but it must be available to users because _yp_dobind is a public
* interface."
*
* This is totally bogus! Nowhere else does Sun state that _yp_dobind() is
* a public interface, and I don't know any reason anyone would want to call
* it. But, just in case anyone does actually expect it to be available..
* we provide this.. exactly as Sun wants it.
*/
struct dom_binding {
struct dom_binding *dom_pnext;
char dom_domain[YPMAXDOMAIN + 1];
struct sockaddr_in dom_server_addr;
u_short dom_server_port;
int dom_socket;
CLIENT *dom_client;
u_short dom_local_port;
long dom_vers;
};
 
/*
* YPBIND PROTOCOL:
*
* ypbind supports the following procedures:
*
* YPBINDPROC_NULL takes (void), returns (void).
* to check if ypbind is running.
* YPBINDPROC_DOMAIN takes (char *), returns (struct ypbind_resp).
* requests that ypbind start to serve the
* named domain (if it doesn't already)
* YPBINDPROC_SETDOM takes (struct ypbind_setdom), returns (void).
* used by ypset.
*/
 
#define YPBINDPROG ((u_long)100007)
#define YPBINDVERS ((u_long)2)
#define YPBINDVERS_ORIG ((u_long)1)
 
/* ypbind procedure numbers */
#define YPBINDPROC_NULL ((u_long)0)
#define YPBINDPROC_DOMAIN ((u_long)1)
#define YPBINDPROC_SETDOM ((u_long)2)
 
/* error code in ypbind_resp.ypbind_status */
enum ypbind_resptype {
YPBIND_SUCC_VAL = 1,
YPBIND_FAIL_VAL = 2
};
 
/* network order, of course */
struct ypbind_binding {
struct in_addr ypbind_binding_addr;
u_short ypbind_binding_port;
};
 
struct ypbind_resp {
enum ypbind_resptype ypbind_status;
union {
u_long ypbind_error;
struct ypbind_binding ypbind_bindinfo;
} ypbind_respbody;
};
 
/* error code in ypbind_resp.ypbind_respbody.ypbind_error */
#define YPBIND_ERR_ERR 1 /* internal error */
#define YPBIND_ERR_NOSERV 2 /* no bound server for passed domain */
#define YPBIND_ERR_RESC 3 /* system resource allocation failure */
 
/*
* Request data structure for ypbind "Set domain" procedure.
*/
struct ypbind_setdom {
char ypsetdom_domain[YPMAXDOMAIN + 1];
struct ypbind_binding ypsetdom_binding;
u_short ypsetdom_vers;
};
#define ypsetdom_addr ypsetdom_binding.ypbind_binding_addr
#define ypsetdom_port ypsetdom_binding.ypbind_binding_port
 
/*
* YPPUSH PROTOCOL:
*
* Sun says:
* "Protocol between clients (ypxfr, only) and yppush
* yppush speaks a protocol in the transient range, which
* is supplied to ypxfr as a command-line parameter when it
* is activated by ypserv."
*
* This protocol is not implemented, naturally, because this YP
* implementation only does the client side.
*/
#define YPPUSHVERS ((u_long)1)
#define YPPUSHVERS_ORIG ((u_long)1)
 
/* yppush procedure numbers */
#define YPPUSHPROC_NULL ((u_long)0)
#define YPPUSHPROC_XFRRESP ((u_long)1)
 
struct yppushresp_xfr {
u_long transid;
u_long status;
};
 
/* yppush status value in yppushresp_xfr.status */
#define YPPUSH_SUCC ((long)1) /* Success */
#define YPPUSH_AGE ((long)2) /* Master's version not newer */
#define YPPUSH_NOMAP ((long)-1) /* Can't find server for map */
#define YPPUSH_NODOM ((long)-2) /* Domain not supported */
#define YPPUSH_RSRC ((long)-3) /* Local resource alloc failure */
#define YPPUSH_RPC ((long)-4) /* RPC failure talking to server */
#define YPPUSH_MADDR ((long)-5) /* Can't get master address */
#define YPPUSH_YPERR ((long)-6) /* YP server/map db error */
#define YPPUSH_BADARGS ((long)-7) /* Request arguments bad */
#define YPPUSH_DBM ((long)-8) /* Local dbm operation failed */
#define YPPUSH_FILE ((long)-9) /* Local file I/O operation failed */
#define YPPUSH_SKEW ((long)-10) /* Map version skew during transfer */
#define YPPUSH_CLEAR ((long)-11) /* Can't send "Clear" req to local ypserv */
#define YPPUSH_FORCE ((long)-12) /* No local order number in map - use -f */
#define YPPUSH_XFRERR ((long)-13) /* ypxfr error */
#define YPPUSH_REFUSED ((long)-14) /* Transfer request refused by ypserv */
 
#endif
/pkgnet/trunk/watt32/inc/rpcsvc/ypclnt.h
0,0 → 1,88
/*!\file rpcsvc/ypclnt.h
* RPC service - Yellow Pages client.
*/
 
/*
* Copyright (c) 1992/3 Theo de Raadt <deraadt@fsa.ca>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote
* products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: ypclnt.h,v 1.3 1995/05/30 04:55:49 rgrimes Exp $
*/
 
#ifndef __RPCSVC_YPCLNT_H
#define __RPCSVC_YPCLNT_H
 
#define YPERR_BADARGS 1 /* args to function are bad */
#define YPERR_RPC 2 /* RPC failure */
#define YPERR_DOMAIN 3 /* can't bind to a server for domain */
#define YPERR_MAP 4 /* no such map in server's domain */
#define YPERR_KEY 5 /* no such key in map */
#define YPERR_YPERR 6 /* some internal YP server or client error */
#define YPERR_RESRC 7 /* local resource allocation failure */
#define YPERR_NOMORE 8 /* no more records in map database */
#define YPERR_PMAP 9 /* can't communicate with portmapper */
#define YPERR_YPBIND 10 /* can't communicate with ypbind */
#define YPERR_YPSERV 11 /* can't communicate with ypserv */
#define YPERR_NODOM 12 /* local domain name not set */
#define YPERR_BADDB 13 /* YP data base is bad */
#define YPERR_VERS 14 /* YP version mismatch */
#define YPERR_ACCESS 15 /* access violation */
#define YPERR_BUSY 16 /* database is busy */
 
/*
* Types of update operations
*/
#define YPOP_CHANGE 1 /* change, do not add */
#define YPOP_INSERT 2 /* add, do not change */
#define YPOP_DELETE 3 /* delete this entry */
#define YPOP_STORE 4 /* add, or change */
 
struct ypall_callback {
int (*foreach)(); /* return non-0 to stop getting called */
char *data; /* opaque pointer for use of callback fn */
};
 
int yp_get_default_domain (char **domp);
int yp_bind (char *dom);
int _yp_dobind (char *dom, struct dom_binding **ypdb);
void yp_unbind (char *dom);
int yp_match (char *indomain, char *inmap, const char *inkey,
int inkeylen, char **outval, int *outvallen);
int yp_first (char *indomain, char *inmap, char **outkey,
int *outkeylen, char **outval, int *outvallen);
int yp_next (char *indomain, char *inmap, char *inkey, int inkeylen,
char **outkey, int *outkeylen, char **outval, int *outvallen);
int yp_master (char *indomain, char *inmap, char **outname);
int yp_order (char *indomain, char *inmap, int *outorder);
int yp_all (char *indomain, char *inmap, struct ypall_callback *incallback);
int yp_invalid_domain (char *dom);
char *yperr_string (int incode);
char *ypbinderr_string(int incode);
int ypprot_err (unsigned int incode);
 
#endif
 
/pkgnet/trunk/watt32/inc/sys/borlandc.err
0,0 → 1,113
#ifndef __SYS_WERRNO_ERR
#define __SYS_WERRNO_ERR
 
/*
* THIS FILE IS GENERATED BY E:\NET\WATT\UTIL\BCC_ERR.EXE. DO NOT EDIT.
*
* Watt-32 errnos are after vendor's errnos (1 - 47)
*/
 
#ifndef __BORLANDC__
#error This file is only for use by "__BORLANDC__"
#endif
 
#define ERRNO_VENDOR_VERSION "4.60"
 
#define EWOULDBLOCK 48
#define EDOM 33
#define ERANGE 34
#define E2BIG 20
#define EACCES 5
#define EAGAIN 42
#define EBADF 6
#define EBUSY 44
#define ECHILD 24
#define EDEADLK 49
#define EEXIST 35
#define EFAULT 14
#define EFBIG 27
#define EINTR 39
#define EINVAL 19
#define EIO 40
#define EISDIR 46
#define EMFILE 4
#define EMLINK 31
#define ENAMETOOLONG 50
#define ENFILE 23
#define ENODEV 15
#define ENOENT 2
#define ENOEXEC 21
#define ENOLCK 51
#define ENOMEM 8
#define ENOSPC 28
#define ENOSYS 52
#define ENOTDIR 45
#define ENOTEMPTY 53
#define ENOTTY 25
#define ENXIO 41
#define EPERM 37
#define EPIPE 32
#define EROFS 30
#define ESPIPE 29
#define ESRCH 38
#define EXDEV 22
#define ENMFILE 18
#define EINPROGRESS 54
#define EALREADY 55
#define ENOTSOCK 56
#define EDESTADDRREQ 57
#define EMSGSIZE 58
#define EPROTOTYPE 59
#define ENOPROTOOPT 60
#define EPROTONOSUPPORT 61
#define ESOCKTNOSUPPORT 62
#define EOPNOTSUPP 63
#define EPFNOSUPPORT 64
#define EAFNOSUPPORT 65
#define EADDRINUSE 66
#define EADDRNOTAVAIL 67
#define ENETDOWN 68
#define ENETUNREACH 69
#define ENETRESET 70
#define ECONNABORTED 71
#define ECONNRESET 72
#define ENOBUFS 73
#define EISCONN 74
#define ENOTCONN 75
#define ESHUTDOWN 76
#define ETIMEDOUT 77
#define ECONNREFUSED 78
#define EHOSTDOWN 79
#define EHOSTUNREACH 80
#define ESTALE 81
#define EREMOTE 82
#define EBADRPC 83
#define ERPCMISMATCH 84
#define EPROGUNAVAIL 85
#define EPROGMISMATCH 86
#define EPROCUNAVAIL 87
#define EILSEQ 88
#define EINVFNC 1
#define ENOPATH 3
#define ECONTR 7
#define EINVMEM 9
#define EINVENV 10
#define EINVFMT 11
#define EINVACC 12
#define EINVDAT 13
#define EDEADLOCK 36
#define ECURDIR 16
#define ENOTSAM 17
#define ETXTBSY 26
#define ENOTBLK 43
#define EUCLEAN 47
#define ETOOMANYREFS 89
#define ELOOP 90
#define EPROCLIM 91
#define EUSERS 92
#define EDQUOT 93
#define EVDBAD 94
#define ENORMTWD 95
#define EOVERFLOW 96
 
#endif /* __SYS_WERRNO_ERR */
/pkgnet/trunk/watt32/inc/sys/cdefs.h
0,0 → 1,257
/*!\file sys/cdefs.h
*
* C-compiler definitions.
*/
 
/*
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Berkeley Software Design, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)cdefs.h 8.7 (Berkeley) 1/21/94
*/
 
#ifndef __SYS_CDEFS_H
#define __SYS_CDEFS_H
 
#if defined(__DJGPP__) && !defined(djgpp_cdefs_incl)
#include "/dev/env/DJDIR/include/sys/cdefs.h"
#define djgpp_cdefs_incl
#endif
 
#ifdef __cplusplus
#define __BEGIN_DECLS extern "C" {
#define __END_DECLS }
#else
#define __BEGIN_DECLS
#define __END_DECLS
#endif
 
#ifndef W32_NAMESPACE
#define W32_NAMESPACE(x) _w32_ ## x
#endif
 
#if defined(__CCDL__)
#define cdecl _cdecl
 
#elif defined(__MINGW32__) && !defined(cdecl)
#define cdecl __attribute__((__cdecl__))
 
#elif defined(_MSC_VER) || defined(__POCC__)
#undef cdecl
#if (_MSC_VER <= 600)
#define cdecl _cdecl
#undef __STDC__
#define __STDC__ 1
#else
#define cdecl __cdecl
#endif
#define NO_ANSI_KEYWORDS
 
#elif defined(__DMC__)
#define NO_UNDERSCORE __syscall
/* e.g. int NO_UNDERSCORE foo (void); */
#endif
 
#ifndef cdecl
#define cdecl
#endif
 
#if defined(_MSC_VER) && !defined(WIN32) && !defined(_WIN32)
/*
* MS's Quick-C/Visual-C (for DOS) insists that signal-handlers, atexit
* functions and var-arg functions must be defined cdecl.
* This is only an issue if a program is using 'fastcall' globally
* (cl option /Gr).
* On Win32 this isn't an issue since WATT-32.DLL cannot be built
* as 'fastcall' anyway.
*/
#undef MS_CDECL
#define MS_CDECL cdecl
#else
#define MS_CDECL
#endif
 
 
struct mbuf {
struct mbuf *next; /* Links mbufs belonging to single packets */
struct mbuf *anext; /* Links packets on queues */
unsigned size; /* Size of associated data buffer */
int refcnt; /* Reference count */
struct mbuf *dup; /* Pointer to duplicated mbuf */
char *data; /* Active working pointers */
unsigned cnt;
};
 
 
/*
* The __CONCAT macro is used to concatenate parts of symbol names, e.g.
* with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo.
* The __CONCAT macro is a bit tricky -- make sure you don't put spaces
* in between its arguments. __CONCAT can also concatenate double-quoted
* strings produced by the __STRING macro, but this only works with ANSI C.
*/
#if (defined(__STDC__) && __STDC__) || defined(__cplusplus) || defined(__TURBOC__)
#undef __P
#define __P(protos) protos /* full-blown ANSI C */
#define __CONCAT(x,y) x ## y
#define __STRING(x) #x
 
#define __const const /* define reserved names to standard */
#define __signed signed
#define __volatile volatile
#if defined(__cplusplus)
#define __inline inline /* convert to C++ keyword */
#elif !defined(__GNUC__) && !defined(_MSC_VER) && !defined(__WATCOMC__)
#define __inline /* delete GCC/MSC/Watcom keyword */
#endif
 
#else
#define __P(protos) () /* traditional C preprocessor */
#define __CONCAT(x,y) x/**/y
#define __STRING(x) "x"
 
#if !defined(__GNUC__) && !defined(_MSC_VER) && !defined(__WATCOMC__)
#define __inline
#endif
 
#if !defined(__GNUC__)
#define __const /* delete pseudo-ANSI C keywords */
#define __signed
#define __volatile
 
/*
* In non-ANSI C environments, new programs will want ANSI-only C keywords
* deleted from the program and old programs will want them left alone.
* When using a compiler other than gcc, programs using the ANSI C keywords
* const, inline etc. as normal identifiers should define -DNO_ANSI_KEYWORDS.
* When using "gcc -traditional", we assume that this is the intent; if
* __GNUC__ is defined but __STDC__ is not, we leave the new keywords alone.
*/
#if !defined(NO_ANSI_KEYWORDS)
#define const /* delete ANSI C keywords */
#define inline
#define signed
#define volatile
#endif
#endif /* !__GNUC__ */
#endif /* !C++ */
 
/*
* GCC1 and some versions of GCC2 declare dead (non-returning) and
* pure (no side effects) functions using "volatile" and "const";
* unfortunately, these then cause warnings under "-ansi -pedantic".
* GCC2 uses a new, peculiar __attribute__((attrs)) style. All of
* these work for GNU C++ (modulo a slight glitch in the C++ grammar
* in the distribution version of 2.5.5).
*/
#if !defined(__GNUC__) || (__GNUC__ < 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ < 5))
#undef __attribute__
#define __attribute__(x) /* delete __attribute__ if non-gcc or older than gcc 2.5 */
#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
#undef __dead
#undef __pure
#define __dead __volatile
#define __pure __const
#undef __dead2
#define __dead2
#endif
#endif
 
/*
* Delete pseudo-keywords wherever they are not available or needed.
* This seems to break MingW in mysterious ways, so leave it,
*/
#ifndef __dead
#define __dead
#endif
 
#ifndef __dead2
#define __dead2
#endif
 
#ifndef __pure
#define __pure
#endif
 
/*
* min() & max() macros
*/
#if defined(__HIGHC__)
#undef min
#undef max
#define min(a,b) _min(a,b) /* intrinsic functions */
#define max(a,b) _max(a,b)
#endif
 
#ifndef min
#define min(a,b) (((a) < (b)) ? (a) : (b))
#endif
 
#ifndef max
#define max(a,b) (((a) > (b)) ? (a) : (b))
#endif
 
/*
* from NetBSD's <sys/cdefs_aout.h>
*
* Written by J.T. Conklin <jtc@wimsey.com> 01/17/95.
* Public domain.
*/
 
/* #define _C_LABEL(x) __CONCAT(_,x) */
 
#if defined(__GNUC__)
#define __indr_reference(sym,alias) \
__asm__(".stabs \"_" #alias "\",11,0,0,0");\
__asm__(".stabs \"_" #sym "\",1,0,0,0");
 
#define __warn_references(sym,msg) \
__asm__(".stabs \"" msg "\",30,0,0,0"); \
__asm__(".stabs \"_" #sym "\",1,0,0,0");
 
#define __IDSTRING(name,string) \
static const char name[] __attribute__((__unused__)) = string
#else
#define __indr_reference(sym,alias)
#define __warn_references(sym,msg)
#define __IDSTRING(name,string) static const char name[] = string
#endif
 
#define __RCSID(_s) __IDSTRING(rcsid,_s)
#define __COPYRIGHT(_s) __IDSTRING(copyright,_s)
 
#define __KERNEL_RCSID(_n,_s) __IDSTRING(__CONCAT(rcsid,_n),_s)
#define __KERNEL_COPYRIGHT(_n,_s) __IDSTRING(__CONCAT(copyright,_n),_s)
 
#endif
/pkgnet/trunk/watt32/inc/sys/digmars.err
0,0 → 1,110
#ifndef __SYS_WERRNO_ERR
#define __SYS_WERRNO_ERR
 
/*
* THIS FILE IS GENERATED BY E:\NET\WATT\UTIL\DM_ERR.EXE. DO NOT EDIT.
*
* Watt-32 errnos are after vendor's errnos (1 - 42)
*/
 
#ifndef __DMC__
#error This file is only for use by "__DMC__"
#endif
 
#define EWOULDBLOCK 43
#define EDOM 33
#define ERANGE 34
#define E2BIG 7
#define EACCES 13
#define EAGAIN 11
#define EBADF 9
#define EBUSY 16
#define ECHILD 10
#define EDEADLK 36
#define EEXIST 17
#define EFAULT 14
#define EFBIG 27
#define EINTR 4
#define EINVAL 22
#define EIO 5
#define EISDIR 21
#define EMFILE 24
#define EMLINK 31
#define ENAMETOOLONG 38
#define ENFILE 23
#define ENODEV 19
#define ENOENT 2
#define ENOEXEC 8
#define ENOLCK 39
#define ENOMEM 12
#define ENOSPC 28
#define ENOSYS 40
#define ENOTDIR 20
#define ENOTEMPTY 41
#define ENOTTY 25
#define ENXIO 6
#define EPERM 1
#define EPIPE 32
#define EROFS 30
#define ESPIPE 29
#define ESRCH 3
#define EXDEV 18
#define ENMFILE 44
#define EINPROGRESS 45
#define EALREADY 46
#define ENOTSOCK 47
#define EDESTADDRREQ 48
#define EMSGSIZE 49
#define EPROTOTYPE 50
#define ENOPROTOOPT 51
#define EPROTONOSUPPORT 52
#define ESOCKTNOSUPPORT 53
#define EOPNOTSUPP 54
#define EPFNOSUPPORT 55
#define EAFNOSUPPORT 56
#define EADDRINUSE 57
#define EADDRNOTAVAIL 58
#define ENETDOWN 59
#define ENETUNREACH 60
#define ENETRESET 61
#define ECONNABORTED 62
#define ECONNRESET 63
#define ENOBUFS 64
#define EISCONN 65
#define ENOTCONN 66
#define ESHUTDOWN 67
#define ETIMEDOUT 68
#define ECONNREFUSED 69
#define EHOSTDOWN 70
#define EHOSTUNREACH 71
#define ESTALE 72
#define EREMOTE 73
#define EBADRPC 74
#define ERPCMISMATCH 75
#define EPROGUNAVAIL 76
#define EPROGMISMATCH 77
#define EPROCUNAVAIL 78
#define EILSEQ 42
#define EINVFNC 79
#define ENOPATH 80
#define ECONTR 81
#define EINVMEM 82
#define EINVENV 83
#define EINVFMT 84
#define EINVACC 85
#define EINVDAT 86
#define EDEADLOCK 36
#define ECURDIR 87
#define ENOTSAM 88
#define ETXTBSY 26
#define ENOTBLK 15
#define EUCLEAN 35
#define ETOOMANYREFS 89
#define ELOOP 90
#define EPROCLIM 91
#define EUSERS 92
#define EDQUOT 93
#define EVDBAD 94
#define ENORMTWD 95
 
#endif /* __SYS_WERRNO_ERR */
/pkgnet/trunk/watt32/inc/sys/djgpp.err
0,0 → 1,113
#ifndef __SYS_WERRNO_ERR
#define __SYS_WERRNO_ERR
 
/*
* THIS FILE WAS GENERATED BY e:/net/watt/util/dj_err.exe. DO NOT EDIT.
*
* Watt-32 errnos are after vendor's errnos (1 - 38)
*/
 
#ifndef __DJGPP__
#error This file is only for use by "__DJGPP__"
#endif
 
#define ERRNO_VENDOR_VERSION "2.03"
 
#define EWOULDBLOCK 39
#define EDOM 1
#define ERANGE 2
#define E2BIG 3
#define EACCES 4
#define EAGAIN 5
#define EBADF 6
#define EBUSY 7
#define ECHILD 8
#define EDEADLK 9
#define EEXIST 10
#define EFAULT 11
#define EFBIG 12
#define EINTR 13
#define EINVAL 14
#define EIO 15
#define EISDIR 16
#define EMFILE 17
#define EMLINK 18
#define ENAMETOOLONG 19
#define ENFILE 20
#define ENODEV 21
#define ENOENT 22
#define ENOEXEC 23
#define ENOLCK 24
#define ENOMEM 25
#define ENOSPC 26
#define ENOSYS 27
#define ENOTDIR 28
#define ENOTEMPTY 29
#define ENOTTY 30
#define ENXIO 31
#define EPERM 32
#define EPIPE 33
#define EROFS 34
#define ESPIPE 35
#define ESRCH 36
#define EXDEV 37
#define ENMFILE 38
#define EINPROGRESS 40
#define EALREADY 41
#define ENOTSOCK 42
#define EDESTADDRREQ 43
#define EMSGSIZE 44
#define EPROTOTYPE 45
#define ENOPROTOOPT 46
#define EPROTONOSUPPORT 47
#define ESOCKTNOSUPPORT 48
#define EOPNOTSUPP 49
#define EPFNOSUPPORT 50
#define EAFNOSUPPORT 51
#define EADDRINUSE 52
#define EADDRNOTAVAIL 53
#define ENETDOWN 54
#define ENETUNREACH 55
#define ENETRESET 56
#define ECONNABORTED 57
#define ECONNRESET 58
#define ENOBUFS 59
#define EISCONN 60
#define ENOTCONN 61
#define ESHUTDOWN 62
#define ETIMEDOUT 63
#define ECONNREFUSED 64
#define EHOSTDOWN 65
#define EHOSTUNREACH 66
#define ESTALE 67
#define EREMOTE 68
#define EBADRPC 69
#define ERPCMISMATCH 70
#define EPROGUNAVAIL 71
#define EPROGMISMATCH 72
#define EPROCUNAVAIL 73
#define EILSEQ 74
#define EINVFNC 75
#define ENOPATH 76
#define ECONTR 77
#define EINVMEM 78
#define EINVENV 79
#define EINVFMT 80
#define EINVACC 81
#define EINVDAT 82
#define EDEADLOCK 83
#define ECURDIR 84
#define ENOTSAM 85
#define ETXTBSY 86
#define ENOTBLK 87
#define EUCLEAN 88
#define ETOOMANYREFS 89
#define ELOOP 90
#define EPROCLIM 91
#define EUSERS 92
#define EDQUOT 93
#define EVDBAD 94
#define ENORMTWD 95
#define EOVERFLOW 96
 
#endif /* __SYS_WERRNO_ERR */
/pkgnet/trunk/watt32/inc/sys/errno.h
0,0 → 1,15
/*!\file sys/errno.h
*
* Compatibility header.
*/
 
/*
* The naming <sys/w??.h> is required for those compilers that
* have <sys/??.h> in the usual place but doesn't define stuff
* related to Watt-32's BSD-socket interface.
*/
 
#ifndef __SYS_WERRNO_H
#include <sys/werrno.h>
#endif
 
/pkgnet/trunk/watt32/inc/sys/highc.err
0,0 → 1,110
#ifndef __SYS_WERRNO_ERR
#define __SYS_WERRNO_ERR
 
/*
* THIS FILE IS GENERATED BY E:\NET\WATT\UTIL\HC_ERR.EXE. DO NOT EDIT.
*
* Watt-32 errnos are after vendor's errnos (1 - 70)
*/
 
#ifndef __HIGHC__
#error This file is only for use by "__HIGHC__"
#endif
 
#define EWOULDBLOCK 35
#define EDOM 33
#define ERANGE 34
#define E2BIG 7
#define EACCES 13
#define EAGAIN 11
#define EBADF 9
#define EBUSY 16
#define ECHILD 10
#define EDEADLK 35
#define EEXIST 17
#define EFAULT 14
#define EFBIG 27
#define EINTR 4
#define EINVAL 22
#define EIO 5
#define EISDIR 21
#define EMFILE 24
#define EMLINK 31
#define ENAMETOOLONG 63
#define ENFILE 23
#define ENODEV 19
#define ENOENT 2
#define ENOEXEC 8
#define ENOLCK 71
#define ENOMEM 12
#define ENOSPC 28
#define ENOSYS 72
#define ENOTDIR 20
#define ENOTEMPTY 66
#define ENOTTY 25
#define ENXIO 6
#define EPERM 1
#define EPIPE 32
#define EROFS 30
#define ESPIPE 29
#define ESRCH 3
#define EXDEV 18
#define ENMFILE 73
#define EINPROGRESS 36
#define EALREADY 37
#define ENOTSOCK 38
#define EDESTADDRREQ 39
#define EMSGSIZE 40
#define EPROTOTYPE 41
#define ENOPROTOOPT 42
#define EPROTONOSUPPORT 43
#define ESOCKTNOSUPPORT 44
#define EOPNOTSUPP 45
#define EPFNOSUPPORT 46
#define EAFNOSUPPORT 47
#define EADDRINUSE 48
#define EADDRNOTAVAIL 49
#define ENETDOWN 50
#define ENETUNREACH 51
#define ENETRESET 52
#define ECONNABORTED 53
#define ECONNRESET 54
#define ENOBUFS 55
#define EISCONN 56
#define ENOTCONN 57
#define ESHUTDOWN 58
#define ETIMEDOUT 60
#define ECONNREFUSED 61
#define EHOSTDOWN 64
#define EHOSTUNREACH 65
#define ESTALE 74
#define EREMOTE 75
#define EBADRPC 76
#define ERPCMISMATCH 77
#define EPROGUNAVAIL 78
#define EPROGMISMATCH 79
#define EPROCUNAVAIL 80
#define EILSEQ 81
#define EINVFNC 82
#define ENOPATH 83
#define ECONTR 84
#define EINVMEM 85
#define EINVENV 86
#define EINVFMT 87
#define EINVACC 88
#define EINVDAT 89
#define EDEADLOCK 35
#define ECURDIR 90
#define ENOTSAM 91
#define ETXTBSY 26
#define ENOTBLK 15
#define EUCLEAN 92
#define ETOOMANYREFS 59
#define ELOOP 62
#define EPROCLIM 67
#define EUSERS 68
#define EDQUOT 69
#define EVDBAD 70
#define ENORMTWD 93
 
#endif /* __SYS_WERRNO_ERR */
/pkgnet/trunk/watt32/inc/sys/ioctl.h
0,0 → 1,142
/*!\file sys/ioctl.h
* BSD socket I/O control.
*/
 
/*-
* Copyright (c) 1982, 1986, 1990 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)ioctl.h 7.19 (Berkeley) 6/26/91
*/
 
#ifndef __SYS_IOCTL_H
#define __SYS_IOCTL_H
 
/*
* Commands for ioctlsocket(), taken from the BSD file fcntl.h.
*
*
* Ioctl's have the command encoded in the lower word,
* and the size of any in or out parameters in the upper
* word. The high 2 bits of the upper word are used
* to encode the in/out status of the parameter; for now
* we restrict parameters to at most 128 bytes.
*/
 
#define IOCPARM_MASK 0x7f /* parameters must be < 128 bytes */
 
#define IOCPARM_LEN(x) (((x) >> 16) & IOCPARM_MASK)
#define IOCBASECMD(x) ((x) & ~IOCPARM_MASK)
#define IOCGROUP(x) (((x) >> 8) & 0xff)
 
#define IOCPARM_MAX 4096 /* max size of ioctl */
#define IOC_VOID 0x20000000 /* no parameters */
#define IOC_OUT 0x40000000 /* copy out parameters */
#define IOC_IN 0x80000000 /* copy in parameters */
#define IOC_INOUT (IOC_IN|IOC_OUT) /* 0x20000000 distinguishes new &
old ioctl's */
#define IOC_DIRMASK 0xe0000000 /* mask for IN/OUT/VOID */
 
#define _IO(x,y) (IOC_VOID|(x<<8)|y)
#define _IOR(x,y,t) (IOC_OUT|((sizeof(t)&IOCPARM_MASK)<<16)|(x<<8)|y)
#define _IOW(x,y,t) (IOC_IN|((sizeof(t)&IOCPARM_MASK)<<16)|(x<<8)|y)
/* this should be _IORW, but stdio got there first */
#define _IOWR(x,y,t) (IOC_INOUT|((sizeof(t)&IOCPARM_MASK)<<16)|(x<<8)|y)
 
/*
* file i/o controls
*/
#define FIOCLEX _IO('f', 1) /* set close on exec on fd */
#define FIONCLEX _IO('f', 2) /* remove close on exec */
#define FIONREAD _IOR('f', 127, int) /* get # bytes to read */
#define FIONBIO _IOW('f', 126, int) /* set/clear non-blocking i/o */
#define FIOASYNC _IOW('f', 125, int) /* set/clear async i/o */
#define FIOSETOWN _IOW('f', 124, int) /* set owner (struct Task *) */
#define FIOGETOWN _IOR('f', 123, int) /* get owner (struct Task *) */
 
/*
* socket i/o controls
*
* SIOCSPGRP and SIOCGPGRP are identical to the FIOSETOWN and FIOGETOWN,
* respectively.
*/
#define SIOCSPGRP _IOW('s', 8, int) /* set process group */
#define SIOCGPGRP _IOR('s', 9, int) /* get process group */
 
/* #ifdef BSD */
#define SIOCADDRT _IOW('r', 10, struct ortentry) /* add route */
#define SIOCDELRT _IOW('r', 11, struct ortentry) /* delete route */
 
#define SIOCSIFADDR _IOW('I', 12, struct ifreq) /* set ifnet address */
#define OSIOCGIFADDR _IOWR('I',13, struct ifreq) /* get ifnet address */
#define SIOCGIFADDR _IOWR('I',33, struct ifreq) /* get ifnet address */
#define SIOCSIFDSTADDR _IOW('I', 14, struct ifreq) /* set p-p address */
#define OSIOCGIFDSTADDR _IOWR('I',15, struct ifreq) /* get p-p address */
#define SIOCGIFDSTADDR _IOWR('I',34, struct ifreq) /* get p-p address */
#define SIOCSIFFLAGS _IOW('I', 16, struct ifreq) /* set ifnet flags */
#define SIOCGIFFLAGS _IOWR('I',17, struct ifreq) /* get ifnet flags */
#define OSIOCGIFBRDADDR _IOWR('I',18, struct ifreq) /* get broadcast addr */
#define SIOCGIFBRDADDR _IOWR('I',35, struct ifreq) /* get broadcast addr */
#define SIOCSIFBRDADDR _IOW('I',19, struct ifreq) /* set broadcast addr */
#define OSIOCGIFCONF _IOWR('I',20, struct ifconf) /* get ifnet list */
#define SIOCGIFCONF _IOWR('I',36, struct ifconf) /* get ifnet list */
#define OSIOCGIFNETMASK _IOWR('I',21, struct ifreq) /* get net addr mask */
#define SIOCGIFNETMASK _IOWR('I',37, struct ifreq) /* get net addr mask */
#define SIOCSIFNETMASK _IOW('I',22, struct ifreq) /* set net addr mask */
#define SIOCGIFMETRIC _IOWR('I',23, struct ifreq) /* get IF metric */
#define SIOCSIFMETRIC _IOW('I',24, struct ifreq) /* set IF metric */
#define SIOCDIFADDR _IOW('I',25, struct ifreq) /* delete IF addr */
#define SIOCAIFADDR _IOW('I',26, struct ifaliasreq) /* add/chg IF alias */
#define SIOCGIFMTU _IOWR('I',27, struct ifreq) /* get IF mtu */
#define SIOCGIFHWADDR _IOWR('I',28, struct ifconf) /* get hardware addr */
#define OSIOCGIFHWADDR SIOCGIFHWADDR
 
#define SIOCSARP _IOW('I', 30, struct arpreq) /* set arp entry */
#define OSIOCGARP _IOWR('I',31, struct arpreq) /* get arp entry */
#define SIOCGARP _IOWR('I',38, struct arpreq) /* get arp entry */
#define SIOCDARP _IOW('I', 32, struct arpreq) /* delete arp entry */
/* #endif */ /* BSD */
 
/* MS-DOS */
#define SIOCSHIWAT _IOW('s', 0, int) /* set high watermark */
#define SIOCGHIWAT _IOR('s', 1, int) /* get high watermark */
#define SIOCSLOWAT _IOW('s', 2, int) /* set low watermark */
#define SIOCGLOWAT _IOR('s', 3, int) /* get low watermark */
#define SIOCATMARK _IOR('s', 7, int) /* at oob mark? */
 
/* Since this file shadows the normal djgpp <sys/ioctl.h>, we provide
* this prototype here.
*/
#if defined(DJGPP)
int ioctl (int __fd, int __cmd, ...);
#endif
 
#endif /* !SYS_IOCTL_H */
/pkgnet/trunk/watt32/inc/sys/ladsoft.err
0,0 → 1,113
#ifndef __SYS_WERRNO_ERR
#define __SYS_WERRNO_ERR
 
/*
* THIS FILE IS GENERATED BY E:\NET\WATT\UTIL\LS_ERR.EXE. DO NOT EDIT.
*
* Watt-32 errnos are after vendor's errnos (1 - 50)
*/
 
#ifndef __CCDL__
#error This file is only for use by "__CCDL__"
#endif
 
#define ERRNO_VENDOR_VERSION "2.30"
 
#define EWOULDBLOCK 51
#define EDOM 33
#define ERANGE 34
#define E2BIG 20
#define EACCES 5
#define EAGAIN 42
#define EBADF 6
#define EBUSY 44
#define ECHILD 24
#define EDEADLK 52
#define EEXIST 35
#define EFAULT 14
#define EFBIG 27
#define EINTR 39
#define EINVAL 19
#define EIO 40
#define EISDIR 46
#define EMFILE 4
#define EMLINK 31
#define ENAMETOOLONG 48
#define ENFILE 23
#define ENODEV 15
#define ENOENT 2
#define ENOEXEC 21
#define ENOLCK 53
#define ENOMEM 8
#define ENOSPC 28
#define ENOSYS 54
#define ENOTDIR 45
#define ENOTEMPTY 55
#define ENOTTY 25
#define ENXIO 41
#define EPERM 37
#define EPIPE 32
#define EROFS 30
#define ESPIPE 29
#define ESRCH 38
#define EXDEV 22
#define ENMFILE 18
#define EINPROGRESS 56
#define EALREADY 57
#define ENOTSOCK 58
#define EDESTADDRREQ 59
#define EMSGSIZE 60
#define EPROTOTYPE 61
#define ENOPROTOOPT 62
#define EPROTONOSUPPORT 63
#define ESOCKTNOSUPPORT 64
#define EOPNOTSUPP 65
#define EPFNOSUPPORT 66
#define EAFNOSUPPORT 67
#define EADDRINUSE 68
#define EADDRNOTAVAIL 69
#define ENETDOWN 70
#define ENETUNREACH 71
#define ENETRESET 72
#define ECONNABORTED 73
#define ECONNRESET 74
#define ENOBUFS 75
#define EISCONN 76
#define ENOTCONN 77
#define ESHUTDOWN 78
#define ETIMEDOUT 79
#define ECONNREFUSED 80
#define EHOSTDOWN 81
#define EHOSTUNREACH 82
#define ESTALE 83
#define EREMOTE 84
#define EBADRPC 85
#define ERPCMISMATCH 86
#define EPROGUNAVAIL 87
#define EPROGMISMATCH 88
#define EPROCUNAVAIL 89
#define EILSEQ 90
#define EINVFNC 1
#define ENOPATH 3
#define ECONTR 7
#define EINVMEM 9
#define EINVENV 10
#define EINVFMT 11
#define EINVACC 12
#define EINVDAT 13
#define EDEADLOCK 36
#define ECURDIR 16
#define ENOTSAM 17
#define ETXTBSY 26
#define ENOTBLK 43
#define EUCLEAN 47
#define ETOOMANYREFS 91
#define ELOOP 92
#define EPROCLIM 93
#define EUSERS 94
#define EDQUOT 95
#define EVDBAD 96
#define ENORMTWD 97
#define EOVERFLOW 98
 
#endif /* __SYS_WERRNO_ERR */
/pkgnet/trunk/watt32/inc/sys/lcc.err
0,0 → 1,111
#ifndef __SYS_WERRNO_ERR
#define __SYS_WERRNO_ERR
 
/*
* THIS FILE WAS GENERATED BY ..\util\lcc_err. DO NOT EDIT.
*
* Watt-32 errnos are after vendor's errnos (1 - 42)
*/
 
#ifndef __LCC__
#error This file is only for use by "__LCC__"
#endif
 
#define EWOULDBLOCK 43
#define EDOM 33
#define ERANGE 34
#define E2BIG 7
#define EACCES 13
#define EAGAIN 11
#define EBADF 9
#define EBUSY 16
#define ECHILD 10
#define EDEADLK 45
#define EEXIST 17
#define EFAULT 14
#define EFBIG 27
#define EINTR 4
#define EINVAL 22
#define EIO 5
#define EISDIR 21
#define EMFILE 24
#define EMLINK 31
#define ENAMETOOLONG 91
#define ENFILE 23
#define ENODEV 19
#define ENOENT 2
#define ENOEXEC 8
#define ENOLCK 46
#define ENOMEM 12
#define ENOSPC 28
#define ENOSYS 88
#define ENOTDIR 20
#define ENOTEMPTY 90
#define ENOTTY 25
#define ENXIO 6
#define EPERM 1
#define EPIPE 32
#define EROFS 30
#define ESPIPE 29
#define ESRCH 3
#define EXDEV 18
#define ENMFILE 89
#define EINPROGRESS 44
#define EALREADY 45
#define ENOTSOCK 46
#define EDESTADDRREQ 47
#define EMSGSIZE 48
#define EPROTOTYPE 49
#define ENOPROTOOPT 50
#define EPROTONOSUPPORT 51
#define ESOCKTNOSUPPORT 52
#define EOPNOTSUPP 53
#define EPFNOSUPPORT 54
#define EAFNOSUPPORT 55
#define EADDRINUSE 56
#define EADDRNOTAVAIL 57
#define ENETDOWN 58
#define ENETUNREACH 59
#define ENETRESET 60
#define ECONNABORTED 61
#define ECONNRESET 62
#define ENOBUFS 63
#define EISCONN 64
#define ENOTCONN 65
#define ESHUTDOWN 66
#define ETIMEDOUT 67
#define ECONNREFUSED 68
#define EHOSTDOWN 69
#define EHOSTUNREACH 70
#define ESTALE 71
#define EREMOTE 66
#define EBADRPC 72
#define ERPCMISMATCH 73
#define EPROGUNAVAIL 74
#define EPROGMISMATCH 75
#define EPROCUNAVAIL 76
#define EILSEQ 77
#define EINVFNC 78
#define ENOPATH 79
#define ECONTR 80
#define EINVMEM 81
#define EINVENV 82
#define EINVFMT 83
#define EINVACC 84
#define EINVDAT 85
#define EDEADLOCK 56
#define ECURDIR 86
#define ENOTSAM 87
#define ETXTBSY 26
#define ENOTBLK 15
#define EUCLEAN 88
#define ETOOMANYREFS 89
#define ELOOP 90
#define EPROCLIM 91
#define EUSERS 92
#define EDQUOT 93
#define EVDBAD 94
#define ENORMTWD 95
#define EOVERFLOW 96
 
#endif /* __SYS_WERRNO_ERR */
/pkgnet/trunk/watt32/inc/sys/mingw32.err
0,0 → 1,113
#ifndef __SYS_WERRNO_ERR
#define __SYS_WERRNO_ERR
 
/*
* THIS FILE WAS GENERATED BY ..\util\mw_err. DO NOT EDIT.
*
* Watt-32 errnos are after vendor's errnos (1 - 42)
*/
 
#ifndef __MINGW32__
#error This file is only for use by "__MINGW32__"
#endif
 
#define ERRNO_VENDOR_VERSION "3.7"
 
#define EWOULDBLOCK 43
#define EDOM 33
#define ERANGE 34
#define E2BIG 7
#define EACCES 13
#define EAGAIN 11
#define EBADF 9
#define EBUSY 16
#define ECHILD 10
#define EDEADLK 36
#define EEXIST 17
#define EFAULT 14
#define EFBIG 27
#define EINTR 4
#define EINVAL 22
#define EIO 5
#define EISDIR 21
#define EMFILE 24
#define EMLINK 31
#define ENAMETOOLONG 38
#define ENFILE 23
#define ENODEV 19
#define ENOENT 2
#define ENOEXEC 8
#define ENOLCK 39
#define ENOMEM 12
#define ENOSPC 28
#define ENOSYS 40
#define ENOTDIR 20
#define ENOTEMPTY 41
#define ENOTTY 25
#define ENXIO 6
#define EPERM 1
#define EPIPE 32
#define EROFS 30
#define ESPIPE 29
#define ESRCH 3
#define EXDEV 18
#define ENMFILE 44
#define EINPROGRESS 45
#define EALREADY 46
#define ENOTSOCK 47
#define EDESTADDRREQ 48
#define EMSGSIZE 49
#define EPROTOTYPE 50
#define ENOPROTOOPT 51
#define EPROTONOSUPPORT 52
#define ESOCKTNOSUPPORT 53
#define EOPNOTSUPP 54
#define EPFNOSUPPORT 55
#define EAFNOSUPPORT 56
#define EADDRINUSE 57
#define EADDRNOTAVAIL 58
#define ENETDOWN 59
#define ENETUNREACH 60
#define ENETRESET 61
#define ECONNABORTED 62
#define ECONNRESET 63
#define ENOBUFS 64
#define EISCONN 65
#define ENOTCONN 66
#define ESHUTDOWN 67
#define ETIMEDOUT 68
#define ECONNREFUSED 69
#define EHOSTDOWN 70
#define EHOSTUNREACH 71
#define ESTALE 72
#define EREMOTE 73
#define EBADRPC 74
#define ERPCMISMATCH 75
#define EPROGUNAVAIL 76
#define EPROGMISMATCH 77
#define EPROCUNAVAIL 78
#define EILSEQ 42
#define EINVFNC 79
#define ENOPATH 80
#define ECONTR 81
#define EINVMEM 82
#define EINVENV 83
#define EINVFMT 84
#define EINVACC 85
#define EINVDAT 86
#define EDEADLOCK 36
#define ECURDIR 87
#define ENOTSAM 88
#define ETXTBSY 89
#define ENOTBLK 90
#define EUCLEAN 91
#define ETOOMANYREFS 92
#define ELOOP 93
#define EPROCLIM 94
#define EUSERS 95
#define EDQUOT 96
#define EVDBAD 97
#define ENORMTWD 98
#define EOVERFLOW 99
 
#endif /* __SYS_WERRNO_ERR */
/pkgnet/trunk/watt32/inc/sys/packoff.h
0,0 → 1,70
/*!\file sys/packoff.h
*
* Default packing of structures.
*/
 
/*++
 
Copyright (c) 1990,91 Microsoft Corporation
 
Module Name:
 
packoff.h
 
Abstract:
 
This file turns packing of structures off. (That is, it enables
automatic alignment of structure fields.) An include file is needed
because various compilers do this in different ways.
 
packoff.h is the complement to packon.h. An inclusion of packoff.h
MUST ALWAYS be preceded by an inclusion of packon.h, in one-to-one
correspondence.
 
Author:
 
Chuck Lenzmeier (chuckl) 4-Mar-1990
 
Revision History:
 
15-Apr-1991 JohnRo
Created lint-able variant.
 
20-Oct-1997 G.Vanem
Added Metaware support
 
05-Jul-1999 G.Vanem
Added LADsoft support
 
01-Nov-2000 G. Vanem
Added Visual C/C++ support
 
--*/
 
#if defined(__BORLANDC__) && (__BORLANDC__ >= 0x550)
#pragma option push -b -a8 -pc -A- /*P_O_Push*/
#endif
 
#if !(defined(lint) || defined(_lint))
#if defined(_MSC_VER) && (_MSC_VER >= 800)
#pragma warning(disable:4103)
#endif
 
#if defined(__CCDL__)
#pragma pack()
#elif defined(__HIGHC__)
#pragma pop_align_members();
#elif defined(__WATCOMC__) && (__WATCOMC__ >= 1000)
#pragma pack(__pop);
#elif (defined(_MSC_VER) && (_MSC_VER > 800)) || \
(defined(__BORLANDC__) && (__BORLANDC__ >= 0x500)) || \
defined(__POCC__) || defined(__LCC__)
#pragma pack(pop)
#else
#pragma pack()
#endif
#endif
 
#if defined(__BORLANDC__) && (__BORLANDC__ >= 0x550)
#pragma option pop /*P_O_Pop*/
#endif
/pkgnet/trunk/watt32/inc/sys/packon.h
0,0 → 1,66
/*!\file sys/packon.h
*
* Sets structure packing to 1 byte.
*/
 
/*++
 
Copyright (c) 1990,91 Microsoft Corporation
 
Module Name:
 
packon.h
 
Abstract:
 
This file turns packing of structures on. (That is, it disables
automatic alignment of structure fields.) An include file is needed
because various compilers do this in different ways.
 
The file packoff.h is the complement to this file.
 
Author:
 
Chuck Lenzmeier (chuckl) 4-Mar-1990
 
Revision History:
 
15-Apr-1991 JohnRo
Created lint-able variant.
 
20-Oct-1997 G.Vanem
Added Metaware support
 
05-Jul-1999 G.Vanem
Added LADsoft support
 
01-Nov-2000 G. Vanem
Added Visual C/C++ support
 
--*/
 
#if defined(__BORLANDC__) && (__BORLANDC__ >= 0x550)
#pragma option push -b -a8 -pc -A- /*P_O_Push*/
#endif
 
#if !(defined(lint) || defined(_lint))
#if defined(_MSC_VER) && (_MSC_VER >= 800)
#pragma warning(disable:4103)
#endif
 
#if defined(__HIGHC__)
#pragma push_align_members(1);
#elif defined(__WATCOMC__) && (__WATCOMC__ >= 1000)
#pragma pack(__push,1);
#elif (defined(_MSC_VER) && (_MSC_VER > 800)) || \
(defined(__BORLANDC__) && (__BORLANDC__ >= 0x500)) || \
defined(__POCC__) || defined(__LCC__)
#pragma pack(push,1)
#else
#pragma pack(1)
#endif
#endif
 
#if defined(__BORLANDC__) && (__BORLANDC__ >= 0x550)
#pragma option pop /*P_O_Pop*/
#endif
/pkgnet/trunk/watt32/inc/sys/param.h
0,0 → 1,35
/*!\file sys/param.h
*
* Miscellaneous defines.
*/
 
/* sys/param.h (wattcp) */
 
#ifndef __SYS_PARAM_H
#define __SYS_PARAM_H
 
#ifndef PAGE_SIZE
#define PAGE_SIZE 0x1000
#endif
 
#ifndef HZ
#define HZ 100
#endif
 
#ifndef MAXNAMLEN
#define MAXNAMLEN 260
#endif
 
#ifndef MAXPATHLEN
#define MAXPATHLEN 260
#endif
 
#ifndef MAXHOSTNAMELEN
#define MAXHOSTNAMELEN 256
#endif
 
#ifndef __SYS_SWAP_BYTES_H
#include <sys/swap.h>
#endif
 
#endif
/pkgnet/trunk/watt32/inc/sys/pellesc.err
0,0 → 1,113
#ifndef __SYS_WERRNO_ERR
#define __SYS_WERRNO_ERR
 
/*
* THIS FILE WAS GENERATED BY ..\util\po_err. DO NOT EDIT.
*
* Watt-32 errnos are after vendor's errnos (1 - 41)
*/
 
#ifndef __POCC__
#error This file is only for use by "__POCC__"
#endif
 
#define ERRNO_VENDOR_VERSION "4.0"
 
#define EWOULDBLOCK 42
#define EDOM 33
#define ERANGE 34
#define E2BIG 43
#define EACCES 13
#define EAGAIN 11
#define EBADF 9
#define EBUSY 44
#define ECHILD 10
#define EDEADLK 36
#define EEXIST 17
#define EFAULT 45
#define EFBIG 46
#define EINTR 47
#define EINVAL 22
#define EIO 48
#define EISDIR 49
#define EMFILE 24
#define EMLINK 50
#define ENAMETOOLONG 51
#define ENFILE 52
#define ENODEV 53
#define ENOENT 2
#define ENOEXEC 8
#define ENOLCK 54
#define ENOMEM 12
#define ENOSPC 28
#define ENOSYS 55
#define ENOTDIR 56
#define ENOTEMPTY 57
#define ENOTTY 58
#define ENXIO 59
#define EPERM 60
#define EPIPE 32
#define EROFS 61
#define ESPIPE 62
#define ESRCH 63
#define EXDEV 18
#define ENMFILE 64
#define EINPROGRESS 65
#define EALREADY 66
#define ENOTSOCK 67
#define EDESTADDRREQ 68
#define EMSGSIZE 69
#define EPROTOTYPE 70
#define ENOPROTOOPT 71
#define EPROTONOSUPPORT 72
#define ESOCKTNOSUPPORT 73
#define EOPNOTSUPP 74
#define EPFNOSUPPORT 75
#define EAFNOSUPPORT 76
#define EADDRINUSE 77
#define EADDRNOTAVAIL 78
#define ENETDOWN 79
#define ENETUNREACH 80
#define ENETRESET 81
#define ECONNABORTED 82
#define ECONNRESET 83
#define ENOBUFS 84
#define EISCONN 85
#define ENOTCONN 86
#define ESHUTDOWN 87
#define ETIMEDOUT 88
#define ECONNREFUSED 89
#define EHOSTDOWN 90
#define EHOSTUNREACH 91
#define ESTALE 92
#define EREMOTE 93
#define EBADRPC 94
#define ERPCMISMATCH 95
#define EPROGUNAVAIL 96
#define EPROGMISMATCH 97
#define EPROCUNAVAIL 98
#define EILSEQ 42
#define EINVFNC 99
#define ENOPATH 100
#define ECONTR 101
#define EINVMEM 102
#define EINVENV 103
#define EINVFMT 104
#define EINVACC 105
#define EINVDAT 106
#define EDEADLOCK 107
#define ECURDIR 108
#define ENOTSAM 109
#define ETXTBSY 110
#define ENOTBLK 111
#define EUCLEAN 112
#define ETOOMANYREFS 113
#define ELOOP 114
#define EPROCLIM 115
#define EUSERS 116
#define EDQUOT 117
#define EVDBAD 118
#define ENORMTWD 119
#define EOVERFLOW 120
 
#endif /* __SYS_WERRNO_ERR */
/pkgnet/trunk/watt32/inc/sys/poll.h
0,0 → 1,22
/*!\file sys/poll.h
*
*/
#ifndef __SYS_POLL_H
#define __SYS_POLL_H
 
#define POLLIN 0x0001
#define POLLPRI 0x0002 /* not used */
#define POLLOUT 0x0004
#define POLLERR 0x0008
#define POLLHUP 0x0010 /* not used */
#define POLLNVAL 0x0020 /* not used */
 
struct pollfd {
int fd;
int events; /* in param: what to poll for */
int revents; /* out param: what events occured */
};
 
extern int poll (struct pollfd *p, int num, int timeout);
 
#endif
/pkgnet/trunk/watt32/inc/sys/queue.h
0,0 → 1,263
/*!\file sys/queue.h
*
*/
 
/*
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)queue.h 8.5 (Berkeley) 8/20/94
*/
 
#ifndef __SYS_QUEUE_H
#define __SYS_QUEUE_H
 
/*
* This file defines three types of data structures: lists, tail queues,
* and circular queues.
*
* A list is headed by a single forward pointer (or an array of forward
* pointers for a hash table header). The elements are doubly linked
* so that an arbitrary element can be removed without a need to
* traverse the list. New elements can be added to the list before
* or after an existing element or at the head of the list. A list
* may only be traversed in the forward direction.
*
* A tail queue is headed by a pair of pointers, one to the head of the
* list and the other to the tail of the list. The elements are doubly
* linked so that an arbitrary element can be removed without a need to
* traverse the list. New elements can be added to the list before or
* after an existing element, at the head of the list, or at the end of
* the list. A tail queue may only be traversed in the forward direction.
*
* A circle queue is headed by a pair of pointers, one to the head of the
* list and the other to the tail of the list. The elements are doubly
* linked so that an arbitrary element can be removed without a need to
* traverse the list. New elements can be added to the list before or after
* an existing element, at the head of the list, or at the end of the list.
* A circle queue may be traversed in either direction, but has a more
* complex end of list detection.
*
* For details on the use of these macros, see the queue(3) manual page.
*/
 
/*
* List definitions.
*/
#define LIST_HEAD(name, type) \
struct name { \
struct type *lh_first; /* first element */ \
}
 
#define LIST_ENTRY(type) \
struct { \
struct type *le_next; /* next element */ \
struct type **le_prev; /* address of previous next element */ \
}
 
/*
* List functions.
*/
#define LIST_INIT(head) { \
(head)->lh_first = NULL; \
}
 
#define LIST_INSERT_AFTER(listelm, elm, field) { \
if (((elm)->field.le_next = (listelm)->field.le_next) != NULL) \
(listelm)->field.le_next->field.le_prev = \
&(elm)->field.le_next; \
(listelm)->field.le_next = (elm); \
(elm)->field.le_prev = &(listelm)->field.le_next; \
}
 
#define LIST_INSERT_BEFORE(listelm, elm, field) { \
(elm)->field.le_prev = (listelm)->field.le_prev; \
(elm)->field.le_next = (listelm); \
*(listelm)->field.le_prev = (elm); \
(listelm)->field.le_prev = &(elm)->field.le_next; \
}
 
#define LIST_INSERT_HEAD(head, elm, field) { \
if (((elm)->field.le_next = (head)->lh_first) != NULL) \
(head)->lh_first->field.le_prev = &(elm)->field.le_next;\
(head)->lh_first = (elm); \
(elm)->field.le_prev = &(head)->lh_first; \
}
 
#define LIST_REMOVE(elm, field) { \
if ((elm)->field.le_next != NULL) \
(elm)->field.le_next->field.le_prev = \
(elm)->field.le_prev; \
*(elm)->field.le_prev = (elm)->field.le_next; \
}
 
/*
* Tail queue definitions.
*/
#define TAILQ_HEAD(name, type) \
struct name { \
struct type *tqh_first; /* first element */ \
struct type **tqh_last; /* addr of last next element */ \
}
 
#define TAILQ_ENTRY(type) \
struct { \
struct type *tqe_next; /* next element */ \
struct type **tqe_prev; /* address of previous next element */ \
}
 
/*
* Tail queue functions.
*/
#define TAILQ_INIT(head) { \
(head)->tqh_first = NULL; \
(head)->tqh_last = &(head)->tqh_first; \
}
 
#define TAILQ_INSERT_HEAD(head, elm, field) { \
if (((elm)->field.tqe_next = (head)->tqh_first) != NULL) \
(head)->tqh_first->field.tqe_prev = \
&(elm)->field.tqe_next; \
else \
(head)->tqh_last = &(elm)->field.tqe_next; \
(head)->tqh_first = (elm); \
(elm)->field.tqe_prev = &(head)->tqh_first; \
}
 
#define TAILQ_INSERT_TAIL(head, elm, field) { \
(elm)->field.tqe_next = NULL; \
(elm)->field.tqe_prev = (head)->tqh_last; \
*(head)->tqh_last = (elm); \
(head)->tqh_last = &(elm)->field.tqe_next; \
}
 
#define TAILQ_INSERT_AFTER(head, listelm, elm, field) { \
if (((elm)->field.tqe_next = (listelm)->field.tqe_next) != NULL)\
(elm)->field.tqe_next->field.tqe_prev = \
&(elm)->field.tqe_next; \
else \
(head)->tqh_last = &(elm)->field.tqe_next; \
(listelm)->field.tqe_next = (elm); \
(elm)->field.tqe_prev = &(listelm)->field.tqe_next; \
}
 
#define TAILQ_INSERT_BEFORE(listelm, elm, field) { \
(elm)->field.tqe_prev = (listelm)->field.tqe_prev; \
(elm)->field.tqe_next = (listelm); \
*(listelm)->field.tqe_prev = (elm); \
(listelm)->field.tqe_prev = &(elm)->field.tqe_next; \
}
 
#define TAILQ_REMOVE(head, elm, field) { \
if (((elm)->field.tqe_next) != NULL) \
(elm)->field.tqe_next->field.tqe_prev = \
(elm)->field.tqe_prev; \
else \
(head)->tqh_last = (elm)->field.tqe_prev; \
*(elm)->field.tqe_prev = (elm)->field.tqe_next; \
}
 
/*
* Circular queue definitions.
*/
#define CIRCLEQ_HEAD(name, type) \
struct name { \
struct type *cqh_first; /* first element */ \
struct type *cqh_last; /* last element */ \
}
 
#define CIRCLEQ_ENTRY(type) \
struct { \
struct type *cqe_next; /* next element */ \
struct type *cqe_prev; /* previous element */ \
}
 
/*
* Circular queue functions.
*/
#define CIRCLEQ_INIT(head) { \
(head)->cqh_first = (void *)(head); \
(head)->cqh_last = (void *)(head); \
}
 
#define CIRCLEQ_INSERT_AFTER(head, listelm, elm, field) { \
(elm)->field.cqe_next = (listelm)->field.cqe_next; \
(elm)->field.cqe_prev = (listelm); \
if ((listelm)->field.cqe_next == (void *)(head)) \
(head)->cqh_last = (elm); \
else \
(listelm)->field.cqe_next->field.cqe_prev = (elm); \
(listelm)->field.cqe_next = (elm); \
}
 
#define CIRCLEQ_INSERT_BEFORE(head, listelm, elm, field) { \
(elm)->field.cqe_next = (listelm); \
(elm)->field.cqe_prev = (listelm)->field.cqe_prev; \
if ((listelm)->field.cqe_prev == (void *)(head)) \
(head)->cqh_first = (elm); \
else \
(listelm)->field.cqe_prev->field.cqe_next = (elm); \
(listelm)->field.cqe_prev = (elm); \
}
 
#define CIRCLEQ_INSERT_HEAD(head, elm, field) { \
(elm)->field.cqe_next = (head)->cqh_first; \
(elm)->field.cqe_prev = (void *)(head); \
if ((head)->cqh_last == (void *)(head)) \
(head)->cqh_last = (elm); \
else \
(head)->cqh_first->field.cqe_prev = (elm); \
(head)->cqh_first = (elm); \
}
 
#define CIRCLEQ_INSERT_TAIL(head, elm, field) { \
(elm)->field.cqe_next = (void *)(head); \
(elm)->field.cqe_prev = (head)->cqh_last; \
if ((head)->cqh_first == (void *)(head)) \
(head)->cqh_first = (elm); \
else \
(head)->cqh_last->field.cqe_next = (elm); \
(head)->cqh_last = (elm); \
}
 
#define CIRCLEQ_REMOVE(head, elm, field) { \
if ((elm)->field.cqe_next == (void *)(head)) \
(head)->cqh_last = (elm)->field.cqe_prev; \
else \
(elm)->field.cqe_next->field.cqe_prev = \
(elm)->field.cqe_prev; \
if ((elm)->field.cqe_prev == (void *)(head)) \
(head)->cqh_first = (elm)->field.cqe_next; \
else \
(elm)->field.cqe_prev->field.cqe_next = \
(elm)->field.cqe_next; \
}
#endif
/pkgnet/trunk/watt32/inc/sys/quickc.err
0,0 → 1,110
#ifndef __SYS_WERRNO_ERR
#define __SYS_WERRNO_ERR
 
/*
* THIS FILE IS GENERATED BY E:\NET\WATT\UTIL\MS_ERR.EXE. DO NOT EDIT.
*
* Watt-32 errnos are after vendor's errnos (1 - 36)
*/
 
#ifndef _MSC_VER
#error This file is only for use by "_MSC_VER"
#endif
 
#define EWOULDBLOCK 37
#define EDOM 33
#define ERANGE 34
#define E2BIG 7
#define EACCES 13
#define EAGAIN 11
#define EBADF 9
#define EBUSY 16
#define ECHILD 10
#define EDEADLK 38
#define EEXIST 17
#define EFAULT 14
#define EFBIG 27
#define EINTR 4
#define EINVAL 22
#define EIO 5
#define EISDIR 21
#define EMFILE 24
#define EMLINK 31
#define ENAMETOOLONG 39
#define ENFILE 23
#define ENODEV 19
#define ENOENT 2
#define ENOEXEC 8
#define ENOLCK 40
#define ENOMEM 12
#define ENOSPC 28
#define ENOSYS 41
#define ENOTDIR 20
#define ENOTEMPTY 42
#define ENOTTY 25
#define ENXIO 6
#define EPERM 1
#define EPIPE 32
#define EROFS 30
#define ESPIPE 29
#define ESRCH 3
#define EXDEV 18
#define ENMFILE 43
#define EINPROGRESS 44
#define EALREADY 45
#define ENOTSOCK 46
#define EDESTADDRREQ 47
#define EMSGSIZE 48
#define EPROTOTYPE 49
#define ENOPROTOOPT 50
#define EPROTONOSUPPORT 51
#define ESOCKTNOSUPPORT 52
#define EOPNOTSUPP 53
#define EPFNOSUPPORT 54
#define EAFNOSUPPORT 55
#define EADDRINUSE 56
#define EADDRNOTAVAIL 57
#define ENETDOWN 58
#define ENETUNREACH 59
#define ENETRESET 60
#define ECONNABORTED 61
#define ECONNRESET 62
#define ENOBUFS 63
#define EISCONN 64
#define ENOTCONN 65
#define ESHUTDOWN 66
#define ETIMEDOUT 67
#define ECONNREFUSED 68
#define EHOSTDOWN 69
#define EHOSTUNREACH 70
#define ESTALE 71
#define EREMOTE 72
#define EBADRPC 73
#define ERPCMISMATCH 74
#define EPROGUNAVAIL 75
#define EPROGMISMATCH 76
#define EPROCUNAVAIL 77
#define EILSEQ 78
#define EINVFNC 79
#define ENOPATH 80
#define ECONTR 81
#define EINVMEM 82
#define EINVENV 83
#define EINVFMT 84
#define EINVACC 85
#define EINVDAT 86
#define EDEADLOCK 36
#define ECURDIR 87
#define ENOTSAM 88
#define ETXTBSY 26
#define ENOTBLK 15
#define EUCLEAN 35
#define ETOOMANYREFS 89
#define ELOOP 90
#define EPROCLIM 91
#define EUSERS 92
#define EDQUOT 93
#define EVDBAD 94
#define ENORMTWD 95
 
#endif /* __SYS_WERRNO_ERR */
/pkgnet/trunk/watt32/inc/sys/select.h
0,0 → 1,6
/*!\file sys/select.h
*
* Compatibility header.
*/
 
#include <tcp.h> /* select_s() */
/pkgnet/trunk/watt32/inc/sys/so_ioctl.h
0,0 → 1,98
/*!\file sys/so_ioctl.h
*
* BSD socket I/O control.
*/
 
/* so_ioctl.h derived from BSD's ioctl.h by hv and em 1994
*
* Copyright (c) 1982, 1986, 1990 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: @(#)ioctl.h 7.19 (Berkeley) 6/26/91
*/
 
#ifndef __SYS_SO_IOCTL_H
#define __SYS_SO_IOCTL_H
 
#undef _IOC
#undef _IOW
#undef _IOR
#undef _IOWR
 
#define _IOC(a,b) ((a<<8)|b)
#define _IOW(a,b,c) _IOC(a,b)
#define _IOR(a,b,c) _IOC(a,b)
#define _IOWR(a,b,c) _IOC(a,b)
 
#define _TCPIP_FIONREAD _IOC('f', 127)
#define FIONBIO _IOC('f', 126)
#define FIOASYNC _IOC('f', 125)
#define FIOTCPCKSUM _IOC('f', 128)
#define FIONSTATUS _IOC('f', 120)
#define FIONURG _IOC('f', 121)
 
/* socket i/o controls */
#define SIOCSHIWAT _IOW('s', 0, int) /* set high watermark */
#define SIOCGHIWAT _IOR('s', 1, int) /* get high watermark */
#define SIOCSLOWAT _IOW('s', 2, int) /* set low watermark */
#define SIOCGLOWAT _IOR('s', 3, int) /* get low watermark */
#define SIOCATMARK _IOR('s', 7, int) /* at oob mark? */
#define SIOCSPGRP _IOW('s', 8, int) /* set process group */
#define SIOCGPGRP _IOR('s', 9, int) /* get process group */
 
#define SIOCADDRT _IOW('r', 10, struct ortentry) /* add route */
#define SIOCDELRT _IOW('r', 11, struct ortentry) /* delete route */
 
#define SIOCSIFADDR _IOW('i', 12, struct ifreq) /* set ifnet address */
#define SIOCGIFADDR _IOWR('i',13, struct ifreg) /* get ifnet addres */
#define OSIOCGIFADDR SIOCGIFADDR
#define SIOCSIFDSTADDR _IOW('i', 14, struct ifreq) /* set p-p address */
#define SIOCGIFDSTADDR _IOWR('i',15, struct ifreq) /* get p-p address */
#define OSIOCGIFDSTADDR SIOCGIFDSTADDR
#define SIOCSIFFLAGS _IOW('i', 16, struct ifreq) /* set ifnet flags */
#define SIOCGIFFLAGS _IOWR('i',17, struct ifreq) /* get ifnet flags */
#define SIOCGIFBRDADDR _IOWR('i',18, struct ifreq) /* get broadcast addr */
#define OSIOCGIFBRDADDR SIOCGIFBRDADDR
#define SIOCSIFBRDADDR _IOW('i', 19, struct ifreq) /* set broadcast addr */
#define SIOCGIFCONF _IOWR('i',20, struct ifreq) /* get ifnet list */
#define OSIOCGIFCONF SIOCGIFCONF
#define SIOCGIFNETMASK _IOWR('i',21, struct ifreq) /* get net addr mask */
#define OSIOCGIFNETMASK SIOCGIFNETMASK
#define SIOCSIFNETMASK _IOW('i', 22, struct ifreq) /* set net addr mask */
#define SIOCGIFMETRIC _IOWR('i',23, struct ifreq) /* get if metric */
#define SIOCSIFMETRIC _IOW('i', 24, struct ifreq) /* set if metric */
 
#define SIOCSARP _IOW('i', 30, struct arpreq) /* set arp entry */
#define SIOCGARP _IOWR('i',31, struct arpreq) /* get arp entry */
#define OSIOCGARP SIOCGARP
#define SIOCDARP _IOW('i', 32, struct arpreq) /* delete arp entry */
 
#endif
/pkgnet/trunk/watt32/inc/sys/socket.h
0,0 → 1,305
/*!\file sys/socket.h
*
* BSD socket API.
*/
 
/* Modified for emx by hv and em 1994-1995
*
* Copyright (c) 1982,1985,1986,1988 Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: @(#)socket.h 7.13 (Berkeley) 4/20/91
* $Id: socket.h,v 1.5 1993/06/27 05:59:06 andrew Exp $
*/
 
#ifndef __SYS_SOCKET_H
#define __SYS_SOCKET_H
 
#ifndef __SYS_W32API_H
#include <sys/w32api.h>
#endif
 
#ifndef __SYS_WERRNO_H
/*#include <sys/werrno.h>*/
#endif
 
#ifndef __SYS_CDEFS_H
#include <sys/cdefs.h>
#endif
 
#ifndef __SYS_WTYPES_H
#include <sys/wtypes.h>
#endif
 
#ifndef __SYS_WTIME_H
#include <sys/wtime.h>
#endif
 
#ifndef __NETINET_IN_H
#include <netinet/in.h>
#endif
 
/*
* Definitions related to sockets: types, address families, options.
*/
 
/*
* This is used instead of -1, since the socket type is signed.
*/
#define INVALID_SOCKET (int)(~0)
#define SOCKET_ERROR (-1)
 
/*
* Types
*/
#define SOCK_STREAM 1 /* stream socket */
#define SOCK_DGRAM 2 /* datagram socket */
#define SOCK_RAW 3 /* raw-protocol interface */
#define SOCK_RDM 4 /* reliably-delivered message */
#define SOCK_SEQPACKET 5 /* sequenced packet stream */
#define SOCK_PACKET 10 /* linux specific way of */
/* getting packets at the dev */
/* level. For writing rarp and */
/* other similar things on the */
/* user level. */
 
/*
* Option flags per-socket.
*/
#define SO_DEBUG 0x0001 /* turn on debugging info recording */
#define SO_ACCEPTCONN 0x0002 /* socket has had listen() */
#define SO_REUSEADDR 0x0004 /* allow local address reuse */
#define SO_KEEPALIVE 0x0008 /* keep connections alive */
#define SO_DONTROUTE 0x0010 /* just use interface addresses */
#define SO_BROADCAST 0x0020 /* permit sending of broadcast msgs */
#define SO_USELOOPBACK 0x0040 /* bypass hardware when possible */
#define SO_LINGER 0x0080 /* linger on close if data present */
#define SO_OOBINLINE 0x0100 /* leave received OOB data in line */
 
#define SO_DONTLINGER (int)(~SO_LINGER)
 
/*
* Additional options, not kept in so_options.
*/
#define SO_SNDBUF 0x1001 /* send buffer size */
#define SO_RCVBUF 0x1002 /* receive buffer size */
#define SO_SNDLOWAT 0x1003 /* send low-water mark */
#define SO_RCVLOWAT 0x1004 /* receive low-water mark */
#define SO_SNDTIMEO 0x1005 /* send timeout */
#define SO_RCVTIMEO 0x1006 /* receive timeout */
#define SO_ERROR 0x1007 /* get error status and clear */
#define SO_TYPE 0x1008 /* get socket type */
 
 
#include <sys/packon.h>
 
/*
* Structure used for manipulating linger option.
*/
struct linger {
int l_onoff; /* option on/off */
int l_linger; /* linger time */
};
 
/*
* Level number for (get/set)sockopt() to apply to socket itself.
*/
#define SOL_SOCKET 0xffff /* options for socket level */
 
/*
* Address families.
*/
#define AF_UNSPEC 0 /* unspecified */
#define AF_UNIX 1 /* local to host (pipes, portals) */
#define AF_INET 2 /* internetwork: UDP, TCP, etc. */
#define AF_IMPLINK 3 /* arpanet imp addresses */
#define AF_PUP 4 /* pup protocols: e.g. BSP */
#define AF_CHAOS 5 /* mit CHAOS protocols */
#define AF_NS 6 /* XEROX NS protocols */
#define AF_ISO 7 /* ISO protocols */
#define AF_OSI AF_ISO
#define AF_ECMA 8 /* european computer manufacturers */
#define AF_DATAKIT 9 /* datakit protocols */
#define AF_CCITT 10 /* CCITT protocols, X.25 etc */
#define AF_SNA 11 /* IBM SNA */
#define AF_DECnet 12 /* DECnet */
#define AF_DLI 13 /* DEC Direct data link interface */
#define AF_LAT 14 /* LAT */
#define AF_HYLINK 15 /* NSC Hyperchannel */
#define AF_APPLETALK 16 /* Apple Talk */
#define AF_ROUTE 17 /* Internal Routing Protocol */
#define AF_LINK 18 /* Link layer interface */
#define pseudo_AF_XTP 19 /* eXpress Transfer Protocol (no AF) */
#define AF_INET6 24 /* IPv6 address family */
#define AF_PACKET 25 /* raw packets */
#define AF_MAX 26
 
/*
* Structure used by kernel to store most
* addresses.
* is called struct osockaddr in 4.4BSD
*/
struct sockaddr {
u_short sa_family; /* address family */
char sa_data[14]; /* up to 14 bytes of direct address */
};
 
/*
* Structure used by kernel to pass protocol
* information in raw sockets.
*/
struct sockproto {
u_short sp_family; /* address family */
u_short sp_protocol; /* protocol */
};
 
/*
* Protocol families, same as address families for now.
*/
#define PF_UNSPEC AF_UNSPEC
#define PF_UNIX AF_UNIX
#define PF_INET AF_INET
#define PF_INET6 AF_INET6
#define PF_IMPLINK AF_IMPLINK
#define PF_PUP AF_PUP
#define PF_CHAOS AF_CHAOS
#define PF_NS AF_NS
#define PF_ISO AF_ISO
#define PF_OSI AF_ISO
#define PF_ECMA AF_ECMA
#define PF_DATAKIT AF_DATAKIT
#define PF_CCITT AF_CCITT
#define PF_SNA AF_SNA
#define PF_DECnet AF_DECnet
#define PF_DLI AF_DLI
#define PF_LAT AF_LAT
#define PF_HYLINK AF_HYLINK
#define PF_APPLETALK AF_APPLETALK
#define PF_ROUTE AF_ROUTE
#define PF_LINK AF_LINK
#define PF_PACKET AF_PACKET
#define PF_XTP pseudo_AF_XTP /* really just proto family, no AF */
 
#define PF_MAX AF_MAX
 
/*
* Maximum queue length specifiable by listen.
*/
#define SOMAXCONN 32
#define MSG_OOB 0x1 /* process out-of-band data */
#define MSG_PEEK 0x2 /* peek at incoming message */
#define MSG_DONTROUTE 0x4 /* send without using routing tables */
#define MSG_EOR 0x8 /* data completes record */
#define MSG_TRUNC 0x10 /* data discarded before delivery */
#define MSG_CTRUNC 0x20 /* control data lost before delivery */
#define MSG_WAITALL 0x40 /* wait for full request or error */
 
#define MSG_MAXIOVLEN 16
 
 
/*
* Header for ancillary data objects in msg_control buffer.
* Used for additional information with/about a datagram
* not expressible by flags. The format is a sequence
* of message elements headed by cmsghdr structures.
*/
struct cmsghdr {
u_int cmsg_len; /* data byte count, including hdr */
int cmsg_level; /* originating protocol */
int cmsg_type; /* protocol-specific type */
/* followed by u_char cmsg_data[]; */
};
 
struct msghdr {
char *msg_name; /* Contains an optional address. */
int msg_namelen; /* len of optional address */
struct iovec *msg_iov; /* scatter/gather array. */
int msg_iovlen; /* number of elements in msg_iov */
char *msg_accrights; /* does not apply to IP - not changed */
int msg_accrightslen; /* does not apply to IP */
};
 
/* CMSG_DATA clashes with <wincrypt.h>
*/
#if (defined(WIN32) || defined(_WIN32)) && \
!defined(_WINDOWS_H) && !defined(_INC_WINDOWS) && !defined(__windows_h__)
#error Include <windows.h> before this point.
#endif
 
/* given pointer to struct adatahdr, return pointer to data */
#undef CMSG_DATA
#define CMSG_DATA(cmsg) ((u_char *)((cmsg) + 1))
 
/* given pointer to struct adatahdr, return pointer to next adatahdr */
#define CMSG_NXTHDR(mhdr, cmsg) \
(((caddr_t)(cmsg) + (cmsg)->cmsg_len + sizeof(struct cmsghdr) > \
(mhdr)->msg_control + (mhdr)->msg_controllen) ? \
(struct cmsghdr *)NULL : \
(struct cmsghdr *)((caddr_t)(cmsg) + ALIGN((cmsg)->cmsg_len)))
 
#define CMSG_FIRSTHDR(mhdr) ((struct cmsghdr *)(mhdr)->msg_control)
 
/* "Socket"-level control message types: */
#define SCM_RIGHTS 0x01 /* access rights (array of int) */
 
#include <sys/packoff.h>
 
__BEGIN_DECLS
 
W32_FUNC int W32_CALL accept (int, struct sockaddr *, int *);
W32_FUNC int W32_CALL bind (int, const struct sockaddr *, int);
W32_FUNC int W32_CALL closesocket (int s);
W32_FUNC int W32_CALL connect (int, const struct sockaddr *, int);
W32_FUNC int W32_CALL ioctlsocket (int s, long cmd, char *argp);
W32_FUNC int MS_CDECL fcntlsocket (int s, int cmd, ...);
 
W32_FUNC int W32_CALL getdomainname (char *name, int len);
W32_FUNC int W32_CALL setdomainname (const char *name, int len);
W32_FUNC int W32_CALL gethostname (char *name, int len);
W32_FUNC int W32_CALL sethostname (const char *name, int len);
 
W32_FUNC u_long W32_CALL gethostid (void);
W32_FUNC u_long W32_CALL sethostid (u_long ip);
W32_FUNC int W32_CALL getpeername (int, struct sockaddr *, int *);
W32_FUNC int W32_CALL getsockname (int, struct sockaddr *, int *);
W32_FUNC int W32_CALL getsockopt (int, int, int, void *, int *);
W32_FUNC int W32_CALL listen (int, int);
W32_FUNC int W32_CALL recv (int, void *, int, int);
W32_FUNC int W32_CALL recvfrom (int, void *, int, int, struct sockaddr *, int *);
W32_FUNC int W32_CALL send (int, const void *, int, int);
W32_FUNC int W32_CALL sendto (int, const void *, int, int, const struct sockaddr *, int);
W32_FUNC int W32_CALL setsockopt (int, int, int, const void *, int);
W32_FUNC int W32_CALL shutdown (int, int);
W32_FUNC int W32_CALL socket (int, int, int);
 
__END_DECLS
 
#endif
/pkgnet/trunk/watt32/inc/sys/swap.h
0,0 → 1,229
/*!\file sys/swap.h
* Swapping of short/long values.
*/
 
#ifndef __SYS_SWAP_BYTES_H
#define __SYS_SWAP_BYTES_H
 
#ifndef __SYS_W32API_H
#include <sys/w32api.h>
#endif
 
#ifndef __SYS_CDEFS_H
#include <sys/cdefs.h>
#endif
 
#ifndef __NETINET_IN_H
#include <netinet/in.h>
#endif
 
#if defined(__dj_include_netinet_in_h_)
#error "You are using the wrong version of <netinet/in.h>. Ref. point 10 of the INSTALL file"
#endif
 
 
__BEGIN_DECLS
 
#if defined(WIN32) || defined(_WIN32) /* provide some real versions too */
W32_FUNC unsigned short W32_CALL ntohs (unsigned short);
W32_FUNC unsigned short W32_CALL htons (unsigned short);
W32_FUNC unsigned long W32_CALL ntohl (unsigned long);
W32_FUNC unsigned long W32_CALL htonl (unsigned long);
W32_FUNC unsigned long cdecl _w32_intel (unsigned long x);
W32_FUNC unsigned short cdecl _w32_intel16 (unsigned short x);
#endif
 
#undef ntohs
#undef htons
#undef ntohl
#undef htonl
#define ntohs(x) intel16(x)
#define htons(x) intel16(x)
#define ntohl(x) intel(x)
#define htonl(x) intel(x)
 
 
/*
* Hard to believe, but someone uses Watt-32 on a
* Motorola/PowerPC embedded target.
*/
#if defined(BIG_ENDIAN_MACHINE) || defined(USE_BIGENDIAN)
#define intel(x) x
#define intel16(x) x
 
#elif defined(__GNUC__) && !defined(__NO_INLINE__) /* -O0 */
#define intel(x) __ntohl(x)
#define intel16(x) __ntohs(x)
 
/*
* Ripped (and adapted) from <linux/include/asm-386/byteorder.h>
*/
/*@unused@*/ extern __inline__ unsigned long __ntohl (unsigned long x)
{
__asm__ __volatile (
"xchgb %b0, %h0\n\t" /* swap lower bytes */
"rorl $16, %0\n\t" /* swap words */
"xchgb %b0, %h0" /* swap higher bytes */
: "=q" (x) : "0" (x));
return (x);
}
 
/*@unused@*/ extern __inline__ unsigned short __ntohs (unsigned short x)
{
__asm__ __volatile__ (
"xchgb %b0, %h0" /* swap bytes */
: "=q" (x) : "0" (x));
return (x);
}
 
#elif defined(__POCC__) /* PellesC */
#define intel(x) __ntohl(x)
#define intel16(x) __ntohs(x)
 
__declspec(naked) inline unsigned long __fastcall __ntohl (unsigned long x)
{
__asm xchg cl, ch /* 'x' is in ecx */
__asm ror ecx, 16
__asm xchg cl, ch
__asm mov eax, ecx
__asm ret
}
 
__declspec(naked) inline unsigned short __fastcall __ntohs (unsigned short x)
{
__asm xchg cl, ch /* 'x' is in ecx */
__asm movzx eax, cx
__asm ret
}
 
#elif (defined(_MSC_VER) && (_MSC_VER >= 1200)) && /* MSVC 6+ */ \
!defined(__POCC__) /* "pocc -Ze" sets _MSC_VER */
#define intel(x) __ntohl(x)
#define intel16(x) __ntohs(x)
 
__declspec(naked) static unsigned long __ntohl (unsigned long x)
{
__asm mov eax, [esp+4]
__asm xchg al, ah
__asm ror eax, 16
__asm xchg al, ah
__asm ret
}
 
__declspec(naked) static unsigned short __ntohs (unsigned short x)
{
__asm mov ax, [esp+4]
__asm xchg al, ah
__asm ret
}
 
#elif defined(__WATCOMC__) && defined(__FLAT__) /* Watcom 32-bit */
#define intel(x) __ntohl(x)
#define intel16(x) __ntohs(x)
 
extern unsigned long __ntohl (unsigned long x);
#pragma aux __ntohl = \
"xchg al, ah" \
"ror eax, 16" \
"xchg al, ah" \
parm [eax] \
modify [eax];
 
extern unsigned short __ntohs (unsigned short x);
#pragma aux __ntohs = \
"xchg al, ah" \
parm [ax] \
modify [ax];
 
#elif defined(__WATCOMC__) && !defined(__FLAT__) /* Watcom 16-bit */
#define intel(x) __ntohl(x)
#define intel16(x) __ntohs(x)
 
extern unsigned long __ntohl (unsigned long x);
#pragma aux __ntohl = \
"xchg al, dh" \
"xchg ah, dl" \
parm [dx ax] \
modify [dx ax];
 
extern unsigned short __ntohs (unsigned short x);
#pragma aux __ntohs = \
"xchg al, ah" \
parm [ax] \
modify [ax];
 
#elif (defined(__BORLANDC__) && defined(__FLAT__)) || /* bcc32 */ \
(defined(__DMC__) && (__INTSIZE==4)) /* dmc -mx */
#include <dos.h>
 
#define intel(x) __ntohl(x)
#define intel16(x) __ntohs(x)
 
#define __ntohs(x) (_AX = x, \
__emit__(0x86,0xC4), /* xchg al, ah */ \
_AX)
 
#define __ntohl(x) (_EAX = x, \
__emit__(0x86,0xC4), /* xchg al, ah */ \
__emit__(0xC1,0xC8,0x10), /* ror eax, 16 */ \
__emit__(0x86,0xC4), /* xchg al, ah */ \
_EAX)
 
#elif defined(__CCDL__) && defined(__386__) /* LadSoft 386 */
#define intel(x) __ntohl(x)
#define intel16(x) __ntohs(x)
 
static unsigned long __ntohl (unsigned long x)
{
asm { mov eax, [x]
xchg al, ah
ror eax, 16
xchg al, ah
}
return (_EAX);
}
static unsigned short __ntohs (unsigned short x)
{
asm { mov ax, [x]
xchg al, ah
}
return (unsigned short)_EAX; /* doesn't have _AX */
}
 
/* This crashes mysteriously if we use _bswap()
*/
#elif defined(__LCC__) && 0 /* LCC-Win32 */
#define intel(x) __ntohl(x)
#define intel16(x) __ntohs(x)
#if 0
#include <intrinsics.h>
#define W32_LCC_INTRINSICS_INCLUDED /* header guard is missing */
#define __ntohl(x) (unsigned long) _bswap(x)
#define __ntohs(x) ((unsigned short) (_bswap(x) >> 16))
#else
unsigned long inline __declspec(naked) __ntohl (unsigned long x)
{
_asm ("movl (%esp), %eax");
_asm ("xchg %ah, %al");
_asm ("rorl $16, %eax");
_asm ("xchg %ah, %al");
}
unsigned short inline __declspec(naked) __ntohs (unsigned short x)
{
_asm ("movs (%esp), %ax");
_asm ("xchg %ah, %al");
}
#endif
 
#else /* no inlining possible (or worth the effort) */
#define intel W32_NAMESPACE (intel)
#define intel16 W32_NAMESPACE (intel16)
#define WATT_NO_INLINE_INTEL
 
W32_FUNC unsigned long cdecl intel (unsigned long x);
W32_FUNC unsigned short cdecl intel16 (unsigned short x);
#endif
 
__END_DECLS
 
#endif /* __SYS_SWAP_BYTES_H */
/pkgnet/trunk/watt32/inc/sys/syslog.h
0,0 → 1,160
/*!\file sys/syslog.h
* syslog() facility.
*/
 
/*
* Copyright (c) 1982, 1986, 1988, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)syslog.h 8.1 (Berkeley) 6/2/93
* $Id: syslog.h,v 1.15 1997/10/06 20:37:01 joerg Exp $
*/
 
#ifndef __SYS_SYSLOG_H
#define __SYS_SYSLOG_H
 
#ifndef _PATH_LOG
#define _PATH_LOG "/var/run/log"
#endif
 
#ifndef _PATH_OLDLOG
#define _PATH_OLDLOG "/dev/log" /* backward compatibility */
#endif
 
/*
* priorities/facilities are encoded into a single 32-bit quantity, where the
* bottom 3 bits are the priority (0-7) and the top 28 bits are the facility
* (0-big number). Both the priorities and the facilities map roughly
* one-to-one to strings in the syslogd(8) source code. This mapping is
* included in this file.
*
* priorities (these are ordered)
*/
#define LOG_EMERG 0 /* system is unusable */
#define LOG_ALERT 1 /* action must be taken immediately */
#define LOG_CRIT 2 /* critical conditions */
#define LOG_ERR 3 /* error conditions */
#define LOG_WARNING 4 /* warning conditions */
#define LOG_NOTICE 5 /* normal but significant condition */
#define LOG_INFO 6 /* informational */
#define LOG_DEBUG 7 /* debug-level messages */
 
#define LOG_PRIMASK 0x07 /* mask to extract priority part (internal) */
/* extract priority */
#define LOG_PRI(p) ((p) & LOG_PRIMASK)
#define LOG_MAKEPRI(fac, pri) ((fac) | (pri))
 
#define INTERNAL_NOPRI 0x10 /* the "no priority" priority */
/* mark "facility" */
#define INTERNAL_MARK LOG_MAKEPRI((LOG_NFACILITIES<<3), 0)
 
typedef struct _code {
unsigned long c_val;
const char *c_name;
} CODE;
 
extern CODE prioritynames[13];
 
/* facility codes */
#define LOG_KERN (0<<3) /* kernel messages */
#define LOG_USER (1<<3) /* random user-level messages */
#define LOG_MAIL (2<<3) /* mail system */
#define LOG_DAEMON (3<<3) /* system daemons */
#define LOG_AUTH (4<<3) /* security/authorization messages */
#define LOG_SYSLOG (5<<3) /* messages generated internally by syslogd */
#define LOG_LPR (6<<3) /* line printer subsystem */
#define LOG_NEWS (7<<3) /* network news subsystem */
#define LOG_UUCP (8<<3) /* UUCP subsystem */
#define LOG_CRON (9<<3) /* clock daemon */
#define LOG_AUTHPRIV (10<<3) /* security/authorization messages (private) */
/* Facility #10 clashes in DEC UNIX, where */
/* it's defined as LOG_MEGASAFE for AdvFS */
/* event logging. */
#define LOG_FTP (11<<3) /* ftp daemon */
#define LOG_NTP (12<<3) /* NTP subsystem */
 
/* other codes through 15 reserved for system use */
#define LOG_LOCAL0 (16<<3) /* reserved for local use */
#define LOG_LOCAL1 (17<<3) /* reserved for local use */
#define LOG_LOCAL2 (18<<3) /* reserved for local use */
#define LOG_LOCAL3 (19<<3) /* reserved for local use */
#define LOG_LOCAL4 (20<<3) /* reserved for local use */
#define LOG_LOCAL5 (21<<3) /* reserved for local use */
#define LOG_LOCAL6 (22<<3) /* reserved for local use */
#define LOG_LOCAL7 (23<<3) /* reserved for local use */
 
#define LOG_NFACILITIES 24 /* current number of facilities */
#define LOG_FACMASK 0x03f8 /* mask to extract facility part */
/* facility of pri */
#define LOG_FAC(p) (((p) & LOG_FACMASK) >> 3)
 
extern CODE facilitynames[24];
 
/*
* arguments to setlogmask.
*/
#define LOG_MASK(pri) (1 << (pri)) /* mask for one priority */
#define LOG_UPTO(pri) ((1 << ((pri)+1)) - 1) /* all priorities through pri */
 
/*
* Option flags for openlog.
*
* LOG_ODELAY no longer does anything.
* LOG_NDELAY is the inverse of what it used to be.
*/
#define LOG_PID 0x01 /* log the pid with each message */
#define LOG_CONS 0x02 /* log on the console if errors in sending */
#define LOG_ODELAY 0x04 /* delay open until first syslog() (default) */
#define LOG_NDELAY 0x08 /* don't delay open */
#define LOG_NOWAIT 0x10 /* don't wait for console forks: DEPRECATED */
#define LOG_PERROR 0x20 /* log to stderr as well */
 
#include <stdarg.h>
 
#ifndef __SYS_W32API_H
#include <sys/w32api.h>
#endif
 
#ifndef __SYS_CDEFS_H
#include <sys/cdefs.h>
#endif
 
__BEGIN_DECLS
 
W32_FUNC void closelog (void);
W32_FUNC void openlog (const char *, int, int);
W32_FUNC int setlogmask (int);
W32_FUNC void syslog (int, const char *, ...);
W32_FUNC void vsyslog (int, const char *, va_list);
 
__END_DECLS
 
#endif
/pkgnet/trunk/watt32/inc/sys/turboc.err
0,0 → 1,64
#ifndef __SYS_WERRNO_ERR
#define __SYS_WERRNO_ERR
 
/*
* THIS FILE IS GENERATED BY E:\NET\WATT\UTIL\TCC_ERR.EXE. DO NOT EDIT.
*
* Watt-32 errnos are after vendor's errnos (1 - 35)
*/
 
#ifndef __TURBOC__
#error This file is only for use by "__TURBOC__"
#endif
 
#define EWOULDBLOCK 36
#define EDEADLK 40
#define ENAMETOOLONG 47
#define ENOLCK 49
#define ENOSYS 51
#define ENOTEMPTY 53
#define EINPROGRESS 61
#define EALREADY 62
#define ENOTSOCK 63
#define EDESTADDRREQ 64
#define EMSGSIZE 65
#define EPROTOTYPE 66
#define ENOPROTOOPT 67
#define EPROTONOSUPPORT 68
#define ESOCKTNOSUPPORT 69
#define EOPNOTSUPP 70
#define EPFNOSUPPORT 71
#define EAFNOSUPPORT 72
#define EADDRINUSE 73
#define EADDRNOTAVAIL 74
#define ENETDOWN 75
#define ENETUNREACH 76
#define ENETRESET 77
#define ECONNABORTED 78
#define ECONNRESET 79
#define ENOBUFS 80
#define EISCONN 81
#define ENOTCONN 82
#define ESHUTDOWN 83
#define ETIMEDOUT 84
#define ECONNREFUSED 85
#define EHOSTDOWN 86
#define EHOSTUNREACH 87
#define ESTALE 88
#define EREMOTE 89
#define EBADRPC 90
#define ERPCMISMATCH 91
#define EPROGUNAVAIL 92
#define EPROGMISMATCH 93
#define EPROCUNAVAIL 94
#define EILSEQ 95
#define EDEADLOCK 96
#define ETOOMANYREFS 100
#define ELOOP 101
#define EPROCLIM 102
#define EUSERS 103
#define EDQUOT 104
#define EVDBAD 105
#define ENORMTWD 106
 
#endif /* __SYS_WERRNO_ERR */
/pkgnet/trunk/watt32/inc/sys/uio.h
0,0 → 1,11
/*!\file sys/uio.h
* Dummy header.
*/
 
#ifndef __SYS_UIO_H
#define __SYS_UIO_H
 
/* This dummy header is required while building e.g. tcpdump
*/
 
#endif
/pkgnet/trunk/watt32/inc/sys/visualc.err
0,0 → 1,113
#ifndef __SYS_WERRNO_ERR
#define __SYS_WERRNO_ERR
 
/*
* THIS FILE WAS GENERATED BY ..\util\vc_err. DO NOT EDIT.
*
* Watt-32 errnos are after vendor's errnos (1 - 42)
*/
 
#ifndef _MSC_VER
#error This file is only for use by "_MSC_VER"
#endif
 
#define ERRNO_VENDOR_VERSION "12.0"
 
#define EWOULDBLOCK 43
#define EDOM 33
#define ERANGE 34
#define E2BIG 7
#define EACCES 13
#define EAGAIN 11
#define EBADF 9
#define EBUSY 16
#define ECHILD 10
#define EDEADLK 36
#define EEXIST 17
#define EFAULT 14
#define EFBIG 27
#define EINTR 4
#define EINVAL 22
#define EIO 5
#define EISDIR 21
#define EMFILE 24
#define EMLINK 31
#define ENAMETOOLONG 38
#define ENFILE 23
#define ENODEV 19
#define ENOENT 2
#define ENOEXEC 8
#define ENOLCK 39
#define ENOMEM 12
#define ENOSPC 28
#define ENOSYS 40
#define ENOTDIR 20
#define ENOTEMPTY 41
#define ENOTTY 25
#define ENXIO 6
#define EPERM 1
#define EPIPE 32
#define EROFS 30
#define ESPIPE 29
#define ESRCH 3
#define EXDEV 18
#define ENMFILE 44
#define EINPROGRESS 45
#define EALREADY 46
#define ENOTSOCK 47
#define EDESTADDRREQ 48
#define EMSGSIZE 49
#define EPROTOTYPE 50
#define ENOPROTOOPT 51
#define EPROTONOSUPPORT 52
#define ESOCKTNOSUPPORT 53
#define EOPNOTSUPP 54
#define EPFNOSUPPORT 55
#define EAFNOSUPPORT 56
#define EADDRINUSE 57
#define EADDRNOTAVAIL 58
#define ENETDOWN 59
#define ENETUNREACH 60
#define ENETRESET 61
#define ECONNABORTED 62
#define ECONNRESET 63
#define ENOBUFS 64
#define EISCONN 65
#define ENOTCONN 66
#define ESHUTDOWN 67
#define ETIMEDOUT 68
#define ECONNREFUSED 69
#define EHOSTDOWN 70
#define EHOSTUNREACH 71
#define ESTALE 72
#define EREMOTE 73
#define EBADRPC 74
#define ERPCMISMATCH 75
#define EPROGUNAVAIL 76
#define EPROGMISMATCH 77
#define EPROCUNAVAIL 78
#define EILSEQ 42
#define EINVFNC 79
#define ENOPATH 80
#define ECONTR 81
#define EINVMEM 82
#define EINVENV 83
#define EINVFMT 84
#define EINVACC 85
#define EINVDAT 86
#define EDEADLOCK 36
#define ECURDIR 87
#define ENOTSAM 88
#define ETXTBSY 89
#define ENOTBLK 90
#define EUCLEAN 91
#define ETOOMANYREFS 92
#define ELOOP 93
#define EPROCLIM 94
#define EUSERS 95
#define EDQUOT 96
#define EVDBAD 97
#define ENORMTWD 98
#define EOVERFLOW 99
 
#endif /* __SYS_WERRNO_ERR */
/pkgnet/trunk/watt32/inc/sys/w32api.h
0,0 → 1,71
/*!\file sys/w32api.h
*
* Watt-32 API decoration for Win32 targets.
*/
#ifndef __SYS_W32API_H
#define __SYS_W32API_H
 
#if !defined(_WATT32_FAKE_WINSOCK_H) && (defined(_WINSOCK_H) || defined(_WINSOCKAPI_))
#error Never include the real <winsock.h> in Watt-32 programs.
#error Change your include-path so the fake <winsock.h> gets included first.
#endif
 
#if !defined(_WATT32_FAKE_WINSOCK2_H) && (defined(_WINSOCK2_H) || defined(_WINSOCK2API_))
#error Never include the real <winsock2.h> in Watt-32 programs.
#error Change your include-path so the fake <winsock2.h> gets included first.
#endif
 
#if !defined(_WATT32_FAKE_WS2TCPIP_H) && defined(_WS2TCPIP_H)
#error Never include the real <ws2tcpip.h> in Watt-32 programs.
#error Change your include-path so the fake <ws2tcpip.h> gets included first.
#endif
 
#if defined(WIN32) || defined(_WIN32)
/* Don't include the real <winsock*.h> */
#define _WINSOCKAPI_
#define _WINSOCK2API_
#define _WINSOCK_H
#define _WINSOCK2_H
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#include <windows.h>
#endif
 
/*
* For non-Win32 targets the .\util\mkimp program (a small C-preprocessor)
* is meant to search all headers for W32_FUNC/W32_DATA prefixes. All
* functions with a W32_FUNC prefix will produce an export stub function.
* See dj_dxe.mak. Very experimental at the moment.
*
* Note: only a small subset of the Winsock extensions are implemented in
* watt-32.dll (hardly any WSA*() functions yet).
*/
#if (defined(WIN32) || defined(_WIN32)) && !defined(WATT32_STATIC)
#if defined(WATT32_BUILD)
#define W32_FUNC extern __declspec(dllexport)
#define W32_DATA extern __declspec(dllexport)
#else
#define W32_FUNC extern __declspec(dllimport)
#define W32_DATA extern __declspec(dllimport)
#endif
#else
#define W32_FUNC extern
#define W32_DATA extern
#endif
 
/*
* W32_CALL is *not* defined to `stdcall' due to a bug in MingW's
* linker. This bug prevents a MingW generated WATT-32.DLL from
* being used by e.g. a MSVC program.
* Ref. http://sources.redhat.com/bugzilla/show_bug.cgi?id=351
* (last paragraph)
*/
#if (defined(WIN32) || defined(_WIN32)) && 0
#define W32_CALL __stdcall /* maybe __fastcall instead for MSVC? */
#else
#define W32_CALL
#endif
 
#endif
 
/pkgnet/trunk/watt32/inc/sys/watcom.err
0,0 → 1,113
#ifndef __SYS_WERRNO_ERR
#define __SYS_WERRNO_ERR
 
/*
* THIS FILE WAS GENERATED BY E:\NET\WATT\UTIL\WC_ERR.EXE. DO NOT EDIT.
*
* Watt-32 errnos are after vendor's errnos (1 - 41)
*/
 
#ifndef __WATCOMC__
#error This file is only for use by "__WATCOMC__"
#endif
 
#define ERRNO_VENDOR_VERSION "12.40"
 
#define EWOULDBLOCK 42
#define EDOM 13
#define ERANGE 14
#define E2BIG 2
#define EACCES 6
#define EAGAIN 18
#define EBADF 4
#define EBUSY 19
#define ECHILD 17
#define EDEADLK 15
#define EEXIST 7
#define EFAULT 34
#define EFBIG 20
#define EINTR 16
#define EINVAL 9
#define EIO 21
#define EISDIR 22
#define EMFILE 11
#define EMLINK 24
#define ENAMETOOLONG 35
#define ENFILE 10
#define ENODEV 36
#define ENOENT 1
#define ENOEXEC 3
#define ENOLCK 37
#define ENOMEM 5
#define ENOSPC 12
#define ENOSYS 38
#define ENOTDIR 23
#define ENOTEMPTY 39
#define ENOTTY 26
#define ENXIO 27
#define EPERM 28
#define EPIPE 29
#define EROFS 30
#define ESPIPE 31
#define ESRCH 32
#define EXDEV 8
#define ENMFILE 43
#define EINPROGRESS 44
#define EALREADY 45
#define ENOTSOCK 46
#define EDESTADDRREQ 47
#define EMSGSIZE 48
#define EPROTOTYPE 49
#define ENOPROTOOPT 50
#define EPROTONOSUPPORT 51
#define ESOCKTNOSUPPORT 52
#define EOPNOTSUPP 53
#define EPFNOSUPPORT 54
#define EAFNOSUPPORT 55
#define EADDRINUSE 56
#define EADDRNOTAVAIL 57
#define ENETDOWN 58
#define ENETUNREACH 59
#define ENETRESET 60
#define ECONNABORTED 61
#define ECONNRESET 62
#define ENOBUFS 63
#define EISCONN 64
#define ENOTCONN 65
#define ESHUTDOWN 66
#define ETIMEDOUT 67
#define ECONNREFUSED 68
#define EHOSTDOWN 69
#define EHOSTUNREACH 70
#define ESTALE 71
#define EREMOTE 72
#define EBADRPC 73
#define ERPCMISMATCH 74
#define EPROGUNAVAIL 75
#define EPROGMISMATCH 76
#define EPROCUNAVAIL 77
#define EILSEQ 40
#define EINVFNC 78
#define ENOPATH 79
#define ECONTR 80
#define EINVMEM 81
#define EINVENV 82
#define EINVFMT 83
#define EINVACC 84
#define EINVDAT 85
#define EDEADLOCK 15
#define ECURDIR 86
#define ENOTSAM 87
#define ETXTBSY 33
#define ENOTBLK 25
#define EUCLEAN 88
#define ETOOMANYREFS 89
#define ELOOP 90
#define EPROCLIM 91
#define EUSERS 92
#define EDQUOT 93
#define EVDBAD 94
#define ENORMTWD 95
#define EOVERFLOW 96
 
#endif /* __SYS_WERRNO_ERR */
/pkgnet/trunk/watt32/inc/sys/werrno.h
0,0 → 1,141
/*!\file sys/werrno.h
*
* sys_errlist[] and errno's for compilers with limited errnos.
* For WIN32, we do NOT use the <winsock.h> WSAE* codes.
*
* G. Vanem <giva@bgnett.no> 1998 - 2004
*/
 
#ifndef __SYS_WERRNO_H
#define __SYS_WERRNO_H
 
/* When doing "gcc -MM" with gcc 3.0 we must include <sys/version.h>
* (via stdio.h) in order for __DJGPP__ to be defined
*/
#include <stdio.h>
#include <errno.h>
 
#ifndef __SYS_W32API_H
#include <sys/w32api.h>
#endif
 
/* Hack: fix for compiling with djgpp 2.04, but
* ./util/dj_err.exe was compiled with 2.03
*/
#if defined(MIXING_DJGPP_203_AND_204)
#undef ELOOP
#endif
 
#if defined(__MINGW32__)
#include <sys/mingw32.err>
 
#elif defined(__HIGHC__)
#undef EDEADLK
#undef EDEADLOCK
#include <sys/highc.err>
 
#elif defined(__BORLANDC__)
#ifdef __FLAT__
#undef ENAMETOOLONG /* bcc32 4.0 */
#endif
#ifdef _WIN32
#undef ENOTEMPTY
#endif
#include <sys/borlandc.err>
 
#elif defined(__TURBOC__)
#include <sys/turboc.err>
 
#elif defined(__WATCOMC__)
#include <sys/watcom.err>
 
#elif defined(__DJGPP__)
#include <sys/djgpp.err>
 
#elif defined(__DMC__) /* Digital Mars Compiler */
#include <sys/digmars.err>
 
#elif defined(_MSC_VER) && (_MSC_VER <= 800) /* MSC 8.0 or older */
#include <sys/quickc.err>
 
#elif defined(_MSC_VER) && (_MSC_VER > 800) /* Visual C on Windows */
#undef EDEADLOCK
#include <sys/visualc.err>
 
#elif defined(__CCDL__) /* LadSoft's cc386.exe */
#include <sys/ladsoft.err>
 
#elif defined(__LCC__)
#include <sys/lcc.err>
 
#elif defined(__POCC__)
#include <sys/pellesc.err>
 
#else
#error Unknown target in <sys/werrno.h>.
#endif
 
/*
* Ugly hack ahead. Someone tell me a better way, but
* errno and friends are macros on Windows. Redefine them
* to point to our variables.
*
* On Windows, the usual 'errno' is a macro "(*_errno)()" that
* is problematic to use as a lvalue.
* On other platforms we modify the global 'errno' variable directly.
* (see SOCK_ERRNO() in misc.h). So no need to redefine it in any way.
*/
 
W32_DATA int _w32_errno;
W32_DATA int _w32_sys_nerr;
W32_DATA char *_w32_sys_errlist[];
 
#if 0
#undef sys_nerr
#define sys_nerr _w32_sys_nerr
 
#undef _sys_nerr
#define _sys_nerr _w32_sys_nerr
 
#undef __sys_nerr
#define __sys_nerr _w32_sys_nerr
 
#undef sys_errlist
#define sys_errlist _w32_sys_errlist
 
#undef _sys_errlist
#define _sys_errlist _w32_sys_errlist
 
#undef __sys_errlist
#define __sys_errlist _w32_sys_errlist
#endif
 
/*
* Incase you have trouble with duplicate defined symbols,
* make sure the "*_s()" versions are referenced before normal
* perror() and strerror() in your C-library.
*/
W32_FUNC void perror_s (const char *str);
W32_FUNC char *strerror_s (int errnum);
 
#if defined(__cplusplus) /* Damn C++ */
#include <stdlib.h>
#include <string.h>
 
#elif !defined(_MSC_VER) && !defined(WIN32)
#if !defined(_INC_STDLIB) && !defined(_STDLIB_H_) && !defined(_STDIO_H)
W32_FUNC void perror (const char *str);
#endif
 
#if !defined(_INC_STRING) && !defined(_STRING_H) && !defined(_STRING_H_)
W32_FUNC char *strerror (int errnum);
#endif
#endif
 
#if defined(WIN32) || defined(_WIN32)
W32_FUNC int __stdcall WSAGetLastError (void);
W32_FUNC void __stdcall WSASetLastError (int err);
#endif
 
#endif /* __SYS_WERRNO_H */
 
/pkgnet/trunk/watt32/inc/sys/wtime.h
0,0 → 1,112
/*!\file sys/wtime.h
*
* Watt-32 time functions.
*/
 
#ifndef __SYS_WTIME_H
#define __SYS_WTIME_H
 
/*
* The naming <sys/wtime.h> is required for those compilers that
* have <sys/time.h> in the usual place but doesn't define
* the following.
*/
 
#include <time.h>
 
#ifdef __BORLANDC__
#undef timezone /* a macro in bcc 5+ */
#endif
 
#ifndef __SYS_W32API_H
#include <sys/w32api.h>
#endif
 
#ifndef __SYS_CDEFS_H
#include <sys/cdefs.h>
#endif
 
#if defined(__DJGPP__)
#include <sys/time.h>
#include <sys/times.h>
 
#elif defined(__MINGW32__)
#include <sys/time.h>
 
#else
struct timeval {
time_t tv_sec;
long tv_usec;
};
#define STRUCT_TIMEVAL_DEFINED
#endif
 
#if !defined(__DJGPP__)
struct timezone {
int tz_minuteswest;
int tz_dsttime;
};
 
struct tms {
unsigned long tms_utime;
unsigned long tms_cstime;
unsigned long tms_cutime;
unsigned long tms_stime;
};
#define STRUCT_TIMEZONE_DEFINED
#define STRUCT_TMS_DEFINED
 
__BEGIN_DECLS
 
#define ITIMER_REAL 0
#define ITIMER_PROF 1
 
struct itimerval {
struct timeval it_interval; /* timer interval */
struct timeval it_value; /* current value */
};
 
W32_FUNC int getitimer (int, struct itimerval *);
W32_FUNC int setitimer (int, struct itimerval *, struct itimerval *);
 
W32_FUNC int gettimeofday (struct timeval *tp, struct timezone *tz);
 
__END_DECLS
 
#endif /* !__DJGPP__ */
 
#if !defined(_STRUCT_TIMESPEC) && !defined(_pthread_signal_h)
#define _STRUCT_TIMESPEC
struct timespec {
time_t tv_sec;
long tv_nsec;
};
#endif
 
#ifndef HZ
#define HZ 18.2F
#endif
 
__BEGIN_DECLS
 
W32_FUNC unsigned long net_times (struct tms *buffer);
W32_FUNC int gettimeofday2 (struct timeval *tv, struct timezone *tz);
 
__END_DECLS
 
/*
* Operations on timevals.
*
* NB: timercmp does not work for >= or <=.
*/
#ifndef timerisset
#define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec)
 
#define timercmp(tvp, uvp, cmp) ((tvp)->tv_sec cmp (uvp)->tv_sec || \
((tvp)->tv_sec == (uvp)->tv_sec && \
(tvp)->tv_usec cmp (uvp)->tv_usec))
 
#define timerclear(tvp) (tvp)->tv_sec = (tvp)->tv_usec = 0
#endif
 
#endif /* !__SYS_WTIME_H */
/pkgnet/trunk/watt32/inc/sys/wtypes.h
0,0 → 1,200
/*!\file sys/wtypes.h
* Watt-32 type definitions.
*/
 
/*-
* Copyright (c) 1982, 1986, 1991 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)types.h 7.17 (Berkeley) 5/6/91
* @(#)wtypes.h Waterloo TCP/IP
*/
 
/*
* the naming <sys/wtypes.h> is required for those compilers that
* have <sys/types.h> in the usual place but doesn't define
* the following types. This file is included from <sys/socket.h>,
* <tcp.h> etc.
*/
 
#ifndef __SYS_WTYPES_H
#define __SYS_WTYPES_H
 
#if 0 /* No, that causes trouble */
#undef FD_SETSIZE
#define FD_SETSIZE 512 /* use same FD_SETSIZE for all targets */
#endif
 
#if defined(__DJGPP__) || defined(__DMC__) || defined(__MINGW32__) || defined(__POCC__)
#include <sys/types.h>
#endif
 
#if defined(__DJGPP__)
#include <machine/endian.h>
#endif
 
#if defined(__MINGW32__) || (defined(__DJGPP__) && DJGPP_MINOR >= 4) || \
(defined(__WATCOMC__) && __WATCOMC__ >= 1230) || /* OW 1.3+ */ \
defined(__POCC__) /* PellesC */
#undef HAVE_STDINT_H
#define HAVE_STDINT_H
#include <stdint.h> /* doesn't define 'u_char' etc. */
#endif
 
 
#if !defined(HAVE_U_INT64_T) && !defined(u_int64_t)
#if defined(__HIGHC__) || defined(__GNUC__)
typedef unsigned long long u_int64_t;
#define HAVE_U_INT64_T
 
#elif defined(__DMC__) && (__INTSIZE == 4)
typedef unsigned long long u_int64_t;
#define HAVE_U_INT64_T
 
#elif defined(__WATCOMC__) && defined(__WATCOM_INT64__)
typedef unsigned __int64 u_int64_t;
#define HAVE_U_INT64_T
 
#elif (defined(_MSC_VER) && (_MSC_VER >= 900)) || defined(__POCC__)
typedef unsigned __int64 u_int64_t;
#define HAVE_U_INT64_T
#endif
#endif
 
#if !defined(__GLIBC__)
#if !defined(HAVE_U_CHAR) && !defined(u_char)
typedef unsigned char u_char;
#define HAVE_U_CHAR
#endif
 
#if !defined(HAVE_U_SHORT) && !defined(u_short)
typedef unsigned short u_short;
#define HAVE_U_SHORT
#endif
 
#if !defined(HAVE_USHORT) && !defined(ushort)
typedef unsigned short ushort; /* SysV compatibility */
#define HAVE_USHORT
#endif
 
#if !defined(HAVE_U_LONG) && !defined(u_long)
typedef unsigned long u_long;
#define HAVE_U_LONG
#endif
 
#if !defined(HAVE_U_INT) && !defined(u_int)
#if defined(__SMALL__) || defined(__LARGE__)
typedef unsigned long u_int; /* too many headers assumes u_int is >=32-bit */
#else
typedef unsigned int u_int;
#endif
#define HAVE_U_INT
#endif
 
#if !defined(HAVE_CADDR_T) && !defined(caddr_t)
typedef unsigned long caddr_t;
#define HAVE_CADDR_T
#endif
#endif
 
#if !defined(HAVE_U_INT8_T) && !defined(u_int8_t)
typedef unsigned char u_int8_t;
#endif
 
#if !defined(HAVE_U_INT16_T) && !defined(u_int16_t)
typedef unsigned short u_int16_t;
#endif
 
#if !defined(HAVE_U_INT32_T) && !defined(u_int32_t)
typedef unsigned long u_int32_t;
#endif
 
#if !defined(HAVE_STDINT_H)
#if !defined(HAVE_INT16_T) && !defined(int16_t)
typedef short int16_t;
#define HAVE_INT16_T
#endif
 
#if !defined(HAVE_INT32_T) && !defined(int32_t)
typedef long int32_t;
#define HAVE_INT32_T
#endif
#endif
 
#if !defined(HAVE_U_QUAD_T) && !defined(u_quad_t)
#define HAVE_U_QUAD_T
#ifdef HAVE_U_INT64_T
#define u_quad_t u_int64_t
#else
#define u_quad_t unsigned long
#endif
#endif
 
#if !defined(IOVEC_DEFINED)
#define IOVEC_DEFINED
struct iovec {
void *iov_base;
int iov_len;
};
#endif
 
 
#define __BIT_TYPES_DEFINED__
 
#if !defined(FD_SET) /* not djgpp */
 
#undef FD_SETSIZE
#define FD_SETSIZE 512
#define FD_SET(n, p) ((p)->fd_bits[(n)/8] |= (1 << ((n) & 7)))
#define FD_CLR(n, p) ((p)->fd_bits[(n)/8] &= ~(1 << ((n) & 7)))
#define FD_ISSET(n,p) ((p)->fd_bits[(n)/8] & (1 << ((n) & 7)))
#define FD_ZERO(p) memset ((void*)(p), 0, sizeof(*(p)))
 
typedef struct fd_set {
unsigned char fd_bits [(FD_SETSIZE+7)/8];
} fd_set;
#endif
 
#ifndef LITTLE_ENDIAN
#define LITTLE_ENDIAN 1234
#endif
 
#ifndef BIG_ENDIAN
#define BIG_ENDIAN 4321
#endif
 
#if defined(BIG_ENDIAN_MACHINE) || defined(USE_BIGENDIAN)
#define BYTE_ORDER BIG_ENDIAN
#else
#define BYTE_ORDER LITTLE_ENDIAN
#endif
 
#endif
/pkgnet/trunk/watt32/inc/syslog.h
0,0 → 1,9
/*!\file inc/syslog.h
* syslog header.
*/
/*
* POSIX requires (AFAIK) this file in a base-dir
*/
#ifndef __SYS_SYSLOG_H
#include <sys/syslog.h>
#endif
/pkgnet/trunk/watt32/inc/tcp.h
0,0 → 1,796
/*!\file inc/tcp.h
* Watt-32 public API.
*/
 
/*
* Waterloo TCP
*
* Copyright (c) 1990-1993 Erick Engelke
*
* Portions copyright others, see copyright.h for details.
*
* This library is free software; you can use it or redistribute under
* the terms of the license included in LICENSE.H.
*
* 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
* file LICENSE.H for more details.
*
*/
 
#ifndef __WATT_TCP_H
#define __WATT_TCP_H
 
/*
* Version (major.minor.dev-rel), 8-bit each.
*/
#define WATTCP_MAJOR_VER 2
#define WATTCP_MINOR_VER 2
#define WATTCP_DEVEL_REL 10
 
#define WATTCP_VER ((WATTCP_MAJOR_VER << 16) + \
(WATTCP_MINOR_VER << 8) + \
WATTCP_DEVEL_REL)
 
#define WATTCP_VER_STRING "2.2.10"
 
#if !defined(RC_INVOKED)
 
#include <stdio.h>
#include <sys/wtypes.h> /* fd_set, iovec */
#include <sys/wtime.h> /* struct timeval, cdecl */
#include <sys/swap.h> /* intel(), intel16() */
#include <sys/w32api.h> /* W32_FUNC, W32_DATA etc. */
 
#ifdef __WATCOMC__
#pragma read_only_directory;
#endif
 
#ifdef __cplusplus
extern "C" {
#if 0 /* keep Emacs's auto-indent happy */
}
#endif
#endif
 
W32_DATA const char *wattcpCopyright; /* "See COPYRIGHT.H for details" */
 
W32_FUNC const char *wattcpVersion (void); /* WatTCP target version/date */
W32_FUNC const char *wattcpCapabilities (void); /* what's been compiled in */
 
#if !defined(WATT32_BUILD)
 
/*
* Typedefs and constants
*/
#ifndef BYTE
#define BYTE unsigned char
#endif
 
#ifndef WORD
#define WORD unsigned short
#endif
 
#ifndef DWORD
#define DWORD unsigned long
#endif
 
#ifndef BOOL
#define BOOL int
#endif
 
#ifndef sock_type
#define sock_type void
#endif
 
/*
* Old compatibility
*/
#ifndef byte
#define byte unsigned char
#endif
 
#ifndef word
#define word unsigned short
#endif
 
#ifndef dword
#define dword unsigned long
#endif
 
#ifndef longword
#define longword unsigned long
#endif
 
/*
* Basic typedefs
*/
typedef BYTE eth_address[6];
typedef BYTE ip6_address[16];
 
typedef int (*ProtoHandler) (void *sock, const BYTE *data, unsigned len,
const void *tcp_phdr, const void *udp_hdr);
 
typedef int (*UserHandler) (void *sock);
 
#endif /* WATT32_BUILD */
 
 
typedef struct {
BYTE undoc [4470];
} tcp_Socket;
 
typedef struct {
BYTE undoc [1740];
} udp_Socket;
 
 
/* Silly C++ compilers needs this to supress warning at max warning level
*/
typedef void (*VoidProc)(void);
 
#define MAX_COOKIES 10
#define MAX_NAMESERVERS 10
#define MAX_HOSTLEN 80
 
/* Modes for sock_mode()
*/
#define TCP_MODE_BINARY 0x01 /* deprecated */
#define TCP_MODE_ASCII 0x02 /* deprecated */
#define SOCK_MODE_BINARY 0x01 /* new name */
#define SOCK_MODE_ASCII 0x02 /* new name */
#define UDP_MODE_CHK 0x04 /* defaults to checksum */
#define UDP_MODE_NOCHK 0x08
#define TCP_MODE_NAGLE 0x10 /* Nagle's algorithm */
#define TCP_MODE_NONAGLE 0x20
 
/* wait-states for sock_sselect()
*/
#define SOCKESTABLISHED 1
#define SOCKDATAREADY 2
#define SOCKCLOSED 4
 
/*
* Hide "private" symbols by prefixing with "_w32_"
*/
#undef W32_NAMESPACE
#define W32_NAMESPACE(x) _w32_ ## x
 
#define init_misc W32_NAMESPACE (init_misc)
#define Random W32_NAMESPACE (Random)
#define set_timeout W32_NAMESPACE (set_timeout)
#define chk_timeout W32_NAMESPACE (chk_timeout)
#define cmp_timeout W32_NAMESPACE (cmp_timeout)
#define hires_timer W32_NAMESPACE (hires_timer)
#define set_timediff W32_NAMESPACE (set_timediff)
#define get_timediff W32_NAMESPACE (get_timediff)
#define timeval_diff W32_NAMESPACE (timeval_diff)
 
#define my_ip_addr W32_NAMESPACE (my_ip_addr)
#define sin_mask W32_NAMESPACE (sin_mask)
#define sock_delay W32_NAMESPACE (sock_delay)
#define sock_inactive W32_NAMESPACE (sock_inactive)
#define sock_data_timeout W32_NAMESPACE (sock_data_timeout)
#define multihomes W32_NAMESPACE (multihomes)
#define block_tcp W32_NAMESPACE (block_tcp)
#define block_udp W32_NAMESPACE (block_udp)
#define block_ip W32_NAMESPACE (block_ip)
#define block_icmp W32_NAMESPACE (block_icmp)
#define last_cookie W32_NAMESPACE (last_cookie)
#define cookies W32_NAMESPACE (cookies)
#define survive_eth W32_NAMESPACE (survive_eth)
#define survive_bootp W32_NAMESPACE (survive_bootp)
#define survive_dhcp W32_NAMESPACE (survive_dhcp)
#define survive_rarp W32_NAMESPACE (survive_rarp)
#define loopback_handler W32_NAMESPACE (loopback_handler)
#define usr_init W32_NAMESPACE (usr_init)
#define usr_post_init W32_NAMESPACE (usr_post_init)
#define in_checksum W32_NAMESPACE (in_checksum)
#define aton W32_NAMESPACE (aton)
#define isaddr W32_NAMESPACE (isaddr)
#define _printf W32_NAMESPACE (_printf)
#define _outch W32_NAMESPACE (_outch)
#define outs W32_NAMESPACE (outs)
#define outsnl W32_NAMESPACE (outsnl)
#define outsn W32_NAMESPACE (outsn)
#define outhexes W32_NAMESPACE (outhexes)
#define outhex W32_NAMESPACE (outhex)
#define rip W32_NAMESPACE (rip)
#define parse_config_table W32_NAMESPACE (parse_config_table)
#define init_timer_isr W32_NAMESPACE (init_timer_isr)
#define exit_timer_isr W32_NAMESPACE (exit_timer_isr)
 
#undef sock_init
#define sock_init() watt_sock_init (sizeof(tcp_Socket), sizeof(udp_Socket))
 
W32_FUNC int watt_sock_init (size_t, size_t);
W32_FUNC const char *sock_init_err (int rc);
 
W32_FUNC void sock_exit (void);
W32_FUNC void dbug_init (void); /* effective if compiled with `USE_DEBUG' */
W32_FUNC void init_misc (void); /* may be called before sock_init() */
W32_FUNC void sock_sig_exit (const char *msg, int sigint);
 
#if !defined(WATT32_BUILD)
/*
* `s' is the pointer to a udp or tcp socket
*/
W32_FUNC int sock_read (void *s, char *dp, int len);
W32_FUNC int sock_preread (void *s, char *dp, int len);
W32_FUNC int sock_fastread (void *s, char *dp, int len);
W32_FUNC int sock_write (void *s, const char *dp, int len);
W32_FUNC int sock_enqueue (void *s, const char *dp, int len);
W32_FUNC int sock_fastwrite (void *s, const char *dp, int len);
W32_FUNC size_t sock_setbuf (void *s, char *buf, size_t len);
W32_FUNC void sock_flush (void *s);
W32_FUNC void sock_noflush (void *s);
W32_FUNC void sock_flushnext (void *s);
W32_FUNC int sock_puts (void *s, const char *dp);
W32_FUNC WORD sock_gets (void *s, char *dp, int n);
W32_FUNC BYTE sock_putc (void *s, char c);
W32_FUNC int sock_getc (void *s);
W32_FUNC WORD sock_dataready (void *s);
W32_FUNC int sock_established(void *s);
W32_FUNC int sock_close (void *s);
W32_FUNC int sock_abort (void *s);
W32_FUNC void (*sock_yield (void *s, VoidProc fn)) (void);
W32_FUNC int sock_mode (void *s, WORD mode);
W32_FUNC int sock_sselect (void *s, int waitstate);
W32_FUNC int sock_timeout (void *s, int seconds);
W32_FUNC int sock_recv (void *s, char *buf, unsigned len);
W32_FUNC int sock_recv_init (void *s, char *buf, unsigned len);
W32_FUNC int sock_recv_from (void *s, DWORD *ip, WORD *port, char *buf, unsigned len, int peek);
W32_FUNC int sock_recv_used (void *s);
W32_FUNC int sock_keepalive (void *s);
 
W32_FUNC size_t sock_rbsize (const void *s);
W32_FUNC size_t sock_rbused (const void *s);
W32_FUNC size_t sock_rbleft (const void *s);
W32_FUNC size_t sock_tbsize (const void *s);
W32_FUNC size_t sock_tbused (const void *s);
W32_FUNC size_t sock_tbleft (const void *s);
 
W32_FUNC int MS_CDECL sock_printf (void *s, const char *fmt, ...)
#if defined(__GNUC__)
__attribute__((format(printf,2,3)))
#endif
;
 
W32_FUNC int MS_CDECL sock_scanf (void *s, const char *fmt, ...)
#if defined(__GNUC__)
__attribute__((format(scanf,2,3)))
#endif
;
 
/*
* TCP or UDP specific stuff, must be used for open's and listens, but
* sock stuff above is used for everything else
*/
W32_FUNC int udp_open (void *s, WORD lport, DWORD ina, WORD port, ProtoHandler handler);
W32_FUNC int tcp_open (void *s, WORD lport, DWORD ina, WORD port, ProtoHandler handler);
W32_FUNC int udp_listen (void *s, WORD lport, DWORD ina, WORD port, ProtoHandler handler);
W32_FUNC int tcp_listen (void *s, WORD lport, DWORD ina, WORD port, ProtoHandler handler, WORD timeout);
W32_FUNC int tcp_established (const void *s);
 
#endif /* WATT32_BUILD */
 
 
W32_FUNC DWORD resolve (const char *name);
W32_FUNC int resolve_ip (DWORD ip, char *name, int len);
W32_FUNC DWORD lookup_host(const char *host, char *ip_str);
W32_FUNC const char *dom_strerror (int err);
 
/*
* less general functions
*/
W32_FUNC int tcp_cbreak (int mode);
 
W32_FUNC DWORD aton (const char *name);
W32_FUNC int isaddr (const char *name);
W32_FUNC char *rip (char *s);
W32_FUNC int watt_kbhit (void);
 
#define tcp_cbrk(mode) tcp_cbreak(mode) /* old name */
 
/*
* Set MD5 secret for TCP option 19 (RFC-2385).
* Only if built with USE_TCP_MD5.
*/
W32_FUNC const char *tcp_md5_secret (void *s, const char *secret);
 
/*
* timers
*/
W32_FUNC DWORD set_timeout (DWORD msec);
W32_FUNC int chk_timeout (DWORD value);
W32_FUNC int cmp_timers (DWORD t1, DWORD t2);
W32_FUNC int set_timediff (long msec);
W32_FUNC long get_timediff (DWORD now, DWORD t);
W32_FUNC int hires_timer (int on);
W32_FUNC double timeval_diff (const struct timeval *a, const struct timeval *b);
 
W32_FUNC void init_timer_isr (void);
W32_FUNC void exit_timer_isr (void);
 
W32_FUNC void init_userSuppliedTimerTick (void);
W32_FUNC void userTimerTick (DWORD);
 
W32_FUNC void ip_timer_init (sock_type *s , unsigned delayseconds);
W32_FUNC int ip_timer_expired (const sock_type *s);
 
/*
* TCP/IP system variables
*/
W32_DATA DWORD my_ip_addr;
W32_DATA DWORD sin_mask; /* eg. 0xFFFFFE00L */
W32_DATA int sock_delay;
W32_DATA int sock_inactive;
W32_DATA int sock_data_timeout;
W32_DATA WORD multihomes;
 
W32_DATA int block_tcp;
W32_DATA int block_udp;
W32_DATA int block_icmp;
W32_DATA int block_ip;
W32_DATA WORD last_cookie;
W32_DATA DWORD cookies [MAX_COOKIES];
 
W32_DATA BOOL survive_eth;
W32_DATA BOOL survive_bootp;
W32_DATA BOOL survive_dhcp;
W32_DATA BOOL survive_rarp;
 
W32_DATA void (*loopback_handler) (void *ip);
 
/*
* things you probably won't need to know about
*/
 
/*
* sock_debugdump
* - dump some socket control block parameters
* used for testing the kernal, not recommended
*/
W32_FUNC void sock_debugdump (const sock_type *s);
 
/*
* tcp_config - read a configuration file
* - if special path desired, call after sock_init()
* - NULL reads path WATTCP.CFG env-var or from program's path
* see sock_init();
*/
W32_FUNC long tcp_config (const char *path);
 
/*
* tcp_tick - must be called periodically by user application.
* - returns NULL when our socket closes
*/
W32_FUNC WORD tcp_tick (sock_type *s);
 
/*
* tcp_set_debug_state - set to 1,2 or reset 0
*/
W32_FUNC void tcp_set_debug_state (WORD x);
 
 
/*
* name domain constants, etc.
*/
#define def_domain W32_NAMESPACE (def_domain)
#define def_nameservers W32_NAMESPACE (def_nameservers)
#define dns_timeout W32_NAMESPACE (dns_timeout)
#define dom_errno W32_NAMESPACE (dom_errno)
#define last_nameserver W32_NAMESPACE (last_nameserver)
#define _mtu W32_NAMESPACE (_mtu)
#define _mss W32_NAMESPACE (_mss)
#define ctrace_on W32_NAMESPACE (ctrace_on)
#define has_rdtsc W32_NAMESPACE (has_rdtsc)
#define clocks_per_usec W32_NAMESPACE (clocks_per_usec)
#define psocket W32_NAMESPACE (psocket)
#define _inet_ntoa W32_NAMESPACE (_inet_ntoa)
#define _inet_addr W32_NAMESPACE (_inet_addr)
 
W32_DATA char *def_domain;
W32_DATA int dom_errno;
W32_DATA DWORD def_nameservers [MAX_NAMESERVERS];
W32_DATA WORD dns_timeout;
W32_DATA WORD last_nameserver;
W32_DATA WORD _watt_handle_cbreak; /* ^C/^Break handle mode */
W32_DATA volatile int _watt_cbroke; /* ^C/^Break occured */
W32_DATA unsigned _mtu, _mss;
W32_DATA int ctrace_on;
W32_DATA int has_rdtsc;
W32_DATA DWORD clocks_per_usec;
 
/* Old compatibility
*/
#define wathndlcbrk _watt_handle_cbreak
#define watcbroke _watt_cbroke
 
/*
* sock_wait_ .. macros
*/
 
/*
* sock_wait_established()
* - Waits until connected or aborts if timeout etc.
*
* sock_wait_input()
* - Waits for received input on socket 's'.
* - May not be valid input for sock_gets().. check returned length.
*
* sock_tick()
* - Do tick and jump on abort.
*
* sock_wait_closed()
* - Close socket and wait until fully closed.
* Discards all received data.
*
* All these macros jump to label sock_err with contents of *statusptr
* set to
* 1 on closed normally.
* -1 on error, call sockerr(s) for cause.
*
*/
#if !defined(WATT32_BUILD)
 
W32_FUNC int _ip_delay0 (void *s, int sec, UserHandler fn, void *statusptr);
W32_FUNC int _ip_delay1 (void *s, int sec, UserHandler fn, void *statusptr);
W32_FUNC int _ip_delay2 (void *s, int sec, UserHandler fn, void *statusptr);
 
 
#define sock_wait_established(s,seconds,fn,statusptr) \
do { \
if (_ip_delay0 (s,seconds,fn,statusptr)) \
goto sock_err; \
} while (0)
 
#define sock_wait_input(s,seconds,fn,statusptr) \
do { \
if (_ip_delay1 (s,seconds,fn,statusptr)) \
goto sock_err; \
} while (0)
 
#define sock_tick(s, statusptr) \
do { \
if (!tcp_tick(s)) { \
if (statusptr) *statusptr = -1; \
goto sock_err; \
} \
} while (0)
 
#define sock_wait_closed(s,seconds,fn,statusptr) \
do { \
if (_ip_delay2(s,seconds,fn,statusptr)) \
goto sock_err; \
} while (0)
 
#endif /* WATT32_BUILD */
 
/*
* User hook for WATTCP.CFG initialisation file.
*/
W32_DATA void (*usr_init) (const char *keyword, const char *value);
W32_DATA void (*usr_post_init) (void);
 
enum config_tab_types {
ARG_ATOI, /* convert to int */
ARG_ATOB, /* convert to 8-bit byte */
ARG_ATOW, /* convert to 16-bit word */
ARG_ATOIP, /* convert to ip-address on host order */
ARG_ATOX_B, /* convert to hex-byte */
ARG_ATOX_W, /* convert to hex-word */
ARG_ATOX_D, /* convert to hex-word */
ARG_STRDUP, /* duplicate string value */
ARG_STRCPY, /* copy string value */
ARG_RESOLVE, /* resolve host to ip-address */
ARG_FUNC /* call convertion function */
};
 
struct config_table {
const char *keyword;
enum config_tab_types type;
void *arg_func;
};
 
 
W32_FUNC int parse_config_table (const struct config_table *tab,
const char *section,
const char *name,
const char *value);
 
/*
* Run with no config file (embedded/diskless)
*/
W32_DATA int _watt_no_config;
 
W32_FUNC void tcp_inject_config (
const struct config_table *cfg,
const char *key,
const char *value);
 
typedef long (*WattUserConfigFunc) (int pass, const struct config_table *cfg);
 
W32_FUNC WattUserConfigFunc _watt_user_config (WattUserConfigFunc fn);
 
 
/*
* Bypass standard handling of DHCP transient configuration
*/
#include <sys/packon.h>
 
struct DHCP_config {
DWORD my_ip;
DWORD netmask;
DWORD gateway;
DWORD nameserver;
DWORD server;
DWORD iplease;
DWORD renewal;
DWORD rebind;
DWORD tcp_keep_intvl;
BYTE default_ttl;
char hostname [MAX_HOSTLEN+1];
char domain [MAX_HOSTLEN+1];
char loghost [MAX_HOSTLEN+1]; /* Only used if USE_BSD_FUNC defined */
};
 
#include <sys/packoff.h>
 
enum DHCP_config_op {
DHCP_OP_READ = 0,
DHCP_OP_WRITE = 1,
DHCP_OP_ERASE = 2
};
 
typedef int (*WattDHCPConfigFunc) (enum DHCP_config_op op,
struct DHCP_config *cfg);
 
W32_FUNC WattDHCPConfigFunc dhcp_set_config_func (WattDHCPConfigFunc fn);
 
 
/*
* Various function-pointer hooks etc.
*/
W32_DATA int (MS_CDECL *_printf) (const char *, ...);
W32_DATA void (*_outch) (char c);
W32_DATA int (*_resolve_hook) (void);
W32_DATA void (*wintr_chain) (void);
 
W32_DATA int (*tftp_writer) (const void *buf, unsigned length);
W32_DATA int (*tftp_terminator) (void);
 
W32_FUNC void outs (const char *s);
W32_FUNC void outsnl (const char *s);
W32_FUNC void outsn (const char *s, int n);
W32_FUNC void outhexes(const char *s, int n);
W32_FUNC void outhex (char ch);
 
W32_FUNC int wintr_enable (void);
W32_FUNC void wintr_disable (void);
W32_FUNC void wintr_shutdown (void);
W32_FUNC void wintr_init (void);
 
W32_FUNC int _ping (DWORD host, DWORD num, const BYTE *pattern, long len);
W32_FUNC DWORD _chk_ping (DWORD host, DWORD *ping_num);
 
W32_FUNC int _eth_init (void);
W32_FUNC void _eth_release (void);
W32_FUNC void *_eth_formatpacket (const void *eth_dest, WORD eth_type);
W32_FUNC void _eth_free (const void *buf);
W32_FUNC void *_eth_arrived (WORD *type, BOOL *brdcast);
W32_FUNC int _eth_send (WORD len, const void *sock, const char *file, unsigned line);
W32_FUNC int _eth_set_addr (const void *addr);
W32_FUNC BYTE _eth_get_hwtype (BYTE *hwtype, BYTE *hwlen);
 
W32_DATA void *(*_eth_recv_hook) (WORD *type);
W32_DATA int (*_eth_recv_peek) (void *mac_buf);
W32_DATA int (*_eth_xmit_hook) (const void *buf, unsigned len);
W32_FUNC WORD in_checksum (const void *buf, unsigned len);
 
#define inchksum(buf,len) in_checksum(buf, len)
 
 
/*
* BSD-socket similarities.
* Refer <sys/socket.h> for the real thing.
*/
#if !defined(WATT32_BUILD)
 
struct watt_sockaddr { /* for _getpeername, _getsockname */
WORD s_type;
WORD s_port;
DWORD s_ip;
BYTE s_spares[6]; /* unused */
};
 
W32_FUNC DWORD _gethostid (void);
W32_FUNC DWORD _sethostid (DWORD ip);
W32_FUNC int _getsockname (const void *s, void *dest, int *len);
W32_FUNC int _getpeername (const void *s, void *dest, int *len);
 
W32_FUNC int _chk_socket (const void *s);
W32_FUNC void psocket (const void *s);
 
#endif
 
W32_FUNC char *_inet_ntoa (char *s, DWORD x);
W32_FUNC DWORD _inet_addr (const char *name);
 
W32_FUNC BOOL _arp_register (DWORD use, DWORD instead_of);
W32_FUNC BOOL _arp_resolve (DWORD ina, eth_address *res);
 
W32_FUNC int addwattcpd (VoidProc p);
W32_FUNC int delwattcpd (VoidProc p);
 
W32_FUNC void _sock_debug_on (void);
W32_FUNC void _sock_debug_off (void);
 
#if !defined(WATT32_BUILD)
 
W32_FUNC const char *sockerr (const void *s); /* UDP / TCP */
W32_FUNC void sockerr_clear (void *s); /* UDP / TCP */
 
W32_FUNC const char *sockstate (const void *s); /* UDP / TCP / Raw */
 
/*
* Reduce internal states to "user-easy" states, GvB 2002-09
*/
enum TCP_SIMPLE_STATE {
TCP_CLOSED,
TCP_LISTENING,
TCP_OPENING,
TCP_OPEN,
TCP_CLOSING
};
 
W32_FUNC enum TCP_SIMPLE_STATE tcp_simple_state (const tcp_Socket *s);
 
#endif /* WATT32_BUILD */
 
 
/*
* BSD functions for read/write/select
*/
W32_FUNC int close_s (int s);
W32_FUNC int write_s (int s, const char *buf, int nbyte);
W32_FUNC int read_s (int s, char *buf, int nbyte);
W32_FUNC int writev_s (int s, const struct iovec *vector, size_t count);
W32_FUNC int readv_s (int s, const struct iovec *vector, size_t count);
 
W32_FUNC const sock_type *__get_sock_from_s (int s, int proto);
/* Use 'IPPROTO_x' for proto */
 
W32_FUNC int select_s (int num_sockets,
fd_set *read_events,
fd_set *write_events,
fd_set *except_events,
struct timeval *timeout);
 
/* The only BSD/Winsock replacement in this file.
* Normally belongs in djgpp's <unistd.h>.
*/
#ifndef __DJGPP__
W32_FUNC int W32_CALL select (int num_sockets,
fd_set *read_events,
fd_set *write_events,
fd_set *except_events,
struct timeval *timeout);
#endif
 
/* Duplicated from <sys/socket.h>
*/
W32_FUNC int W32_CALL gethostname (char *name, int len);
 
/*
* Multicast stuff (if built with `USE_MULTICAST')
*/
W32_DATA int _multicast_on;
 
W32_FUNC int join_mcast_group (DWORD ip);
W32_FUNC int leave_mcast_group (DWORD ip);
W32_FUNC int _ip4_is_multicast (DWORD ip);
W32_FUNC int multi_to_eth (DWORD ip, eth_address *eth);
W32_FUNC int udp_SetTTL (udp_Socket *s, BYTE ttl);
 
 
/*
* Commandline parsing
*/
#if defined(__DJGPP__)
#include <unistd.h>
 
#elif defined(__MINGW32__)
#include <getopt.h>
 
#elif !defined(_GETOPT_H) /* not using a local getopt.c */
#define optarg W32_NAMESPACE (optarg)
#define optind W32_NAMESPACE (optind)
#define opterr W32_NAMESPACE (opterr)
#define optopt W32_NAMESPACE (optopt)
#define optswchar W32_NAMESPACE (optswchar)
#define optmode W32_NAMESPACE (optmode)
#define getopt W32_NAMESPACE (getopt)
 
W32_DATA char *optarg; /* argument of current option */
W32_DATA int optind; /* index of next argument; default=0: initialize */
W32_DATA int opterr; /* 0=disable error messages; default=1: enable */
W32_DATA int optopt; /* option char returned from getopt() */
W32_DATA char *optswchar; /* characters introducing options; default="-" */
 
W32_DATA enum _optmode {
GETOPT_UNIX, /* options at start of argument list (default) */
GETOPT_ANY, /* move non-options to the end */
GETOPT_KEEP, /* return options in order */
} optmode;
 
W32_FUNC int getopt (int argc, char *const *argv, const char *opt_str);
#endif
 
 
/*
* Statistics printing
*/
W32_FUNC void print_mac_stats (void);
W32_FUNC void print_pkt_stats (void);
W32_FUNC void print_vjc_stats (void);
W32_FUNC void print_arp_stats (void);
W32_FUNC void print_pppoe_stats(void);
W32_FUNC void print_ip4_stats (void);
W32_FUNC void print_ip6_stats (void);
W32_FUNC void print_icmp_stats (void);
W32_FUNC void print_igmp_stats (void);
W32_FUNC void print_udp_stats (void);
W32_FUNC void print_tcp_stats (void);
W32_FUNC void print_all_stats (void);
W32_FUNC void reset_stats (void);
 
#if !defined(WATT32_BUILD)
W32_FUNC int sock_stats (void *s, DWORD *days, WORD *inactive,
WORD *cwindow, DWORD *avg, DWORD *sd);
#endif
 
 
/*
* Controlling timer interrupt handler for background processing.
* Not recommended, little tested
*/
W32_FUNC void backgroundon (void);
W32_FUNC void backgroundoff (void);
W32_FUNC void backgroundfn (VoidProc func);
 
 
/*
* Misc functions
*/
#if !defined(__DJGPP__) && !(defined(__WATCOMC__) && (__WATCOMC__ >= 1240))
#define ffs W32_NAMESPACE (ffs)
W32_FUNC int ffs (int mask);
#endif
 
#if defined (__HIGHC__)
W32_FUNC int system (const char *cmd);
pragma Alias (system, "_mw_watt_system");
#endif
 
W32_FUNC unsigned Random (unsigned a, unsigned b);
 
 
/*
* Tracing to RS-232 serial port, by Gundolf von Bachhaus <GBachhaus@gmx.net>
* Watt-32 library must be compiled with `USE_RS232_DBG' (see .\src\config.h)
*/
W32_FUNC int trace2com_init (WORD portAddress, DWORD baudRate);
W32_FUNC int MS_CDECL __trace2com (const char *fmt, ...)
#if defined(__GNUC__)
__attribute__((format(printf,1,2)))
#endif
;
 
#ifdef __cplusplus
}
#endif
 
#endif /* RC_INVOKED */
#endif /* __WATT_TCP_H */
/pkgnet/trunk/watt32/inc/winsock.h
0,0 → 1,56
#ifndef _WATT32_FAKE_WINSOCK_H
#define _WATT32_FAKE_WINSOCK_H
 
#ifndef __SYS_W32API_H
#include <sys/w32api.h>
#endif
 
#ifndef __SYS_SOCKET_H
#include <sys/socket.h>
#endif
 
#ifndef __SYS_WERRNO_H
#include <sys/werrno.h>
#endif
 
#if !defined(WIN32) && !defined(_WIN32)
#error This file is only for Watt-32 targeting Windows programs.
#endif
 
#if !defined(_WATT32_FAKE_WINSOCK2_H)
 
#define WSADESCRIPTION_LEN 256
#define WSASYS_STATUS_LEN 128
 
typedef struct WSAData {
unsigned short wVersion;
unsigned short wHighVersion;
char szDescription[WSADESCRIPTION_LEN+1];
char szSystemStatus[WSASYS_STATUS_LEN+1];
unsigned short iMaxSockets;
unsigned short iMaxUdpDg;
char *lpVendorInfo;
} WSADATA, *LPWSADATA;
 
W32_FUNC int __stdcall WSAStartup (unsigned short wVersionRequired,
WSADATA *WSAData);
 
 
#ifndef FD_SETSIZE
#define FD_SETSIZE 64
#endif
 
/*
* Needed if user compiled with the normal <winsock*.h> and just relinked
* with Watt-32 (import) library.
*/
typedef struct winsock_fd_set {
unsigned int fd_count; /* how many are SET? */
int fd_array [FD_SETSIZE]; /* an array of sockets */
} winsock_fd_set;
 
W32_FUNC int __stdcall __WSAFDIsSet (int s, winsock_fd_set *fd);
 
#endif /* _WATT32_FAKE_WINSOCK2_H */
#endif
 
/pkgnet/trunk/watt32/inc/winsock2.h
0,0 → 1,56
#ifndef _WATT32_FAKE_WINSOCK2_H
#define _WATT32_FAKE_WINSOCK2_H
 
#ifndef __SYS_W32API_H
#include <sys/w32api.h>
#endif
 
#ifndef __SYS_SOCKET_H
#include <sys/socket.h>
#endif
 
#ifndef __SYS_WERRNO_H
#include <sys/werrno.h>
#endif
 
#if !defined(WIN32) && !defined(_WIN32)
#error This file is only for Watt-32 targeting Windows programs.
#endif
 
#if !defined(_WATT32_FAKE_WINSOCK_H)
 
#define WSADESCRIPTION_LEN 256
#define WSASYS_STATUS_LEN 128
 
typedef struct WSAData {
unsigned short wVersion;
unsigned short wHighVersion;
char szDescription[WSADESCRIPTION_LEN+1];
char szSystemStatus[WSASYS_STATUS_LEN+1];
unsigned short iMaxSockets;
unsigned short iMaxUdpDg;
char *lpVendorInfo;
} WSADATA, *LPWSADATA;
 
W32_FUNC int __stdcall WSAStartup (unsigned short wVersionRequired,
WSADATA *WSAData);
 
 
#ifndef FD_SETSIZE
#define FD_SETSIZE 64
#endif
 
/*
* Needed if user compiled with the normal <winsock*.h> and just relinked
* with Watt-32 (import) library.
*/
typedef struct winsock_fd_set {
unsigned int fd_count; /* how many are SET? */
int fd_array [FD_SETSIZE]; /* an array of sockets */
} winsock_fd_set;
 
W32_FUNC int __stdcall __WSAFDIsSet (int s, winsock_fd_set *fd);
 
#endif /* _WATT32_FAKE_WINSOCK_H */
#endif /* _WATT32_FAKE_WINSOCK2_H */
 
/pkgnet/trunk/watt32/inc/ws2tcpip.h
0,0 → 1,13
#ifndef _WATT32_FAKE_WS2TCPIP_H
#define _WATT32_FAKE_WS2TCPIP_H
 
#ifndef __SYS_SOCKET_H
#include <sys/socket.h>
#endif
 
#if !defined(WIN32) && !defined(_WIN32)
#error This file is only for Watt-32 targeting Windows programs.
#endif
 
#endif
 
/pkgnet/trunk/watt32/lib/wattcpwl.lib
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property