/* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License, Version 1.0 only * (the "License"). You may not use this file except in compliance * with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. * See the License for the specific language governing permissions * and limitations under the License. * * When distributing Covered Code, include this CDDL HEADER in each * file and include the License file at usr/src/OPENSOLARIS.LICENSE. * If applicable, add the following below this CDDL HEADER, with the * fields enclosed by brackets "[]" replaced with your own identifying * information: Portions Copyright [yyyy] [name of copyright owner] * * CDDL HEADER END */ /* * Copyright 2003 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* Copyright (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. */ /* All rights reserved. */ /* * Portions of this source code were derived from Berkeley 4.3 BSD * under license from the Regents of the University of California. */ #ifndef _PROTOCOLS_DUMPRESTORE_H #define _PROTOCOLS_DUMPRESTORE_H #ifdef __cplusplus extern "C" { #endif /* * This header file defines two different versions of the * ufsdump/ufsrestore interface. If the defined constant * SUPPORTS_MTB_TAPE_FORMAT is set, the data structures in * this header file will support backups of more than 2 terabytes * of data. * * In the old format (the format that only supports dumps * of less than 2 terabytes), TP_BSIZE is the size of file blocks * on the dump tapes. * Note that TP_BSIZE must be a multiple of DEV_BSIZE. * * In the new format, tp_bsize is used to store the * tape block size, which is variable. The tape block size * is like 'fragsize', in that 'c_tapea' in each tape record * contains the 'tape block record' number in a signed int. * We set TP_BSIZE_MAX to 65536, which will handle 128TB * of data. The new format is indicated by a magic number * in the tape header of MTB_MAGIC. The new format is only * used when the size of the backup exceeds 2 TB. If the * backup can be stored in less thatn 2 TB, ufsdump still * uses the format indicated by the NFS_MAGIC magic number. * Therefore, backups of less than 2 TB are still readable * by earlier versions of ufsrestore. * * 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. CARTRIDGETREC is the * number of TP_BSIZE (or tp_bsize) blocks that are written * in each tape record on cartridge 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_MAX 65536 #define TP_BSIZE_MIN 1024 #define ESIZE_SHIFT_MAX 6 /* shift TP_BSIZE_MIN to TP_BSIZE_MAX */ #ifdef SUPPORTS_MTB_TAPE_FORMAT #define TP_BUFSIZE TP_BSIZE_MAX extern int32_t tp_bsize; #else #define TP_BSIZE 1024 #define TP_BUFSIZE TP_BSIZE #endif /* SUPPORTS_MTB_TAPE_FORMAT */ #define NTREC 10 #define HIGHDENSITYTREC 32 #define CARTRIDGETREC 63 #define TP_NINDIR (TP_BSIZE_MIN/2) #define TP_NINOS (TP_NINDIR / sizeof (long)) #define LBLSIZE 16 #define NAMELEN 64 #define OFS_MAGIC (int)60011 #define NFS_MAGIC (int)60012 #define MTB_MAGIC (int)60013 #define CHECKSUM (int)84446 union u_data { char s_addrs[TP_NINDIR]; /* 1 => data; 0 => hole in inode */ int32_t s_inos[TP_NINOS]; /* starting inodes on tape */ }; union u_shadow { struct s_nonsh { int32_t c_level; /* level of this dump */ char c_filesys[NAMELEN]; /* dumpped file system name */ char c_dev[NAMELEN]; /* name of dumpped device */ char c_host[NAMELEN]; /* name of dumpped host */ } c_nonsh; char c_shadow[1]; }; /* if you change anything here, be sure to change normspcl in byteorder.c */ extern union u_spcl { char dummy[TP_BUFSIZE]; struct s_spcl { int32_t c_type; /* record type (see below) */ time32_t c_date; /* date of previous dump */ time32_t c_ddate; /* date of this dump */ int32_t c_volume; /* dump volume number */ daddr32_t c_tapea; /* logical block of this record */ ino32_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 */ union u_data c_data; /* see union above */ char c_label[LBLSIZE]; /* dump label */ union u_shadow c_shadow; /* see union above */ int32_t c_flags; /* additional information */ int32_t c_firstrec; /* first record on volume */ #ifdef SUPPORTS_MTB_TAPE_FORMAT int32_t c_tpbsize; /* tape block size */ int32_t c_spare[31]; /* reserved for future uses */ #else int32_t c_spare[32]; #endif /* SUPPORTS_MTB_TAPE_FORMAT */ } s_spcl; } u_spcl; #define spcl u_spcl.s_spcl #define c_addr c_data.s_addrs #define c_inos c_data.s_inos #define c_level c_shadow.c_nonsh.c_level #define c_filesys c_shadow.c_nonsh.c_filesys #define c_dev c_shadow.c_nonsh.c_dev #define c_host c_shadow.c_nonsh.c_host /* * 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 */ #define TS_EOM 7 /* floppy EOM - restore compat w/ old dump */ /* * flag values */ #define DR_NEWHEADER 1 /* new format tape header */ #define DR_INODEINFO 2 /* header contains starting inode info */ #define DR_REDUMP 4 /* dump contains recopies of active files */ #define DR_TRUEINC 8 /* dump is a "true incremental" */ #define DR_HASMETA 16 /* metadata in this header */ #define DUMPOUTFMT "%-32s %c %s" /* for printf */ /* name, incno, ctime(date) */ #define DUMPINFMT "%258s %c %128[^\n]\n" /* inverse for scanf */ #ifdef __cplusplus } #endif #endif /* !_PROTOCOLS_DUMPRESTORE_H */ /* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License, Version 1.0 only * (the "License"). You may not use this file except in compliance * with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. * See the License for the specific language governing permissions * and limitations under the License. * * When distributing Covered Code, include this CDDL HEADER in each * file and include the License file at usr/src/OPENSOLARIS.LICENSE. * If applicable, add the following below this CDDL HEADER, with the * fields enclosed by brackets "[]" replaced with your own identifying * information: Portions Copyright [yyyy] [name of copyright owner] * * CDDL HEADER END */ /* * Copyright 1999 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ /* All Rights Reserved */ /* * Portions of this source code were derived from Berkeley 4.3 BSD * under license from the Regents of the University of California. */ /* * Routing Information Protocol for IPv6 (RIPng) * as specfied by RFC 2080. */ #ifndef _PROTOCOLS_RIPNGD_H #define _PROTOCOLS_RIPNGD_H #ifdef __cplusplus extern "C" { #endif struct netinfo6 { struct in6_addr rip6_prefix; /* destination prefix */ uint16_t rip6_route_tag; /* route tag */ uint8_t rip6_prefix_length; /* destination prefix length */ uint8_t rip6_metric; /* cost of route */ }; struct rip6 { uint8_t rip6_cmd; /* request/response */ uint8_t rip6_vers; /* protocol version # */ uint16_t rip6_res1; /* pad to 32-bit boundary */ struct netinfo6 rip6_nets[1]; /* variable length... */ }; #define RIPVERSION6 1 /* * Packet types. */ #define RIPCMD6_REQUEST 1 /* want info - from suppliers */ #define RIPCMD6_RESPONSE 2 /* responding to request */ #define IPPORT_ROUTESERVER6 521 #ifdef __cplusplus } #endif #endif /* _PROTOCOLS_RIPNGD_H */ /* * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ /* All Rights Reserved */ /* * 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 acknowledgment: * 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. */ /* * 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. */ #ifndef _PROTOCOLS_ROUTED_H #define _PROTOCOLS_ROUTED_H #ifdef __cplusplus extern "C" { #endif /* The RIPv2 protocol is described in RFC 2453 */ #define RIPv1 1 #define RIPv2 2 #ifndef RIPVERSION #define RIPVERSION RIPv1 #endif #define RIP_PORT 520 #if RIPVERSION == RIPv1 struct netinfo { struct sockaddr rip_dst; /* destination net/host */ uint32_t rip_metric; /* cost of route */ }; #else struct netinfo { uint16_t n_family; #define RIP_AF_INET htons(AF_INET) #define RIP_AF_UNSPEC 0 #define RIP_AF_AUTH 0xffff uint16_t n_tag; /* optional in RIPv2 */ uint32_t n_dst; /* destination net or host */ #define RIP_DEFAULT 0 uint32_t n_mask; /* netmask in RIPv2 */ uint32_t n_nhop; /* optional next hop in RIPv2 */ uint32_t n_metric; /* cost of route */ }; #endif /* RIPv1 */ /* RIPv2 authentication */ struct netauth { uint16_t a_family; /* always RIP_AF_AUTH */ uint16_t a_type; #define RIP_AUTH_NONE 0 #define RIP_AUTH_TRAILER htons(1) /* authentication data */ #define RIP_AUTH_PW htons(2) /* password type */ #define RIP_AUTH_MD5 htons(3) /* Keyed MD5 */ union { #define RIP_AUTH_PW_LEN 16 uint8_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 */ uint32_t md5_seqno; /* sequence number */ uint32_t rsvd[2]; /* must be 0 */ #define RIP_AUTH_MD5_LEN RIP_AUTH_PW_LEN } a_md5; } au; }; struct rip_emetric { uint16_t rip_metric; uint16_t rip_mask; uint32_t rip_token[1]; }; struct rip_sec_entry { uint32_t rip_dst; uint32_t rip_count; struct rip_emetric rip_emetric[1]; }; struct rip { uint8_t rip_cmd; /* request/response */ uint8_t rip_vers; /* protocol version # */ uint16_t rip_res1; /* pad to 32-bit boundary */ union { /* variable length... */ struct netinfo ru_nets[1]; /* variable length... */ char ru_tracefile[1]; /* ditto ... */ struct netauth ru_auth[1]; struct { uint32_t rip_generation; struct rip_sec_entry rip_sec_entry[1]; } ru_tsol; } ripun; #define rip_nets ripun.ru_nets #define rip_tracefile ripun.ru_tracefile #define rip_auths ripun.ru_auth #define rip_tsol ripun.ru_tsol }; struct entryinfo { struct sockaddr rtu_dst; struct sockaddr rtu_router; short rtu_flags; short rtu_state; int rtu_timer; int rtu_metric; int int_flags; char int_name[16]; }; typedef struct rdisc_info_s { uint_t info_type; uint_t info_version; uint_t info_num_of_routers; } rdisc_info_t; /* * Structure that is returned with the default router info. */ typedef struct defr_s { uint32_t defr_info_type; uint32_t defr_version; struct in_addr defr_addr; uint32_t defr_index; uint32_t defr_life; uint32_t defr_pref; } defr_t; /* * Packet types. */ #define RIPCMD_REQUEST 1 /* want info - from suppliers */ #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 /* like request, but anyone answers */ #define RIPCMD_POLLENTRY 6 /* like poll, but for entire entry */ #define RIPCMD_SEC_RESPONSE 51 /* response includes E-metrics */ #define RIPCMD_SEC_T_RESPONSE 52 /* tunneling */ #define RIPCMD_MAX 7 #define RDISC_SNMP_SOCKET "/var/run/in.rdisc_mib" #define RDISC_SNMP_INFO_REQ 1 #define RDISC_SNMP_INFO_RESPONSE 2 #define RDISC_DEF_ROUTER_INFO 3 #define RDISC_SNMP_INFO_VER 1 #define RDISC_DEF_ROUTER_VER 1 #define HOPCNT_INFINITY 16 /* per Xerox NS */ #define MAXPACKETSIZE 512 /* max broadcast size */ #define NETS_LEN ((MAXPACKETSIZE - sizeof (struct rip)) \ / sizeof (struct netinfo) +1) #define INADDR_RIP_GROUP 0xe0000009U /* 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 TIMER_RATE 30 /* alarm clocks every 30 seconds */ #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 300 /* time to garbage collect */ #ifdef __cplusplus } #endif #endif /* _PROTOCOLS_ROUTED_H */