diff --git a/sys/conf/NOTES b/sys/conf/NOTES index 117c6fd37557..5f806991c264 100644 --- a/sys/conf/NOTES +++ b/sys/conf/NOTES @@ -1,2839 +1,2857 @@ # # NOTES -- Lines that can be cut/pasted into kernel and hints configs. # # Lines that begin with 'device', 'options', 'machine', 'ident', 'maxusers', # 'makeoptions', 'hints' etc go into the kernel configuration that you # run config(8) with. # # Lines that begin with 'hints.' are NOT for config(8), they go into your # hints file. See /boot/device.hints and/or the 'hints' config(8) directive. # # Please use ``make LINT'' to create an old-style LINT file if you want to # do kernel test-builds. # # $FreeBSD$ # # # This directive is mandatory; it defines the architecture to be # configured for; in this case, the 386 family based IBM-PC and # compatibles. # machine i386 # # This is the ``identification'' of the kernel. Usually this should # be the same as the name of your kernel. # ident LINT # # The `maxusers' parameter controls the static sizing of a number of # internal system tables by a complicated formula defined in param.c. # maxusers 10 # # We want LINT to cover profiling as well profile 2 # # The `makeoptions' parameter allows variables to be passed to the # generated Makefile in the build area. # # CONF_CFLAGS gives some extra compiler flags that are added to ${CFLAGS} # after most other flags. Here we use it to inhibit use of non-optimal # gcc builtin functions (e.g., memcmp). # # DEBUG happens to be magic. # The following is equivalent to 'config -g KERNELNAME' and creates # 'kernel.debug' compiled with -g debugging as well as a normal # 'kernel'. Use 'make install.debug' to install the debug kernel # but that isn't normally necessary as the debug symbols are not loaded # by the kernel and are not useful there anyway. # # KERNEL can be overridden so that you can change the default name of your # kernel. # makeoptions CONF_CFLAGS=-fno-builtin #Don't allow use of memcmp, etc. #makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols #makeoptions KERNEL=foo #Build kernel "foo" and install "/foo" # # Certain applications can grow to be larger than the 512M limit # that FreeBSD initially imposes. Below are some options to # allow that limit to grow to 1GB, and can be increased further # with changing the parameters. MAXDSIZ is the maximum that the # limit can be set to, and the DFLDSIZ is the default value for # the limit. You might want to set the default lower than the # max, and explicitly set the maximum with a shell command for processes # that regularly exceed the limit like INND. # options MAXDSIZ="(1024UL*1024*1024)" options DFLDSIZ="(1024UL*1024*1024)" # # BLKDEV_IOSIZE sets the default block size used in user block # device I/O. Note that this value will be overriden by the label # when specifying a block device from a label with a non-0 # partition blocksize. The default is PAGE_SIZE. # options BLKDEV_IOSIZE=8192 # Options for the VM subsystem options PQ_CACHESIZE=512 # color for 512k/16k cache # Deprecated options supported for backwards compatibility #options PQ_NOOPT # No coloring #options PQ_LARGECACHE # color for 512k/16k cache #options PQ_HUGECACHE # color for 1024k/16k cache #options PQ_MEDIUMCACHE # color for 256k/16k cache #options PQ_NORMALCACHE # color for 64k/16k cache # This allows you to actually store this configuration file into # the kernel binary itself, where it may be later read by saying: # strings -n 3 /kernel | sed -n 's/^___//p' > MYKERNEL # options INCLUDE_CONFIG_FILE # Include this file in kernel # # The root device and filesystem type can be compiled in; # this provides a fallback option if the root device cannot # be correctly guesst by the bootstrap code, or an override if # the RB_DFLTROOT flag (-r) is specified when booting the kernel. # options ROOTDEVNAME=\"ufs:da0s2e\" ##################################################################### # SMP OPTIONS: # # SMP enables building of a Symmetric MultiProcessor Kernel. # APIC_IO enables the use of the IO APIC for Symmetric I/O. # # Notes: # # An SMP kernel will ONLY run on an Intel MP spec. qualified motherboard. # # Be sure to disable 'cpu I386_CPU' && 'cpu I486_CPU' for SMP kernels. # # Check the 'Rogue SMP hardware' section to see if additional options # are required by your hardware. # # Mandatory: options SMP # Symmetric MultiProcessor Kernel options APIC_IO # Symmetric (APIC) I/O # # Rogue SMP hardware: # # Bridged PCI cards: # # The MP tables of most of the current generation MP motherboards # do NOT properly support bridged PCI cards. To use one of these # cards you should refer to ??? # SMP Debugging Options: # # MUTEX_DEBUG enables various extra assertions in the mutex code. # WITNESS enables the mutex witness code which detects deadlocks and cycles # during locking operations. # WITNESS_DDB causes the witness code to drop into the kernel debugger if # a lock heirarchy violation occurs or if locks are held when going to # sleep. # WITNESS_SKIPSPIN disables the witness checks on spin mutexes. options MUTEX_DEBUG options WITNESS options WITNESS_DDB options WITNESS_SKIPSPIN ##################################################################### # CPU OPTIONS # # You must specify at least one CPU (the one you intend to run on); # deleting the specification for CPUs you don't need to use may make # parts of the system run faster. # I386_CPU is mutually exclusive with the other CPU types. # #cpu I386_CPU cpu I486_CPU cpu I586_CPU # aka Pentium(tm) cpu I686_CPU # aka Pentium Pro(tm) # # Options for CPU features. # # CPU_BLUELIGHTNING_FPU_OP_CACHE enables FPU operand cache on IBM # BlueLightning CPU. It works only with Cyrix FPU, and this option # should not be used with Intel FPU. # # CPU_BLUELIGHTNING_3X enables triple-clock mode on IBM Blue Lightning # CPU if CPU supports it. The default is double-clock mode on # BlueLightning CPU box. # # CPU_BTB_EN enables branch target buffer on Cyrix 5x86 (NOTE 1). # # CPU_DIRECT_MAPPED_CACHE sets L1 cache of Cyrix 486DLC CPU in direct # mapped mode. Default is 2-way set associative mode. # # CPU_CYRIX_NO_LOCK enables weak locking for the entire address space # of Cyrix 6x86 and 6x86MX CPUs by setting the NO_LOCK bit of CCR1. # Otherwise, the NO_LOCK bit of CCR1 is cleared. (NOTE 3) # # CPU_DISABLE_5X86_LSSER disables load store serialize (i.e. enables # reorder). This option should not be used if you use memory mapped # I/O device(s). # # CPU_FASTER_5X86_FPU enables faster FPU exception handler. # # CPU_I486_ON_386 enables CPU cache on i486 based CPU upgrade products # for i386 machines. # # CPU_IORT defines I/O clock delay time (NOTE 1). Default values of # I/O clock delay time on Cyrix 5x86 and 6x86 are 0 and 7,respectively # (no clock delay). # # CPU_L2_LATENCY specifed the L2 cache latency value. This option is used # only when CPU_PPRO2CELERON is defined and Mendocino Celeron is detected. # The default value is 5. # # CPU_LOOP_EN prevents flushing the prefetch buffer if the destination # of a jump is already present in the prefetch buffer on Cyrix 5x86(NOTE # 1). # # CPU_PPRO2CELERON enables L2 cache of Mendocino Celeron CPUs. This option # is useful when you use Socket 8 to Socket 370 converter, because most Pentium # Pro BIOSs do not enable L2 cache of Mendocino Celeron CPUs. # # CPU_RSTK_EN enables return stack on Cyrix 5x86 (NOTE 1). # # CPU_SUSP_HLT enables suspend on HALT. If this option is set, CPU # enters suspend mode following execution of HALT instruction. # # CPU_WT_ALLOC enables write allocation on Cyrix 6x86/6x86MX and AMD # K5/K6/K6-2 cpus. # # CYRIX_CACHE_WORKS enables CPU cache on Cyrix 486 CPUs with cache # flush at hold state. # # CYRIX_CACHE_REALLY_WORKS enables (1) CPU cache on Cyrix 486 CPUs # without cache flush at hold state, and (2) write-back CPU cache on # Cyrix 6x86 whose revision < 2.7 (NOTE 2). # # NO_F00F_HACK disables the hack that prevents Pentiums (and ONLY # Pentiums) from locking up when a LOCK CMPXCHG8B instruction is # executed. This option is only needed if I586_CPU is also defined, # and should be included for any non-Pentium CPU that defines it. # # NO_MEMORY_HOLE is an optimisation for systems with AMD K6 processors # which indicates that the 15-16MB range is *definitely* not being # occupied by an ISA memory hole. # # NOTE 1: The options, CPU_BTB_EN, CPU_LOOP_EN, CPU_IORT, # CPU_LOOP_EN and CPU_RSTK_EN should not be used because of CPU bugs. # These options may crash your system. # # NOTE 2: If CYRIX_CACHE_REALLY_WORKS is not set, CPU cache is enabled # in write-through mode when revision < 2.7. If revision of Cyrix # 6x86 >= 2.7, CPU cache is always enabled in write-back mode. # # NOTE 3: This option may cause failures for software that requires # locked cycles in order to operate correctly. # options CPU_BLUELIGHTNING_FPU_OP_CACHE options CPU_BLUELIGHTNING_3X options CPU_BTB_EN options CPU_DIRECT_MAPPED_CACHE options CPU_DISABLE_5X86_LSSER options CPU_FASTER_5X86_FPU options CPU_I486_ON_386 options CPU_IORT options CPU_L2_LATENCY=5 options CPU_LOOP_EN options CPU_PPRO2CELERON options CPU_RSTK_EN options CPU_SUSP_HLT options CPU_WT_ALLOC options CYRIX_CACHE_WORKS options CYRIX_CACHE_REALLY_WORKS #options NO_F00F_HACK # # A math emulator is mandatory if you wish to run on hardware which # does not have a floating-point processor. Pick either the original, # bogus (but freely-distributable) math emulator, or a much more # fully-featured but GPL-licensed emulator taken from Linux. # options MATH_EMULATE #Support for x87 emulation # Don't enable both of these in a real config. options GPL_MATH_EMULATE #Support for x87 emulation via #new math emulator ##################################################################### # COMPATIBILITY OPTIONS # # Implement system calls compatible with 4.3BSD and older versions of # FreeBSD. You probably do NOT want to remove this as much current code # still relies on the 4.3 emulation. # options COMPAT_43 # # These three options provide support for System V Interface # Definition-style interprocess communication, in the form of shared # memory, semaphores, and message queues, respectively. # options SYSVSHM options SYSVSEM options SYSVMSG ##################################################################### # DEBUGGING OPTIONS # # Enable the kernel debugger. # options DDB # # Don't drop into DDB for a panic. Intended for unattended operation # where you may want to drop to DDB from the console, but still want # the machine to recover from a panic # options DDB_UNATTENDED # # If using GDB remote mode to debug the kernel, there's a non-standard # extension to the remote protocol that can be used to use the serial # port as both the debugging port and the system console. It's non- # standard and you're on your own if you enable it. See also the # "remotechat" variables in the FreeBSD specific version of gdb. # options GDB_REMOTE_CHAT # # KTRACE enables the system-call tracing facility ktrace(2). # options KTRACE #kernel tracing # # KTR is a kernel tracing mechanism imported from BSD/OS. Currently it # has no userland interface aside from a few sysctl's. It is enabled with # the KTR option. The KTR_EXTEND option causes trace events to be generated # as a string from snprintf rather than as a string and up to 5 argument # pointers. KTR_ENTRIES defines the number of entries in the circular trace # buffer. KTR_COMPILE defines the mask of events to compile into the kernel # as defined by the KTR_* constants in . KTR_MASK defines the # initial value of the ktr_mask variable which determines at runtime what # events to trace. KTR_CPUMASK determines which CPU's log events, with # bit X corresponding to cpu X. KTR_VERBOSE enables dumping of KTR events # to the console by default. This functionality can be toggled via the # debug.ktr_verbose sysctl and defaults to off if KTR_VERBOSE is not defined. # options KTR options KTR_EXTEND options KTR_ENTRIES=1024 options KTR_COMPILE=0x3fffff options KTR_MASK=0x201208 options KTR_CPUMASK=0x3 options KTR_VERBOSE # # The INVARIANTS option is used in a number of source files to enable # extra sanity checking of internal structures. This support is not # enabled by default because of the extra time it would take to check # for these conditions, which can only occur as a result of # programming errors. # options INVARIANTS # # The INVARIANT_SUPPORT option makes us compile in support for # verifying some of the internal structures. It is a prerequisite for # 'INVARIANTS', as enabling 'INVARIANTS' will make these functions be # called. The intent is that you can set 'INVARIANTS' for single # source files (by changing the source file or specifying it on the # command line) if you have 'INVARIANT_SUPPORT' enabled. Also, if you # wish to build a kernel module with 'INVARIANTS', then adding # 'INVARIANT_SUPPORT' to your kernel will provide all the necessary # infrastructure without the added overhead. # options INVARIANT_SUPPORT # # The DIAGNOSTIC option is used to enable extra debugging information # from some parts of the kernel. As this makes everything more noisy, # it is disabled by default. # options DIAGNOSTIC # # REGRESSION causes optional kernel interfaces necessary only for regression # testing to be enabled. These interfaces may consitute security risks # when enabled, as they permit processes to easily modify aspects of the # run-time environment to reproduce unlikely or unusual (possibly normally # impossible) scenarios. # options REGRESSION # # PERFMON causes the driver for Pentium/Pentium Pro performance counters # to be compiled. See perfmon(4) for more information. # options PERFMON # # This option let some drivers co-exist that can't co-exist in a running # system. This is used to be able to compile all kernel code in one go for # quality assurance purposes (like this file, which the option takes it name # from.) # options COMPILING_LINT # XXX - this doesn't belong here. # Allow ordinary users to take the console - this is useful for X. options UCONSOLE # XXX - this doesn't belong here either options USERCONFIG #boot -c editor options INTRO_USERCONFIG #imply -c and show intro screen options VISUAL_USERCONFIG #visual boot -c editor ##################################################################### # NETWORKING OPTIONS # # Protocol families: # Only the INET (Internet) family is officially supported in FreeBSD. # Source code for the NS (Xerox Network Service) is provided for amusement # value. # options INET #Internet communications protocols options INET6 #IPv6 communications protocols options IPSEC #IP security options IPSEC_ESP #IP security (crypto; define w/ IPSEC) options IPSEC_DEBUG #debug for IP security options IPX #IPX/SPX communications protocols options IPXIP #IPX in IP encapsulation (not available) options IPTUNNEL #IP in IPX encapsulation (not available) options NCP #NetWare Core protocol options NETATALK #Appletalk communications protocols options NETATALKDEBUG #Appletalk debugging # These are currently broken but are shipped due to interest. #options NS #Xerox NS protocols #options NSIP #XNS over IP # mchain library. It can be either loaded as KLD or compiled into kernel options LIBMCHAIN # netgraph(4). Enable the base netgraph code with the NETGRAPH option. # Individual node types can be enabled with the corresponding option # listed below; however, this is not strictly necessary as netgraph # will automatically load the corresponding KLD module if the node type # is not already compiled into the kernel. Each type below has a # corresponding man page, e.g., ng_async(8). options NETGRAPH #netgraph(4) system options NETGRAPH_ASYNC options NETGRAPH_BPF options NETGRAPH_CISCO options NETGRAPH_ECHO options NETGRAPH_ETHER options NETGRAPH_FRAME_RELAY options NETGRAPH_HOLE options NETGRAPH_IFACE options NETGRAPH_KSOCKET options NETGRAPH_LMI # MPPC compression requires proprietary files (not included) #options NETGRAPH_MPPC_COMPRESSION options NETGRAPH_MPPC_ENCRYPTION options NETGRAPH_ONE2MANY options NETGRAPH_PPP options NETGRAPH_PPPOE options NETGRAPH_PPTPGRE options NETGRAPH_RFC1490 options NETGRAPH_SOCKET options NETGRAPH_TEE options NETGRAPH_TTY options NETGRAPH_UI options NETGRAPH_VJC device mn # Munich32x/Falc54 Nx64kbit/sec cards. device lmc # tulip based LanMedia WAN cards device musycc # LMC/SBE LMC1504 quad T1/E1 # # Network interfaces: # The `loop' device is MANDATORY when networking is enabled. # The `ether' device provides generic code to handle # Ethernets; it is MANDATORY when a Ethernet device driver is # configured or token-ring is enabled. # The 'fddi' device provides generic code to support FDDI. # The `sppp' device serves a similar role for certain types # of synchronous PPP links (like `cx', `ar'). # The `sl' device implements the Serial Line IP (SLIP) service. # The `ppp' device implements the Point-to-Point Protocol. # The `bpf' device enables the Berkeley Packet Filter. Be # aware of the legal and administrative consequences of enabling this # option. The number of devices determines the maximum number of # simultaneous BPF clients programs runnable. # The `disc' device implements a minimal network interface, # which throws away all packets sent and never receives any. It is # included for testing purposes. This shows up as the 'ds' interface. # The `tap' device is a pty-like virtual Ethernet interface # The `tun' device implements (user-)ppp and nos-tun # The `gif' device implements IPv6 over IP4 tunneling, # IPv4 over IPv6 tunneling, IPv4 over IPv4 tunneling and # IPv6 over IPv6 tunneling. # The XBONEHACK option allows the same pair of addresses to be configured on # multiple gif interfaces. # The `faith' device captures packets sent to it and diverts them # to the IPv4/IPv6 translation daemon. # The `stf' device implements 6to4 encapsulation. # The `ef' device provides support for multiple ethernet frame types # specified via ETHER_* options. See ef(4) for details. # # The PPP_BSDCOMP option enables support for compress(1) style entire # packet compression, the PPP_DEFLATE is for zlib/gzip style compression. # PPP_FILTER enables code for filtering the ppp data stream and selecting # events for resetting the demand dial activity timer - requires bpf. # See pppd(8) for more details. # device ether #Generic Ethernet device vlan 1 #VLAN support device token #Generic TokenRing device fddi #Generic FDDI device sppp #Generic Synchronous PPP device loop 1 #Network loopback device device bpf #Berkeley packet filter device disc #Discard device (ds0, ds1, etc) device tap #Virtual Ethernet driver device tun #Tunnel driver (ppp(8), nos-tun(8)) device sl #Serial Line IP device ppp 2 #Point-to-point protocol options PPP_BSDCOMP #PPP BSD-compress support options PPP_DEFLATE #PPP zlib/deflate/gzip support options PPP_FILTER #enable bpf filtering (needs bpf) device ef # Multiple ethernet frames support options ETHER_II # enable Ethernet_II frame options ETHER_8023 # enable Ethernet_802.3 (Novell) frame options ETHER_8022 # enable Ethernet_802.2 frame options ETHER_SNAP # enable Ethernet_802.2/SNAP frame # for IPv6 device gif 4 #IPv6 and IPv4 tunneling options XBONEHACK device faith 1 #for IPv6 and IPv4 translation device stf #6to4 IPv6 over IPv4 encapsulation # # Internet family options: # # MROUTING enables the kernel multicast packet forwarder, which works # with mrouted(8). # # IPFIREWALL enables support for IP firewall construction, in # conjunction with the `ipfw' program. IPFIREWALL_VERBOSE sends # logged packets to the system logger. IPFIREWALL_VERBOSE_LIMIT # limits the number of times a matching entry can be logged. # # WARNING: IPFIREWALL defaults to a policy of "deny ip from any to any" # and if you do not add other rules during startup to allow access, # YOU WILL LOCK YOURSELF OUT. It is suggested that you set firewall_type=open # in /etc/rc.conf when first enabling this feature, then refining the # firewall rules in /etc/rc.firewall after you've tested that the new kernel # feature works properly. # # IPFIREWALL_DEFAULT_TO_ACCEPT causes the default rule (at boot) to # allow everything. Use with care, if a cracker can crash your # firewall machine, they can get to your protected machines. However, # if you are using it as an as-needed filter for specific problems as # they arise, then this may be for you. Changing the default to 'allow' # means that you won't get stuck if the kernel and /sbin/ipfw binary get # out of sync. # # IPDIVERT enables the divert IP sockets, used by ``ipfw divert'' # # IPSTEALTH enables code to support stealth forwarding (i.e., forwarding # packets without touching the ttl). This can be useful to hide firewalls # from traceroute and similar tools. # # TCPDEBUG is undocumented. # options MROUTING # Multicast routing options IPFIREWALL #firewall options IPFIREWALL_VERBOSE #print information about # dropped packets options IPFIREWALL_FORWARD #enable transparent proxy support options IPFIREWALL_VERBOSE_LIMIT=100 #limit verbosity options IPFIREWALL_DEFAULT_TO_ACCEPT #allow everything by default options IPV6FIREWALL #firewall for IPv6 options IPV6FIREWALL_VERBOSE options IPV6FIREWALL_VERBOSE_LIMIT=100 options IPV6FIREWALL_DEFAULT_TO_ACCEPT options IPDIVERT #divert sockets options IPFILTER #ipfilter support options IPFILTER_LOG #ipfilter logging options IPFILTER_DEFAULT_BLOCK #block all packets by default options IPSTEALTH #support for stealth forwarding options TCPDEBUG # Statically Link in accept filters options ACCEPT_FILTER_DATA options ACCEPT_FILTER_HTTP # TCP_DROP_SYNFIN adds support for ignoring TCP packets with SYN+FIN. This # prevents nmap et al. from identifying the TCP/IP stack, but breaks support # for RFC1644 extensions and is not recommended for web servers. # options TCP_DROP_SYNFIN #drop TCP packets with SYN+FIN # DUMMYNET enables the "dummynet" bandwidth limiter. You need # IPFIREWALL as well. See the dummynet(4) manpage for more info. # BRIDGE enables bridging between ethernet cards -- see bridge(4). # You can use IPFIREWALL and dummynet together with bridging. options DUMMYNET options BRIDGE # # ATM (HARP version) options # # ATM_CORE includes the base ATM functionality code. This must be included # for ATM support. # # ATM_IP includes support for running IP over ATM. # # At least one (and usually only one) of the following signalling managers # must be included (note that all signalling managers include PVC support): # ATM_SIGPVC includes support for the PVC-only signalling manager `sigpvc'. # ATM_SPANS includes support for the `spans' signalling manager, which runs # the FORE Systems's proprietary SPANS signalling protocol. # ATM_UNI includes support for the `uni30' and `uni31' signalling managers, # which run the ATM Forum UNI 3.x signalling protocols. # # The `hea' driver provides support for the Efficient Networks, Inc. # ENI-155p ATM PCI Adapter. # # The `hfa' driver provides support for the FORE Systems, Inc. # PCA-200E ATM PCI Adapter. # options ATM_CORE #core ATM protocol family options ATM_IP #IP over ATM support options ATM_SIGPVC #SIGPVC signalling manager options ATM_SPANS #SPANS signalling manager options ATM_UNI #UNI signalling manager device hea #Efficient ENI-155p ATM PCI device hfa #FORE PCA-200E ATM PCI ##################################################################### # FILESYSTEM OPTIONS # # Only the root, /usr, and /tmp filesystems need be statically # compiled; everything else will be automatically loaded at mount # time. (Exception: the UFS family---FFS, and MFS --- cannot # currently be demand-loaded.) Some people still prefer to statically # compile other filesystems as well. # # NB: The NULL, PORTAL, UMAP and UNION filesystems are known to be # buggy, and WILL panic your system if you attempt to do anything with # them. They are included here as an incentive for some enterprising # soul to sit down and fix them. # # One of these is mandatory: options FFS #Fast filesystem options MFS #Memory File System options NFS #Network File System # The rest are optional: #options NFS_NOSERVER #Disable the NFS-server code. options CD9660 #ISO 9660 filesystem options FDESCFS #File descriptor filesystem options HPFS #OS/2 File system options MSDOSFS #MS DOS File System (FAT, FAT32) options NTFS #NT File System options NULLFS #NULL filesystem options NWFS #NetWare filesystem options PORTALFS #Portal filesystem options PROCFS #Process filesystem options UMAPFS #UID map filesystem options UNIONFS #Union filesystem # options NODEVFS #disable devices filesystem # The xFS_ROOT options REQUIRE the associated ``options xFS'' options NFS_ROOT #NFS usable as root device # This code enables IFS, an FFS which exports inodes as the namespace. # You can find details in src/sys/ufs/ifs/README . options IFS # Soft updates is a technique for improving file system speed and # making abrupt shutdown less risky. # options SOFTUPDATES # Extended attributes allow additional data to be associated with files, # and is used for ACLs, Capabilities, and MAC labels. # See src/sys/ufs/ufs/README.extattr for more information. options UFS_EXTATTR options UFS_EXTATTR_AUTOSTART # Access Control List support for UFS filesystems. The current ACL # implementation requires extended attribute support, UFS_EXTATTR, # for the underlying filesystem. # See src/sys/ufs/ufs/README.acls for more information. options UFS_ACL # Make space in the kernel for a root filesystem on a md device. # Define to the number of kilobytes to reserve for the filesystem. options MD_ROOT_SIZE=10 # Make the md device a potential root device, either with preloaded # images of type mfs_root or md_root. options MD_ROOT # Allow this many swap-devices. # # In order to manage swap, the system must reserve bitmap space that # scales with the largest mounted swap device multiplied by NSWAPDEV, # irregardless of whether other swap devices exist or not. So it # is not a good idea to make this value too large. options NSWAPDEV=5 # Disk quotas are supported when this option is enabled. options QUOTA #enable disk quotas # If you are running a machine just as a fileserver for PC and MAC # users, using SAMBA or Netatalk, you may consider setting this option # and keeping all those users' directories on a filesystem that is # mounted with the suiddir option. This gives new files the same # ownership as the directory (similar to group). It's a security hole # if you let these users run programs, so confine it to file-servers # (but it'll save you lots of headaches in those cases). Root owned # directories are exempt and X bits are cleared. The suid bit must be # set on the directory as well; see chmod(1) PC owners can't see/set # ownerships so they keep getting their toes trodden on. This saves # you all the support calls as the filesystem it's used on will act as # they expect: "It's my dir so it must be my file". # options SUIDDIR # NFS options: options NFS_MINATTRTIMO=3 # VREG attrib cache timeout in sec options NFS_MAXATTRTIMO=60 options NFS_MINDIRATTRTIMO=30 # VDIR attrib cache timeout in sec options NFS_MAXDIRATTRTIMO=60 options NFS_GATHERDELAY=10 # Default write gather delay (msec) options NFS_UIDHASHSIZ=29 # Tune the size of nfssvc_sock with this options NFS_WDELAYHASHSIZ=16 # and with this options NFS_MUIDHASHSIZ=63 # Tune the size of nfsmount with this options NFS_DEBUG # Enable NFS Debugging # Coda stuff: options CODA #CODA filesystem. device vcoda 4 #coda minicache <-> venus comm. # # Add support for the EXT2FS filesystem of Linux fame. Be a bit # careful with this - the ext2fs code has a tendency to lag behind # changes and not be exercised very much, so mounting read/write could # be dangerous (and even mounting read only could result in panics.) # options EXT2FS # Use real implementations of the aio_* system calls. There are numerous # stability issues in the current aio code that make it unsuitable for # inclusion on shell boxes. options VFS_AIO # Enable the code UFS IO optimization through the VM system. This allows # use VM operations instead of copying operations when possible. # # Even with this enabled, actual use of the code is still controlled by the # sysctl vfs.ioopt. 0 gives no optimization, 1 gives normal (use VM # operations if a request happens to fit), 2 gives agressive optimization # (the operations are split to do as much as possible through the VM system.) # # Enabling this will probably not give an overall speedup except for # special workloads. options ENABLE_VFS_IOOPT # Cryptographically secure random number generator; /dev/[u]random device random ##################################################################### # POSIX P1003.1B # Real time extensions added in the 1993 Posix # P1003_1B: Infrastructure # _KPOSIX_PRIORITY_SCHEDULING: Build in _POSIX_PRIORITY_SCHEDULING # _KPOSIX_VERSION: Version kernel is built for options P1003_1B options _KPOSIX_PRIORITY_SCHEDULING options _KPOSIX_VERSION=199309L ##################################################################### # CLOCK OPTIONS # The granularity of operation is controlled by the kernel option HZ whose # default value (100) means a granularity of 10ms. For an accurate simulation # of high data rates it might be necessary to reduce the timer granularity to # 1ms or less. Consider, however, that some interfaces using programmed I/O # may require a considerable time to output packets. So, reducing the # granularity too much might actually cause ticks to be missed thus reducing # the accuracy of operation. options HZ=100 # Other clock options options CLK_CALIBRATION_LOOP options CLK_USE_I8254_CALIBRATION options CLK_USE_TSC_CALIBRATION ##################################################################### # SCSI DEVICES # SCSI DEVICE CONFIGURATION # The SCSI subsystem consists of the `base' SCSI code, a number of # high-level SCSI device `type' drivers, and the low-level host-adapter # device drivers. The host adapters are listed in the ISA and PCI # device configuration sections below. # # Beginning with FreeBSD 2.0.5 you can wire down your SCSI devices so # that a given bus, target, and LUN always come on line as the same # device unit. In earlier versions the unit numbers were assigned # in the order that the devices were probed on the SCSI bus. This # means that if you removed a disk drive, you may have had to rewrite # your /etc/fstab file, and also that you had to be careful when adding # a new disk as it may have been probed earlier and moved your device # configuration around. # This old behavior is maintained as the default behavior. The unit # assignment begins with the first non-wired down unit for a device # type. For example, if you wire a disk as "da3" then the first # non-wired disk will be assigned da4. # The syntax for wiring down devices is: hint.scbus.0.at="ahc0" hint.scbus.1.at="ahc1" hint.scbus.1.bus="0" hint.scbus.3.at="ahc2" hint.scbus.3.bus="0" hint.scbus.2.at="ahc2" hint.scbus.2.bus="1" hint.da.0.at="scbus0" hint.da.0.target="0" hint.da.0.unit="0" hint.da.1.at="scbus3" hint.da.1.target="1" hint.da.2.at="scbus2" hint.da.2.target="3" hint.sa.1.at="scbus1" hint.sa.1.target="6" # "units" (SCSI logical unit number) that are not specified are # treated as if specified as LUN 0. # All SCSI devices allocate as many units as are required. # The ch driver drives SCSI Media Changer ("jukebox") devices. # # The da driver drives SCSI Direct Access ("disk") and Optical Media # ("WORM") devices. # # The sa driver drives SCSI Sequential Access ("tape") devices. # # The cd driver drives SCSI Read Only Direct Access ("cd") devices. # # The ses driver drives SCSI Envinronment Services ("ses") and # SAF-TE ("SCSI Accessable Fault-Tolerant Enclosure") devices. # # The pt driver drives SCSI Processor devices. # # # Target Mode support is provided here but also requires that a SIM # (SCSI Host Adapter Driver) provide support as well. # # The targ driver provides target mode support as a Processor type device. # It exists to give the minimal context necessary to respond to Inquiry # commands. There is a sample user application that shows how the rest # of the command support might be done in /usr/share/examples/scsi_target. # # The targbh driver provides target mode support and exists to respond # to incoming commands that do not otherwise have a logical unit assigned # to them. # # The "unknown" device (uk? in pre-2.0.5) is now part of the base SCSI # configuration as the "pass" driver. device scbus #base SCSI code device ch #SCSI media changers device da #SCSI direct access devices (aka disks) device sa #SCSI tapes device cd #SCSI CD-ROMs device ses #SCSI Environmental Services (and SAF-TE) device pt #SCSI processor device targ #SCSI Target Mode Code device targbh #SCSI Target Mode Blackhole Device device pass #CAM passthrough driver # CAM OPTIONS: # debugging options: # -- NOTE -- If you specify one of the bus/target/lun options, you must # specify them all! # CAMDEBUG: When defined enables debugging macros # CAM_DEBUG_BUS: Debug the given bus. Use -1 to debug all busses. # CAM_DEBUG_TARGET: Debug the given target. Use -1 to debug all targets. # CAM_DEBUG_LUN: Debug the given lun. Use -1 to debug all luns. # CAM_DEBUG_FLAGS: OR together CAM_DEBUG_INFO, CAM_DEBUG_TRACE, # CAM_DEBUG_SUBTRACE, and CAM_DEBUG_CDB # # CAM_MAX_HIGHPOWER: Maximum number of concurrent high power (start unit) cmds # SCSI_NO_SENSE_STRINGS: When defined disables sense descriptions # SCSI_NO_OP_STRINGS: When defined disables opcode descriptions # SCSI_DELAY: The number of MILLISECONDS to freeze the SIM (scsi adapter) # queue after a bus reset, and the number of milliseconds to # freeze the device queue after a bus device reset. options CAMDEBUG options CAM_DEBUG_BUS=-1 options CAM_DEBUG_TARGET=-1 options CAM_DEBUG_LUN=-1 options CAM_DEBUG_FLAGS="CAM_DEBUG_INFO|CAM_DEBUG_TRACE|CAM_DEBUG_CDB" options CAM_MAX_HIGHPOWER=4 options SCSI_NO_SENSE_STRINGS options SCSI_NO_OP_STRINGS options SCSI_DELAY=8000 # Be pessimistic about Joe SCSI device # Options for the CAM CDROM driver: # CHANGER_MIN_BUSY_SECONDS: Guaranteed minimum time quantum for a changer LUN # CHANGER_MAX_BUSY_SECONDS: Maximum time quantum per changer LUN, only # enforced if there is I/O waiting for another LUN # The compiled in defaults for these variables are 2 and 10 seconds, # respectively. # # These can also be changed on the fly with the following sysctl variables: # kern.cam.cd.changer.min_busy_seconds # kern.cam.cd.changer.max_busy_seconds # options CHANGER_MIN_BUSY_SECONDS=2 options CHANGER_MAX_BUSY_SECONDS=10 # Options for the CAM sequential access driver: # SA_SPACE_TIMEOUT: Timeout for space operations, in minutes # SA_REWIND_TIMEOUT: Timeout for rewind operations, in minutes # SA_ERASE_TIMEOUT: Timeout for erase operations, in minutes # SA_1FM_AT_EOD: Default to model which only has a default one filemark at EOT. options SA_SPACE_TIMEOUT="(60)" options SA_REWIND_TIMEOUT="(2*60)" options SA_ERASE_TIMEOUT="(4*60)" options SA_1FM_AT_EOD # Optional timeout for the CAM processor target (pt) device # This is specified in seconds. The default is 60 seconds. options SCSI_PT_DEFAULT_TIMEOUT="60" # Optional enable of doing SES passthrough on other devices (e.g., disks) # # Normally disabled because a lot of newer SCSI disks report themselves # as having SES capabilities, but this can then clot up attempts to build # build a topology with the SES device that's on the box these drives # are in.... options SES_ENABLE_PASSTHROUGH ##################################################################### # MISCELLANEOUS DEVICES AND OPTIONS # The `pty' device usually turns out to be ``effectively mandatory'', # as it is required for `telnetd', `rlogind', `screen', `emacs', and # `xterm', among others. device pty #Pseudo ttys device speaker #Play IBM BASIC-style noises out your speaker device gzip #Exec gzipped a.out's device md #Memory/malloc disk device snp #Snoop device - to look at pty/vty/etc.. device ccd 4 #Concatenated disk driver # Configuring Vinum into the kernel is not necessary, since the kld # module gets started automatically when vinum(8) starts. This # device is also untested. Use at your own risk. # # The option VINUMDEBUG must match the value set in CFLAGS # in src/sbin/vinum/Makefile. Failure to do so will result in # the following message from vinum(8): # # Can't get vinum config: Invalid argument # # see vinum(4) for more reasons not to use these options. device vinum #Vinum concat/mirror/raid driver options VINUMDEBUG #enable Vinum debugging hooks # Kernel side iconv library options LIBICONV # Size of the kernel message buffer. Should be N * pagesize. options MSGBUF_SIZE=40960 ##################################################################### # HARDWARE BUS CONFIGURATION # ISA, EISA, MCA and PCI bus: # # Mandatory ISA devices: isa, npx # device isa # # Options for `isa': # # AUTO_EOI_1 enables the `automatic EOI' feature for the master 8259A # interrupt controller. This saves about 0.7-1.25 usec for each interrupt. # This option breaks suspend/resume on some portables. # # AUTO_EOI_2 enables the `automatic EOI' feature for the slave 8259A # interrupt controller. This saves about 0.7-1.25 usec for each interrupt. # Automatic EOI is documented not to work for for the slave with the # original i8259A, but it works for some clones and some integrated # versions. # # MAXMEM specifies the amount of RAM on the machine; if this is not # specified, FreeBSD will first read the amount of memory from the CMOS # RAM, so the amount of memory will initially be limited to 64MB or 16MB # depending on the BIOS. If the BIOS reports 64MB, a memory probe will # then attempt to detect the installed amount of RAM. If this probe # fails to detect >64MB RAM you will have to use the MAXMEM option. # The amount is in kilobytes, so for a machine with 128MB of RAM, it would # be 131072 (128 * 1024). # # BROKEN_KEYBOARD_RESET disables the use of the keyboard controller to # reset the CPU for reboot. This is needed on some systems with broken # keyboard controllers. options COMPAT_OLDISA #Use ISA shims and glue for old drivers options AUTO_EOI_1 #options AUTO_EOI_2 options MAXMEM="(128*1024)" #options BROKEN_KEYBOARD_RESET # Enable support for the kernel PLL to use an external PPS signal, # under supervision of [x]ntpd(8) # More info in ntpd documentation: http://www.eecis.udel.edu/~ntp options PPS_SYNC # If you see the "calcru: negative time of %ld usec for pid %d (%s)\n" # message you probably have some broken sw/hw which disables interrupts # for too long. You can make the system more resistant to this by # choosing a high value for NTIMECOUNTER. The default is 5, there # is no upper limit but more than a couple of hundred are not productive. # A better strategy may be to sysctl -w kern.timecounter.method=1 options NTIMECOUNTER=20 # # EISA bus # # The EISA bus device is `eisa'. It provides auto-detection and # configuration support for all devices on the EISA bus. device eisa # By default, only 10 EISA slots are probed, since the slot numbers # above clash with the configuration address space of the PCI subsystem, # and the EISA probe is not very smart about this. This is sufficient # for most machines, but in particular the HP NetServer LC series comes # with an onboard AIC7770 dual-channel SCSI controller on EISA slot #11, # thus you need to bump this figure to 12 for them. options EISA_SLOTS=12 # # MCA bus: # # The MCA bus device is `mca'. It provides auto-detection and # configuration support for all devices on the MCA bus. # No hints are required for MCA. device mca # # PCI bus & PCI options: # # The main PCI bus device is `pci'. It provides auto-detection and # configuration support for all devices on the PCI bus, using either # configuration mode defined in the PCI specification. device pci # # AGP GART support device agp # PCI options # #options PCI_QUIET #quiets PCI code on chipset settings ##################################################################### # HARDWARE DEVICE CONFIGURATION # EISA support is available for some device, so they can be auto-probed. # MicroChannel (MCA) support is available for some devices. # For ISA the required hints are listed. # EISA, MCA, PCI and pccard are self identifying buses, so no hints # are needed. # # Mandatory devices: # # The keyboard controller; it controls the keyboard and the PS/2 mouse. device atkbdc 1 hint.atkbdc.0.at="isa" hint.atkbdc.0.port="0x060" # The AT keyboard device atkbd hint.atkbd.0.at="atkbdc" hint.atkbd.0.irq="1" # Options for atkbd: options ATKBD_DFLT_KEYMAP # specify the built-in keymap makeoptions ATKBD_DFLT_KEYMAP="jp.106" # These options are valid for other keyboard drivers as well. options KBD_DISABLE_KEYMAP_LOAD # refuse to load a keymap options KBD_INSTALL_CDEV # install a CDEV entry in /dev # `flags' for atkbd: # 0x01 Force detection of keyboard, else we always assume a keyboard # 0x02 Don't reset keyboard, useful for some newer ThinkPads # 0x04 Old-style (XT) keyboard support, useful for older ThinkPads # PS/2 mouse device psm hint.psm.0.at="atkbdc" hint.psm.0.irq="12" # Options for psm: options PSM_HOOKRESUME #hook the system resume event, useful #for some laptops options PSM_RESETAFTERSUSPEND #reset the device at the resume event # The video card driver. device vga hint.vga.0.at="isa" # Options for vga: # Try the following option if the mouse pointer is not drawn correctly # or font does not seem to be loaded properly. May cause flicker on # some systems. options VGA_ALT_SEQACCESS # If you can dispense with some vga driver features, you may want to # use the following options to save some memory. #options VGA_NO_FONT_LOADING # don't save/load font #options VGA_NO_MODE_CHANGE # don't change video modes # Older video cards may require this option for proper operation. options VGA_SLOW_IOACCESS # do byte-wide i/o's to TS and GDC regs # The following option probably won't work with the LCD displays. options VGA_WIDTH90 # support 90 column modes # To include support for VESA video modes options VESA options FB_DEBUG # Frame buffer debugging options FB_INSTALL_CDEV # install a CDEV entry in /dev # Splash screen at start up! Screen savers require this too. device splash # The pcvt console driver (vt220 compatible). device vt hint.vt.0.at="isa" options XSERVER # support for running an X server on vt options FAT_CURSOR # start with block cursor # This PCVT option is for keyboards such as those used on IBM ThinkPad laptops options PCVT_SCANSET=2 # IBM keyboards are non-std # Other PCVT options are documented in pcvt(4). options PCVT_24LINESDEF options PCVT_CTRL_ALT_DEL options PCVT_META_ESC options PCVT_NSCREENS=9 options PCVT_PRETTYSCRNS options PCVT_SCREENSAVER options PCVT_USEKBDSEC options PCVT_VT220KEYB options PCVT_GREENSAVER # The syscons console driver (sco color console compatible). device sc 1 hint.sc.0.at="isa" options MAXCONS=16 # number of virtual consoles options SC_ALT_MOUSE_IMAGE # simplified mouse cursor in text mode options SC_DFLT_FONT # compile font in makeoptions SC_DFLT_FONT=cp850 options SC_DISABLE_DDBKEY # disable `debug' key options SC_DISABLE_REBOOT # disable reboot key sequence options SC_HISTORY_SIZE=200 # number of history buffer lines options SC_MOUSE_CHAR=0x3 # char code for text mode mouse cursor options SC_PIXEL_MODE # add support for the raster text mode # The following options will let you change the default colors of syscons. options SC_NORM_ATTR="(FG_GREEN|BG_BLACK)" options SC_NORM_REV_ATTR="(FG_YELLOW|BG_GREEN)" options SC_KERNEL_CONS_ATTR="(FG_RED|BG_BLACK)" options SC_KERNEL_CONS_REV_ATTR="(FG_BLACK|BG_RED)" # If you have a two button mouse, you may want to add the following option # to use the right button of the mouse to paste text. options SC_TWOBUTTON_MOUSE # You can selectively disable features in syscons. options SC_NO_CUTPASTE options SC_NO_FONT_LOADING options SC_NO_HISTORY options SC_NO_SYSMOUSE # `flags' for sc # 0x80 Put the video card in the VESA 800x600 dots, 16 color mode # 0x100 Probe for a keyboard device periodically if one is not present # 3Dfx Voodoo Graphics, Voodoo II /dev/3dfx CDEV support. This will create # the /dev/3dfx0 device to work with glide implementations. This should get # linked to /dev/3dfx and /dev/voodoo. Note that this is not the same as # the tdfx DRI module from XFree86 and is completely unrelated. # # To enable Linuxulator support, one must also include COMPAT_LINUX in the # config as well, or you will not have the dependencies. The other option # is to load both as modules. device tdfx # Enable 3Dfx Voodoo support options TDFX_LINUX # Enable Linuxulator support # # The Numeric Processing eXtension driver. In addition to this, you # may configure a math emulator (see above). If your machine has a # hardware FPU and the kernel configuration includes the npx device # *and* a math emulator compiled into the kernel, the hardware FPU # will be used, unless it is found to be broken or unless "flags" to # npx0 includes "0x08", which requests preference for the emulator. device npx hint.npx.0.at="nexus" hint.npx.0.port="0x0F0" hint.npx.0.flags="0x0" hint.npx.0.irq="13" # # `flags' for npx0: # 0x01 don't use the npx registers to optimize bcopy. # 0x02 don't use the npx registers to optimize bzero. # 0x04 don't use the npx registers to optimize copyin or copyout. # 0x08 use emulator even if hardware FPU is available. # The npx registers are normally used to optimize copying and zeroing when # all of the following conditions are satisfied: # I586_CPU is an option # the cpu is an i586 (perhaps not a Pentium) # the probe for npx0 succeeds # INT 16 exception handling works. # Then copying and zeroing using the npx registers is normally 30-100% faster. # The flags can be used to control cases where it doesn't work or is slower. # Setting them at boot time using userconfig works right (the optimizations # are not used until later in the bootstrap when npx0 is attached). # Flag 0x08 automatically disables the i586 optimized routines. # # # ACPI support using the Intel ACPI Component Architecture reference # implementation. # # ACPI_DEBUG enables the use of the debug.acpi.level and debug.acpi.layer # kernel environment variables to select initial debugging levels for the # Intel ACPICA code. (Note that the Intel code must also have USE_DEBUGGER # defined when it is built). # device acpica options ACPI_DEBUG # # Optional devices: # # # SCSI host adapters: # # adv: All Narrow SCSI bus AdvanSys controllers. # adw: Second Generation AdvanSys controllers including the ADV940UW. # aha: Adaptec 154x/1535/1640 # ahb: Adaptec 174x EISA controllers # ahc: Adaptec 274x/284x/2910/293x/294x/394x/3950x/3960x/398X/4944/ # 19160x/29160x, aic7770/aic78xx # aic: Adaptec 6260/6360, APA-1460 (PC Card), NEC PC9801-100 (C-BUS) # amd: Support for the AMD 53C974 SCSI host adapter chip as found on devices # such as the Tekram DC-390(T). # bt: Most Buslogic controllers: including BT-445, BT-54x, BT-64x, BT-74x, # BT-75x, BT-946, BT-948, BT-956, BT-958, SDC3211B, SDC3211F, SDC3222F # isp: Qlogic ISP 1020, 1040 and 1040B PCI SCSI host adapters, # ISP 1240 Dual Ultra SCSI, ISP 1080 and 1280 (Dual) Ultra2, # ISP 12160 Ultra3 SCSI, # Qlogic ISP 2100 and ISP 2200 Fibre Channel host adapters. # ispfw: Firmware module for Qlogic host adapters # ncr: NCR 53C810, 53C825 self-contained SCSI host adapters. # ncv: NCR 53C500 based SCSI host adapters. # nsp: Workbit Ninja SCSI-3 based PC Card SCSI host adapters. # sym: Symbios/Logic 53C8XX family of PCI-SCSI I/O processors: # 53C810, 53C810A, 53C815, 53C825, 53C825A, 53C860, 53C875, # 53C876, 53C885, 53C895, 53C895A, 53C896, 53C897, 53C1510D, # 53C1010-33, 53C1010-66. # stg: TMC 18C30, 18C50 based SCSI host adapters. # wds: WD7000 # # Note that the order is important in order for Buslogic ISA/EISA cards to be # probed correctly. # device bt hint.bt.0.at="isa" hint.bt.0.port="0x330" device adv hint.adv.0.at="isa" device adw device aha hint.aha.0.at="isa" device aic hint.aic.0.at="isa" device ahb device ahc device amd device isp hint.isp.0.disable="1" hint.isp.0.role="3" hint.isp.0.prefer_iomap="1" hint.isp.0.prefer_memmap="1" hint.isp.0.fwload_disable="1" hint.isp.0.ignore_nvram="1" hint.isp.0.fullduplex="1" hint.isp.0.topology="lport" hint.isp.0.topology="nport" hint.isp.0.topology="lport-only" hint.isp.0.topology="nport-only" # we can't get u_int64_t types, nor can we get strings if it's got # a leading 0x, hence this silly dodge. hint.isp.0.portwnn="w50000000aaaa0000" hint.isp.0.nodewnn="w50000000aaaa0001" device ispfw device ncr device ncv device nsp device sym device stg hint.stg.0.at="isa" hint.stg.0.port="0x140" hint.stg.0.port="11" device wds hint.wds.0.at="isa" hint.wds.0.port="0x350" hint.wds.0.irq="11" hint.wds.0.drq="6" # The aic7xxx driver will attempt to use memory mapped I/O for all PCI # controllers that have it configured only if this option is set. Unfortunately, # this doesn't work on some motherboards, which prevents it from being the # default. options AHC_ALLOW_MEMIO # Enable diagnostic sequencer code. options AHC_DEBUG_SEQUENCER # Dump the contents of the ahc controller configuration PROM. options AHC_DUMP_EEPROM # Bitmap of units to enable targetmode operations. options AHC_TMODE_ENABLE # The adw driver will attempt to use memory mapped I/O for all PCI # controllers that have it configured only if this option is set. options ADW_ALLOW_MEMIO # Options used in dev/isp/ (Qlogic SCSI/FC driver). # # ISP_TARGET_MODE - enable target mode operation # #options ISP_TARGET_MODE=1 # Options used in dev/sym/ (Symbios SCSI driver). #options SYM_SETUP_LP_PROBE_MAP #-Low Priority Probe Map (bits) # Allows the ncr to take precedence # 1 (1<<0) -> 810a, 860 # 2 (1<<1) -> 825a, 875, 885, 895 # 4 (1<<2) -> 895a, 896, 1510d #options SYM_SETUP_SCSI_DIFF #-HVD support for 825a, 875, 885 # disabled:0 (default), enabled:1 #options SYM_SETUP_PCI_PARITY #-PCI parity checking # disabled:0, enabled:1 (default) #options SYM_SETUP_MAX_LUN #-Number of LUNs supported # default:8, range:[1..64] # The 'asr' driver provides support for current DPT/Adaptec SCSI RAID # controllers (SmartRAID V and VI and later). # These controllers require the CAM infrastructure. # device asr # The 'dpt' driver provides support for old DPT controllers (http://www.dpt.com/). # These have hardware RAID-{0,1,5} support, and do multi-initiator I/O. # The DPT controllers are commonly re-licensed under other brand-names - # some controllers by Olivetti, Dec, HP, AT&T, SNI, AST, Alphatronic, NEC and # Compaq are actually DPT controllers. # # See src/sys/dev/dpt for debugging and other subtle options. # DPT_MEASURE_PERFORMANCE Enables a set of (semi)invasive metrics. Various # instruments are enabled. The tools in # /usr/sbin/dpt_* assume these to be enabled. # DPT_HANDLE_TIMEOUTS Normally device timeouts are handled by the DPT. # If you ant the driver to handle timeouts, enable # this option. If your system is very busy, this # option will create more trouble than solve. # DPT_TIMEOUT_FACTOR Used to compute the excessive amount of time to # wait when timing out with the above option. # DPT_DEBUG_xxxx These are controllable from sys/dev/dpt/dpt.h # DPT_LOST_IRQ When enabled, will try, once per second, to catch # any interrupt that got lost. Seems to help in some # DPT-firmware/Motherboard combinations. Minimal # cost, great benefit. # DPT_RESET_HBA Make "reset" actually reset the controller # instead of fudging it. Only enable this if you # are 100% certain you need it. device dpt # DPT options #!CAM# options DPT_MEASURE_PERFORMANCE #!CAM# options DPT_HANDLE_TIMEOUTS options DPT_TIMEOUT_FACTOR=4 options DPT_LOST_IRQ options DPT_RESET_HBA options DPT_ALLOW_MEMIO # # Mylex AcceleRAID and eXtremeRAID controllers with v6 and later # firmware. These controllers have a SCSI-like interface, and require # the CAM infrastructure. # device mly # # Adaptec FSA RAID controllers, including integrated DELL controllers, # the Dell PERC 2/QC and the HP NetRAID-4M # # AAC_COMPAT_LINUX Include code to support Linux-binary management # utilities (requires Linux compatibility # support). # device aac # # Compaq Smart RAID, Mylex DAC960 and AMI MegaRAID controllers. Only # one entry is needed; the code will find and configure all supported # controllers. # device ida # Compaq Smart RAID device mlx # Mylex DAC960 device amr # AMI MegaRAID # # 3ware ATA RAID # device twe # 3ware ATA RAID # # The 'ATA' driver supports all ATA and ATAPI devices, including PC Card # devices. You only need one "device ata" for it to find all # PCI and PC Card ATA/ATAPI devices on modern machines. device ata device atadisk # ATA disk drives device atapicd # ATAPI CDROM drives device atapifd # ATAPI floppy drives device atapist # ATAPI tape drives # # For older non-PCI, non-PnPBIOS systems, these are the hints lines to add: hint.ata.0.at="isa" hint.ata.0.port="0x1f0" hint.ata.0.irq="14" hint.ata.1.at="isa" hint.ata.1.port="0x170" hint.ata.1.irq="15" # # The following options are valid on the ATA driver: # # ATA_STATIC_ID: controller numbering is static ie depends on location # else the device numbers are dynamically allocated. options ATA_STATIC_ID # # Standard floppy disk controllers and floppy tapes, supports # the Y-E DATA External FDD (PC Card) # device fdc hint.fdc.0.at="isa" hint.fdc.0.port="0x3F0" hint.fdc.0.irq="6" hint.fdc.0.drq="2" # # FDC_DEBUG enables floppy debugging. Since the debug output is huge, you # gotta turn it actually on by setting the variable fd_debug with DDB, # however. options FDC_DEBUG # # Activate this line if you happen to have an Insight floppy tape. # Probing them proved to be dangerous for people with floppy disks only, # so it's "hidden" behind a flag: #hint.fdc.0.flags="1" # Specify floppy devices hint.fd.0.at="fdc0" hint.fd.0.drive="0" hint.fd.1.at="fdc0" hint.fd.1.drive="1" # M-systems DiskOnchip products see src/sys/contrib/dev/fla/README device fla hint.fla.0.at="isa" # # Other standard PC hardware: # # mse: Logitech and ATI InPort bus mouse ports # sio: serial ports (see sio(4)), including support for various # PC Card devices, such as Modem and NICs (see etc/defaults/pccard.conf) device mse hint.mse.0.at="isa" hint.mse.0.port="0x23c" hint.mse.0.irq="5" device sio hint.sio.0.at="isa" hint.sio.0.port="0x3F8" hint.sio.0.flags="0x10" hint.sio.0.irq="4" # # `flags' for serial drivers that support consoles (only for sio now): # 0x10 enable console support for this unit. The other console flags # are ignored unless this is set. Enabling console support does # not make the unit the preferred console - boot with -h or set # the 0x20 flag for that. Currently, at most one unit can have # console support; the first one (in config file order) with # this flag set is preferred. Setting this flag for sio0 gives # the old behaviour. # 0x20 force this unit to be the console (unless there is another # higher priority console). This replaces the COMCONSOLE option. # 0x40 reserve this unit for low level console operations. Do not # access the device in any normal way. # 0x80 use this port for serial line gdb support in ddb. # # PnP `flags' (set via userconfig using pnp x flags y) # 0x1 disable probing of this device. Used to prevent your modem # from being attached as a PnP modem. # # Options for serial drivers that support consoles (only for sio now): options BREAK_TO_DEBUGGER #a BREAK on a comconsole goes to #DDB, if available. options CONSPEED=9600 #default speed for serial console (default 9600) # Solaris implements a new BREAK which is initiated by a character # sequence CR ~ ^b which is similar to a familiar pattern used on # Sun servers by the Remote Console. options ALT_BREAK_TO_DEBUGGER # Options for sio: options COM_ESP #code for Hayes ESP options COM_MULTIPORT #code for some cards with shared IRQs # Other flags for sio that aren't documented in the man page. # 0x20000 enable hardware RTS/CTS and larger FIFOs. Only works for # ST16650A-compatible UARTs. # # Network interfaces: # # MII bus support is required for some PCI 10/100 ethernet NICs, # namely those which use MII-compliant transceivers or implement # tranceiver control interfaces that operate like an MII. Adding # "device miibus0" to the kernel config pulls in support for # the generic miibus API and all of the PHY drivers, including a # generic one for PHYs that aren't specifically handled by an # individual driver. device miibus # an: Aironet 4500/4800 802.11 wireless adapters. Supports the PCMCIA, # PCI and ISA varieties. # ar: Arnet SYNC/570i hdlc sync 2/4 port V.35/X.21 serial driver # (requires sppp) # awi: Support for IEEE 802.11 PC Card devices using the AMD Am79C930 and # Harris (Intersil) Chipset with PCnetMobile firmware by AMD. # cnw: Xircom CNW/Netware Airsurfer PC Card adapter # cs: IBM Etherjet and other Crystal Semi CS89x0-based adapters # cx: Cronyx/Sigma multiport sync/async (with Cisco or PPP framing) # dc: Support for PCI fast ethernet adapters based on the DEC/Intel 21143 # and various workalikes including: # the ADMtek AL981 Comet and AN985 Centaur, the ASIX Electronics # AX88140A and AX88141, the Davicom DM9100 and DM9102, the Lite-On # 82c168 and 82c169 PNIC, the Lite-On/Macronix LC82C115 PNIC II # and the Macronix 98713/98713A/98715/98715A/98725 PMAC. This driver # replaces the old al, ax, dm, pn and mx drivers. List of brands: # Digital DE500-BA, Kingston KNE100TX, D-Link DFE-570TX, SOHOware SFA110, # SVEC PN102-TX, CNet Pro110B, 120A, and 120B, Compex RL100-TX, # LinkSys LNE100TX, LNE100TX V2.0, Jaton XpressNet, Alfa Inc GFC2204, # KNE110TX. # de: Digital Equipment DC21040 # ed: Western Digital and SMC 80xx; Novell NE1000 and NE2000; 3Com 3C503 # HP PC Lan+, various PC Card devices (refer to etc/defauls/pccard.conf) # el: 3Com 3C501 (slow!) # ep: 3Com 3C509, 3C529, 3C556, 3C562D, 3C563D, 3C572, 3C574X, 3C579, 3C589 # and PC Card devices using these chipsets. # ex: Intel EtherExpress Pro/10 and other i82595-based adapters, # Olicom Ethernet PC Card devices. # fe: Fujitsu MB86960A/MB86965A Ethernet # fea: DEC DEFEA EISA FDDI adapter # fpa: Support for the Digital DEFPA PCI FDDI. `device fddi' is also needed. # fxp: Intel EtherExpress Pro/100B # (hint of prefer_iomap can be done to prefer I/O instead of Mem mapping) # ie: AT&T StarLAN 10 and EN100; 3Com 3C507; unknown NI5210; # Intel EtherExpress # le: Digital Equipment EtherWorks 2 and EtherWorks 3 (DEPCA, DE100, # DE101, DE200, DE201, DE202, DE203, DE204, DE205, DE422) # lnc: Lance/PCnet cards (Isolan, Novell NE2100, NE32-VL, AMD Am7990 and # Am79C960) # nge: Support for PCI gigabit ethernet adapters based on the National # Semiconductor DP83820 and DP83821 chipset. This includes the # SMC EZ Card 1000 (SMC9462TX), D-Link DGE-500T, Asante FriendlyNet # GigaNIX 1000TA and 1000TPC, and the Addtron AEG320T. # oltr: Olicom ISA token-ring adapters OC-3115, OC-3117, OC-3118 and OC-3133 # (no hints needed). # Olicom PCI token-ring adapters OC-3136, OC-3137, OC-3139, OC-3140, # OC-3141, OC-3540, OC-3250 # rdp: RealTek RTL 8002-based pocket ethernet adapters # pcn: Support for PCI fast ethernet adapters based on the AMD Am79c97x # chipsets, including the PCnet/FAST, PCnet/FAST+, PCnet/PRO and # PCnet/Home. These were previously handled by the lnc driver (and # still will be if you leave this driver out of the kernel). # rl: Support for PCI fast ethernet adapters based on the RealTek 8129/8139 # chipset. Note that the RealTek driver defaults to using programmed # I/O to do register accesses because memory mapped mode seems to cause # severe lockups on SMP hardware. This driver also supports the # Accton EN1207D `Cheetah' adapter, which uses a chip called # the MPX 5030/5038, which is either a RealTek in disguise or a # RealTek workalike. Note that the D-Link DFE-530TX+ uses the RealTek # chipset and is supported by this driver, not the 'vr' driver. # sf: Support for Adaptec Duralink PCI fast ethernet adapters based on the # Adaptec AIC-6915 "starfire" controller. # This includes dual and quad port cards, as well as one 100baseFX card. # Most of these are 64-bit PCI devices, except for one single port # card which is 32-bit. # sis: Support for NICs based on the Silicon Integrated Systems SiS 900, # SiS 7016 and NS DP83815 PCI fast ethernet controller chips. # sk: Support for the SysKonnect SK-984x series PCI gigabit ethernet NICs. # This includes the SK-9841 and SK-9842 single port cards (single mode # and multimode fiber) and the SK-9843 and SK-9844 dual port cards # (also single mode and multimode). # The driver will autodetect the number of ports on the card and # attach each one as a separate network interface. # sn: Support for ISA and PC Card Ethernet devices using the # SMC91C90/92/94/95 chips. # sr: RISCom/N2 hdlc sync 1/2 port V.35/X.21 serial driver (requires sppp) # ste: Sundance Technologies ST201 PCI fast ethernet controller, includes # the D-Link DFE-550TX. # ti: Support for PCI gigabit ethernet NICs based on the Alteon Networks # Tigon 1 and Tigon 2 chipsets. This includes the Alteon AceNIC, the # 3Com 3c985, the Netgear GA620 and various others. Note that you will # probably want to bump up NMBCLUSTERS a lot to use this driver. # tl: Support for the Texas Instruments TNETE100 series 'ThunderLAN' # cards and integrated ethernet controllers. This includes several # Compaq Netelligent 10/100 cards and the built-in ethernet controllers # in several Compaq Prosignia, Proliant and Deskpro systems. It also # supports several Olicom 10Mbps and 10/100 boards. # tx: SMC 9432 TX, BTX and FTX cards. (SMC EtherPower II serie) # vr: Support for various fast ethernet adapters based on the VIA # Technologies VT3043 `Rhine I' and VT86C100A `Rhine II' chips, # including the D-Link DFE530TX (see 'rl' for DFE530TX+), the Hawking # Technologies PN102TX, and the AOpen/Acer ALN-320. # vx: 3Com 3C590 and 3C595 # wb: Support for fast ethernet adapters based on the Winbond W89C840F chip. # Note: this is not the same as the Winbond W89C940F, which is a # NE2000 clone. # wl: Lucent Wavelan (ISA card only). # wi: Lucent WaveLAN/IEEE 802.11 PCMCIA adapters. Note: this supports both # the PCMCIA and ISA cards: the ISA card is really a PCMCIA to ISA # bridge with a PCMCIA adapter plugged into it. # wx: Intel Gigabit Ethernet PCI card (`Wiseman') # xe: Xircom/Intel EtherExpress Pro100/16 PC Card ethernet controller, # Accton Fast EtherCard-16, Compaq Netelligent 10/100 PC Card, # Toshiba 10/100 Ethernet PC Card, Xircom 16-bit Ethernet + Modem 56 # xl: Support for the 3Com 3c900, 3c905, 3c905B and 3c905C (Fast) # Etherlink XL cards and integrated controllers. This includes the # integrated 3c905B-TX chips in certain Dell Optiplex and Dell # Precision desktop machines and the integrated 3c905-TX chips # in Dell Latitude laptop docking stations. # Also supported: 3Com 3c980(C)-TX, 3Com 3cSOHO100-TX, 3Com 3c450-TX # Order for ISA/EISA devices is important here device ar 1 hint.ar.0.at="isa" hint.ar.0.port="0x300" hint.ar.0.irq="10" hint.ar.0.maddr="0xd0000" device cs hint.cs.0.at="isa" hint.cs.0.port="0x300" device cx 1 hint.cx.0.at="isa" hint.cx.0.port="0x240" hint.cx.0.irq="15" hint.cx.0.drq="7" device ed hint.ed.0.at="isa" hint.ed.0.port="0x280" hint.ed.0.irq="5" hint.ed.0.maddr="0xd8000" device el 1 hint.el.0.at="isa" hint.el.0.port="0x300" hint.el.0.irq="9" device ep device ex device fe 1 options FE_8BIT_SUPPORT # LAC-98 support hint.fe.0.at="isa" hint.fe.0.port="0x300" device fea device ie 2 hint.ie.0.at="isa" hint.ie.0.port="0x300" hint.ie.0.irq="5" hint.ie.0.maddr="0xd0000" hint.ie.1.at="isa" hint.ie.1.port="0x360" hint.ie.1.irq="7" hint.ie.1.maddr="0xd0000" device le 1 hint.le.0.at="isa" hint.le.0.port="0x300" hint.le.0.irq="5" hint.le.0.maddr="0xd0000" device lnc 1 hint.lnc.0.at="isa" hint.lnc.0.port="0x280" hint.lnc.0.irq="10" hint.lnc.0.drq="0" device rdp 1 hint.rdp.0.at="isa" hint.rdp.0.port="0x378" hint.rdp.0.irq="7" hint.rdp.0.flags="2" device sr 1 hint.sr.0.at="isa" hint.sr.0.port="0x300" hint.sr.0.irq="5" hint.sr.0.maddr="0xd0000" device sn hint.sn.0.at="isa" hint.sn.0.port="0x300" hint.sn.0.irq="10" device an device awi device cnw device wi options WLCACHE # enables the signal-strength cache options WLDEBUG # enables verbose debugging output device wl 1 hint.wl.0.at="isa" hint.wl.0.port="0x300" device xe device oltr options OLTR_NO_BULLSEYE_MAC options OLTR_NO_HAWKEYE_MAC options OLTR_NO_TMS_MAC hint.oltr.0.at="isa" # PCI Ethernet NICs that use the common MII bus controller code. device dc # DEC/Intel 21143 and various workalikes device fxp # Intel EtherExpress PRO/100B (82557, 82558) hint.fxp.0.prefer_iomap="0" device rl # RealTek 8129/8139 device pcn # AMD Am79C79x PCI 10/100 NICs device sf # Adaptec AIC-6915 (``Starfire'') device sis # Silicon Integrated Systems SiS 900/SiS 7016 device ste # Sundance ST201 (D-Link DFE-550TX) device tl # Texas Instruments ThunderLAN device tx # SMC EtherPower II (83c170 ``EPIC'') device vr # VIA Rhine, Rhine II device wb # Winbond W89C840F device xl # 3Com 3c90x (``Boomerang'', ``Cyclone'') # PCI Ethernet NICs. device de # DEC/Intel DC21x4x (``Tulip'') device vx # 3Com 3c590, 3c595 (``Vortex'') # PCI Gigabit & FDDI NICs. device nge device sk device ti device wx device fpa 1 # # ATM related options (Cranor version) # (note: this driver cannot be used with the HARP ATM stack) # # The `en' device provides support for Efficient Networks (ENI) # ENI-155 PCI midway cards, and the Adaptec 155Mbps PCI ATM cards (ANA-59x0). # # atm device provides generic atm functions and is required for # atm devices. # NATM enables the netnatm protocol family that can be used to # bypass TCP/IP. # # the current driver supports only PVC operations (no atm-arp, no multicast). # for more details, please read the original documents at # http://www.ccrc.wustl.edu/pub/chuck/tech/bsdatm/bsdatm.html # device atm device en options NATM #native ATM # # Audio drivers: `pcm', `sbc', `gusc', `pca' # # pcm: PCM audio through various sound cards. # # This has support for a large number of new audio cards, based on # CS423x, OPTi931, Yamaha OPL-SAx, and also for SB16, GusPnP. # For more information about this driver and supported cards, # see the pcm.4 man page. # # The flags of the device tells the device a bit more info about the # device that normally is obtained through the PnP interface. # bit 2..0 secondary DMA channel; # bit 4 set if the board uses two dma channels; # bit 15..8 board type, overrides autodetection; leave it # zero if don't know what to put in (and you don't, # since this is unsupported at the moment...). # # This driver will use the new PnP code if it's available. # # pca: PCM audio through your PC speaker # # Supported cards include: # Creative SoundBlaster ISA PnP/non-PnP # Supports ESS and Avance ISA chips as well. # Gravis UltraSound ISA PnP/non-PnP # Crystal Semiconductor CS461x/428x PCI # Neomagic 256AV (ac97) # Most of the more common ISA/PnP sb/mss/ess compatable cards. device pcm # For non-pnp sound cards with no bridge drivers only: hint.pcm.0.at="isa" hint.pcm.0.irq="10" hint.pcm.0.drq="1" hint.pcm.0.flags="0x0" # For PnP/PCI sound cards, no hints are required. # # midi: MIDI interfaces and synthesizers # device midi # For non-pnp sound cards with no bridge drivers: hint.midi.0.at="isa" hint.midi.0.irq="5" hint.midi.0.flags="0x0" # For serial ports (this example configures port 2): # TODO: implement generic tty-midi interface so that we can use # other uarts. hint.midi.0.at="isa" hint.midi.0.port="0x2F8" hint.midi.0.irq="3" # # seq: MIDI sequencer # device seq # The bridge drivers for sound cards. These can be separately configured # for providing services to the likes of new-midi. # When used with 'device pcm' they also provide pcm sound services. # # sbc: Creative SoundBlaster ISA PnP/non-PnP # Supports ESS and Avance ISA chips as well. # gusc: Gravis UltraSound ISA PnP/non-PnP # csa: Crystal Semiconductor CS461x/428x PCI # For non-PnP cards: device sbc hint.sbc.0.at="isa" hint.sbc.0.port="0x220" hint.sbc.0.irq="5" hint.sbc.0.drq="1" hint.sbc.0.flags="0x15" device gusc hint.gusc.0.at="isa" hint.gusc.0.port="0x220" hint.gusc.0.irq="5" hint.gusc.0.drq="1" hint.gusc.0.flags="0x13" device pca hint.pca.0.at="isa" hint.pca.0.port="0x040" # # Miscellaneous hardware: # # mcd: Mitsumi CD-ROM # scd: Sony CD-ROM # matcd: Matsushita/Panasonic CD-ROM # wt: Wangtek and Archive QIC-02/QIC-36 tape drives # ctx: Cortex-I frame grabber # apm: Laptop Advanced Power Management (experimental) # pmtimer: Timer device driver for power management events (APM or ACPI) # spigot: The Creative Labs Video Spigot video-acquisition board # meteor: Matrox Meteor video capture board # bktr: Brooktree bt848/848a/849a/878/879 video capture and TV Tuner board # cy: Cyclades serial driver # dgb: Digiboard PC/Xi and PC/Xe series driver (ALPHA QUALITY!) # dgm: Digiboard PC/Xem driver (obsolete) # digi: Digiboard driver # gp: National Instruments AT-GPIB and AT-GPIB/TNT board, PCMCIA-GPIB # asc: GI1904-based hand scanners, e.g. the Trust Amiscan Grey # gsc: Genius GS-4500 hand scanner. # joy: joystick (including IO DATA PCJOY PC Card joystick) # The LOUTB option specifies a slower outb() for debugging purposes. # rc: RISCom/8 multiport card # rp: Comtrol Rocketport(ISA) - single card # tw: TW-523 power line interface for use with X-10 home control products # si: Specialix SI/XIO 4-32 port terminal multiplexor # spic: Sony Programmable I/O controller (VAIO notebooks) # stl: Stallion EasyIO and EasyConnection 8/32 (cd1400 based) # stli: Stallion EasyConnection 8/64, ONboard, Brumby (intelligent) # Notes on APM # The flags takes the following meaning for apm0: # 0x0020 Statclock is broken. # If apm is omitted, some systems require sysctl -w kern.timecounter.method=1 # for correct timekeeping. # Notes on the spigot: # The video spigot is at 0xad6. This port address can not be changed. # The irq values may only be 10, 11, or 15 # I/O memory is an 8kb region. Possible values are: # 0a0000, 0a2000, ..., 0fffff, f00000, f02000, ..., ffffff # The start address must be on an even boundary. # Add the following option if you want to allow non-root users to be able # to access the spigot. This option is not secure because it allows users # direct access to the I/O page. # options SPIGOT_UNSECURE # Notes on the Comtrol Rocketport driver: # # The exact values used for rp0 depend on how many boards you have # in the system. The manufacturer's sample configs are listed as: # # device rp # core driver support # # Comtrol Rocketport ISA single card # hints.rp.0.at="isa" # hints.rp.0.port="0x280" # # If instead you have two ISA cards, one installed at 0x100 and the # second installed at 0x180, then you should add the following to # your kernel probe hints: # hints.rp.0.at="isa" # hints.rp.0.port="0x100" # hints.rp.1.at="isa" # hints.rp.1.port="0x180" # # For 4 ISA cards, it might be something like this: # hints.rp.0.at="isa" # hints.rp.0.port="0x180" # hints.rp.1.at="isa" # hints.rp.1.port="0x100" # hints.rp.2.at="isa" # hints.rp.2.port="0x340" # hints.rp.3.at="isa" # hints.rp.3.port="0x240" # # And for PCI cards, you need no hints. # Notes on the Digiboard driver: # # The following flag values have special meanings: # 0x01 - alternate layout of pins (dgb & dgm) # 0x02 - use the windowed PC/Xe in 64K mode (dgb only) # Notes on the Specialix SI/XIO driver: # The host card is memory, not IO mapped. # The Rev 1 host cards use a 64K chunk, on a 32K boundary. # The Rev 2 host cards use a 32K chunk, on a 32K boundary. # The cards can use an IRQ of 11, 12 or 15. # Notes on the Sony Programmable I/O controller # This is a temporary driver that should someday be replaced by something # that hooks into the ACPI layer. The device is hooked to the PIIX4's # General Device 10 decoder, which means you have to fiddle with PCI # registers to map it in, even though it is otherwise treated here as # an ISA device. At the moment, the driver polls, although the device # is capable of generating interrupts. It largely undocumented. # The port location in the hint is where you WANT the device to be # mapped. 0x10a0 seems to be traditional. At the moment the jogdial # is the only thing truly supported, but aparently a fair percentage # of the Vaio extra features are controlled by this device. # Notes on the Stallion stl and stli drivers: # See src/i386/isa/README.stl for complete instructions. # This is version 0.0.5alpha, unsupported by Stallion. # The stl driver has a secondary IO port hard coded at 0x280. You need # to change src/i386/isa/stallion.c if you reconfigure this on the boards. # The "flags" and "msize" settings on the stli driver depend on the board: # EasyConnection 8/64 ISA: flags 23 msize 0x1000 # EasyConnection 8/64 EISA: flags 24 msize 0x10000 # EasyConnection 8/64 MCA: flags 25 msize 0x1000 # ONboard ISA: flags 4 msize 0x10000 # ONboard EISA: flags 7 msize 0x10000 # ONboard MCA: flags 3 msize 0x10000 # Brumby: flags 2 msize 0x4000 # Stallion: flags 1 msize 0x10000 device mcd 1 hint.mcd.0.at="isa" hint.mcd.0.port="0x300" hint.mcd.0.irq="10" # for the Sony CDU31/33A CDROM device scd 1 hint.scd.0.at="isa" hint.scd.0.port="0x230" # for the SoundBlaster 16 multicd - up to 4 devices device matcd 1 hint.matcd.0.at="isa" hint.matcd.0.port="0x230" device wt 1 hint.wt.0.at="isa" hint.wt.0.port="0x300" hint.wt.0.irq="5" hint.wt.0.drq="1" device ctx 1 hint.ctx.0.at="isa" hint.ctx.0.port="0x230" hint.ctx.0.maddr="0xd0000" device spigot 1 hint.spigot.0.at="isa" hint.spigot.0.port="0xad6" hint.spigot.0.irq="15" hint.spigot.0.maddr="0xee000" device apm hint.apm.0.flags="0x20" device pmtimer # Adjust system timer at wakeup time hint.pmtimer.0.at="isa" device gp hint.gp.0.at="isa" hint.gp.0.port="0x2c0" device gsc 1 hint.gsc.0.at="isa" hint.gsc.0.port="0x270" hint.gsc.0.drq="3" device joy # PnP aware, hints for nonpnp only hint.joy.0.at="isa" hint.joy.0.port="0x201" device cy 1 options CY_PCI_FASTINTR # Use with cy_pci unless irq is shared hint.cy.0.at="isa" hint.cy.0.irq="10" hint.cy.0.maddr="0xd4000" hint.cy.0.msize="0x2000" device dgb 1 options NDGBPORTS=16 # Defaults to 16*NDGB hint.dgb.0.at="isa" hint.dgb.0.port="0x220" hint.dgb.0.maddr="0xfc000" device dgm hint.dgm.0.at="isa" hint.dgm.0.port="0x104" hint.dgm.0.maddr="0xd0000" device digi hint.dgm.0.at="isa" hint.dgm.0.port="0x104" hint.dgm.0.maddr="0xd0000" # BIOS & FEP/OS components of device digi. Normally left as modules device digi_CX device digi_CX_PCI device digi_EPCX device digi_EPCX_PCI device digi_Xe device digi_Xem device digi_Xr device rc 1 hint.rc.0.at="isa" hint.rc.0.port="0x220" hint.rc.0.irq="12" device rp hint.rp.0.at="isa" hint.rp.0.port="0x280" # the port and irq for tw0 are fictitious device tw 1 hint.tw.0.at="isa" hint.tw.0.port="0x380" hint.tw.0.irq="11" device si options SI_DEBUG hint.si.0.at="isa" hint.si.0.maddr="0xd0000" hint.si.0.irq="12" device asc 1 hint.asc.0.at="isa" hint.asc.0.port="0x3EB" hint.asc.0.drq="3" hint.asc.0.irq="10" device spic hint.spic.0.at="isa" hint.spic.0.port="0x10a0" device stl hint.stl.0.at="isa" hint.stl.0.port="0x2a0" hint.stl.0.irq="10" device stli hint.stli.0.at="isa" hint.stli.0.port="0x2a0" hint.stli.0.maddr="0xcc000" hint.stli.0.flags="23" hint.stli.0.msize="0x1000" # You are unlikely to have the hardware for loran device loran hint.loran.0.at="isa" hint.loran.0.irq="5" # HOT1 Xilinx 6200 card (http://www.vcc.com/) device xrpu # # The `meteor' device is a PCI video capture board. It can also have the # following options: # options METEOR_ALLOC_PAGES=xxx preallocate kernel pages for data entry # figure (ROWS*COLUMN*BYTES_PER_PIXEL*FRAME+PAGE_SIZE-1)/PAGE_SIZE # options METEOR_DEALLOC_PAGES remove all allocated pages on close(2) # options METEOR_DEALLOC_ABOVE=xxx remove all allocated pages above the # specified amount. If this value is below the allocated amount no action # taken # options METEOR_SYSTEM_DEFAULT={METEOR_PAL|METEOR_NTSC|METEOR_SECAM}, used # for initialization of fps routine when a signal is not present. # # The 'bktr' device is a PCI video capture device using the Brooktree # bt848/bt848a/bt849a/bt878/bt879 chipset. When used with a TV Tuner it forms a # TV card, eg Miro PC/TV, Hauppauge WinCast/TV WinTV, VideoLogic Captivator, # Intel Smart Video III, AverMedia, IMS Turbo, FlyVideo. # # options OVERRIDE_CARD=xxx # options OVERRIDE_TUNER=xxx # options OVERRIDE_MSP=1 # options OVERRIDE_DBX=1 # These options can be used to override the auto detection # The current values for xxx are found in src/sys/dev/bktr/bktr_card.h # Using sysctl(8) run-time overrides on a per-card basis can be made # # options BROOKTREE_SYSTEM_DEFAULT=BROOKTREE_PAL # or # options BROOKTREE_SYSTEM_DEFAULT=BROOKTREE_NTSC # Specifes the default video capture mode. # This is required for Dual Crystal (28&35Mhz) boards where PAL is used # to prevent hangs during initialisation. eg VideoLogic Captivator PCI. # # options BKTR_USE_PLL # PAL or SECAM users who have a 28Mhz crystal (and no 35Mhz crystal) # must enable PLL mode with this option. eg some new Bt878 cards. # # options BKTR_GPIO_ACCESS # This enable IOCTLs which give user level access to the GPIO port. # # options BKTR_NO_MSP_RESET # Prevents the MSP34xx reset. Good if you initialise the MSP in another OS first # # options BKTR_430_FX_MODE # Switch Bt878/879 cards into Intel 430FX chipset compatibility mode. # # options BKTR_SIS_VIA_MODE # Switch Bt878/879 cards into SIS/VIA chipset compatibility mode which is # needed for some old SiS and VIA chipset motherboards. # This also allows Bt878/879 chips to work on old OPTi (<1997) chipset # motherboards and motherboards with bad or incomplete PCI 2.1 support. # As a rough guess, old = before 1998 # device meteor 1 # Brooktree driver has been ported to the new I2C framework. Thus, # you'll need to have the following 3 lines in the kernel config. # device smbus # device iicbus # device iicbb # The iic and smb devices are only needed if you want to control other # I2C slaves connected to the external connector of some cards. # device bktr 1 # # PC Card/PCMCIA # (OLDCARD) # # card: pccard slots # pcic: isa/pccard bridge device pcic hint.pcic.0.at="isa" hint.pcic.1.at="isa" device card # # PC Card/PCMCIA and Cardbus # (NEWCARD) # # Note that NEWCARD and OLDCARD are incompatible. Do not use both at the same # time. # # pccbb: isa/pccard and pci/cardbus bridge # pccard: pccard slots # cardbus: cardbus slots #device pccbb #device pccard #device cardbus # You may need to reset all pccards after resuming options PCIC_RESUME_RESET # reset after resume # # Laptop/Notebook options: # # See also: # apm under `Miscellaneous hardware' # above. # For older notebooks that signal a powerfail condition (external # power supply dropped, or battery state low) by issuing an NMI: options POWERFAIL_NMI # make it beep instead of panicing # # SMB bus # # System Management Bus support is provided by the 'smbus' device. # Access to the SMBus device is via the 'smb' device (/dev/smb*), # which is a child of the 'smbus' device. # # Supported devices: # smb standard io through /dev/smb* # # Supported SMB interfaces: # iicsmb I2C to SMB bridge with any iicbus interface # bktr brooktree848 I2C hardware interface # intpm Intel PIIX4 Power Management Unit # alpm Acer Aladdin-IV/V/Pro2 Power Management Unit # ichsmb Intel ICH SMBus controller chips (82801AA, 82801AB, 82801BA) # device smbus # Bus support, required for smb below. device intpm device alpm device ichsmb device smb # # I2C Bus # # Philips i2c bus support is provided by the `iicbus' device. # # Supported devices: # ic i2c network interface # iic i2c standard io # iicsmb i2c to smb bridge. Allow i2c i/o with smb commands. # # Supported interfaces: # pcf Philips PCF8584 ISA-bus controller # bktr brooktree848 I2C software interface # # Other: # iicbb generic I2C bit-banging code (needed by lpbb, bktr) # device iicbus # Bus support, required for ic/iic/iicsmb below. device iicbb device ic device iic device iicsmb # smb over i2c bridge device pcf hint.pcf.0.at="isa" hint.pcf.0.port="0x320" hint.pcf.0.irq="5" #--------------------------------------------------------------------------- # ISDN4BSD # # See /usr/share/examples/isdn/ROADMAP for an introduction to isdn4bsd. # # i4b passive ISDN cards support contains the following hardware drivers: # # isic - Siemens/Infineon ISDN ISAC/HSCX/IPAC chipset driver # iwic - Winbond W6692 PCI bus ISDN S/T interface controller # ifpi - AVM Fritz!Card PCI driver # ihfc - Cologne Chip HFC ISA/ISA-PnP chipset driver # ifpnp - AVM Fritz!Card PnP driver # itjc - Siemens ISAC / TJNet Tiger300/320 chipset # +# i4b active ISDN cards support contains the following hardware drivers: +# +# iavc - AVM B1 PCI, AVM B1 ISA, AVM T1 +# # Note that the ``options'' (if given) and ``device'' lines must BOTH # be uncommented to enable support for a given card ! # # In addition to a hardware driver (and probably an option) the mandatory # ISDN protocol stack devices and the mandatory support device must be # enabled as well as one or more devices from the optional devices section. # #--------------------------------------------------------------------------- # isic driver (Siemens/Infineon chipsets) # device isic # # ISA bus non-PnP Cards: # ---------------------- # # Teles S0/8 or Niccy 1008 options TEL_S0_8 hint.isic.0.at="isa" hint.isic.0.maddr="0xd0000" hint.isic.0.irq="5" hint.isic.0.flags="1" # # Teles S0/16 or Creatix ISDN-S0 or Niccy 1016 options TEL_S0_16 hint.isic.0.at="isa" hint.isic.0.port="0xd80" hint.isic.0.maddr="0xd0000" hint.isic.0.irq="5" hint.isic.0.flags="2" # # Teles S0/16.3 options TEL_S0_16_3 hint.isic.0.at="isa" hint.isic.0.port="0xd80" hint.isic.0.irq="5" hint.isic.0.flags="3" # # AVM A1 or AVM Fritz!Card options AVM_A1 hint.isic.0.at="isa" hint.isic.0.port="0x340" hint.isic.0.irq="5" hint.isic.0.flags="4" # # USRobotics Sportster ISDN TA intern options USR_STI hint.isic.0.at="isa" hint.isic.0.port="0x268" hint.isic.0.irq="5" hint.isic.0.flags="7" # # ITK ix1 Micro ( < V.3, non-PnP version ) options ITKIX1 hint.isic.0.at="isa" hint.isic.0.port="0x398" hint.isic.0.irq="10" hint.isic.0.flags="18" # # ELSA PCC-16 options ELSA_PCC16 hint.isic.0.at="isa" hint.isic.0.port="0x360" hint.isic.0.irq="10" hint.isic.0.flags="20" # # ISA bus PnP Cards: # ------------------ # # Teles S0/16.3 PnP options TEL_S0_16_3_P # # Creatix ISDN-S0 P&P options CRTX_S0_P # # Dr. Neuhaus Niccy Go@ options DRN_NGO # # Sedlbauer Win Speed options SEDLBAUER # # Dynalink IS64PH options DYNALINK # # ELSA QuickStep 1000pro ISA options ELSA_QS1ISA # # Siemens I-Surf 2.0 options SIEMENS_ISURF2 # # Asuscom ISDNlink 128K ISA options ASUSCOM_IPAC # # Eicon Diehl DIVA 2.0 and 2.02 options EICON_DIVA # # PCI bus Cards: # -------------- # # ELSA MicroLink ISDN/PCI (same as ELSA QuickStep 1000pro PCI) options ELSA_QS1PCI # # #--------------------------------------------------------------------------- # ifpnp driver for AVM Fritz!Card PnP # # AVM Fritz!Card PnP device ifpnp # #--------------------------------------------------------------------------- # ihfc driver for Cologne Chip ISA chipsets (experimental!) # # Teles 16.3c ISA PnP # AcerISDN P10 ISA PnP # TELEINT ISDN SPEED No.1 device ihfc # #--------------------------------------------------------------------------- # ifpi driver for AVM Fritz!Card PCI # # AVM Fritz!Card PCI device ifpi # #--------------------------------------------------------------------------- # iwic driver for Winbond W6692 chipset # # ASUSCOM P-IN100-ST-D (and other Winbond W6692 based cards) device iwic # #--------------------------------------------------------------------------- # itjc driver for Simens ISAC / TJNet Tiger300/320 chipset # # Traverse Technologies NETjet-S # Teles PCI-TJ device itjc # #--------------------------------------------------------------------------- +# iavc driver (AVM active cards, needs i4bcapi driver!) +# +device iavc +# +# AVM B1 ISA bus (PnP mode not supported!) +# ---------------------------------------- +hint.iavc.0.at="isa" +hint.iavc.0.port="0x150" +hint.iavc.0.irq="5" +# +#--------------------------------------------------------------------------- # ISDN Protocol Stack - mandatory for all hardware drivers # # Q.921 / layer 2 - i4b passive cards D channel handling device "i4bq921" # # Q.931 / layer 3 - i4b passive cards D channel handling device "i4bq931" # # layer 4 - i4b common passive and active card handling device "i4b" # #--------------------------------------------------------------------------- # ISDN devices - mandatory for all hardware drivers # # userland driver to do ISDN tracing (for passive cards only) device "i4btrc" 4 # # userland driver to control the whole thing device "i4bctl" # #--------------------------------------------------------------------------- # ISDN devices - optional # # userland driver for access to raw B channel device "i4brbch" 4 # # userland driver for telephony device "i4btel" 2 # # network driver for IP over raw HDLC ISDN device "i4bipr" 4 # enable VJ header compression detection for ipr i/f options IPR_VJ # enable logging of the first n IP packets to isdnd (n=32 here) options IPR_LOG=32 # # network driver for sync PPP over ISDN; requires an equivalent # number of sppp device to be configured device "i4bisppp" 4 # -# B-channel inteface to the netgraph subsystem +# B-channel interface to the netgraph subsystem device "i4bing" 2 # +# CAPI driver needed for active ISDN cards (see iavc driver above) +device "i4bcapi" +# #--------------------------------------------------------------------------- # Parallel-Port Bus # # Parallel port bus support is provided by the `ppbus' device. # Multiple devices may be attached to the parallel port, devices # are automatically probed and attached when found. # # Supported devices: # vpo Iomega Zip Drive # Requires SCSI disk support ('scbus' and 'da'), best # performance is achieved with ports in EPP 1.9 mode. # lpt Parallel Printer # plip Parallel network interface # ppi General-purpose I/O ("Geek Port") + IEEE1284 I/O # pps Pulse per second Timing Interface # lpbb Philips official parallel port I2C bit-banging interface # # Supported interfaces: # ppc ISA-bus parallel port interfaces. # options PPC_PROBE_CHIPSET # Enable chipset specific detection # (see flags in ppc(4)) options DEBUG_1284 # IEEE1284 signaling protocol debug options PERIPH_1284 # Makes your computer act as a IEEE1284 # compliant peripheral options DONTPROBE_1284 # Avoid boot detection of PnP parallel devices options VP0_DEBUG # ZIP/ZIP+ debug options LPT_DEBUG # Printer driver debug options PPC_DEBUG # Parallel chipset level debug options PLIP_DEBUG # Parallel network IP interface debug options PCFCLOCK_VERBOSE # Verbose pcfclock driver options PCFCLOCK_MAX_RETRIES=5 # Maximum read tries (default 10) device ppc hint.ppc.0.at="isa" hint.ppc.0.irq="7" device ppbus device vpo device lpt device plip device ppi device pps device lpbb device pcfclock # Kernel BOOTP support options BOOTP # Use BOOTP to obtain IP address/hostname options BOOTP_NFSROOT # NFS mount root filesystem using BOOTP info options BOOTP_NFSV3 # Use NFS v3 to NFS mount root options BOOTP_COMPAT # Workaround for broken bootp daemons. options BOOTP_WIRED_TO=fxp0 # Use interface fxp0 for BOOTP # # Add tie-ins for a hardware watchdog. This only enable the hooks; # the user must still supply the actual driver. # options HW_WDOG # # Set the number of PV entries per process. Increasing this can # stop panics related to heavy use of shared memory. However, that can # (combined with large amounts of physical memory) cause panics at # boot time due the kernel running out of VM space. # # If you're tweaking this, you might also want to increase the sysctls # "vm.v_free_min", "vm.v_free_reserved", and "vm.v_free_target". # # The value below is the one more than the default. # options PMAP_SHPGPERPROC=201 # # Disable swapping. This option removes all code which actually performs # swapping, so it's not possible to turn it back on at run-time. # # This is sometimes usable for systems which don't have any swap space # (see also sysctls "vm.defer_swapspace_pageouts" and # "vm.disable_swapspace_pageouts") # #options NO_SWAPPING # Set the number of sf_bufs to allocate. sf_bufs are virtual buffers # for sendfile(2) that are used to map file VM pages, and normally # default to a quantity that is roughly 16*MAXUSERS+512. You would # typically want about 4 of these for each simultaneous file send. # options NSFBUFS=1024 # # Enable extra debugging code for locks. This stores the filename and # line of whatever acquired the lock in the lock itself, and change a # number of function calls to pass around the relevant data. This is # not at all useful unless you are debugging lock code. Also note # that it is likely to break e.g. fstat(1) unless you recompile your # userland with -DDEBUG_LOCKS as well. # options DEBUG_LOCKS ##################################################################### # ABI Emulation # Enable iBCS2 runtime support for SCO and ISC binaries options IBCS2 # Emulate spx device for client side of SVR3 local X interface options SPX_HACK # Enable Linux ABI emulation options COMPAT_LINUX # Enable the linux-like proc filesystem support (requires COMPAT_LINUX) options LINPROCFS # Linux debugging options DEBUG_LINUX # # SysVR4 ABI emulation # # The svr4 ABI emulator can be statically compiled into the kernel or loaded as # a KLD module. # The STREAMS network emulation code can also be compiled statically or as a # module. If loaded as a module, it must be loaded before the svr4 module # (the /usr/sbin/svr4 script does this for you). If compiling statically, # the `streams' device must be configured into any kernel which also # specifies COMPAT_SVR4. It is possible to have a statically-configured # STREAMS device and a dynamically loadable svr4 emulator; the /usr/sbin/svr4 # script understands that it doesn't need to load the `streams' module under # those circumstances. # Caveat: At this time, `options KTRACE' is required for the svr4 emulator # (whether static or dynamic). # options COMPAT_SVR4 # build emulator statically options DEBUG_SVR4 # enable verbose debugging device streams # STREAMS network driver (required for svr4). ##################################################################### # USB support # UHCI controller device uhci # OHCI controller device ohci # General USB code (mandatory for USB) device usb # # USB Double Bulk Pipe devices device udbp # Generic USB device driver device ugen # Human Interface Device (anything with buttons and dials) device uhid # USB keyboard device ukbd # USB printer device ulpt # USB Iomega Zip 100 Drive device umass # USB modem support device umodem # USB mouse device ums # Diamond Rio 500 Mp3 player device urio # USB scanners device uscanner # # ADMtek USB ethernet. Supports the LinkSys USB100TX, # the Billionton USB100, the Melco LU-ATX, the D-Link DSB-650TX # and the SMC 2202USB. Also works with the ADMtek AN986 Pegasus # eval board. device aue # # CATC USB-EL1201A USB ethernet. Supports the CATC Netmate # and Netmate II, and the Belkin F5U111. device cue # # Kawasaki LSI ethernet. Supports the LinkSys USB10T, # Entrega USB-NET-E45, Peracom Ethernet Adapter, the # 3Com 3c19250, the ADS Technologies USB-10BT, the ATen UC10T, # the Netgear EA101, the D-Link DSB-650, the SMC 2102USB # and 2104USB, and the Corega USB-T. device kue # debugging options for the USB subsystem # options UHCI_DEBUG options OHCI_DEBUG options USB_DEBUG options UGEN_DEBUG options UHID_DEBUG options UHUB_DEBUG options UKBD_DEBUG options ULPT_DEBUG options UMASS_DEBUG options UMS_DEBUG options URIO_DEBUG # options for ukbd: options UKBD_DFLT_KEYMAP # specify the built-in keymap makeoptions UKBD_DFLT_KEYMAP=it.iso # # Embedded system options: # # An embedded system might want to run something other than init. options INIT_PATH="/sbin/init:/stand/sysinstall" # Debug options options BUS_DEBUG # enable newbus debugging options DEBUG_VFS_LOCKS # enable vfs lock debugging options NPX_DEBUG # enable npx debugging (FPU/math emu) ##################################################################### # SYSV IPC KERNEL PARAMETERS # # Maximum number of entries in a semaphore map. options SEMMAP=31 # Maximum number of System V semaphores that can be used on the system at # one time. options SEMMNI=11 # Total number of semaphores system wide options SEMMNS=61 # Total number of undo structures in system options SEMMNU=31 # Maximum number of System V semaphores that can be used by a single process # at one time. options SEMMSL=61 # Maximum number of operations that can be outstanding on a single System V # semaphore at one time. options SEMOPM=101 # Maximum number of undo operations that can be outstanding on a single # System V semaphore at one time. options SEMUME=11 # Maximum number of shared memory pages system wide. options SHMALL=1025 # Maximum size, in bytes, of a single System V shared memory region. options SHMMAX="(SHMMAXPGS*PAGE_SIZE+1)" options SHMMAXPGS=1025 # Minimum size, in bytes, of a single System V shared memory region. options SHMMIN=2 # Maximum number of shared memory regions that can be used on the system # at one time. options SHMMNI=33 # Maximum number of System V shared memory regions that can be attached to # a single process at one time. options SHMSEG=9 ##################################################################### # More undocumented options for linting. # Note that documenting these are not considered an affront. options CAM_DEBUG_DELAY # VFS cluster debugging. options CLUSTERDEBUG # Eliminate unneeded cache flush instruction(s). options CPU_UPGRADE_HW_CACHE options DEBUG # PECOFF module (Win32 Execution Format) options PECOFF_SUPPORT options PECOFF_DEBUG # Disable the 4 MByte PSE CPU feature. #options DISABLE_PSE options ENABLE_ALART options I4B_SMP_WORKAROUND options I586_PMC_GUPROF=0x70000 options KBDIO_DEBUG=2 options KBD_MAXRETRY=4 options KBD_MAXWAIT=6 options KBD_RESETDELAY=201 # Enable the PF_KEY Key Management API. options KEY # Kernel filelock debugging. options LOCKF_DEBUG # System V compatible message queues # Please note that the values provided here are used to test kernel # building. The defaults in the sources provide almost the same numbers. # MSGSSZ must be a power of 2 between 8 and 1024. options MSGMNB=2049 # Max number of chars in queue options MSGMNI=41 # Max number of message queue identifiers options MSGSEG=2049 # Max number of message segments options MSGSSZ=16 # Size of a message segment options MSGTQL=41 # Max number of messages in system options NBUF=512 # Number of buffer headers options NMBCLUSTERS=1024 # Number of mbuf clusters options PANIC_REBOOT_WAIT_TIME=16 options PSM_DEBUG=1 options SCSI_NCR_DEBUG options SCSI_NCR_MAX_SYNC=10000 options SCSI_NCR_MAX_WIDE=1 options SCSI_NCR_MYADDR=7 options SC_DEBUG_LEVEL=5 # Syscons debug level options SC_RENDER_DEBUG # syscons rendering debugging options SHOW_BUSYBUFS # List buffers that prevent root unmount options SIMPLELOCK_DEBUG options SLIP_IFF_OPTS options TIMER_FREQ="((14318182+6)/12)" options VFS_BIO_DEBUG # VFS buffer I/O debugging options VM_KMEM_SIZE options VM_KMEM_SIZE_MAX options VM_KMEM_SIZE_SCALE diff --git a/sys/conf/files b/sys/conf/files index ec8ae7b10e90..22c2859e5d08 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -1,1247 +1,1260 @@ # $FreeBSD$ # # The long compile-with and dependency lines are required because of # limitations in config: backslash-newline doesn't work in strings, and # dependency lines other than the first are silently ignored. # aicasm optional ahc \ dependency "$S/dev/aic7xxx/aicasm/*.[chyl]" \ compile-with "${MAKE} -f $S/dev/aic7xxx/aicasm/Makefile MAKESRCPATH=$S/dev/aic7xxx/aicasm" \ no-obj no-implicit-rule \ clean "aicasm aicasm_gram.c aicasm_scan.c y.tab.h" aic7xxx_{seq,reg}.h optional ahc \ compile-with "./aicasm ${INCLUDES} -I$S/cam/scsi -I$S/dev/aic7xxx -o aic7xxx_seq.h -r aic7xxx_reg.h $S/dev/aic7xxx/aic7xxx.seq" \ no-obj no-implicit-rule before-depend \ clean "aic7xxx_seq.h aic7xxx_reg.h" \ dependency "$S/dev/aic7xxx/aic7xxx.{reg,seq} $S/cam/scsi/scsi_message.h aicasm" kern/device_if.m standard kern/bus_if.m standard kern/linker_if.m standard cam/cam.c optional scbus cam/cam_extend.c optional scbus cam/cam_periph.c optional scbus cam/cam_queue.c optional scbus cam/cam_sim.c optional scbus cam/cam_xpt.c optional scbus cam/scsi/scsi_all.c optional scbus cam/scsi/scsi_cd.c optional cd cam/scsi/scsi_ch.c optional ch cam/scsi/scsi_da.c optional da cam/scsi/scsi_low.c optional ct cam/scsi/scsi_low.c optional ncv cam/scsi/scsi_low.c optional nsp cam/scsi/scsi_low.c optional stg cam/scsi/scsi_low_pisa.c optional ct cam/scsi/scsi_low_pisa.c optional ncv cam/scsi/scsi_low_pisa.c optional nsp cam/scsi/scsi_low_pisa.c optional stg cam/scsi/scsi_pass.c optional pass cam/scsi/scsi_pt.c optional pt cam/scsi/scsi_sa.c optional sa cam/scsi/scsi_ses.c optional ses cam/scsi/scsi_targ_bh.c optional targbh cam/scsi/scsi_target.c optional targ coda/coda_fbsd.c count vcoda coda/coda_namecache.c optional vcoda coda/coda_psdev.c optional vcoda coda/coda_subr.c optional vcoda coda/coda_venus.c optional vcoda coda/coda_vfsops.c optional vcoda coda/coda_vnops.c optional vcoda contrib/dev/acpica/Subsystem/Common/cmalloc.c optional acpica contrib/dev/acpica/Subsystem/Common/cmclib.c optional acpica contrib/dev/acpica/Subsystem/Common/cmcopy.c optional acpica contrib/dev/acpica/Subsystem/Common/cmdebug.c optional acpica contrib/dev/acpica/Subsystem/Common/cmdelete.c optional acpica contrib/dev/acpica/Subsystem/Common/cmeval.c optional acpica contrib/dev/acpica/Subsystem/Common/cmglobal.c optional acpica contrib/dev/acpica/Subsystem/Common/cminit.c optional acpica contrib/dev/acpica/Subsystem/Common/cmobject.c optional acpica contrib/dev/acpica/Subsystem/Common/cmutils.c optional acpica contrib/dev/acpica/Subsystem/Common/cmxface.c optional acpica contrib/dev/acpica/Subsystem/Debugger/dbcmds.c optional acpica acpi_debug contrib/dev/acpica/Subsystem/Debugger/dbdisasm.c optional acpica acpi_debug contrib/dev/acpica/Subsystem/Debugger/dbdisply.c optional acpica acpi_debug contrib/dev/acpica/Subsystem/Debugger/dbexec.c optional acpica acpi_debug contrib/dev/acpica/Subsystem/Debugger/dbfileio.c optional acpica acpi_debug contrib/dev/acpica/Subsystem/Debugger/dbhistry.c optional acpica acpi_debug contrib/dev/acpica/Subsystem/Debugger/dbinput.c optional acpica acpi_debug contrib/dev/acpica/Subsystem/Debugger/dbstats.c optional acpica acpi_debug contrib/dev/acpica/Subsystem/Debugger/dbutils.c optional acpica acpi_debug contrib/dev/acpica/Subsystem/Debugger/dbxface.c optional acpica acpi_debug contrib/dev/acpica/Subsystem/Dispatcher/dsfield.c optional acpica contrib/dev/acpica/Subsystem/Dispatcher/dsmethod.c optional acpica contrib/dev/acpica/Subsystem/Dispatcher/dsmthdat.c optional acpica contrib/dev/acpica/Subsystem/Dispatcher/dsobject.c optional acpica contrib/dev/acpica/Subsystem/Dispatcher/dsopcode.c optional acpica contrib/dev/acpica/Subsystem/Dispatcher/dsutils.c optional acpica contrib/dev/acpica/Subsystem/Dispatcher/dswexec.c optional acpica contrib/dev/acpica/Subsystem/Dispatcher/dswload.c optional acpica contrib/dev/acpica/Subsystem/Dispatcher/dswscope.c optional acpica contrib/dev/acpica/Subsystem/Dispatcher/dswstate.c optional acpica contrib/dev/acpica/Subsystem/Events/evevent.c optional acpica contrib/dev/acpica/Subsystem/Events/evmisc.c optional acpica contrib/dev/acpica/Subsystem/Events/evregion.c optional acpica contrib/dev/acpica/Subsystem/Events/evrgnini.c optional acpica contrib/dev/acpica/Subsystem/Events/evsci.c optional acpica contrib/dev/acpica/Subsystem/Events/evxface.c optional acpica contrib/dev/acpica/Subsystem/Events/evxfevnt.c optional acpica contrib/dev/acpica/Subsystem/Events/evxfregn.c optional acpica contrib/dev/acpica/Subsystem/Hardware/hwacpi.c optional acpica contrib/dev/acpica/Subsystem/Hardware/hwgpe.c optional acpica contrib/dev/acpica/Subsystem/Hardware/hwregs.c optional acpica contrib/dev/acpica/Subsystem/Hardware/hwsleep.c optional acpica contrib/dev/acpica/Subsystem/Hardware/hwtimer.c optional acpica contrib/dev/acpica/Subsystem/Interpreter/amconfig.c optional acpica contrib/dev/acpica/Subsystem/Interpreter/amconvrt.c optional acpica contrib/dev/acpica/Subsystem/Interpreter/amcreate.c optional acpica contrib/dev/acpica/Subsystem/Interpreter/amdump.c optional acpica contrib/dev/acpica/Subsystem/Interpreter/amdyadic.c optional acpica contrib/dev/acpica/Subsystem/Interpreter/amfield.c optional acpica contrib/dev/acpica/Subsystem/Interpreter/amfldio.c optional acpica contrib/dev/acpica/Subsystem/Interpreter/ammisc.c optional acpica contrib/dev/acpica/Subsystem/Interpreter/ammonad.c optional acpica contrib/dev/acpica/Subsystem/Interpreter/amnames.c optional acpica contrib/dev/acpica/Subsystem/Interpreter/amprep.c optional acpica contrib/dev/acpica/Subsystem/Interpreter/amregion.c optional acpica contrib/dev/acpica/Subsystem/Interpreter/amresnte.c optional acpica contrib/dev/acpica/Subsystem/Interpreter/amresolv.c optional acpica contrib/dev/acpica/Subsystem/Interpreter/amresop.c optional acpica contrib/dev/acpica/Subsystem/Interpreter/amstore.c optional acpica contrib/dev/acpica/Subsystem/Interpreter/amstoren.c optional acpica contrib/dev/acpica/Subsystem/Interpreter/amstorob.c optional acpica contrib/dev/acpica/Subsystem/Interpreter/amsystem.c optional acpica contrib/dev/acpica/Subsystem/Interpreter/amutils.c optional acpica contrib/dev/acpica/Subsystem/Interpreter/amxface.c optional acpica contrib/dev/acpica/Subsystem/Namespace/nsaccess.c optional acpica contrib/dev/acpica/Subsystem/Namespace/nsalloc.c optional acpica contrib/dev/acpica/Subsystem/Namespace/nsdump.c optional acpica contrib/dev/acpica/Subsystem/Namespace/nseval.c optional acpica contrib/dev/acpica/Subsystem/Namespace/nsinit.c optional acpica contrib/dev/acpica/Subsystem/Namespace/nsload.c optional acpica contrib/dev/acpica/Subsystem/Namespace/nsnames.c optional acpica contrib/dev/acpica/Subsystem/Namespace/nsobject.c optional acpica contrib/dev/acpica/Subsystem/Namespace/nssearch.c optional acpica contrib/dev/acpica/Subsystem/Namespace/nsutils.c optional acpica contrib/dev/acpica/Subsystem/Namespace/nswalk.c optional acpica contrib/dev/acpica/Subsystem/Namespace/nsxfname.c optional acpica contrib/dev/acpica/Subsystem/Namespace/nsxfobj.c optional acpica contrib/dev/acpica/Subsystem/Parser/psargs.c optional acpica contrib/dev/acpica/Subsystem/Parser/psfind.c optional acpica contrib/dev/acpica/Subsystem/Parser/psopcode.c optional acpica contrib/dev/acpica/Subsystem/Parser/psparse.c optional acpica contrib/dev/acpica/Subsystem/Parser/psscope.c optional acpica contrib/dev/acpica/Subsystem/Parser/pstree.c optional acpica contrib/dev/acpica/Subsystem/Parser/psutils.c optional acpica contrib/dev/acpica/Subsystem/Parser/pswalk.c optional acpica contrib/dev/acpica/Subsystem/Parser/psxface.c optional acpica contrib/dev/acpica/Subsystem/Resources/rsaddr.c optional acpica contrib/dev/acpica/Subsystem/Resources/rscalc.c optional acpica contrib/dev/acpica/Subsystem/Resources/rscreate.c optional acpica contrib/dev/acpica/Subsystem/Resources/rsdump.c optional acpica contrib/dev/acpica/Subsystem/Resources/rsio.c optional acpica contrib/dev/acpica/Subsystem/Resources/rsirq.c optional acpica contrib/dev/acpica/Subsystem/Resources/rslist.c optional acpica contrib/dev/acpica/Subsystem/Resources/rsmemory.c optional acpica contrib/dev/acpica/Subsystem/Resources/rsmisc.c optional acpica contrib/dev/acpica/Subsystem/Resources/rsutils.c optional acpica contrib/dev/acpica/Subsystem/Resources/rsxface.c optional acpica contrib/dev/acpica/Subsystem/Tables/tbconvrt.c optional acpica contrib/dev/acpica/Subsystem/Tables/tbget.c optional acpica contrib/dev/acpica/Subsystem/Tables/tbinstal.c optional acpica contrib/dev/acpica/Subsystem/Tables/tbutils.c optional acpica contrib/dev/acpica/Subsystem/Tables/tbxface.c optional acpica contrib/dev/acpica/Subsystem/Tables/tbxfroot.c optional acpica crypto/blowfish/bf_cbc.c optional ipsec ipsec_esp crypto/blowfish/bf_cbc_m.c optional ipsec ipsec_esp crypto/blowfish/bf_enc.c optional ipsec ipsec_esp crypto/blowfish/bf_skey.c optional ipsec ipsec_esp crypto/cast128/cast128.c optional ipsec ipsec_esp crypto/cast128/cast128_cbc.c optional ipsec ipsec_esp crypto/des/des_3cbc.c optional ipsec ipsec_esp crypto/des/des_cbc.c optional ipsec ipsec_esp crypto/des/des_ecb.c optional ipsec ipsec_esp crypto/des/des_setkey.c optional ipsec ipsec_esp crypto/rc5/rc5.c optional ipsec ipsec_esp crypto/rc5/rc5_cbc.c optional ipsec ipsec_esp crypto/sha1.c optional ipsec ddb/db_access.c optional ddb ddb/db_break.c optional ddb ddb/db_command.c optional ddb ddb/db_examine.c optional ddb ddb/db_expr.c optional ddb ddb/db_input.c optional ddb ddb/db_kld.c optional ddb ddb/db_lex.c optional ddb ddb/db_output.c optional ddb ddb/db_print.c optional ddb ddb/db_ps.c optional ddb ddb/db_run.c optional ddb ddb/db_sym.c optional ddb ddb/db_sysctl.c optional ddb ddb/db_trap.c optional ddb ddb/db_variables.c optional ddb ddb/db_watch.c optional ddb ddb/db_write_cmd.c optional ddb dev/aac/aac.c optional aac dev/aac/aac_debug.c optional aac dev/aac/aac_disk.c optional aac dev/aac/aac_pci.c optional aac pci dev/acpica/acpi.c optional acpica dev/acpica/acpi_acad.c optional acpica #dev/acpica/acpi_apic.c optional acpica dev/acpica/acpi_button.c optional acpica dev/acpica/acpi_cmbat.c optional acpica dev/acpica/acpi_ec.c optional acpica dev/acpica/acpi_isa.c optional acpica isa dev/acpica/acpi_lid.c optional acpica dev/acpica/acpi_pcib.c optional acpica pci #dev/acpica/acpi_processor.c optional acpica dev/acpica/acpi_resource.c optional acpica dev/acpica/acpi_thermal.c optional acpica dev/acpica/acpi_timer.c optional acpica dev/acpica/Osd/OsdDebug.c optional acpica dev/acpica/Osd/OsdEnvironment.c optional acpica dev/acpica/Osd/OsdHardware.c optional acpica dev/acpica/Osd/OsdInterrupt.c optional acpica dev/acpica/Osd/OsdMemory.c optional acpica dev/acpica/Osd/OsdSchedule.c optional acpica dev/acpica/Osd/OsdStream.c optional acpica dev/acpica/Osd/OsdSynch.c optional acpica dev/advansys/adv_eisa.c optional adv eisa dev/advansys/adv_pci.c optional adv pci dev/advansys/advansys.c optional adv dev/advansys/advlib.c optional adv dev/advansys/advmcode.c optional adv dev/advansys/adw_pci.c optional adw pci dev/advansys/adwcam.c optional adw dev/advansys/adwlib.c optional adw dev/advansys/adwmcode.c optional adw dev/aha/aha.c optional aha dev/aha/aha_isa.c optional aha isa dev/aha/aha_mca.c optional aha mca dev/ahb/ahb.c optional ahb eisa dev/aic/aic.c optional aic dev/aic/aic_pccard.c optional aic card dev/aic/aic_pccard.c optional aic pccard dev/aic7xxx/aic7770.c optional ahc eisa dev/aic7xxx/ahc_eisa.c optional ahc eisa #dev/aic7xxx/ahc_isa.c optional ahc isa dev/aic7xxx/ahc_pci.c optional ahc pci dev/aic7xxx/aic7xxx.c optional ahc dev/aic7xxx/aic7xxx_93cx6.c optional ahc dev/aic7xxx/aic7xxx_freebsd.c optional ahc dev/aic7xxx/aic7xxx_pci.c optional ahc pci dev/amr/amr.c optional amr dev/amr/amr_disk.c optional amr dev/amr/amr_pci.c optional amr dev/an/if_an.c optional an dev/an/if_an_isa.c optional an isa dev/an/if_an_pccard.c optional an card #dev/an/if_an_pccard.c optional an pccard dev/an/if_an_pci.c optional an pci dev/ar/if_ar.c optional ar dev/ar/if_ar_pci.c optional ar pci dev/asr/asr.c optional asr pci dev/ata/ata-all.c optional ata dev/ata/ata-isa.c optional ata isa dev/ata/ata-card.c optional ata card #dev/ata/ata-card.c optional ata pccard dev/ata/ata-pci.c optional ata pci dev/ata/ata-dma.c optional ata pci dev/ata/ata-disk.c optional atadisk dev/ata/ata-raid.c optional atadisk dev/ata/atapi-all.c optional atapicd dev/ata/atapi-all.c optional atapifd dev/ata/atapi-all.c optional atapist dev/ata/atapi-cd.c optional atapicd dev/ata/atapi-fd.c optional atapifd dev/ata/atapi-tape.c optional atapist dev/awi/am79c930.c optional awi dev/awi/awi.c optional awi dev/awi/awi_wep.c optional awi dev/awi/awi_wicfg.c optional awi dev/awi/if_awi_pccard.c optional awi card dev/awi/if_awi_pccard.c optional awi pccard dev/bktr/bktr_audio.c optional bktr pci dev/bktr/bktr_card.c optional bktr pci dev/bktr/bktr_core.c count bktr pci dev/bktr/bktr_i2c.c optional bktr pci smbus dev/bktr/bktr_os.c optional bktr pci dev/bktr/bktr_tuner.c optional bktr pci dev/buslogic/bt.c optional bt dev/buslogic/bt_eisa.c optional bt eisa dev/buslogic/bt_isa.c optional bt isa dev/buslogic/bt_mca.c optional bt mca dev/buslogic/bt_pci.c optional bt pci dev/cardbus/cardbus.c optional cardbus dev/cardbus/cardbus_cis.c optional cardbus dev/ccd/ccd.c count ccd dev/cnw/if_cnw.c optional cnw card #dev/cnw/if_cnw.c optional cnw pccard dev/cs/if_cs.c optional cs dev/cs/if_cs_isa.c optional cs isa dev/cs/if_cs_pccard.c optional cs card dev/cs/if_cs_pccard.c optional cs pccard dev/dgb/dgb.c count dgb dev/dgb/dgm.c optional dgm \ warning "Please use digi instead of dgm" dev/digi/digi.c optional digi dev/digi/digi_isa.c optional digi dev/digi/digi_pci.c optional digi dev/digi/CX.c optional digi_CX dev/digi/CX_PCI.c optional digi_CX_PCI dev/digi/EPCX.c optional digi_EPCX dev/digi/EPCX_PCI.c optional digi_EPCX_PCI dev/digi/Xe.c optional digi_Xe dev/digi/Xem.c optional digi_Xem dev/digi/Xr.c optional digi_Xr #dev/dpt/dpt_control.c optional dpt dev/dpt/dpt_eisa.c optional dpt eisa dev/dpt/dpt_pci.c optional dpt pci dev/dpt/dpt_scsi.c optional dpt dev/ed/if_ed.c optional ed dev/ed/if_ed_pccard.c optional ed card dev/ed/if_ed_pccard.c optional ed pccard dev/ed/if_ed_pci.c optional ed pci dev/en/midway.c optional en dev/ep/if_ep.c optional ep dev/ep/if_ep_eisa.c optional ep eisa dev/ep/if_ep_isa.c optional ep isa dev/ep/if_ep_mca.c optional ep mca dev/ep/if_ep_pccard.c optional ep card dev/ep/if_ep_pccard.c optional ep pccard dev/ex/if_ex.c optional ex dev/ex/if_ex_isa.c optional ex isa dev/ex/if_ex_pccard.c optional ex card #dev/ex/if_ex_pccard.c optional ex pccard dev/fe/if_fe.c optional fe dev/fe/if_fe_pccard.c optional fe card #dev/fe/if_fe_pccard.c optional fe pccard dev/fxp/if_fxp.c optional fxp dev/hea/eni.c optional hea dev/hea/eni_buffer.c optional hea dev/hea/eni_globals.c optional hea dev/hea/eni_if.c optional hea dev/hea/eni_init.c optional hea dev/hea/eni_intr.c optional hea dev/hea/eni_receive.c optional hea dev/hea/eni_transmit.c optional hea dev/hea/eni_vcm.c optional hea dev/hfa/fore_buffer.c optional hfa dev/hfa/fore_command.c optional hfa dev/hfa/fore_globals.c optional hfa dev/hfa/fore_if.c optional hfa dev/hfa/fore_init.c optional hfa dev/hfa/fore_intr.c optional hfa dev/hfa/fore_load.c optional hfa dev/hfa/fore_output.c optional hfa dev/hfa/fore_receive.c optional hfa dev/hfa/fore_stats.c optional hfa dev/hfa/fore_timer.c optional hfa dev/hfa/fore_transmit.c optional hfa dev/hfa/fore_vcm.c optional hfa dev/ichsmb/ichsmb.c optional ichsmb dev/ichsmb/ichsmb_pci.c optional ichsmb pci dev/ida/ida.c optional ida dev/ida/ida_disk.c optional ida dev/ida/ida_eisa.c optional ida eisa dev/ida/ida_pci.c optional ida pci dev/ie/if_ie.c count ie isa dev/iicbus/iicbb_if.m optional iicbb dev/iicbus/iicbus_if.m optional iicbus dev/iicbus/if_ic.c optional ic dev/iicbus/iic.c optional iic dev/iicbus/iicbb.c optional iicbb dev/iicbus/iicbus.c optional iicbus dev/iicbus/iiconf.c optional iicbus dev/iicbus/iicsmb.c optional iicsmb \ dependency "iicbus_if.h" dev/isp/isp.c optional isp dev/isp/isp_freebsd.c optional isp dev/isp/isp_target.c optional isp dev/isp/isp_pci.c optional isp dev/ispfw/ispfw.c optional ispfw dev/lmc/if_lmc.c optional lmc dev/lnc/if_lnc.c optional lnc dev/lnc/if_lnc_isa.c optional lnc isa dev/lnc/if_lnc_pc98.c optional lnc isa dev/lnc/if_lnc_pci.c optional lnc pci dev/ncv/ncr53c500.c optional ncv dev/ncv/ncr53c500_pccard.c optional ncv card #dev/ncv/ncr53c500_pccard.c optional ncv pccard dev/nsp/nsp.c optional nsp dev/nsp/nsp_pccard.c optional nsp card #dev/nsp/nsp_pccard.c optional nsp pccard dev/mca/mca_bus.c optional mca dev/md/md.c optional md dev/mii/amphy.c optional miibus dev/mii/brgphy.c optional miibus dev/mii/dcphy.c optional miibus pci dev/mii/e1000phy.c optional miibus dev/mii/exphy.c optional miibus dev/mii/inphy.c optional miibus dev/mii/mii.c optional miibus dev/mii/mii_physubr.c optional miibus dev/mii/mlphy.c optional miibus dev/mii/nsphy.c optional miibus dev/mii/nsgphy.c optional miibus dev/mii/pnphy.c optional miibus dev/mii/pnaphy.c optional miibus dev/mii/rlphy.c optional miibus dev/mii/tdkphy.c optional miibus dev/mii/tlphy.c optional miibus dev/mii/ukphy.c optional miibus dev/mii/ukphy_subr.c optional miibus dev/mii/xmphy.c optional miibus dev/mii/lxtphy.c optional miibus dev/mii/qsphy.c optional miibus dev/mii/acphy.c optional miibus dev/mii/miibus_if.m optional miibus dev/mlx/mlx.c optional mlx dev/mlx/mlx_disk.c optional mlx dev/mlx/mlx_pci.c optional mlx dev/mly/mly.c optional mly dev/mly/mly_cam.c optional mly dev/mly/mly_pci.c optional mly dev/musycc/musycc.c optional musycc dev/nge/if_nge.c optional nge dev/null/null.c standard dev/nmdm/nmdm.c optional nmdm dev/pccard/card_if.m optional card dev/pccard/card_if.m optional cardbus dev/pccard/card_if.m optional pccard dev/pccard/pccard.c optional pccard dev/pccard/pccard_cis.c optional pccard dev/pccard/pccard_cis_quirks.c optional pccard dev/pccard/power_if.m optional pccbb dev/pccard/power_if.m optional pccard dev/pci/eisa_pci.c optional pci dev/pci/fixup_pci.c optional pci dev/pci/ignore_pci.c optional pci dev/pci/isa_pci.c optional pci dev/pci/pci.c count pci dev/pci/pci_if.m optional pci dev/pci/pci_pci.c optional pci dev/pci/pci_user.c optional pci dev/pci/pcib_if.m optional pci dev/pcic/i82365.c optional pcic pccard dev/pcic/i82365_isa.c optional pcic pccard dev/pdq/if_fea.c optional fea eisa dev/pdq/if_fpa.c optional fpa pci dev/pdq/pdq.c optional fea eisa dev/pdq/pdq.c optional fpa pci dev/pdq/pdq_ifsubr.c optional fea eisa dev/pdq/pdq_ifsubr.c optional fpa pci dev/ppbus/ppbus_if.m optional ppbus dev/ppbus/if_plip.c optional plip dev/ppbus/immio.c optional vpo dev/ppbus/lpbb.c optional lpbb dev/ppbus/lpt.c optional lpt dev/ppbus/pcfclock.c optional pcfclock dev/ppbus/ppb_1284.c optional ppbus dev/ppbus/ppb_base.c optional ppbus dev/ppbus/ppb_msq.c optional ppbus dev/ppbus/ppbconf.c optional ppbus dev/ppbus/ppi.c optional ppi dev/ppbus/pps.c optional pps dev/ppbus/vpo.c optional vpo dev/ppbus/vpoio.c optional vpo dev/random/harvest.c standard dev/random/randomdev.c optional random dev/random/yarrow.c optional random dev/random/hash.c optional random crypto/rijndael/rijndael-alg-fst.c optional random crypto/rijndael/rijndael-api-fst.c optional random dev/ray/if_ray.c optional ray card dev/ray/if_ray.c optional ray pccard dev/rp/rp.c optional rp dev/rp/rp_isa.c optional rp isa dev/rp/rp_pci.c optional rp pci dev/si/si.c optional si dev/si/si2_z280.c optional si dev/si/si3_t225.c optional si dev/si/si_eisa.c optional si eisa dev/si/si_isa.c optional si isa dev/si/si_pci.c optional si pci dev/smbus/smbus_if.m optional smbus dev/smbus/smb.c optional smb dev/smbus/smbconf.c optional smbus dev/smbus/smbus.c count smbus dev/sn/if_sn.c optional sn dev/sn/if_sn_isa.c optional sn isa dev/sn/if_sn_pccard.c optional sn card dev/sn/if_sn_pccard.c optional sn pccard dev/sound/isa/ad1816.c optional pcm isa dev/sound/isa/emu8000.c optional midi isa dev/sound/isa/es1888.c optional pcm isa dev/sound/isa/ess.c optional pcm isa dev/sound/isa/gusc.c optional gusc isa dev/sound/isa/gusc.c optional pcm isa dev/sound/isa/gusmidi.c optional midi isa dev/sound/isa/mpu.c optional midi isa dev/sound/isa/mss.c optional pcm isa dev/sound/isa/opl.c optional midi isa dev/sound/isa/sb16.c optional pcm isa dev/sound/isa/sb8.c optional pcm isa dev/sound/isa/sbc.c optional pcm isa dev/sound/isa/sbc.c optional sbc isa dev/sound/isa/uartsio.c optional midi isa dev/sound/midi/midi.c optional midi dev/sound/midi/midibuf.c optional midi dev/sound/midi/midisynth.c optional midi dev/sound/midi/sequencer.c optional seq midi dev/sound/pci/als4000.c optional pcm pci #dev/sound/pci/aureal.c optional pcm pci dev/sound/pci/cmi.c optional pcm pci dev/sound/pci/cs4281.c optional pcm pci dev/sound/pci/csa.c optional csa pci dev/sound/pci/csa.c optional pcm pci dev/sound/pci/csamidi.c optional midi csa dev/sound/pci/csapcm.c optional pcm pci dev/sound/pci/ds1.c optional pcm pci dev/sound/pci/emu10k1.c optional pcm pci dev/sound/pci/es137x.c optional pcm pci dev/sound/pci/fm801.c optional pcm pci dev/sound/pci/maestro.c optional pcm pci dev/sound/pci/neomagic.c optional pcm pci dev/sound/pci/solo.c optional pcm pci dev/sound/pci/t4dwave.c optional pcm pci dev/sound/pci/via82c686.c optional pcm pci dev/sound/pci/vibes.c optional pcm pci dev/sound/pcm/ac97.c optional pcm dev/sound/pcm/ac97_if.m optional pcm dev/sound/pcm/buffer.c optional pcm dev/sound/pcm/channel.c optional pcm dev/sound/pcm/channel_if.m optional pcm dev/sound/pcm/dsp.c optional pcm dev/sound/pcm/fake.c optional pcm dev/sound/pcm/feeder.c optional pcm dev/sound/pcm/feeder_if.m optional pcm dev/sound/pcm/feeder_fmt.c optional pcm dev/sound/pcm/feeder_rate.c optional pcm dev/sound/pcm/mixer.c optional pcm dev/sound/pcm/mixer_if.m optional pcm dev/sound/pcm/sound.c optional pcm #dev/sound/usb/upcm.c optional pcm usb dev/sr/if_sr.c optional sr dev/sr/if_sr_pci.c optional sr pci dev/streams/streams.c optional streams dev/stg/tmc18c30.c optional stg dev/stg/tmc18c30_pccard.c optional stg card #dev/stg/tmc18c30_pccard.c optional stg pccard dev/stg/tmc18c30_isa.c optional stg isa dev/sym/sym_hipd.c optional sym \ dependency "$S/dev/sym/sym_{conf,defs}.h" dev/tdfx/tdfx_pci.c optional tdfx pci dev/twe/twe.c optional twe dev/twe/twe_freebsd.c optional twe # # USB support dev/usb/usb_if.m optional usb dev/usb/hid.c optional usb dev/usb/if_aue.c optional aue dev/usb/if_cue.c optional cue dev/usb/if_kue.c optional kue dev/usb/ohci.c optional ohci dev/usb/udbp.c optional udbp dev/usb/ugen.c optional ugen dev/usb/uhci.c optional uhci dev/usb/uhid.c optional uhid dev/usb/uhub.c optional usb dev/usb/ukbd.c optional ukbd dev/usb/ulpt.c optional ulpt dev/usb/umass.c optional umass dev/usb/umodem.c optional umodem dev/usb/ums.c optional ums dev/usb/urio.c optional urio dev/usb/uscanner.c optional uscanner dev/usb/usb.c optional usb dev/usb/usb_ethersubr.c optional usb #dev/usb/usb_mem.c optional usb dev/usb/usb_quirks.c optional usb dev/usb/usb_subr.c optional usb dev/usb/usbdi.c optional usb dev/usb/usbdi_util.c optional usb dev/vinum/vinum.c optional vinum dev/vinum/vinumconfig.c optional vinum dev/vinum/vinumdaemon.c optional vinum dev/vinum/vinuminterrupt.c optional vinum dev/vinum/vinumio.c optional vinum dev/vinum/vinumioctl.c optional vinum dev/vinum/vinumlock.c optional vinum dev/vinum/vinummemory.c optional vinum dev/vinum/vinumparser.c optional vinum dev/vinum/vinumraid5.c optional vinum dev/vinum/vinumrequest.c optional vinum dev/vinum/vinumrevive.c optional vinum dev/vinum/vinumstate.c optional vinum dev/vinum/vinumutil.c optional vinum dev/vx/if_vx.c optional vx dev/vx/if_vx_eisa.c optional vx eisa dev/vx/if_vx_pci.c optional vx pci #dev/wlp/if_wlp.c optional wlp card dev/wds/wd7000.c optional wds isa dev/wi/if_wi.c optional wi card dev/wi/if_wi.c optional wi pccard dev/xe/if_xe.c optional xe card fs/deadfs/dead_vnops.c standard fs/devfs/devfs_devs.c standard fs/devfs/devfs_vfsops.c standard fs/devfs/devfs_vnops.c standard fs/fdescfs/fdesc_vfsops.c optional fdescfs fs/fdescfs/fdesc_vnops.c optional fdescfs fs/fifofs/fifo_vnops.c standard fs/hpfs/hpfs_alsubr.c optional hpfs fs/hpfs/hpfs_hash.c optional hpfs fs/hpfs/hpfs_lookup.c optional hpfs fs/hpfs/hpfs_subr.c optional hpfs fs/hpfs/hpfs_vfsops.c optional hpfs fs/hpfs/hpfs_vnops.c optional hpfs fs/msdosfs/msdosfs_conv.c optional msdosfs fs/msdosfs/msdosfs_denode.c optional msdosfs fs/msdosfs/msdosfs_fat.c optional msdosfs fs/msdosfs/msdosfs_lookup.c optional msdosfs fs/msdosfs/msdosfs_vfsops.c optional msdosfs fs/msdosfs/msdosfs_vnops.c optional msdosfs fs/nullfs/null_subr.c optional nullfs fs/nullfs/null_vfsops.c optional nullfs fs/nullfs/null_vnops.c optional nullfs fs/portalfs/portal_vfsops.c optional portalfs fs/portalfs/portal_vnops.c optional portalfs fs/procfs/procfs_ctl.c optional procfs fs/procfs/procfs_dbregs.c standard fs/procfs/procfs_fpregs.c standard fs/procfs/procfs_map.c optional procfs fs/procfs/procfs_mem.c standard fs/procfs/procfs_note.c optional procfs fs/procfs/procfs_regs.c standard fs/procfs/procfs_rlimit.c optional procfs fs/procfs/procfs_status.c optional procfs fs/procfs/procfs_subr.c optional procfs fs/procfs/procfs_type.c optional procfs fs/procfs/procfs_vfsops.c optional procfs fs/procfs/procfs_vnops.c optional procfs fs/specfs/spec_vnops.c standard fs/umapfs/umap_subr.c optional umapfs fs/umapfs/umap_vfsops.c optional umapfs fs/umapfs/umap_vnops.c optional umapfs fs/unionfs/union_subr.c optional unionfs fs/unionfs/union_vfsops.c optional unionfs fs/unionfs/union_vnops.c optional unionfs gnu/ext2fs/ext2_alloc.c optional ext2fs \ warning "kernel contains GPL contaminated ext2fs file system" gnu/ext2fs/ext2_balloc.c optional ext2fs gnu/ext2fs/ext2_inode.c optional ext2fs gnu/ext2fs/ext2_inode_cnv.c optional ext2fs gnu/ext2fs/ext2_linux_balloc.c optional ext2fs gnu/ext2fs/ext2_linux_ialloc.c optional ext2fs gnu/ext2fs/ext2_lookup.c optional ext2fs gnu/ext2fs/ext2_subr.c optional ext2fs gnu/ext2fs/ext2_vfsops.c optional ext2fs gnu/ext2fs/ext2_vnops.c optional ext2fs # # isdn4bsd device drivers # i4b/driver/i4b_trace.c count i4btrc i4b/driver/i4b_rbch.c count i4brbch i4b/driver/i4b_tel.c count i4btel i4b/driver/i4b_ipr.c count i4bipr net/slcompress.c optional i4bipr i4b/driver/i4b_ctl.c count i4bctl i4b/driver/i4b_ing.c count i4bing i4b/driver/i4b_isppp.c count i4bisppp i4b/driver/i4b_ispppsubr.c optional i4bisppp net/slcompress.c optional i4bisppp # +# isdn4bsd CAPI driver +# +i4b/capi/capi_l4if.c count i4bcapi +i4b/capi/capi_llif.c optional i4bcapi +i4b/capi/capi_msgs.c optional i4bcapi +# +# isdn4bsd AVM B1/T1 CAPI driver +# +i4b/capi/iavc/iavc_pci.c count iavc +i4b/capi/iavc/iavc_isa.c optional iavc +i4b/capi/iavc/iavc_lli.c optional iavc +i4b/capi/iavc/iavc_card.c optional iavc +# # isdn4bsd support # i4b/layer2/i4b_mbuf.c optional i4btrc # # isdn4bsd Q.921 handler # i4b/layer2/i4b_l2.c count i4bq921 i4b/layer2/i4b_l2fsm.c optional i4bq921 i4b/layer2/i4b_uframe.c optional i4bq921 i4b/layer2/i4b_tei.c optional i4bq921 i4b/layer2/i4b_sframe.c optional i4bq921 i4b/layer2/i4b_iframe.c optional i4bq921 i4b/layer2/i4b_l2timer.c optional i4bq921 i4b/layer2/i4b_util.c optional i4bq921 i4b/layer2/i4b_lme.c optional i4bq921 # # isdn4bsd Q.931 handler # i4b/layer3/i4b_q931.c count i4bq931 i4b/layer3/i4b_l3fsm.c optional i4bq931 i4b/layer3/i4b_l3timer.c optional i4bq931 i4b/layer3/i4b_l2if.c optional i4bq931 i4b/layer3/i4b_l4if.c optional i4bq931 i4b/layer3/i4b_q932fac.c optional i4bq931 # # isdn4bsd control device driver, interface to isdnd # i4b/layer4/i4b_i4bdrv.c count i4b i4b/layer4/i4b_l4.c optional i4b i4b/layer4/i4b_l4mgmt.c optional i4b i4b/layer4/i4b_l4timer.c optional i4b # isa/isa_if.m optional isa isa/isa_common.c optional isa isa/isahint.c optional isa isa/joy.c optional joy isa/pnp.c optional isa isa/pnpparse.c optional isa isofs/cd9660/cd9660_bmap.c optional cd9660 isofs/cd9660/cd9660_lookup.c optional cd9660 isofs/cd9660/cd9660_node.c optional cd9660 isofs/cd9660/cd9660_rrip.c optional cd9660 isofs/cd9660/cd9660_util.c optional cd9660 isofs/cd9660/cd9660_vfsops.c optional cd9660 isofs/cd9660/cd9660_vnops.c optional cd9660 kern/imgact_elf.c standard kern/imgact_shell.c standard kern/inflate.c optional gzip kern/init_main.c standard kern/init_sysent.c standard kern/kern_acct.c standard kern/kern_acl.c standard kern/kern_cap.c standard kern/kern_clock.c standard kern/kern_condvar.c standard kern/kern_conf.c standard kern/kern_descrip.c standard kern/kern_environment.c standard kern/kern_event.c standard kern/kern_exec.c standard kern/kern_exit.c standard kern/kern_fork.c standard kern/kern_idle.c standard kern/kern_intr.c standard kern/kern_jail.c standard kern/kern_kthread.c standard kern/kern_ktr.c optional ktr kern/kern_ktrace.c standard kern/kern_linker.c standard kern/kern_lock.c standard kern/kern_lockf.c standard kern/kern_malloc.c standard kern/kern_mib.c standard kern/kern_module.c standard kern/kern_mutex.c standard kern/kern_ntptime.c standard kern/kern_physio.c standard kern/kern_proc.c standard kern/kern_prot.c standard kern/kern_resource.c standard kern/kern_shutdown.c standard kern/kern_sig.c standard kern/kern_subr.c standard kern/kern_switch.c standard kern/kern_sx.c standard kern/kern_synch.c standard kern/kern_syscalls.c standard kern/kern_sysctl.c standard kern/kern_tc.c standard kern/kern_time.c standard kern/kern_timeout.c standard kern/kern_xxx.c standard kern/link_elf.c standard kern/md5c.c standard kern/subr_autoconf.c standard kern/subr_blist.c standard kern/subr_bus.c standard kern/subr_devstat.c standard kern/subr_disk.c standard kern/subr_disklabel.c standard kern/subr_diskslice.c standard kern/subr_eventhandler.c standard kern/subr_kobj.c standard kern/subr_log.c standard kern/subr_mchain.c optional libmchain kern/subr_module.c standard kern/subr_pcpu.c standard kern/subr_prf.c standard kern/subr_prof.c standard kern/subr_rman.c standard kern/subr_sbuf.c standard kern/subr_scanf.c standard kern/subr_smp.c optional smp kern/subr_taskqueue.c standard kern/subr_witness.c optional witness kern/subr_xxx.c standard kern/sys_generic.c standard kern/sys_pipe.c standard kern/sys_process.c standard kern/sys_socket.c standard kern/syscalls.c optional witness kern/sysv_ipc.c standard kern/sysv_msg.c optional sysvmsg kern/sysv_sem.c optional sysvsem kern/sysv_shm.c optional sysvshm kern/tty.c standard kern/tty_compat.c standard kern/tty_conf.c standard kern/tty_cons.c standard kern/tty_pty.c optional pty kern/tty_snoop.c optional snp kern/tty_subr.c standard kern/tty_tty.c standard kern/uipc_accf.c optional inet kern/uipc_domain.c standard kern/uipc_mbuf.c standard kern/uipc_mbuf2.c standard kern/uipc_proto.c standard kern/uipc_socket.c standard kern/uipc_socket2.c standard kern/uipc_syscalls.c standard kern/uipc_usrreq.c standard kern/vfs_aio.c standard kern/vfs_bio.c standard kern/vfs_cache.c standard kern/vfs_cluster.c standard kern/vfs_conf.c standard kern/vfs_default.c standard kern/vfs_export.c standard kern/vfs_init.c standard kern/vfs_lookup.c standard kern/vfs_subr.c standard kern/vfs_syscalls.c standard kern/vfs_vnops.c standard # # These files in libkern/ are those needed by all architectures. Some # of the files in libkern/ are only needed on some architectures, e.g., # libkern/divdi3.c is needed by i386 but not alpha. Also, some of these # routines may be optimized for a particular platform. In either case, # the file should be moved to /conf/files. from here. # libkern/arc4random.c standard libkern/bcd.c standard libkern/bsearch.c standard libkern/iconv.c optional libiconv libkern/iconv_converter_if.m optional libiconv libkern/iconv_xlat.c optional libiconv libkern/index.c standard libkern/inet_ntoa.c standard libkern/mcount.c optional profiling-routine libkern/qsort.c standard libkern/random.c standard libkern/rindex.c standard libkern/scanc.c standard libkern/skpc.c standard libkern/strcat.c standard libkern/strcmp.c standard libkern/strcpy.c standard libkern/strlen.c standard libkern/strncmp.c standard libkern/strncpy.c standard libkern/strtol.c standard libkern/strtoq.c standard libkern/strtoul.c standard libkern/strtouq.c standard net/bpf.c standard net/bpf_filter.c optional bpf bpf.h standard \ compile-with "echo '#define NBPF 1' > bpf.h" \ no-obj no-implicit-rule before-depend net/bridge.c optional bridge net/bsd_comp.c optional ppp_bsdcomp #net/hostcache.c standard net/if.c standard net/if_atmsubr.c optional atm net/if_disc.c optional disc net/if_ef.c optional ef net/if_ethersubr.c optional ether net/if_faith.c count faith net/if_fddisubr.c optional fddi net/if_gif.c count gif net/if_iso88025subr.c optional token net/if_loop.c optional loop net/if_media.c standard net/if_mib.c standard net/if_ppp.c count ppp net/if_sl.c optional sl net/if_spppsubr.c optional sppp net/if_stf.c count stf net/if_tun.c optional tun net/if_tap.c optional tap net/if_vlan.c count vlan net/intrq.c standard net/net_osdep.c standard net/ppp_deflate.c optional ppp_deflate net/ppp_tty.c optional ppp net/pfil.c optional pfil_hooks net/pfil.c optional ipfilter net/radix.c standard net/raw_cb.c standard net/raw_usrreq.c standard net/route.c standard net/rtsock.c standard net/slcompress.c optional ppp net/slcompress.c optional sl net/zlib.c optional ppp_deflate net/zlib.c optional ipsec netatalk/aarp.c optional netatalk netatalk/at_control.c optional netatalk netatalk/at_proto.c optional netatalk netatalk/at_rmx.c optional netatalkdebug netatalk/ddp_input.c optional netatalk netatalk/ddp_output.c optional netatalk netatalk/ddp_usrreq.c optional netatalk netatm/atm_aal5.c optional atm_core netatm/atm_cm.c optional atm_core netatm/atm_device.c optional atm_core netatm/atm_if.c optional atm_core netatm/atm_proto.c optional atm_core netatm/atm_signal.c optional atm_core netatm/atm_socket.c optional atm_core netatm/atm_subr.c optional atm_core netatm/atm_usrreq.c optional atm_core netatm/ipatm/ipatm_event.c optional atm_ip atm_core netatm/ipatm/ipatm_if.c optional atm_ip atm_core netatm/ipatm/ipatm_input.c optional atm_ip atm_core netatm/ipatm/ipatm_load.c optional atm_ip atm_core netatm/ipatm/ipatm_output.c optional atm_ip atm_core netatm/ipatm/ipatm_usrreq.c optional atm_ip atm_core netatm/ipatm/ipatm_vcm.c optional atm_ip atm_core netatm/sigpvc/sigpvc_if.c optional atm_sigpvc atm_core netatm/sigpvc/sigpvc_subr.c optional atm_sigpvc atm_core netatm/spans/spans_arp.c optional atm_spans atm_core \ dependency "spans_xdr.h" netatm/spans/spans_cls.c optional atm_spans atm_core netatm/spans/spans_if.c optional atm_spans atm_core netatm/spans/spans_kxdr.c optional atm_spans atm_core netatm/spans/spans_msg.c optional atm_spans atm_core netatm/spans/spans_print.c optional atm_spans atm_core netatm/spans/spans_proto.c optional atm_spans atm_core netatm/spans/spans_subr.c optional atm_spans atm_core netatm/spans/spans_util.c optional atm_spans atm_core spans_xdr.h optional atm_spans atm_core \ before-depend \ dependency "$S/netatm/spans/spans_xdr.x" \ compile-with "rpcgen -h -C $S/netatm/spans/spans_xdr.x > spans_xdr.h" \ clean "spans_xdr.h" \ no-obj no-implicit-rule spans_xdr.c optional atm_spans atm_core \ before-depend \ dependency "$S/netatm/spans/spans_xdr.x" \ compile-with "rpcgen -c -C $S/netatm/spans/spans_xdr.x > spans_xdr.c" \ clean "spans_xdr.c" \ no-obj no-implicit-rule local spans_xdr.o optional atm_spans atm_core \ dependency "$S/netatm/spans/spans_xdr.x" \ compile-with "${NORMAL_C}" \ no-implicit-rule local netatm/uni/q2110_sigaa.c optional atm_uni atm_core netatm/uni/q2110_sigcpcs.c optional atm_uni atm_core netatm/uni/q2110_subr.c optional atm_uni atm_core netatm/uni/qsaal1_sigaa.c optional atm_uni atm_core netatm/uni/qsaal1_sigcpcs.c optional atm_uni atm_core netatm/uni/qsaal1_subr.c optional atm_uni atm_core netatm/uni/sscf_uni.c optional atm_uni atm_core netatm/uni/sscf_uni_lower.c optional atm_uni atm_core netatm/uni/sscf_uni_upper.c optional atm_uni atm_core netatm/uni/sscop.c optional atm_uni atm_core netatm/uni/sscop_lower.c optional atm_uni atm_core netatm/uni/sscop_pdu.c optional atm_uni atm_core netatm/uni/sscop_sigaa.c optional atm_uni atm_core netatm/uni/sscop_sigcpcs.c optional atm_uni atm_core netatm/uni/sscop_subr.c optional atm_uni atm_core netatm/uni/sscop_timer.c optional atm_uni atm_core netatm/uni/sscop_upper.c optional atm_uni atm_core netatm/uni/uni_load.c optional atm_uni atm_core netatm/uni/uniarp.c optional atm_uni atm_core netatm/uni/uniarp_cache.c optional atm_uni atm_core netatm/uni/uniarp_input.c optional atm_uni atm_core netatm/uni/uniarp_output.c optional atm_uni atm_core netatm/uni/uniarp_timer.c optional atm_uni atm_core netatm/uni/uniarp_vcm.c optional atm_uni atm_core netatm/uni/uniip.c optional atm_uni atm_core netatm/uni/unisig_decode.c optional atm_uni atm_core netatm/uni/unisig_encode.c optional atm_uni atm_core netatm/uni/unisig_if.c optional atm_uni atm_core netatm/uni/unisig_mbuf.c optional atm_uni atm_core netatm/uni/unisig_msg.c optional atm_uni atm_core netatm/uni/unisig_print.c optional atm_uni atm_core netatm/uni/unisig_proto.c optional atm_uni atm_core netatm/uni/unisig_sigmgr_state.c optional atm_uni atm_core netatm/uni/unisig_subr.c optional atm_uni atm_core netatm/uni/unisig_util.c optional atm_uni atm_core netatm/uni/unisig_vc_state.c optional atm_uni atm_core netgraph/ng_UI.c optional netgraph_UI netgraph/ng_async.c optional netgraph_async netgraph/ng_base.c optional netgraph netgraph/ng_bpf.c optional netgraph_bpf net/bpf_filter.c optional netgraph_bpf netgraph/ng_bridge.c optional netgraph_bridge netgraph/ng_cisco.c optional netgraph_cisco netgraph/ng_echo.c optional netgraph_echo netgraph/ng_ether.c optional netgraph_ether netgraph/ng_frame_relay.c optional netgraph_frame_relay netgraph/ng_hole.c optional netgraph_hole netgraph/ng_iface.c optional netgraph_iface netgraph/ng_ksocket.c optional netgraph_ksocket netgraph/ng_lmi.c optional netgraph_lmi netgraph/ng_mppc.c optional netgraph_mppc_compression # The next two files (plus the header file net/mppc.h) are proprietary and # must be obtained elsewhere in order to enable NETGRAPH_MPPC_COMPRESSION net/mppcc.c optional netgraph_mppc_compression net/mppcd.c optional netgraph_mppc_compression netgraph/ng_mppc.c optional netgraph_mppc_encryption crypto/rc4/rc4.c optional awi crypto/rc4/rc4.c optional netgraph_mppc_encryption crypto/sha1.c optional netgraph_mppc_encryption netgraph/ng_one2many.c optional netgraph_one2many netgraph/ng_parse.c optional netgraph netgraph/ng_ppp.c optional netgraph_ppp netgraph/ng_pppoe.c optional netgraph_pppoe netgraph/ng_pptpgre.c optional netgraph_pptpgre netgraph/ng_rfc1490.c optional netgraph_rfc1490 netgraph/ng_socket.c optional netgraph_socket netgraph/ng_tee.c optional netgraph_tee netgraph/ng_tty.c optional netgraph_tty netgraph/ng_vjc.c optional netgraph_vjc net/slcompress.c optional netgraph_vjc netinet/accf_data.c optional accept_filter_data netinet/accf_http.c optional accept_filter_http netinet/fil.c optional ipfilter inet netinet/if_atm.c optional atm netinet/if_ether.c optional ether netinet/igmp.c optional inet netinet/in.c optional inet netinet/in_gif.c optional gif inet #netinet/in_hostcache.c optional inet netinet/in_pcb.c optional inet netinet/in_proto.c optional inet netinet/in_rmx.c optional inet netinet/ip_auth.c optional ipfilter inet netinet/ip_divert.c optional ipdivert netinet/ip_dummynet.c optional dummynet netinet/ip_ecn.c optional inet netinet/ip_ecn.c optional inet6 netinet/ip_encap.c optional inet netinet/ip_encap.c optional inet6 netinet/ip_fil.c optional ipfilter inet netinet/ip_flow.c optional inet netinet/ip_frag.c optional ipfilter inet netinet/ip_fw.c optional ipfirewall netinet/ip_icmp.c optional inet netinet/ip_input.c optional inet netinet/ip_log.c optional ipfilter inet netinet/ip_mroute.c optional inet netinet/ip_nat.c optional ipfilter inet netinet/ip_output.c optional inet netinet/ip_proxy.c optional ipfilter inet netinet/ip_state.c optional ipfilter inet netinet/mlfk_ipl.c optional ipfilter inet netinet/raw_ip.c optional inet netinet/tcp_debug.c optional tcpdebug netinet/tcp_input.c optional inet netinet/tcp_output.c optional inet netinet/tcp_subr.c optional inet netinet/tcp_timer.c optional inet netinet/tcp_usrreq.c optional inet netinet/udp_usrreq.c optional inet netinet6/ah_core.c optional ipsec netinet6/ah_input.c optional ipsec netinet6/ah_output.c optional ipsec netinet6/dest6.c optional inet6 netinet6/esp_core.c optional ipsec ipsec_esp netinet6/esp_input.c optional ipsec ipsec_esp netinet6/esp_output.c optional ipsec ipsec_esp netinet6/frag6.c optional inet6 netinet6/icmp6.c optional inet6 netinet6/in6.c optional inet6 netinet6/in6_cksum.c optional inet6 netinet6/in6_gif.c optional gif inet6 netinet6/in6_ifattach.c optional inet6 netinet6/in6_pcb.c optional inet6 netinet6/in6_prefix.c optional inet6 netinet6/in6_proto.c optional inet6 netinet6/in6_rmx.c optional inet6 netinet6/in6_src.c optional inet6 netinet6/ip6_forward.c optional inet6 netinet6/ip6_fw.c optional inet6 ipv6firewall netinet6/ip6_input.c optional inet6 netinet6/ip6_mroute.c optional inet6 netinet6/ip6_output.c optional inet6 netinet6/ipcomp_core.c optional ipsec netinet6/ipcomp_input.c optional ipsec netinet6/ipcomp_output.c optional ipsec netinet6/ipsec.c optional ipsec netinet6/mld6.c optional inet6 netinet6/nd6.c optional inet6 netinet6/nd6_nbr.c optional inet6 netinet6/nd6_rtr.c optional inet6 netinet6/raw_ip6.c optional inet6 netinet6/route6.c optional inet6 netinet6/scope6.c optional inet6 netinet6/udp6_output.c optional inet6 netinet6/udp6_usrreq.c optional inet6 netipx/ipx.c optional ipx netipx/ipx_cksum.c optional ipx netipx/ipx_input.c optional ipx netipx/ipx_ip.c optional ipx netipx/ipx_outputfl.c optional ipx netipx/ipx_pcb.c optional ipx netipx/ipx_proto.c optional ipx netipx/ipx_tun.c optional ipx netipx/ipx_usrreq.c optional ipx netipx/spx_debug.c optional ipx netipx/spx_usrreq.c optional ipx netkey/key.c optional ipsec netkey/keydb.c optional ipsec netkey/key_debug.c optional ipsec netkey/keysock.c optional ipsec netnatm/natm.c optional natm netnatm/natm_pcb.c optional natm netnatm/natm_proto.c optional natm netncp/ncp_conn.c optional ncp netncp/ncp_crypt.c optional ncp netncp/ncp_login.c optional ncp netncp/ncp_mod.c optional ncp netncp/ncp_ncp.c optional ncp netncp/ncp_nls.c optional ncp netncp/ncp_rq.c optional ncp netncp/ncp_sock.c optional ncp netncp/ncp_subr.c optional ncp netns/idp_usrreq.c optional ns netns/ns.c optional ns netns/ns_error.c optional ns netns/ns_input.c optional ns netns/ns_ip.c optional ns netns/ns_output.c optional ns netns/ns_pcb.c optional ns netns/ns_proto.c optional ns netns/spp_debug.c optional ns netns/spp_usrreq.c optional ns nfs/bootp_subr.c optional bootp nfs/krpc_subr.c optional bootp nfs/nfs_bio.c optional nfs nfs/nfs_node.c optional nfs nfs/nfs_lock.c optional nfs nfs/nfs_nqlease.c optional nfs nfs/nfs_serv.c optional nfs nfs/nfs_socket.c optional nfs nfs/nfs_srvcache.c optional nfs nfs/nfs_subs.c optional nfs nfs/nfs_syscalls.c optional nfs nfs/nfs_vfsops.c optional nfs nfs/nfs_vnops.c optional nfs ntfs/ntfs_compr.c optional ntfs ntfs/ntfs_ihash.c optional ntfs ntfs/ntfs_subr.c optional ntfs ntfs/ntfs_vfsops.c optional ntfs ntfs/ntfs_vnops.c optional ntfs nwfs/nwfs_io.c optional nwfs nwfs/nwfs_ioctl.c optional nwfs nwfs/nwfs_node.c optional nwfs nwfs/nwfs_subr.c optional nwfs nwfs/nwfs_vfsops.c optional nwfs nwfs/nwfs_vnops.c optional nwfs pccard/pccard.c count card pccard/pccard_beep.c optional card pccard/pccard_nbk.c optional card pccard/pcic.c optional pcic card pccard/pcic_isa.c optional pcic card isa pccard/pcic_pci.c optional pcic card pci pci/agp.c optional agp pci/agp_if.m optional agp pci/agp_intel.c optional agp pci/agp_via.c optional agp pci/agp_sis.c optional agp pci/agp_ali.c optional agp pci/agp_amd.c optional agp pci/agp_i810.c optional agp pci/alpm.c optional alpm pci/amd.c optional amd pci/cy_pci.c optional cy pci pci/if_dc.c optional dc pci/if_de.c optional de pci/if_en_pci.c optional en pci #pci/if_fxp.c optional fxp pci/if_mn.c optional mn pci/if_pcn.c optional pcn pci/if_rl.c optional rl pci/if_sf.c optional sf pci/if_sis.c optional sis pci/if_sk.c optional sk pci/if_ste.c optional ste pci/if_ti.c optional ti pci/if_tl.c optional tl pci/if_tx.c optional tx pci/if_vr.c optional vr pci/if_wb.c optional wb pci/if_wx.c optional wx pci/if_xl.c optional xl pci/intpm.c optional intpm pci/meteor.c count meteor pci pci/ncr.c optional ncr pci/ohci_pci.c optional ohci dev/pccbb/pccbb.c optional pccbb pci/simos.c optional simos pci/uhci_pci.c optional uhci pci/xrpu.c optional xrpu posix4/ksched.c optional _kposix_priority_scheduling posix4/p1003_1b.c standard posix4/posix4_mib.c standard ufs/ffs/ffs_alloc.c optional ffs ufs/ffs/ffs_alloc.c optional ifs ufs/ffs/ffs_alloc.c optional mfs ufs/ffs/ffs_balloc.c optional ffs ufs/ffs/ffs_balloc.c optional ifs ufs/ffs/ffs_balloc.c optional mfs ufs/ffs/ffs_inode.c optional ffs ufs/ffs/ffs_inode.c optional ifs ufs/ffs/ffs_inode.c optional mfs ufs/ffs/ffs_snapshot.c optional ffs ufs/ffs/ffs_snapshot.c optional ifs ufs/ffs/ffs_snapshot.c optional mfs ufs/ffs/ffs_softdep.c optional softupdates ufs/ffs/ffs_softdep_stub.c standard ufs/ffs/ffs_subr.c optional ffs ufs/ffs/ffs_subr.c optional ifs ufs/ffs/ffs_subr.c optional mfs ufs/ffs/ffs_tables.c optional ffs ufs/ffs/ffs_tables.c optional ifs ufs/ffs/ffs_tables.c optional mfs ufs/ffs/ffs_vfsops.c optional ffs ufs/ffs/ffs_vfsops.c optional ifs ufs/ffs/ffs_vfsops.c optional mfs ufs/ffs/ffs_vnops.c optional ffs ufs/ffs/ffs_vnops.c optional ifs ufs/ffs/ffs_vnops.c optional mfs ufs/mfs/mfs_vfsops.c optional mfs ufs/mfs/mfs_vnops.c optional mfs ufs/ufs/ufs_acl.c standard ufs/ufs/ufs_bmap.c standard ufs/ufs/ufs_extattr.c standard ufs/ufs/ufs_ihash.c standard ufs/ufs/ufs_inode.c standard ufs/ufs/ufs_lookup.c standard ufs/ifs/ifs_lookup.c optional ifs ufs/ifs/ifs_vfsops.c optional ifs ufs/ifs/ifs_vnops.c optional ifs ufs/ifs/ifs_subr.c optional ifs ufs/ufs/ufs_quota.c standard ufs/ufs/ufs_vfsops.c standard ufs/ufs/ufs_vnops.c standard vm/default_pager.c standard vm/device_pager.c standard vm/phys_pager.c standard vm/swap_pager.c standard vm/vm_fault.c standard vm/vm_glue.c standard vm/vm_init.c standard vm/vm_kern.c standard vm/vm_map.c standard vm/vm_meter.c standard vm/vm_mmap.c standard vm/vm_object.c standard vm/vm_page.c standard vm/vm_pageout.c standard vm/vm_pager.c standard vm/vm_swap.c standard vm/vm_unix.c standard vm/vm_zone.c standard vm/vnode_pager.c standard diff --git a/sys/i386/conf/NOTES b/sys/i386/conf/NOTES index 117c6fd37557..5f806991c264 100644 --- a/sys/i386/conf/NOTES +++ b/sys/i386/conf/NOTES @@ -1,2839 +1,2857 @@ # # NOTES -- Lines that can be cut/pasted into kernel and hints configs. # # Lines that begin with 'device', 'options', 'machine', 'ident', 'maxusers', # 'makeoptions', 'hints' etc go into the kernel configuration that you # run config(8) with. # # Lines that begin with 'hints.' are NOT for config(8), they go into your # hints file. See /boot/device.hints and/or the 'hints' config(8) directive. # # Please use ``make LINT'' to create an old-style LINT file if you want to # do kernel test-builds. # # $FreeBSD$ # # # This directive is mandatory; it defines the architecture to be # configured for; in this case, the 386 family based IBM-PC and # compatibles. # machine i386 # # This is the ``identification'' of the kernel. Usually this should # be the same as the name of your kernel. # ident LINT # # The `maxusers' parameter controls the static sizing of a number of # internal system tables by a complicated formula defined in param.c. # maxusers 10 # # We want LINT to cover profiling as well profile 2 # # The `makeoptions' parameter allows variables to be passed to the # generated Makefile in the build area. # # CONF_CFLAGS gives some extra compiler flags that are added to ${CFLAGS} # after most other flags. Here we use it to inhibit use of non-optimal # gcc builtin functions (e.g., memcmp). # # DEBUG happens to be magic. # The following is equivalent to 'config -g KERNELNAME' and creates # 'kernel.debug' compiled with -g debugging as well as a normal # 'kernel'. Use 'make install.debug' to install the debug kernel # but that isn't normally necessary as the debug symbols are not loaded # by the kernel and are not useful there anyway. # # KERNEL can be overridden so that you can change the default name of your # kernel. # makeoptions CONF_CFLAGS=-fno-builtin #Don't allow use of memcmp, etc. #makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols #makeoptions KERNEL=foo #Build kernel "foo" and install "/foo" # # Certain applications can grow to be larger than the 512M limit # that FreeBSD initially imposes. Below are some options to # allow that limit to grow to 1GB, and can be increased further # with changing the parameters. MAXDSIZ is the maximum that the # limit can be set to, and the DFLDSIZ is the default value for # the limit. You might want to set the default lower than the # max, and explicitly set the maximum with a shell command for processes # that regularly exceed the limit like INND. # options MAXDSIZ="(1024UL*1024*1024)" options DFLDSIZ="(1024UL*1024*1024)" # # BLKDEV_IOSIZE sets the default block size used in user block # device I/O. Note that this value will be overriden by the label # when specifying a block device from a label with a non-0 # partition blocksize. The default is PAGE_SIZE. # options BLKDEV_IOSIZE=8192 # Options for the VM subsystem options PQ_CACHESIZE=512 # color for 512k/16k cache # Deprecated options supported for backwards compatibility #options PQ_NOOPT # No coloring #options PQ_LARGECACHE # color for 512k/16k cache #options PQ_HUGECACHE # color for 1024k/16k cache #options PQ_MEDIUMCACHE # color for 256k/16k cache #options PQ_NORMALCACHE # color for 64k/16k cache # This allows you to actually store this configuration file into # the kernel binary itself, where it may be later read by saying: # strings -n 3 /kernel | sed -n 's/^___//p' > MYKERNEL # options INCLUDE_CONFIG_FILE # Include this file in kernel # # The root device and filesystem type can be compiled in; # this provides a fallback option if the root device cannot # be correctly guesst by the bootstrap code, or an override if # the RB_DFLTROOT flag (-r) is specified when booting the kernel. # options ROOTDEVNAME=\"ufs:da0s2e\" ##################################################################### # SMP OPTIONS: # # SMP enables building of a Symmetric MultiProcessor Kernel. # APIC_IO enables the use of the IO APIC for Symmetric I/O. # # Notes: # # An SMP kernel will ONLY run on an Intel MP spec. qualified motherboard. # # Be sure to disable 'cpu I386_CPU' && 'cpu I486_CPU' for SMP kernels. # # Check the 'Rogue SMP hardware' section to see if additional options # are required by your hardware. # # Mandatory: options SMP # Symmetric MultiProcessor Kernel options APIC_IO # Symmetric (APIC) I/O # # Rogue SMP hardware: # # Bridged PCI cards: # # The MP tables of most of the current generation MP motherboards # do NOT properly support bridged PCI cards. To use one of these # cards you should refer to ??? # SMP Debugging Options: # # MUTEX_DEBUG enables various extra assertions in the mutex code. # WITNESS enables the mutex witness code which detects deadlocks and cycles # during locking operations. # WITNESS_DDB causes the witness code to drop into the kernel debugger if # a lock heirarchy violation occurs or if locks are held when going to # sleep. # WITNESS_SKIPSPIN disables the witness checks on spin mutexes. options MUTEX_DEBUG options WITNESS options WITNESS_DDB options WITNESS_SKIPSPIN ##################################################################### # CPU OPTIONS # # You must specify at least one CPU (the one you intend to run on); # deleting the specification for CPUs you don't need to use may make # parts of the system run faster. # I386_CPU is mutually exclusive with the other CPU types. # #cpu I386_CPU cpu I486_CPU cpu I586_CPU # aka Pentium(tm) cpu I686_CPU # aka Pentium Pro(tm) # # Options for CPU features. # # CPU_BLUELIGHTNING_FPU_OP_CACHE enables FPU operand cache on IBM # BlueLightning CPU. It works only with Cyrix FPU, and this option # should not be used with Intel FPU. # # CPU_BLUELIGHTNING_3X enables triple-clock mode on IBM Blue Lightning # CPU if CPU supports it. The default is double-clock mode on # BlueLightning CPU box. # # CPU_BTB_EN enables branch target buffer on Cyrix 5x86 (NOTE 1). # # CPU_DIRECT_MAPPED_CACHE sets L1 cache of Cyrix 486DLC CPU in direct # mapped mode. Default is 2-way set associative mode. # # CPU_CYRIX_NO_LOCK enables weak locking for the entire address space # of Cyrix 6x86 and 6x86MX CPUs by setting the NO_LOCK bit of CCR1. # Otherwise, the NO_LOCK bit of CCR1 is cleared. (NOTE 3) # # CPU_DISABLE_5X86_LSSER disables load store serialize (i.e. enables # reorder). This option should not be used if you use memory mapped # I/O device(s). # # CPU_FASTER_5X86_FPU enables faster FPU exception handler. # # CPU_I486_ON_386 enables CPU cache on i486 based CPU upgrade products # for i386 machines. # # CPU_IORT defines I/O clock delay time (NOTE 1). Default values of # I/O clock delay time on Cyrix 5x86 and 6x86 are 0 and 7,respectively # (no clock delay). # # CPU_L2_LATENCY specifed the L2 cache latency value. This option is used # only when CPU_PPRO2CELERON is defined and Mendocino Celeron is detected. # The default value is 5. # # CPU_LOOP_EN prevents flushing the prefetch buffer if the destination # of a jump is already present in the prefetch buffer on Cyrix 5x86(NOTE # 1). # # CPU_PPRO2CELERON enables L2 cache of Mendocino Celeron CPUs. This option # is useful when you use Socket 8 to Socket 370 converter, because most Pentium # Pro BIOSs do not enable L2 cache of Mendocino Celeron CPUs. # # CPU_RSTK_EN enables return stack on Cyrix 5x86 (NOTE 1). # # CPU_SUSP_HLT enables suspend on HALT. If this option is set, CPU # enters suspend mode following execution of HALT instruction. # # CPU_WT_ALLOC enables write allocation on Cyrix 6x86/6x86MX and AMD # K5/K6/K6-2 cpus. # # CYRIX_CACHE_WORKS enables CPU cache on Cyrix 486 CPUs with cache # flush at hold state. # # CYRIX_CACHE_REALLY_WORKS enables (1) CPU cache on Cyrix 486 CPUs # without cache flush at hold state, and (2) write-back CPU cache on # Cyrix 6x86 whose revision < 2.7 (NOTE 2). # # NO_F00F_HACK disables the hack that prevents Pentiums (and ONLY # Pentiums) from locking up when a LOCK CMPXCHG8B instruction is # executed. This option is only needed if I586_CPU is also defined, # and should be included for any non-Pentium CPU that defines it. # # NO_MEMORY_HOLE is an optimisation for systems with AMD K6 processors # which indicates that the 15-16MB range is *definitely* not being # occupied by an ISA memory hole. # # NOTE 1: The options, CPU_BTB_EN, CPU_LOOP_EN, CPU_IORT, # CPU_LOOP_EN and CPU_RSTK_EN should not be used because of CPU bugs. # These options may crash your system. # # NOTE 2: If CYRIX_CACHE_REALLY_WORKS is not set, CPU cache is enabled # in write-through mode when revision < 2.7. If revision of Cyrix # 6x86 >= 2.7, CPU cache is always enabled in write-back mode. # # NOTE 3: This option may cause failures for software that requires # locked cycles in order to operate correctly. # options CPU_BLUELIGHTNING_FPU_OP_CACHE options CPU_BLUELIGHTNING_3X options CPU_BTB_EN options CPU_DIRECT_MAPPED_CACHE options CPU_DISABLE_5X86_LSSER options CPU_FASTER_5X86_FPU options CPU_I486_ON_386 options CPU_IORT options CPU_L2_LATENCY=5 options CPU_LOOP_EN options CPU_PPRO2CELERON options CPU_RSTK_EN options CPU_SUSP_HLT options CPU_WT_ALLOC options CYRIX_CACHE_WORKS options CYRIX_CACHE_REALLY_WORKS #options NO_F00F_HACK # # A math emulator is mandatory if you wish to run on hardware which # does not have a floating-point processor. Pick either the original, # bogus (but freely-distributable) math emulator, or a much more # fully-featured but GPL-licensed emulator taken from Linux. # options MATH_EMULATE #Support for x87 emulation # Don't enable both of these in a real config. options GPL_MATH_EMULATE #Support for x87 emulation via #new math emulator ##################################################################### # COMPATIBILITY OPTIONS # # Implement system calls compatible with 4.3BSD and older versions of # FreeBSD. You probably do NOT want to remove this as much current code # still relies on the 4.3 emulation. # options COMPAT_43 # # These three options provide support for System V Interface # Definition-style interprocess communication, in the form of shared # memory, semaphores, and message queues, respectively. # options SYSVSHM options SYSVSEM options SYSVMSG ##################################################################### # DEBUGGING OPTIONS # # Enable the kernel debugger. # options DDB # # Don't drop into DDB for a panic. Intended for unattended operation # where you may want to drop to DDB from the console, but still want # the machine to recover from a panic # options DDB_UNATTENDED # # If using GDB remote mode to debug the kernel, there's a non-standard # extension to the remote protocol that can be used to use the serial # port as both the debugging port and the system console. It's non- # standard and you're on your own if you enable it. See also the # "remotechat" variables in the FreeBSD specific version of gdb. # options GDB_REMOTE_CHAT # # KTRACE enables the system-call tracing facility ktrace(2). # options KTRACE #kernel tracing # # KTR is a kernel tracing mechanism imported from BSD/OS. Currently it # has no userland interface aside from a few sysctl's. It is enabled with # the KTR option. The KTR_EXTEND option causes trace events to be generated # as a string from snprintf rather than as a string and up to 5 argument # pointers. KTR_ENTRIES defines the number of entries in the circular trace # buffer. KTR_COMPILE defines the mask of events to compile into the kernel # as defined by the KTR_* constants in . KTR_MASK defines the # initial value of the ktr_mask variable which determines at runtime what # events to trace. KTR_CPUMASK determines which CPU's log events, with # bit X corresponding to cpu X. KTR_VERBOSE enables dumping of KTR events # to the console by default. This functionality can be toggled via the # debug.ktr_verbose sysctl and defaults to off if KTR_VERBOSE is not defined. # options KTR options KTR_EXTEND options KTR_ENTRIES=1024 options KTR_COMPILE=0x3fffff options KTR_MASK=0x201208 options KTR_CPUMASK=0x3 options KTR_VERBOSE # # The INVARIANTS option is used in a number of source files to enable # extra sanity checking of internal structures. This support is not # enabled by default because of the extra time it would take to check # for these conditions, which can only occur as a result of # programming errors. # options INVARIANTS # # The INVARIANT_SUPPORT option makes us compile in support for # verifying some of the internal structures. It is a prerequisite for # 'INVARIANTS', as enabling 'INVARIANTS' will make these functions be # called. The intent is that you can set 'INVARIANTS' for single # source files (by changing the source file or specifying it on the # command line) if you have 'INVARIANT_SUPPORT' enabled. Also, if you # wish to build a kernel module with 'INVARIANTS', then adding # 'INVARIANT_SUPPORT' to your kernel will provide all the necessary # infrastructure without the added overhead. # options INVARIANT_SUPPORT # # The DIAGNOSTIC option is used to enable extra debugging information # from some parts of the kernel. As this makes everything more noisy, # it is disabled by default. # options DIAGNOSTIC # # REGRESSION causes optional kernel interfaces necessary only for regression # testing to be enabled. These interfaces may consitute security risks # when enabled, as they permit processes to easily modify aspects of the # run-time environment to reproduce unlikely or unusual (possibly normally # impossible) scenarios. # options REGRESSION # # PERFMON causes the driver for Pentium/Pentium Pro performance counters # to be compiled. See perfmon(4) for more information. # options PERFMON # # This option let some drivers co-exist that can't co-exist in a running # system. This is used to be able to compile all kernel code in one go for # quality assurance purposes (like this file, which the option takes it name # from.) # options COMPILING_LINT # XXX - this doesn't belong here. # Allow ordinary users to take the console - this is useful for X. options UCONSOLE # XXX - this doesn't belong here either options USERCONFIG #boot -c editor options INTRO_USERCONFIG #imply -c and show intro screen options VISUAL_USERCONFIG #visual boot -c editor ##################################################################### # NETWORKING OPTIONS # # Protocol families: # Only the INET (Internet) family is officially supported in FreeBSD. # Source code for the NS (Xerox Network Service) is provided for amusement # value. # options INET #Internet communications protocols options INET6 #IPv6 communications protocols options IPSEC #IP security options IPSEC_ESP #IP security (crypto; define w/ IPSEC) options IPSEC_DEBUG #debug for IP security options IPX #IPX/SPX communications protocols options IPXIP #IPX in IP encapsulation (not available) options IPTUNNEL #IP in IPX encapsulation (not available) options NCP #NetWare Core protocol options NETATALK #Appletalk communications protocols options NETATALKDEBUG #Appletalk debugging # These are currently broken but are shipped due to interest. #options NS #Xerox NS protocols #options NSIP #XNS over IP # mchain library. It can be either loaded as KLD or compiled into kernel options LIBMCHAIN # netgraph(4). Enable the base netgraph code with the NETGRAPH option. # Individual node types can be enabled with the corresponding option # listed below; however, this is not strictly necessary as netgraph # will automatically load the corresponding KLD module if the node type # is not already compiled into the kernel. Each type below has a # corresponding man page, e.g., ng_async(8). options NETGRAPH #netgraph(4) system options NETGRAPH_ASYNC options NETGRAPH_BPF options NETGRAPH_CISCO options NETGRAPH_ECHO options NETGRAPH_ETHER options NETGRAPH_FRAME_RELAY options NETGRAPH_HOLE options NETGRAPH_IFACE options NETGRAPH_KSOCKET options NETGRAPH_LMI # MPPC compression requires proprietary files (not included) #options NETGRAPH_MPPC_COMPRESSION options NETGRAPH_MPPC_ENCRYPTION options NETGRAPH_ONE2MANY options NETGRAPH_PPP options NETGRAPH_PPPOE options NETGRAPH_PPTPGRE options NETGRAPH_RFC1490 options NETGRAPH_SOCKET options NETGRAPH_TEE options NETGRAPH_TTY options NETGRAPH_UI options NETGRAPH_VJC device mn # Munich32x/Falc54 Nx64kbit/sec cards. device lmc # tulip based LanMedia WAN cards device musycc # LMC/SBE LMC1504 quad T1/E1 # # Network interfaces: # The `loop' device is MANDATORY when networking is enabled. # The `ether' device provides generic code to handle # Ethernets; it is MANDATORY when a Ethernet device driver is # configured or token-ring is enabled. # The 'fddi' device provides generic code to support FDDI. # The `sppp' device serves a similar role for certain types # of synchronous PPP links (like `cx', `ar'). # The `sl' device implements the Serial Line IP (SLIP) service. # The `ppp' device implements the Point-to-Point Protocol. # The `bpf' device enables the Berkeley Packet Filter. Be # aware of the legal and administrative consequences of enabling this # option. The number of devices determines the maximum number of # simultaneous BPF clients programs runnable. # The `disc' device implements a minimal network interface, # which throws away all packets sent and never receives any. It is # included for testing purposes. This shows up as the 'ds' interface. # The `tap' device is a pty-like virtual Ethernet interface # The `tun' device implements (user-)ppp and nos-tun # The `gif' device implements IPv6 over IP4 tunneling, # IPv4 over IPv6 tunneling, IPv4 over IPv4 tunneling and # IPv6 over IPv6 tunneling. # The XBONEHACK option allows the same pair of addresses to be configured on # multiple gif interfaces. # The `faith' device captures packets sent to it and diverts them # to the IPv4/IPv6 translation daemon. # The `stf' device implements 6to4 encapsulation. # The `ef' device provides support for multiple ethernet frame types # specified via ETHER_* options. See ef(4) for details. # # The PPP_BSDCOMP option enables support for compress(1) style entire # packet compression, the PPP_DEFLATE is for zlib/gzip style compression. # PPP_FILTER enables code for filtering the ppp data stream and selecting # events for resetting the demand dial activity timer - requires bpf. # See pppd(8) for more details. # device ether #Generic Ethernet device vlan 1 #VLAN support device token #Generic TokenRing device fddi #Generic FDDI device sppp #Generic Synchronous PPP device loop 1 #Network loopback device device bpf #Berkeley packet filter device disc #Discard device (ds0, ds1, etc) device tap #Virtual Ethernet driver device tun #Tunnel driver (ppp(8), nos-tun(8)) device sl #Serial Line IP device ppp 2 #Point-to-point protocol options PPP_BSDCOMP #PPP BSD-compress support options PPP_DEFLATE #PPP zlib/deflate/gzip support options PPP_FILTER #enable bpf filtering (needs bpf) device ef # Multiple ethernet frames support options ETHER_II # enable Ethernet_II frame options ETHER_8023 # enable Ethernet_802.3 (Novell) frame options ETHER_8022 # enable Ethernet_802.2 frame options ETHER_SNAP # enable Ethernet_802.2/SNAP frame # for IPv6 device gif 4 #IPv6 and IPv4 tunneling options XBONEHACK device faith 1 #for IPv6 and IPv4 translation device stf #6to4 IPv6 over IPv4 encapsulation # # Internet family options: # # MROUTING enables the kernel multicast packet forwarder, which works # with mrouted(8). # # IPFIREWALL enables support for IP firewall construction, in # conjunction with the `ipfw' program. IPFIREWALL_VERBOSE sends # logged packets to the system logger. IPFIREWALL_VERBOSE_LIMIT # limits the number of times a matching entry can be logged. # # WARNING: IPFIREWALL defaults to a policy of "deny ip from any to any" # and if you do not add other rules during startup to allow access, # YOU WILL LOCK YOURSELF OUT. It is suggested that you set firewall_type=open # in /etc/rc.conf when first enabling this feature, then refining the # firewall rules in /etc/rc.firewall after you've tested that the new kernel # feature works properly. # # IPFIREWALL_DEFAULT_TO_ACCEPT causes the default rule (at boot) to # allow everything. Use with care, if a cracker can crash your # firewall machine, they can get to your protected machines. However, # if you are using it as an as-needed filter for specific problems as # they arise, then this may be for you. Changing the default to 'allow' # means that you won't get stuck if the kernel and /sbin/ipfw binary get # out of sync. # # IPDIVERT enables the divert IP sockets, used by ``ipfw divert'' # # IPSTEALTH enables code to support stealth forwarding (i.e., forwarding # packets without touching the ttl). This can be useful to hide firewalls # from traceroute and similar tools. # # TCPDEBUG is undocumented. # options MROUTING # Multicast routing options IPFIREWALL #firewall options IPFIREWALL_VERBOSE #print information about # dropped packets options IPFIREWALL_FORWARD #enable transparent proxy support options IPFIREWALL_VERBOSE_LIMIT=100 #limit verbosity options IPFIREWALL_DEFAULT_TO_ACCEPT #allow everything by default options IPV6FIREWALL #firewall for IPv6 options IPV6FIREWALL_VERBOSE options IPV6FIREWALL_VERBOSE_LIMIT=100 options IPV6FIREWALL_DEFAULT_TO_ACCEPT options IPDIVERT #divert sockets options IPFILTER #ipfilter support options IPFILTER_LOG #ipfilter logging options IPFILTER_DEFAULT_BLOCK #block all packets by default options IPSTEALTH #support for stealth forwarding options TCPDEBUG # Statically Link in accept filters options ACCEPT_FILTER_DATA options ACCEPT_FILTER_HTTP # TCP_DROP_SYNFIN adds support for ignoring TCP packets with SYN+FIN. This # prevents nmap et al. from identifying the TCP/IP stack, but breaks support # for RFC1644 extensions and is not recommended for web servers. # options TCP_DROP_SYNFIN #drop TCP packets with SYN+FIN # DUMMYNET enables the "dummynet" bandwidth limiter. You need # IPFIREWALL as well. See the dummynet(4) manpage for more info. # BRIDGE enables bridging between ethernet cards -- see bridge(4). # You can use IPFIREWALL and dummynet together with bridging. options DUMMYNET options BRIDGE # # ATM (HARP version) options # # ATM_CORE includes the base ATM functionality code. This must be included # for ATM support. # # ATM_IP includes support for running IP over ATM. # # At least one (and usually only one) of the following signalling managers # must be included (note that all signalling managers include PVC support): # ATM_SIGPVC includes support for the PVC-only signalling manager `sigpvc'. # ATM_SPANS includes support for the `spans' signalling manager, which runs # the FORE Systems's proprietary SPANS signalling protocol. # ATM_UNI includes support for the `uni30' and `uni31' signalling managers, # which run the ATM Forum UNI 3.x signalling protocols. # # The `hea' driver provides support for the Efficient Networks, Inc. # ENI-155p ATM PCI Adapter. # # The `hfa' driver provides support for the FORE Systems, Inc. # PCA-200E ATM PCI Adapter. # options ATM_CORE #core ATM protocol family options ATM_IP #IP over ATM support options ATM_SIGPVC #SIGPVC signalling manager options ATM_SPANS #SPANS signalling manager options ATM_UNI #UNI signalling manager device hea #Efficient ENI-155p ATM PCI device hfa #FORE PCA-200E ATM PCI ##################################################################### # FILESYSTEM OPTIONS # # Only the root, /usr, and /tmp filesystems need be statically # compiled; everything else will be automatically loaded at mount # time. (Exception: the UFS family---FFS, and MFS --- cannot # currently be demand-loaded.) Some people still prefer to statically # compile other filesystems as well. # # NB: The NULL, PORTAL, UMAP and UNION filesystems are known to be # buggy, and WILL panic your system if you attempt to do anything with # them. They are included here as an incentive for some enterprising # soul to sit down and fix them. # # One of these is mandatory: options FFS #Fast filesystem options MFS #Memory File System options NFS #Network File System # The rest are optional: #options NFS_NOSERVER #Disable the NFS-server code. options CD9660 #ISO 9660 filesystem options FDESCFS #File descriptor filesystem options HPFS #OS/2 File system options MSDOSFS #MS DOS File System (FAT, FAT32) options NTFS #NT File System options NULLFS #NULL filesystem options NWFS #NetWare filesystem options PORTALFS #Portal filesystem options PROCFS #Process filesystem options UMAPFS #UID map filesystem options UNIONFS #Union filesystem # options NODEVFS #disable devices filesystem # The xFS_ROOT options REQUIRE the associated ``options xFS'' options NFS_ROOT #NFS usable as root device # This code enables IFS, an FFS which exports inodes as the namespace. # You can find details in src/sys/ufs/ifs/README . options IFS # Soft updates is a technique for improving file system speed and # making abrupt shutdown less risky. # options SOFTUPDATES # Extended attributes allow additional data to be associated with files, # and is used for ACLs, Capabilities, and MAC labels. # See src/sys/ufs/ufs/README.extattr for more information. options UFS_EXTATTR options UFS_EXTATTR_AUTOSTART # Access Control List support for UFS filesystems. The current ACL # implementation requires extended attribute support, UFS_EXTATTR, # for the underlying filesystem. # See src/sys/ufs/ufs/README.acls for more information. options UFS_ACL # Make space in the kernel for a root filesystem on a md device. # Define to the number of kilobytes to reserve for the filesystem. options MD_ROOT_SIZE=10 # Make the md device a potential root device, either with preloaded # images of type mfs_root or md_root. options MD_ROOT # Allow this many swap-devices. # # In order to manage swap, the system must reserve bitmap space that # scales with the largest mounted swap device multiplied by NSWAPDEV, # irregardless of whether other swap devices exist or not. So it # is not a good idea to make this value too large. options NSWAPDEV=5 # Disk quotas are supported when this option is enabled. options QUOTA #enable disk quotas # If you are running a machine just as a fileserver for PC and MAC # users, using SAMBA or Netatalk, you may consider setting this option # and keeping all those users' directories on a filesystem that is # mounted with the suiddir option. This gives new files the same # ownership as the directory (similar to group). It's a security hole # if you let these users run programs, so confine it to file-servers # (but it'll save you lots of headaches in those cases). Root owned # directories are exempt and X bits are cleared. The suid bit must be # set on the directory as well; see chmod(1) PC owners can't see/set # ownerships so they keep getting their toes trodden on. This saves # you all the support calls as the filesystem it's used on will act as # they expect: "It's my dir so it must be my file". # options SUIDDIR # NFS options: options NFS_MINATTRTIMO=3 # VREG attrib cache timeout in sec options NFS_MAXATTRTIMO=60 options NFS_MINDIRATTRTIMO=30 # VDIR attrib cache timeout in sec options NFS_MAXDIRATTRTIMO=60 options NFS_GATHERDELAY=10 # Default write gather delay (msec) options NFS_UIDHASHSIZ=29 # Tune the size of nfssvc_sock with this options NFS_WDELAYHASHSIZ=16 # and with this options NFS_MUIDHASHSIZ=63 # Tune the size of nfsmount with this options NFS_DEBUG # Enable NFS Debugging # Coda stuff: options CODA #CODA filesystem. device vcoda 4 #coda minicache <-> venus comm. # # Add support for the EXT2FS filesystem of Linux fame. Be a bit # careful with this - the ext2fs code has a tendency to lag behind # changes and not be exercised very much, so mounting read/write could # be dangerous (and even mounting read only could result in panics.) # options EXT2FS # Use real implementations of the aio_* system calls. There are numerous # stability issues in the current aio code that make it unsuitable for # inclusion on shell boxes. options VFS_AIO # Enable the code UFS IO optimization through the VM system. This allows # use VM operations instead of copying operations when possible. # # Even with this enabled, actual use of the code is still controlled by the # sysctl vfs.ioopt. 0 gives no optimization, 1 gives normal (use VM # operations if a request happens to fit), 2 gives agressive optimization # (the operations are split to do as much as possible through the VM system.) # # Enabling this will probably not give an overall speedup except for # special workloads. options ENABLE_VFS_IOOPT # Cryptographically secure random number generator; /dev/[u]random device random ##################################################################### # POSIX P1003.1B # Real time extensions added in the 1993 Posix # P1003_1B: Infrastructure # _KPOSIX_PRIORITY_SCHEDULING: Build in _POSIX_PRIORITY_SCHEDULING # _KPOSIX_VERSION: Version kernel is built for options P1003_1B options _KPOSIX_PRIORITY_SCHEDULING options _KPOSIX_VERSION=199309L ##################################################################### # CLOCK OPTIONS # The granularity of operation is controlled by the kernel option HZ whose # default value (100) means a granularity of 10ms. For an accurate simulation # of high data rates it might be necessary to reduce the timer granularity to # 1ms or less. Consider, however, that some interfaces using programmed I/O # may require a considerable time to output packets. So, reducing the # granularity too much might actually cause ticks to be missed thus reducing # the accuracy of operation. options HZ=100 # Other clock options options CLK_CALIBRATION_LOOP options CLK_USE_I8254_CALIBRATION options CLK_USE_TSC_CALIBRATION ##################################################################### # SCSI DEVICES # SCSI DEVICE CONFIGURATION # The SCSI subsystem consists of the `base' SCSI code, a number of # high-level SCSI device `type' drivers, and the low-level host-adapter # device drivers. The host adapters are listed in the ISA and PCI # device configuration sections below. # # Beginning with FreeBSD 2.0.5 you can wire down your SCSI devices so # that a given bus, target, and LUN always come on line as the same # device unit. In earlier versions the unit numbers were assigned # in the order that the devices were probed on the SCSI bus. This # means that if you removed a disk drive, you may have had to rewrite # your /etc/fstab file, and also that you had to be careful when adding # a new disk as it may have been probed earlier and moved your device # configuration around. # This old behavior is maintained as the default behavior. The unit # assignment begins with the first non-wired down unit for a device # type. For example, if you wire a disk as "da3" then the first # non-wired disk will be assigned da4. # The syntax for wiring down devices is: hint.scbus.0.at="ahc0" hint.scbus.1.at="ahc1" hint.scbus.1.bus="0" hint.scbus.3.at="ahc2" hint.scbus.3.bus="0" hint.scbus.2.at="ahc2" hint.scbus.2.bus="1" hint.da.0.at="scbus0" hint.da.0.target="0" hint.da.0.unit="0" hint.da.1.at="scbus3" hint.da.1.target="1" hint.da.2.at="scbus2" hint.da.2.target="3" hint.sa.1.at="scbus1" hint.sa.1.target="6" # "units" (SCSI logical unit number) that are not specified are # treated as if specified as LUN 0. # All SCSI devices allocate as many units as are required. # The ch driver drives SCSI Media Changer ("jukebox") devices. # # The da driver drives SCSI Direct Access ("disk") and Optical Media # ("WORM") devices. # # The sa driver drives SCSI Sequential Access ("tape") devices. # # The cd driver drives SCSI Read Only Direct Access ("cd") devices. # # The ses driver drives SCSI Envinronment Services ("ses") and # SAF-TE ("SCSI Accessable Fault-Tolerant Enclosure") devices. # # The pt driver drives SCSI Processor devices. # # # Target Mode support is provided here but also requires that a SIM # (SCSI Host Adapter Driver) provide support as well. # # The targ driver provides target mode support as a Processor type device. # It exists to give the minimal context necessary to respond to Inquiry # commands. There is a sample user application that shows how the rest # of the command support might be done in /usr/share/examples/scsi_target. # # The targbh driver provides target mode support and exists to respond # to incoming commands that do not otherwise have a logical unit assigned # to them. # # The "unknown" device (uk? in pre-2.0.5) is now part of the base SCSI # configuration as the "pass" driver. device scbus #base SCSI code device ch #SCSI media changers device da #SCSI direct access devices (aka disks) device sa #SCSI tapes device cd #SCSI CD-ROMs device ses #SCSI Environmental Services (and SAF-TE) device pt #SCSI processor device targ #SCSI Target Mode Code device targbh #SCSI Target Mode Blackhole Device device pass #CAM passthrough driver # CAM OPTIONS: # debugging options: # -- NOTE -- If you specify one of the bus/target/lun options, you must # specify them all! # CAMDEBUG: When defined enables debugging macros # CAM_DEBUG_BUS: Debug the given bus. Use -1 to debug all busses. # CAM_DEBUG_TARGET: Debug the given target. Use -1 to debug all targets. # CAM_DEBUG_LUN: Debug the given lun. Use -1 to debug all luns. # CAM_DEBUG_FLAGS: OR together CAM_DEBUG_INFO, CAM_DEBUG_TRACE, # CAM_DEBUG_SUBTRACE, and CAM_DEBUG_CDB # # CAM_MAX_HIGHPOWER: Maximum number of concurrent high power (start unit) cmds # SCSI_NO_SENSE_STRINGS: When defined disables sense descriptions # SCSI_NO_OP_STRINGS: When defined disables opcode descriptions # SCSI_DELAY: The number of MILLISECONDS to freeze the SIM (scsi adapter) # queue after a bus reset, and the number of milliseconds to # freeze the device queue after a bus device reset. options CAMDEBUG options CAM_DEBUG_BUS=-1 options CAM_DEBUG_TARGET=-1 options CAM_DEBUG_LUN=-1 options CAM_DEBUG_FLAGS="CAM_DEBUG_INFO|CAM_DEBUG_TRACE|CAM_DEBUG_CDB" options CAM_MAX_HIGHPOWER=4 options SCSI_NO_SENSE_STRINGS options SCSI_NO_OP_STRINGS options SCSI_DELAY=8000 # Be pessimistic about Joe SCSI device # Options for the CAM CDROM driver: # CHANGER_MIN_BUSY_SECONDS: Guaranteed minimum time quantum for a changer LUN # CHANGER_MAX_BUSY_SECONDS: Maximum time quantum per changer LUN, only # enforced if there is I/O waiting for another LUN # The compiled in defaults for these variables are 2 and 10 seconds, # respectively. # # These can also be changed on the fly with the following sysctl variables: # kern.cam.cd.changer.min_busy_seconds # kern.cam.cd.changer.max_busy_seconds # options CHANGER_MIN_BUSY_SECONDS=2 options CHANGER_MAX_BUSY_SECONDS=10 # Options for the CAM sequential access driver: # SA_SPACE_TIMEOUT: Timeout for space operations, in minutes # SA_REWIND_TIMEOUT: Timeout for rewind operations, in minutes # SA_ERASE_TIMEOUT: Timeout for erase operations, in minutes # SA_1FM_AT_EOD: Default to model which only has a default one filemark at EOT. options SA_SPACE_TIMEOUT="(60)" options SA_REWIND_TIMEOUT="(2*60)" options SA_ERASE_TIMEOUT="(4*60)" options SA_1FM_AT_EOD # Optional timeout for the CAM processor target (pt) device # This is specified in seconds. The default is 60 seconds. options SCSI_PT_DEFAULT_TIMEOUT="60" # Optional enable of doing SES passthrough on other devices (e.g., disks) # # Normally disabled because a lot of newer SCSI disks report themselves # as having SES capabilities, but this can then clot up attempts to build # build a topology with the SES device that's on the box these drives # are in.... options SES_ENABLE_PASSTHROUGH ##################################################################### # MISCELLANEOUS DEVICES AND OPTIONS # The `pty' device usually turns out to be ``effectively mandatory'', # as it is required for `telnetd', `rlogind', `screen', `emacs', and # `xterm', among others. device pty #Pseudo ttys device speaker #Play IBM BASIC-style noises out your speaker device gzip #Exec gzipped a.out's device md #Memory/malloc disk device snp #Snoop device - to look at pty/vty/etc.. device ccd 4 #Concatenated disk driver # Configuring Vinum into the kernel is not necessary, since the kld # module gets started automatically when vinum(8) starts. This # device is also untested. Use at your own risk. # # The option VINUMDEBUG must match the value set in CFLAGS # in src/sbin/vinum/Makefile. Failure to do so will result in # the following message from vinum(8): # # Can't get vinum config: Invalid argument # # see vinum(4) for more reasons not to use these options. device vinum #Vinum concat/mirror/raid driver options VINUMDEBUG #enable Vinum debugging hooks # Kernel side iconv library options LIBICONV # Size of the kernel message buffer. Should be N * pagesize. options MSGBUF_SIZE=40960 ##################################################################### # HARDWARE BUS CONFIGURATION # ISA, EISA, MCA and PCI bus: # # Mandatory ISA devices: isa, npx # device isa # # Options for `isa': # # AUTO_EOI_1 enables the `automatic EOI' feature for the master 8259A # interrupt controller. This saves about 0.7-1.25 usec for each interrupt. # This option breaks suspend/resume on some portables. # # AUTO_EOI_2 enables the `automatic EOI' feature for the slave 8259A # interrupt controller. This saves about 0.7-1.25 usec for each interrupt. # Automatic EOI is documented not to work for for the slave with the # original i8259A, but it works for some clones and some integrated # versions. # # MAXMEM specifies the amount of RAM on the machine; if this is not # specified, FreeBSD will first read the amount of memory from the CMOS # RAM, so the amount of memory will initially be limited to 64MB or 16MB # depending on the BIOS. If the BIOS reports 64MB, a memory probe will # then attempt to detect the installed amount of RAM. If this probe # fails to detect >64MB RAM you will have to use the MAXMEM option. # The amount is in kilobytes, so for a machine with 128MB of RAM, it would # be 131072 (128 * 1024). # # BROKEN_KEYBOARD_RESET disables the use of the keyboard controller to # reset the CPU for reboot. This is needed on some systems with broken # keyboard controllers. options COMPAT_OLDISA #Use ISA shims and glue for old drivers options AUTO_EOI_1 #options AUTO_EOI_2 options MAXMEM="(128*1024)" #options BROKEN_KEYBOARD_RESET # Enable support for the kernel PLL to use an external PPS signal, # under supervision of [x]ntpd(8) # More info in ntpd documentation: http://www.eecis.udel.edu/~ntp options PPS_SYNC # If you see the "calcru: negative time of %ld usec for pid %d (%s)\n" # message you probably have some broken sw/hw which disables interrupts # for too long. You can make the system more resistant to this by # choosing a high value for NTIMECOUNTER. The default is 5, there # is no upper limit but more than a couple of hundred are not productive. # A better strategy may be to sysctl -w kern.timecounter.method=1 options NTIMECOUNTER=20 # # EISA bus # # The EISA bus device is `eisa'. It provides auto-detection and # configuration support for all devices on the EISA bus. device eisa # By default, only 10 EISA slots are probed, since the slot numbers # above clash with the configuration address space of the PCI subsystem, # and the EISA probe is not very smart about this. This is sufficient # for most machines, but in particular the HP NetServer LC series comes # with an onboard AIC7770 dual-channel SCSI controller on EISA slot #11, # thus you need to bump this figure to 12 for them. options EISA_SLOTS=12 # # MCA bus: # # The MCA bus device is `mca'. It provides auto-detection and # configuration support for all devices on the MCA bus. # No hints are required for MCA. device mca # # PCI bus & PCI options: # # The main PCI bus device is `pci'. It provides auto-detection and # configuration support for all devices on the PCI bus, using either # configuration mode defined in the PCI specification. device pci # # AGP GART support device agp # PCI options # #options PCI_QUIET #quiets PCI code on chipset settings ##################################################################### # HARDWARE DEVICE CONFIGURATION # EISA support is available for some device, so they can be auto-probed. # MicroChannel (MCA) support is available for some devices. # For ISA the required hints are listed. # EISA, MCA, PCI and pccard are self identifying buses, so no hints # are needed. # # Mandatory devices: # # The keyboard controller; it controls the keyboard and the PS/2 mouse. device atkbdc 1 hint.atkbdc.0.at="isa" hint.atkbdc.0.port="0x060" # The AT keyboard device atkbd hint.atkbd.0.at="atkbdc" hint.atkbd.0.irq="1" # Options for atkbd: options ATKBD_DFLT_KEYMAP # specify the built-in keymap makeoptions ATKBD_DFLT_KEYMAP="jp.106" # These options are valid for other keyboard drivers as well. options KBD_DISABLE_KEYMAP_LOAD # refuse to load a keymap options KBD_INSTALL_CDEV # install a CDEV entry in /dev # `flags' for atkbd: # 0x01 Force detection of keyboard, else we always assume a keyboard # 0x02 Don't reset keyboard, useful for some newer ThinkPads # 0x04 Old-style (XT) keyboard support, useful for older ThinkPads # PS/2 mouse device psm hint.psm.0.at="atkbdc" hint.psm.0.irq="12" # Options for psm: options PSM_HOOKRESUME #hook the system resume event, useful #for some laptops options PSM_RESETAFTERSUSPEND #reset the device at the resume event # The video card driver. device vga hint.vga.0.at="isa" # Options for vga: # Try the following option if the mouse pointer is not drawn correctly # or font does not seem to be loaded properly. May cause flicker on # some systems. options VGA_ALT_SEQACCESS # If you can dispense with some vga driver features, you may want to # use the following options to save some memory. #options VGA_NO_FONT_LOADING # don't save/load font #options VGA_NO_MODE_CHANGE # don't change video modes # Older video cards may require this option for proper operation. options VGA_SLOW_IOACCESS # do byte-wide i/o's to TS and GDC regs # The following option probably won't work with the LCD displays. options VGA_WIDTH90 # support 90 column modes # To include support for VESA video modes options VESA options FB_DEBUG # Frame buffer debugging options FB_INSTALL_CDEV # install a CDEV entry in /dev # Splash screen at start up! Screen savers require this too. device splash # The pcvt console driver (vt220 compatible). device vt hint.vt.0.at="isa" options XSERVER # support for running an X server on vt options FAT_CURSOR # start with block cursor # This PCVT option is for keyboards such as those used on IBM ThinkPad laptops options PCVT_SCANSET=2 # IBM keyboards are non-std # Other PCVT options are documented in pcvt(4). options PCVT_24LINESDEF options PCVT_CTRL_ALT_DEL options PCVT_META_ESC options PCVT_NSCREENS=9 options PCVT_PRETTYSCRNS options PCVT_SCREENSAVER options PCVT_USEKBDSEC options PCVT_VT220KEYB options PCVT_GREENSAVER # The syscons console driver (sco color console compatible). device sc 1 hint.sc.0.at="isa" options MAXCONS=16 # number of virtual consoles options SC_ALT_MOUSE_IMAGE # simplified mouse cursor in text mode options SC_DFLT_FONT # compile font in makeoptions SC_DFLT_FONT=cp850 options SC_DISABLE_DDBKEY # disable `debug' key options SC_DISABLE_REBOOT # disable reboot key sequence options SC_HISTORY_SIZE=200 # number of history buffer lines options SC_MOUSE_CHAR=0x3 # char code for text mode mouse cursor options SC_PIXEL_MODE # add support for the raster text mode # The following options will let you change the default colors of syscons. options SC_NORM_ATTR="(FG_GREEN|BG_BLACK)" options SC_NORM_REV_ATTR="(FG_YELLOW|BG_GREEN)" options SC_KERNEL_CONS_ATTR="(FG_RED|BG_BLACK)" options SC_KERNEL_CONS_REV_ATTR="(FG_BLACK|BG_RED)" # If you have a two button mouse, you may want to add the following option # to use the right button of the mouse to paste text. options SC_TWOBUTTON_MOUSE # You can selectively disable features in syscons. options SC_NO_CUTPASTE options SC_NO_FONT_LOADING options SC_NO_HISTORY options SC_NO_SYSMOUSE # `flags' for sc # 0x80 Put the video card in the VESA 800x600 dots, 16 color mode # 0x100 Probe for a keyboard device periodically if one is not present # 3Dfx Voodoo Graphics, Voodoo II /dev/3dfx CDEV support. This will create # the /dev/3dfx0 device to work with glide implementations. This should get # linked to /dev/3dfx and /dev/voodoo. Note that this is not the same as # the tdfx DRI module from XFree86 and is completely unrelated. # # To enable Linuxulator support, one must also include COMPAT_LINUX in the # config as well, or you will not have the dependencies. The other option # is to load both as modules. device tdfx # Enable 3Dfx Voodoo support options TDFX_LINUX # Enable Linuxulator support # # The Numeric Processing eXtension driver. In addition to this, you # may configure a math emulator (see above). If your machine has a # hardware FPU and the kernel configuration includes the npx device # *and* a math emulator compiled into the kernel, the hardware FPU # will be used, unless it is found to be broken or unless "flags" to # npx0 includes "0x08", which requests preference for the emulator. device npx hint.npx.0.at="nexus" hint.npx.0.port="0x0F0" hint.npx.0.flags="0x0" hint.npx.0.irq="13" # # `flags' for npx0: # 0x01 don't use the npx registers to optimize bcopy. # 0x02 don't use the npx registers to optimize bzero. # 0x04 don't use the npx registers to optimize copyin or copyout. # 0x08 use emulator even if hardware FPU is available. # The npx registers are normally used to optimize copying and zeroing when # all of the following conditions are satisfied: # I586_CPU is an option # the cpu is an i586 (perhaps not a Pentium) # the probe for npx0 succeeds # INT 16 exception handling works. # Then copying and zeroing using the npx registers is normally 30-100% faster. # The flags can be used to control cases where it doesn't work or is slower. # Setting them at boot time using userconfig works right (the optimizations # are not used until later in the bootstrap when npx0 is attached). # Flag 0x08 automatically disables the i586 optimized routines. # # # ACPI support using the Intel ACPI Component Architecture reference # implementation. # # ACPI_DEBUG enables the use of the debug.acpi.level and debug.acpi.layer # kernel environment variables to select initial debugging levels for the # Intel ACPICA code. (Note that the Intel code must also have USE_DEBUGGER # defined when it is built). # device acpica options ACPI_DEBUG # # Optional devices: # # # SCSI host adapters: # # adv: All Narrow SCSI bus AdvanSys controllers. # adw: Second Generation AdvanSys controllers including the ADV940UW. # aha: Adaptec 154x/1535/1640 # ahb: Adaptec 174x EISA controllers # ahc: Adaptec 274x/284x/2910/293x/294x/394x/3950x/3960x/398X/4944/ # 19160x/29160x, aic7770/aic78xx # aic: Adaptec 6260/6360, APA-1460 (PC Card), NEC PC9801-100 (C-BUS) # amd: Support for the AMD 53C974 SCSI host adapter chip as found on devices # such as the Tekram DC-390(T). # bt: Most Buslogic controllers: including BT-445, BT-54x, BT-64x, BT-74x, # BT-75x, BT-946, BT-948, BT-956, BT-958, SDC3211B, SDC3211F, SDC3222F # isp: Qlogic ISP 1020, 1040 and 1040B PCI SCSI host adapters, # ISP 1240 Dual Ultra SCSI, ISP 1080 and 1280 (Dual) Ultra2, # ISP 12160 Ultra3 SCSI, # Qlogic ISP 2100 and ISP 2200 Fibre Channel host adapters. # ispfw: Firmware module for Qlogic host adapters # ncr: NCR 53C810, 53C825 self-contained SCSI host adapters. # ncv: NCR 53C500 based SCSI host adapters. # nsp: Workbit Ninja SCSI-3 based PC Card SCSI host adapters. # sym: Symbios/Logic 53C8XX family of PCI-SCSI I/O processors: # 53C810, 53C810A, 53C815, 53C825, 53C825A, 53C860, 53C875, # 53C876, 53C885, 53C895, 53C895A, 53C896, 53C897, 53C1510D, # 53C1010-33, 53C1010-66. # stg: TMC 18C30, 18C50 based SCSI host adapters. # wds: WD7000 # # Note that the order is important in order for Buslogic ISA/EISA cards to be # probed correctly. # device bt hint.bt.0.at="isa" hint.bt.0.port="0x330" device adv hint.adv.0.at="isa" device adw device aha hint.aha.0.at="isa" device aic hint.aic.0.at="isa" device ahb device ahc device amd device isp hint.isp.0.disable="1" hint.isp.0.role="3" hint.isp.0.prefer_iomap="1" hint.isp.0.prefer_memmap="1" hint.isp.0.fwload_disable="1" hint.isp.0.ignore_nvram="1" hint.isp.0.fullduplex="1" hint.isp.0.topology="lport" hint.isp.0.topology="nport" hint.isp.0.topology="lport-only" hint.isp.0.topology="nport-only" # we can't get u_int64_t types, nor can we get strings if it's got # a leading 0x, hence this silly dodge. hint.isp.0.portwnn="w50000000aaaa0000" hint.isp.0.nodewnn="w50000000aaaa0001" device ispfw device ncr device ncv device nsp device sym device stg hint.stg.0.at="isa" hint.stg.0.port="0x140" hint.stg.0.port="11" device wds hint.wds.0.at="isa" hint.wds.0.port="0x350" hint.wds.0.irq="11" hint.wds.0.drq="6" # The aic7xxx driver will attempt to use memory mapped I/O for all PCI # controllers that have it configured only if this option is set. Unfortunately, # this doesn't work on some motherboards, which prevents it from being the # default. options AHC_ALLOW_MEMIO # Enable diagnostic sequencer code. options AHC_DEBUG_SEQUENCER # Dump the contents of the ahc controller configuration PROM. options AHC_DUMP_EEPROM # Bitmap of units to enable targetmode operations. options AHC_TMODE_ENABLE # The adw driver will attempt to use memory mapped I/O for all PCI # controllers that have it configured only if this option is set. options ADW_ALLOW_MEMIO # Options used in dev/isp/ (Qlogic SCSI/FC driver). # # ISP_TARGET_MODE - enable target mode operation # #options ISP_TARGET_MODE=1 # Options used in dev/sym/ (Symbios SCSI driver). #options SYM_SETUP_LP_PROBE_MAP #-Low Priority Probe Map (bits) # Allows the ncr to take precedence # 1 (1<<0) -> 810a, 860 # 2 (1<<1) -> 825a, 875, 885, 895 # 4 (1<<2) -> 895a, 896, 1510d #options SYM_SETUP_SCSI_DIFF #-HVD support for 825a, 875, 885 # disabled:0 (default), enabled:1 #options SYM_SETUP_PCI_PARITY #-PCI parity checking # disabled:0, enabled:1 (default) #options SYM_SETUP_MAX_LUN #-Number of LUNs supported # default:8, range:[1..64] # The 'asr' driver provides support for current DPT/Adaptec SCSI RAID # controllers (SmartRAID V and VI and later). # These controllers require the CAM infrastructure. # device asr # The 'dpt' driver provides support for old DPT controllers (http://www.dpt.com/). # These have hardware RAID-{0,1,5} support, and do multi-initiator I/O. # The DPT controllers are commonly re-licensed under other brand-names - # some controllers by Olivetti, Dec, HP, AT&T, SNI, AST, Alphatronic, NEC and # Compaq are actually DPT controllers. # # See src/sys/dev/dpt for debugging and other subtle options. # DPT_MEASURE_PERFORMANCE Enables a set of (semi)invasive metrics. Various # instruments are enabled. The tools in # /usr/sbin/dpt_* assume these to be enabled. # DPT_HANDLE_TIMEOUTS Normally device timeouts are handled by the DPT. # If you ant the driver to handle timeouts, enable # this option. If your system is very busy, this # option will create more trouble than solve. # DPT_TIMEOUT_FACTOR Used to compute the excessive amount of time to # wait when timing out with the above option. # DPT_DEBUG_xxxx These are controllable from sys/dev/dpt/dpt.h # DPT_LOST_IRQ When enabled, will try, once per second, to catch # any interrupt that got lost. Seems to help in some # DPT-firmware/Motherboard combinations. Minimal # cost, great benefit. # DPT_RESET_HBA Make "reset" actually reset the controller # instead of fudging it. Only enable this if you # are 100% certain you need it. device dpt # DPT options #!CAM# options DPT_MEASURE_PERFORMANCE #!CAM# options DPT_HANDLE_TIMEOUTS options DPT_TIMEOUT_FACTOR=4 options DPT_LOST_IRQ options DPT_RESET_HBA options DPT_ALLOW_MEMIO # # Mylex AcceleRAID and eXtremeRAID controllers with v6 and later # firmware. These controllers have a SCSI-like interface, and require # the CAM infrastructure. # device mly # # Adaptec FSA RAID controllers, including integrated DELL controllers, # the Dell PERC 2/QC and the HP NetRAID-4M # # AAC_COMPAT_LINUX Include code to support Linux-binary management # utilities (requires Linux compatibility # support). # device aac # # Compaq Smart RAID, Mylex DAC960 and AMI MegaRAID controllers. Only # one entry is needed; the code will find and configure all supported # controllers. # device ida # Compaq Smart RAID device mlx # Mylex DAC960 device amr # AMI MegaRAID # # 3ware ATA RAID # device twe # 3ware ATA RAID # # The 'ATA' driver supports all ATA and ATAPI devices, including PC Card # devices. You only need one "device ata" for it to find all # PCI and PC Card ATA/ATAPI devices on modern machines. device ata device atadisk # ATA disk drives device atapicd # ATAPI CDROM drives device atapifd # ATAPI floppy drives device atapist # ATAPI tape drives # # For older non-PCI, non-PnPBIOS systems, these are the hints lines to add: hint.ata.0.at="isa" hint.ata.0.port="0x1f0" hint.ata.0.irq="14" hint.ata.1.at="isa" hint.ata.1.port="0x170" hint.ata.1.irq="15" # # The following options are valid on the ATA driver: # # ATA_STATIC_ID: controller numbering is static ie depends on location # else the device numbers are dynamically allocated. options ATA_STATIC_ID # # Standard floppy disk controllers and floppy tapes, supports # the Y-E DATA External FDD (PC Card) # device fdc hint.fdc.0.at="isa" hint.fdc.0.port="0x3F0" hint.fdc.0.irq="6" hint.fdc.0.drq="2" # # FDC_DEBUG enables floppy debugging. Since the debug output is huge, you # gotta turn it actually on by setting the variable fd_debug with DDB, # however. options FDC_DEBUG # # Activate this line if you happen to have an Insight floppy tape. # Probing them proved to be dangerous for people with floppy disks only, # so it's "hidden" behind a flag: #hint.fdc.0.flags="1" # Specify floppy devices hint.fd.0.at="fdc0" hint.fd.0.drive="0" hint.fd.1.at="fdc0" hint.fd.1.drive="1" # M-systems DiskOnchip products see src/sys/contrib/dev/fla/README device fla hint.fla.0.at="isa" # # Other standard PC hardware: # # mse: Logitech and ATI InPort bus mouse ports # sio: serial ports (see sio(4)), including support for various # PC Card devices, such as Modem and NICs (see etc/defaults/pccard.conf) device mse hint.mse.0.at="isa" hint.mse.0.port="0x23c" hint.mse.0.irq="5" device sio hint.sio.0.at="isa" hint.sio.0.port="0x3F8" hint.sio.0.flags="0x10" hint.sio.0.irq="4" # # `flags' for serial drivers that support consoles (only for sio now): # 0x10 enable console support for this unit. The other console flags # are ignored unless this is set. Enabling console support does # not make the unit the preferred console - boot with -h or set # the 0x20 flag for that. Currently, at most one unit can have # console support; the first one (in config file order) with # this flag set is preferred. Setting this flag for sio0 gives # the old behaviour. # 0x20 force this unit to be the console (unless there is another # higher priority console). This replaces the COMCONSOLE option. # 0x40 reserve this unit for low level console operations. Do not # access the device in any normal way. # 0x80 use this port for serial line gdb support in ddb. # # PnP `flags' (set via userconfig using pnp x flags y) # 0x1 disable probing of this device. Used to prevent your modem # from being attached as a PnP modem. # # Options for serial drivers that support consoles (only for sio now): options BREAK_TO_DEBUGGER #a BREAK on a comconsole goes to #DDB, if available. options CONSPEED=9600 #default speed for serial console (default 9600) # Solaris implements a new BREAK which is initiated by a character # sequence CR ~ ^b which is similar to a familiar pattern used on # Sun servers by the Remote Console. options ALT_BREAK_TO_DEBUGGER # Options for sio: options COM_ESP #code for Hayes ESP options COM_MULTIPORT #code for some cards with shared IRQs # Other flags for sio that aren't documented in the man page. # 0x20000 enable hardware RTS/CTS and larger FIFOs. Only works for # ST16650A-compatible UARTs. # # Network interfaces: # # MII bus support is required for some PCI 10/100 ethernet NICs, # namely those which use MII-compliant transceivers or implement # tranceiver control interfaces that operate like an MII. Adding # "device miibus0" to the kernel config pulls in support for # the generic miibus API and all of the PHY drivers, including a # generic one for PHYs that aren't specifically handled by an # individual driver. device miibus # an: Aironet 4500/4800 802.11 wireless adapters. Supports the PCMCIA, # PCI and ISA varieties. # ar: Arnet SYNC/570i hdlc sync 2/4 port V.35/X.21 serial driver # (requires sppp) # awi: Support for IEEE 802.11 PC Card devices using the AMD Am79C930 and # Harris (Intersil) Chipset with PCnetMobile firmware by AMD. # cnw: Xircom CNW/Netware Airsurfer PC Card adapter # cs: IBM Etherjet and other Crystal Semi CS89x0-based adapters # cx: Cronyx/Sigma multiport sync/async (with Cisco or PPP framing) # dc: Support for PCI fast ethernet adapters based on the DEC/Intel 21143 # and various workalikes including: # the ADMtek AL981 Comet and AN985 Centaur, the ASIX Electronics # AX88140A and AX88141, the Davicom DM9100 and DM9102, the Lite-On # 82c168 and 82c169 PNIC, the Lite-On/Macronix LC82C115 PNIC II # and the Macronix 98713/98713A/98715/98715A/98725 PMAC. This driver # replaces the old al, ax, dm, pn and mx drivers. List of brands: # Digital DE500-BA, Kingston KNE100TX, D-Link DFE-570TX, SOHOware SFA110, # SVEC PN102-TX, CNet Pro110B, 120A, and 120B, Compex RL100-TX, # LinkSys LNE100TX, LNE100TX V2.0, Jaton XpressNet, Alfa Inc GFC2204, # KNE110TX. # de: Digital Equipment DC21040 # ed: Western Digital and SMC 80xx; Novell NE1000 and NE2000; 3Com 3C503 # HP PC Lan+, various PC Card devices (refer to etc/defauls/pccard.conf) # el: 3Com 3C501 (slow!) # ep: 3Com 3C509, 3C529, 3C556, 3C562D, 3C563D, 3C572, 3C574X, 3C579, 3C589 # and PC Card devices using these chipsets. # ex: Intel EtherExpress Pro/10 and other i82595-based adapters, # Olicom Ethernet PC Card devices. # fe: Fujitsu MB86960A/MB86965A Ethernet # fea: DEC DEFEA EISA FDDI adapter # fpa: Support for the Digital DEFPA PCI FDDI. `device fddi' is also needed. # fxp: Intel EtherExpress Pro/100B # (hint of prefer_iomap can be done to prefer I/O instead of Mem mapping) # ie: AT&T StarLAN 10 and EN100; 3Com 3C507; unknown NI5210; # Intel EtherExpress # le: Digital Equipment EtherWorks 2 and EtherWorks 3 (DEPCA, DE100, # DE101, DE200, DE201, DE202, DE203, DE204, DE205, DE422) # lnc: Lance/PCnet cards (Isolan, Novell NE2100, NE32-VL, AMD Am7990 and # Am79C960) # nge: Support for PCI gigabit ethernet adapters based on the National # Semiconductor DP83820 and DP83821 chipset. This includes the # SMC EZ Card 1000 (SMC9462TX), D-Link DGE-500T, Asante FriendlyNet # GigaNIX 1000TA and 1000TPC, and the Addtron AEG320T. # oltr: Olicom ISA token-ring adapters OC-3115, OC-3117, OC-3118 and OC-3133 # (no hints needed). # Olicom PCI token-ring adapters OC-3136, OC-3137, OC-3139, OC-3140, # OC-3141, OC-3540, OC-3250 # rdp: RealTek RTL 8002-based pocket ethernet adapters # pcn: Support for PCI fast ethernet adapters based on the AMD Am79c97x # chipsets, including the PCnet/FAST, PCnet/FAST+, PCnet/PRO and # PCnet/Home. These were previously handled by the lnc driver (and # still will be if you leave this driver out of the kernel). # rl: Support for PCI fast ethernet adapters based on the RealTek 8129/8139 # chipset. Note that the RealTek driver defaults to using programmed # I/O to do register accesses because memory mapped mode seems to cause # severe lockups on SMP hardware. This driver also supports the # Accton EN1207D `Cheetah' adapter, which uses a chip called # the MPX 5030/5038, which is either a RealTek in disguise or a # RealTek workalike. Note that the D-Link DFE-530TX+ uses the RealTek # chipset and is supported by this driver, not the 'vr' driver. # sf: Support for Adaptec Duralink PCI fast ethernet adapters based on the # Adaptec AIC-6915 "starfire" controller. # This includes dual and quad port cards, as well as one 100baseFX card. # Most of these are 64-bit PCI devices, except for one single port # card which is 32-bit. # sis: Support for NICs based on the Silicon Integrated Systems SiS 900, # SiS 7016 and NS DP83815 PCI fast ethernet controller chips. # sk: Support for the SysKonnect SK-984x series PCI gigabit ethernet NICs. # This includes the SK-9841 and SK-9842 single port cards (single mode # and multimode fiber) and the SK-9843 and SK-9844 dual port cards # (also single mode and multimode). # The driver will autodetect the number of ports on the card and # attach each one as a separate network interface. # sn: Support for ISA and PC Card Ethernet devices using the # SMC91C90/92/94/95 chips. # sr: RISCom/N2 hdlc sync 1/2 port V.35/X.21 serial driver (requires sppp) # ste: Sundance Technologies ST201 PCI fast ethernet controller, includes # the D-Link DFE-550TX. # ti: Support for PCI gigabit ethernet NICs based on the Alteon Networks # Tigon 1 and Tigon 2 chipsets. This includes the Alteon AceNIC, the # 3Com 3c985, the Netgear GA620 and various others. Note that you will # probably want to bump up NMBCLUSTERS a lot to use this driver. # tl: Support for the Texas Instruments TNETE100 series 'ThunderLAN' # cards and integrated ethernet controllers. This includes several # Compaq Netelligent 10/100 cards and the built-in ethernet controllers # in several Compaq Prosignia, Proliant and Deskpro systems. It also # supports several Olicom 10Mbps and 10/100 boards. # tx: SMC 9432 TX, BTX and FTX cards. (SMC EtherPower II serie) # vr: Support for various fast ethernet adapters based on the VIA # Technologies VT3043 `Rhine I' and VT86C100A `Rhine II' chips, # including the D-Link DFE530TX (see 'rl' for DFE530TX+), the Hawking # Technologies PN102TX, and the AOpen/Acer ALN-320. # vx: 3Com 3C590 and 3C595 # wb: Support for fast ethernet adapters based on the Winbond W89C840F chip. # Note: this is not the same as the Winbond W89C940F, which is a # NE2000 clone. # wl: Lucent Wavelan (ISA card only). # wi: Lucent WaveLAN/IEEE 802.11 PCMCIA adapters. Note: this supports both # the PCMCIA and ISA cards: the ISA card is really a PCMCIA to ISA # bridge with a PCMCIA adapter plugged into it. # wx: Intel Gigabit Ethernet PCI card (`Wiseman') # xe: Xircom/Intel EtherExpress Pro100/16 PC Card ethernet controller, # Accton Fast EtherCard-16, Compaq Netelligent 10/100 PC Card, # Toshiba 10/100 Ethernet PC Card, Xircom 16-bit Ethernet + Modem 56 # xl: Support for the 3Com 3c900, 3c905, 3c905B and 3c905C (Fast) # Etherlink XL cards and integrated controllers. This includes the # integrated 3c905B-TX chips in certain Dell Optiplex and Dell # Precision desktop machines and the integrated 3c905-TX chips # in Dell Latitude laptop docking stations. # Also supported: 3Com 3c980(C)-TX, 3Com 3cSOHO100-TX, 3Com 3c450-TX # Order for ISA/EISA devices is important here device ar 1 hint.ar.0.at="isa" hint.ar.0.port="0x300" hint.ar.0.irq="10" hint.ar.0.maddr="0xd0000" device cs hint.cs.0.at="isa" hint.cs.0.port="0x300" device cx 1 hint.cx.0.at="isa" hint.cx.0.port="0x240" hint.cx.0.irq="15" hint.cx.0.drq="7" device ed hint.ed.0.at="isa" hint.ed.0.port="0x280" hint.ed.0.irq="5" hint.ed.0.maddr="0xd8000" device el 1 hint.el.0.at="isa" hint.el.0.port="0x300" hint.el.0.irq="9" device ep device ex device fe 1 options FE_8BIT_SUPPORT # LAC-98 support hint.fe.0.at="isa" hint.fe.0.port="0x300" device fea device ie 2 hint.ie.0.at="isa" hint.ie.0.port="0x300" hint.ie.0.irq="5" hint.ie.0.maddr="0xd0000" hint.ie.1.at="isa" hint.ie.1.port="0x360" hint.ie.1.irq="7" hint.ie.1.maddr="0xd0000" device le 1 hint.le.0.at="isa" hint.le.0.port="0x300" hint.le.0.irq="5" hint.le.0.maddr="0xd0000" device lnc 1 hint.lnc.0.at="isa" hint.lnc.0.port="0x280" hint.lnc.0.irq="10" hint.lnc.0.drq="0" device rdp 1 hint.rdp.0.at="isa" hint.rdp.0.port="0x378" hint.rdp.0.irq="7" hint.rdp.0.flags="2" device sr 1 hint.sr.0.at="isa" hint.sr.0.port="0x300" hint.sr.0.irq="5" hint.sr.0.maddr="0xd0000" device sn hint.sn.0.at="isa" hint.sn.0.port="0x300" hint.sn.0.irq="10" device an device awi device cnw device wi options WLCACHE # enables the signal-strength cache options WLDEBUG # enables verbose debugging output device wl 1 hint.wl.0.at="isa" hint.wl.0.port="0x300" device xe device oltr options OLTR_NO_BULLSEYE_MAC options OLTR_NO_HAWKEYE_MAC options OLTR_NO_TMS_MAC hint.oltr.0.at="isa" # PCI Ethernet NICs that use the common MII bus controller code. device dc # DEC/Intel 21143 and various workalikes device fxp # Intel EtherExpress PRO/100B (82557, 82558) hint.fxp.0.prefer_iomap="0" device rl # RealTek 8129/8139 device pcn # AMD Am79C79x PCI 10/100 NICs device sf # Adaptec AIC-6915 (``Starfire'') device sis # Silicon Integrated Systems SiS 900/SiS 7016 device ste # Sundance ST201 (D-Link DFE-550TX) device tl # Texas Instruments ThunderLAN device tx # SMC EtherPower II (83c170 ``EPIC'') device vr # VIA Rhine, Rhine II device wb # Winbond W89C840F device xl # 3Com 3c90x (``Boomerang'', ``Cyclone'') # PCI Ethernet NICs. device de # DEC/Intel DC21x4x (``Tulip'') device vx # 3Com 3c590, 3c595 (``Vortex'') # PCI Gigabit & FDDI NICs. device nge device sk device ti device wx device fpa 1 # # ATM related options (Cranor version) # (note: this driver cannot be used with the HARP ATM stack) # # The `en' device provides support for Efficient Networks (ENI) # ENI-155 PCI midway cards, and the Adaptec 155Mbps PCI ATM cards (ANA-59x0). # # atm device provides generic atm functions and is required for # atm devices. # NATM enables the netnatm protocol family that can be used to # bypass TCP/IP. # # the current driver supports only PVC operations (no atm-arp, no multicast). # for more details, please read the original documents at # http://www.ccrc.wustl.edu/pub/chuck/tech/bsdatm/bsdatm.html # device atm device en options NATM #native ATM # # Audio drivers: `pcm', `sbc', `gusc', `pca' # # pcm: PCM audio through various sound cards. # # This has support for a large number of new audio cards, based on # CS423x, OPTi931, Yamaha OPL-SAx, and also for SB16, GusPnP. # For more information about this driver and supported cards, # see the pcm.4 man page. # # The flags of the device tells the device a bit more info about the # device that normally is obtained through the PnP interface. # bit 2..0 secondary DMA channel; # bit 4 set if the board uses two dma channels; # bit 15..8 board type, overrides autodetection; leave it # zero if don't know what to put in (and you don't, # since this is unsupported at the moment...). # # This driver will use the new PnP code if it's available. # # pca: PCM audio through your PC speaker # # Supported cards include: # Creative SoundBlaster ISA PnP/non-PnP # Supports ESS and Avance ISA chips as well. # Gravis UltraSound ISA PnP/non-PnP # Crystal Semiconductor CS461x/428x PCI # Neomagic 256AV (ac97) # Most of the more common ISA/PnP sb/mss/ess compatable cards. device pcm # For non-pnp sound cards with no bridge drivers only: hint.pcm.0.at="isa" hint.pcm.0.irq="10" hint.pcm.0.drq="1" hint.pcm.0.flags="0x0" # For PnP/PCI sound cards, no hints are required. # # midi: MIDI interfaces and synthesizers # device midi # For non-pnp sound cards with no bridge drivers: hint.midi.0.at="isa" hint.midi.0.irq="5" hint.midi.0.flags="0x0" # For serial ports (this example configures port 2): # TODO: implement generic tty-midi interface so that we can use # other uarts. hint.midi.0.at="isa" hint.midi.0.port="0x2F8" hint.midi.0.irq="3" # # seq: MIDI sequencer # device seq # The bridge drivers for sound cards. These can be separately configured # for providing services to the likes of new-midi. # When used with 'device pcm' they also provide pcm sound services. # # sbc: Creative SoundBlaster ISA PnP/non-PnP # Supports ESS and Avance ISA chips as well. # gusc: Gravis UltraSound ISA PnP/non-PnP # csa: Crystal Semiconductor CS461x/428x PCI # For non-PnP cards: device sbc hint.sbc.0.at="isa" hint.sbc.0.port="0x220" hint.sbc.0.irq="5" hint.sbc.0.drq="1" hint.sbc.0.flags="0x15" device gusc hint.gusc.0.at="isa" hint.gusc.0.port="0x220" hint.gusc.0.irq="5" hint.gusc.0.drq="1" hint.gusc.0.flags="0x13" device pca hint.pca.0.at="isa" hint.pca.0.port="0x040" # # Miscellaneous hardware: # # mcd: Mitsumi CD-ROM # scd: Sony CD-ROM # matcd: Matsushita/Panasonic CD-ROM # wt: Wangtek and Archive QIC-02/QIC-36 tape drives # ctx: Cortex-I frame grabber # apm: Laptop Advanced Power Management (experimental) # pmtimer: Timer device driver for power management events (APM or ACPI) # spigot: The Creative Labs Video Spigot video-acquisition board # meteor: Matrox Meteor video capture board # bktr: Brooktree bt848/848a/849a/878/879 video capture and TV Tuner board # cy: Cyclades serial driver # dgb: Digiboard PC/Xi and PC/Xe series driver (ALPHA QUALITY!) # dgm: Digiboard PC/Xem driver (obsolete) # digi: Digiboard driver # gp: National Instruments AT-GPIB and AT-GPIB/TNT board, PCMCIA-GPIB # asc: GI1904-based hand scanners, e.g. the Trust Amiscan Grey # gsc: Genius GS-4500 hand scanner. # joy: joystick (including IO DATA PCJOY PC Card joystick) # The LOUTB option specifies a slower outb() for debugging purposes. # rc: RISCom/8 multiport card # rp: Comtrol Rocketport(ISA) - single card # tw: TW-523 power line interface for use with X-10 home control products # si: Specialix SI/XIO 4-32 port terminal multiplexor # spic: Sony Programmable I/O controller (VAIO notebooks) # stl: Stallion EasyIO and EasyConnection 8/32 (cd1400 based) # stli: Stallion EasyConnection 8/64, ONboard, Brumby (intelligent) # Notes on APM # The flags takes the following meaning for apm0: # 0x0020 Statclock is broken. # If apm is omitted, some systems require sysctl -w kern.timecounter.method=1 # for correct timekeeping. # Notes on the spigot: # The video spigot is at 0xad6. This port address can not be changed. # The irq values may only be 10, 11, or 15 # I/O memory is an 8kb region. Possible values are: # 0a0000, 0a2000, ..., 0fffff, f00000, f02000, ..., ffffff # The start address must be on an even boundary. # Add the following option if you want to allow non-root users to be able # to access the spigot. This option is not secure because it allows users # direct access to the I/O page. # options SPIGOT_UNSECURE # Notes on the Comtrol Rocketport driver: # # The exact values used for rp0 depend on how many boards you have # in the system. The manufacturer's sample configs are listed as: # # device rp # core driver support # # Comtrol Rocketport ISA single card # hints.rp.0.at="isa" # hints.rp.0.port="0x280" # # If instead you have two ISA cards, one installed at 0x100 and the # second installed at 0x180, then you should add the following to # your kernel probe hints: # hints.rp.0.at="isa" # hints.rp.0.port="0x100" # hints.rp.1.at="isa" # hints.rp.1.port="0x180" # # For 4 ISA cards, it might be something like this: # hints.rp.0.at="isa" # hints.rp.0.port="0x180" # hints.rp.1.at="isa" # hints.rp.1.port="0x100" # hints.rp.2.at="isa" # hints.rp.2.port="0x340" # hints.rp.3.at="isa" # hints.rp.3.port="0x240" # # And for PCI cards, you need no hints. # Notes on the Digiboard driver: # # The following flag values have special meanings: # 0x01 - alternate layout of pins (dgb & dgm) # 0x02 - use the windowed PC/Xe in 64K mode (dgb only) # Notes on the Specialix SI/XIO driver: # The host card is memory, not IO mapped. # The Rev 1 host cards use a 64K chunk, on a 32K boundary. # The Rev 2 host cards use a 32K chunk, on a 32K boundary. # The cards can use an IRQ of 11, 12 or 15. # Notes on the Sony Programmable I/O controller # This is a temporary driver that should someday be replaced by something # that hooks into the ACPI layer. The device is hooked to the PIIX4's # General Device 10 decoder, which means you have to fiddle with PCI # registers to map it in, even though it is otherwise treated here as # an ISA device. At the moment, the driver polls, although the device # is capable of generating interrupts. It largely undocumented. # The port location in the hint is where you WANT the device to be # mapped. 0x10a0 seems to be traditional. At the moment the jogdial # is the only thing truly supported, but aparently a fair percentage # of the Vaio extra features are controlled by this device. # Notes on the Stallion stl and stli drivers: # See src/i386/isa/README.stl for complete instructions. # This is version 0.0.5alpha, unsupported by Stallion. # The stl driver has a secondary IO port hard coded at 0x280. You need # to change src/i386/isa/stallion.c if you reconfigure this on the boards. # The "flags" and "msize" settings on the stli driver depend on the board: # EasyConnection 8/64 ISA: flags 23 msize 0x1000 # EasyConnection 8/64 EISA: flags 24 msize 0x10000 # EasyConnection 8/64 MCA: flags 25 msize 0x1000 # ONboard ISA: flags 4 msize 0x10000 # ONboard EISA: flags 7 msize 0x10000 # ONboard MCA: flags 3 msize 0x10000 # Brumby: flags 2 msize 0x4000 # Stallion: flags 1 msize 0x10000 device mcd 1 hint.mcd.0.at="isa" hint.mcd.0.port="0x300" hint.mcd.0.irq="10" # for the Sony CDU31/33A CDROM device scd 1 hint.scd.0.at="isa" hint.scd.0.port="0x230" # for the SoundBlaster 16 multicd - up to 4 devices device matcd 1 hint.matcd.0.at="isa" hint.matcd.0.port="0x230" device wt 1 hint.wt.0.at="isa" hint.wt.0.port="0x300" hint.wt.0.irq="5" hint.wt.0.drq="1" device ctx 1 hint.ctx.0.at="isa" hint.ctx.0.port="0x230" hint.ctx.0.maddr="0xd0000" device spigot 1 hint.spigot.0.at="isa" hint.spigot.0.port="0xad6" hint.spigot.0.irq="15" hint.spigot.0.maddr="0xee000" device apm hint.apm.0.flags="0x20" device pmtimer # Adjust system timer at wakeup time hint.pmtimer.0.at="isa" device gp hint.gp.0.at="isa" hint.gp.0.port="0x2c0" device gsc 1 hint.gsc.0.at="isa" hint.gsc.0.port="0x270" hint.gsc.0.drq="3" device joy # PnP aware, hints for nonpnp only hint.joy.0.at="isa" hint.joy.0.port="0x201" device cy 1 options CY_PCI_FASTINTR # Use with cy_pci unless irq is shared hint.cy.0.at="isa" hint.cy.0.irq="10" hint.cy.0.maddr="0xd4000" hint.cy.0.msize="0x2000" device dgb 1 options NDGBPORTS=16 # Defaults to 16*NDGB hint.dgb.0.at="isa" hint.dgb.0.port="0x220" hint.dgb.0.maddr="0xfc000" device dgm hint.dgm.0.at="isa" hint.dgm.0.port="0x104" hint.dgm.0.maddr="0xd0000" device digi hint.dgm.0.at="isa" hint.dgm.0.port="0x104" hint.dgm.0.maddr="0xd0000" # BIOS & FEP/OS components of device digi. Normally left as modules device digi_CX device digi_CX_PCI device digi_EPCX device digi_EPCX_PCI device digi_Xe device digi_Xem device digi_Xr device rc 1 hint.rc.0.at="isa" hint.rc.0.port="0x220" hint.rc.0.irq="12" device rp hint.rp.0.at="isa" hint.rp.0.port="0x280" # the port and irq for tw0 are fictitious device tw 1 hint.tw.0.at="isa" hint.tw.0.port="0x380" hint.tw.0.irq="11" device si options SI_DEBUG hint.si.0.at="isa" hint.si.0.maddr="0xd0000" hint.si.0.irq="12" device asc 1 hint.asc.0.at="isa" hint.asc.0.port="0x3EB" hint.asc.0.drq="3" hint.asc.0.irq="10" device spic hint.spic.0.at="isa" hint.spic.0.port="0x10a0" device stl hint.stl.0.at="isa" hint.stl.0.port="0x2a0" hint.stl.0.irq="10" device stli hint.stli.0.at="isa" hint.stli.0.port="0x2a0" hint.stli.0.maddr="0xcc000" hint.stli.0.flags="23" hint.stli.0.msize="0x1000" # You are unlikely to have the hardware for loran device loran hint.loran.0.at="isa" hint.loran.0.irq="5" # HOT1 Xilinx 6200 card (http://www.vcc.com/) device xrpu # # The `meteor' device is a PCI video capture board. It can also have the # following options: # options METEOR_ALLOC_PAGES=xxx preallocate kernel pages for data entry # figure (ROWS*COLUMN*BYTES_PER_PIXEL*FRAME+PAGE_SIZE-1)/PAGE_SIZE # options METEOR_DEALLOC_PAGES remove all allocated pages on close(2) # options METEOR_DEALLOC_ABOVE=xxx remove all allocated pages above the # specified amount. If this value is below the allocated amount no action # taken # options METEOR_SYSTEM_DEFAULT={METEOR_PAL|METEOR_NTSC|METEOR_SECAM}, used # for initialization of fps routine when a signal is not present. # # The 'bktr' device is a PCI video capture device using the Brooktree # bt848/bt848a/bt849a/bt878/bt879 chipset. When used with a TV Tuner it forms a # TV card, eg Miro PC/TV, Hauppauge WinCast/TV WinTV, VideoLogic Captivator, # Intel Smart Video III, AverMedia, IMS Turbo, FlyVideo. # # options OVERRIDE_CARD=xxx # options OVERRIDE_TUNER=xxx # options OVERRIDE_MSP=1 # options OVERRIDE_DBX=1 # These options can be used to override the auto detection # The current values for xxx are found in src/sys/dev/bktr/bktr_card.h # Using sysctl(8) run-time overrides on a per-card basis can be made # # options BROOKTREE_SYSTEM_DEFAULT=BROOKTREE_PAL # or # options BROOKTREE_SYSTEM_DEFAULT=BROOKTREE_NTSC # Specifes the default video capture mode. # This is required for Dual Crystal (28&35Mhz) boards where PAL is used # to prevent hangs during initialisation. eg VideoLogic Captivator PCI. # # options BKTR_USE_PLL # PAL or SECAM users who have a 28Mhz crystal (and no 35Mhz crystal) # must enable PLL mode with this option. eg some new Bt878 cards. # # options BKTR_GPIO_ACCESS # This enable IOCTLs which give user level access to the GPIO port. # # options BKTR_NO_MSP_RESET # Prevents the MSP34xx reset. Good if you initialise the MSP in another OS first # # options BKTR_430_FX_MODE # Switch Bt878/879 cards into Intel 430FX chipset compatibility mode. # # options BKTR_SIS_VIA_MODE # Switch Bt878/879 cards into SIS/VIA chipset compatibility mode which is # needed for some old SiS and VIA chipset motherboards. # This also allows Bt878/879 chips to work on old OPTi (<1997) chipset # motherboards and motherboards with bad or incomplete PCI 2.1 support. # As a rough guess, old = before 1998 # device meteor 1 # Brooktree driver has been ported to the new I2C framework. Thus, # you'll need to have the following 3 lines in the kernel config. # device smbus # device iicbus # device iicbb # The iic and smb devices are only needed if you want to control other # I2C slaves connected to the external connector of some cards. # device bktr 1 # # PC Card/PCMCIA # (OLDCARD) # # card: pccard slots # pcic: isa/pccard bridge device pcic hint.pcic.0.at="isa" hint.pcic.1.at="isa" device card # # PC Card/PCMCIA and Cardbus # (NEWCARD) # # Note that NEWCARD and OLDCARD are incompatible. Do not use both at the same # time. # # pccbb: isa/pccard and pci/cardbus bridge # pccard: pccard slots # cardbus: cardbus slots #device pccbb #device pccard #device cardbus # You may need to reset all pccards after resuming options PCIC_RESUME_RESET # reset after resume # # Laptop/Notebook options: # # See also: # apm under `Miscellaneous hardware' # above. # For older notebooks that signal a powerfail condition (external # power supply dropped, or battery state low) by issuing an NMI: options POWERFAIL_NMI # make it beep instead of panicing # # SMB bus # # System Management Bus support is provided by the 'smbus' device. # Access to the SMBus device is via the 'smb' device (/dev/smb*), # which is a child of the 'smbus' device. # # Supported devices: # smb standard io through /dev/smb* # # Supported SMB interfaces: # iicsmb I2C to SMB bridge with any iicbus interface # bktr brooktree848 I2C hardware interface # intpm Intel PIIX4 Power Management Unit # alpm Acer Aladdin-IV/V/Pro2 Power Management Unit # ichsmb Intel ICH SMBus controller chips (82801AA, 82801AB, 82801BA) # device smbus # Bus support, required for smb below. device intpm device alpm device ichsmb device smb # # I2C Bus # # Philips i2c bus support is provided by the `iicbus' device. # # Supported devices: # ic i2c network interface # iic i2c standard io # iicsmb i2c to smb bridge. Allow i2c i/o with smb commands. # # Supported interfaces: # pcf Philips PCF8584 ISA-bus controller # bktr brooktree848 I2C software interface # # Other: # iicbb generic I2C bit-banging code (needed by lpbb, bktr) # device iicbus # Bus support, required for ic/iic/iicsmb below. device iicbb device ic device iic device iicsmb # smb over i2c bridge device pcf hint.pcf.0.at="isa" hint.pcf.0.port="0x320" hint.pcf.0.irq="5" #--------------------------------------------------------------------------- # ISDN4BSD # # See /usr/share/examples/isdn/ROADMAP for an introduction to isdn4bsd. # # i4b passive ISDN cards support contains the following hardware drivers: # # isic - Siemens/Infineon ISDN ISAC/HSCX/IPAC chipset driver # iwic - Winbond W6692 PCI bus ISDN S/T interface controller # ifpi - AVM Fritz!Card PCI driver # ihfc - Cologne Chip HFC ISA/ISA-PnP chipset driver # ifpnp - AVM Fritz!Card PnP driver # itjc - Siemens ISAC / TJNet Tiger300/320 chipset # +# i4b active ISDN cards support contains the following hardware drivers: +# +# iavc - AVM B1 PCI, AVM B1 ISA, AVM T1 +# # Note that the ``options'' (if given) and ``device'' lines must BOTH # be uncommented to enable support for a given card ! # # In addition to a hardware driver (and probably an option) the mandatory # ISDN protocol stack devices and the mandatory support device must be # enabled as well as one or more devices from the optional devices section. # #--------------------------------------------------------------------------- # isic driver (Siemens/Infineon chipsets) # device isic # # ISA bus non-PnP Cards: # ---------------------- # # Teles S0/8 or Niccy 1008 options TEL_S0_8 hint.isic.0.at="isa" hint.isic.0.maddr="0xd0000" hint.isic.0.irq="5" hint.isic.0.flags="1" # # Teles S0/16 or Creatix ISDN-S0 or Niccy 1016 options TEL_S0_16 hint.isic.0.at="isa" hint.isic.0.port="0xd80" hint.isic.0.maddr="0xd0000" hint.isic.0.irq="5" hint.isic.0.flags="2" # # Teles S0/16.3 options TEL_S0_16_3 hint.isic.0.at="isa" hint.isic.0.port="0xd80" hint.isic.0.irq="5" hint.isic.0.flags="3" # # AVM A1 or AVM Fritz!Card options AVM_A1 hint.isic.0.at="isa" hint.isic.0.port="0x340" hint.isic.0.irq="5" hint.isic.0.flags="4" # # USRobotics Sportster ISDN TA intern options USR_STI hint.isic.0.at="isa" hint.isic.0.port="0x268" hint.isic.0.irq="5" hint.isic.0.flags="7" # # ITK ix1 Micro ( < V.3, non-PnP version ) options ITKIX1 hint.isic.0.at="isa" hint.isic.0.port="0x398" hint.isic.0.irq="10" hint.isic.0.flags="18" # # ELSA PCC-16 options ELSA_PCC16 hint.isic.0.at="isa" hint.isic.0.port="0x360" hint.isic.0.irq="10" hint.isic.0.flags="20" # # ISA bus PnP Cards: # ------------------ # # Teles S0/16.3 PnP options TEL_S0_16_3_P # # Creatix ISDN-S0 P&P options CRTX_S0_P # # Dr. Neuhaus Niccy Go@ options DRN_NGO # # Sedlbauer Win Speed options SEDLBAUER # # Dynalink IS64PH options DYNALINK # # ELSA QuickStep 1000pro ISA options ELSA_QS1ISA # # Siemens I-Surf 2.0 options SIEMENS_ISURF2 # # Asuscom ISDNlink 128K ISA options ASUSCOM_IPAC # # Eicon Diehl DIVA 2.0 and 2.02 options EICON_DIVA # # PCI bus Cards: # -------------- # # ELSA MicroLink ISDN/PCI (same as ELSA QuickStep 1000pro PCI) options ELSA_QS1PCI # # #--------------------------------------------------------------------------- # ifpnp driver for AVM Fritz!Card PnP # # AVM Fritz!Card PnP device ifpnp # #--------------------------------------------------------------------------- # ihfc driver for Cologne Chip ISA chipsets (experimental!) # # Teles 16.3c ISA PnP # AcerISDN P10 ISA PnP # TELEINT ISDN SPEED No.1 device ihfc # #--------------------------------------------------------------------------- # ifpi driver for AVM Fritz!Card PCI # # AVM Fritz!Card PCI device ifpi # #--------------------------------------------------------------------------- # iwic driver for Winbond W6692 chipset # # ASUSCOM P-IN100-ST-D (and other Winbond W6692 based cards) device iwic # #--------------------------------------------------------------------------- # itjc driver for Simens ISAC / TJNet Tiger300/320 chipset # # Traverse Technologies NETjet-S # Teles PCI-TJ device itjc # #--------------------------------------------------------------------------- +# iavc driver (AVM active cards, needs i4bcapi driver!) +# +device iavc +# +# AVM B1 ISA bus (PnP mode not supported!) +# ---------------------------------------- +hint.iavc.0.at="isa" +hint.iavc.0.port="0x150" +hint.iavc.0.irq="5" +# +#--------------------------------------------------------------------------- # ISDN Protocol Stack - mandatory for all hardware drivers # # Q.921 / layer 2 - i4b passive cards D channel handling device "i4bq921" # # Q.931 / layer 3 - i4b passive cards D channel handling device "i4bq931" # # layer 4 - i4b common passive and active card handling device "i4b" # #--------------------------------------------------------------------------- # ISDN devices - mandatory for all hardware drivers # # userland driver to do ISDN tracing (for passive cards only) device "i4btrc" 4 # # userland driver to control the whole thing device "i4bctl" # #--------------------------------------------------------------------------- # ISDN devices - optional # # userland driver for access to raw B channel device "i4brbch" 4 # # userland driver for telephony device "i4btel" 2 # # network driver for IP over raw HDLC ISDN device "i4bipr" 4 # enable VJ header compression detection for ipr i/f options IPR_VJ # enable logging of the first n IP packets to isdnd (n=32 here) options IPR_LOG=32 # # network driver for sync PPP over ISDN; requires an equivalent # number of sppp device to be configured device "i4bisppp" 4 # -# B-channel inteface to the netgraph subsystem +# B-channel interface to the netgraph subsystem device "i4bing" 2 # +# CAPI driver needed for active ISDN cards (see iavc driver above) +device "i4bcapi" +# #--------------------------------------------------------------------------- # Parallel-Port Bus # # Parallel port bus support is provided by the `ppbus' device. # Multiple devices may be attached to the parallel port, devices # are automatically probed and attached when found. # # Supported devices: # vpo Iomega Zip Drive # Requires SCSI disk support ('scbus' and 'da'), best # performance is achieved with ports in EPP 1.9 mode. # lpt Parallel Printer # plip Parallel network interface # ppi General-purpose I/O ("Geek Port") + IEEE1284 I/O # pps Pulse per second Timing Interface # lpbb Philips official parallel port I2C bit-banging interface # # Supported interfaces: # ppc ISA-bus parallel port interfaces. # options PPC_PROBE_CHIPSET # Enable chipset specific detection # (see flags in ppc(4)) options DEBUG_1284 # IEEE1284 signaling protocol debug options PERIPH_1284 # Makes your computer act as a IEEE1284 # compliant peripheral options DONTPROBE_1284 # Avoid boot detection of PnP parallel devices options VP0_DEBUG # ZIP/ZIP+ debug options LPT_DEBUG # Printer driver debug options PPC_DEBUG # Parallel chipset level debug options PLIP_DEBUG # Parallel network IP interface debug options PCFCLOCK_VERBOSE # Verbose pcfclock driver options PCFCLOCK_MAX_RETRIES=5 # Maximum read tries (default 10) device ppc hint.ppc.0.at="isa" hint.ppc.0.irq="7" device ppbus device vpo device lpt device plip device ppi device pps device lpbb device pcfclock # Kernel BOOTP support options BOOTP # Use BOOTP to obtain IP address/hostname options BOOTP_NFSROOT # NFS mount root filesystem using BOOTP info options BOOTP_NFSV3 # Use NFS v3 to NFS mount root options BOOTP_COMPAT # Workaround for broken bootp daemons. options BOOTP_WIRED_TO=fxp0 # Use interface fxp0 for BOOTP # # Add tie-ins for a hardware watchdog. This only enable the hooks; # the user must still supply the actual driver. # options HW_WDOG # # Set the number of PV entries per process. Increasing this can # stop panics related to heavy use of shared memory. However, that can # (combined with large amounts of physical memory) cause panics at # boot time due the kernel running out of VM space. # # If you're tweaking this, you might also want to increase the sysctls # "vm.v_free_min", "vm.v_free_reserved", and "vm.v_free_target". # # The value below is the one more than the default. # options PMAP_SHPGPERPROC=201 # # Disable swapping. This option removes all code which actually performs # swapping, so it's not possible to turn it back on at run-time. # # This is sometimes usable for systems which don't have any swap space # (see also sysctls "vm.defer_swapspace_pageouts" and # "vm.disable_swapspace_pageouts") # #options NO_SWAPPING # Set the number of sf_bufs to allocate. sf_bufs are virtual buffers # for sendfile(2) that are used to map file VM pages, and normally # default to a quantity that is roughly 16*MAXUSERS+512. You would # typically want about 4 of these for each simultaneous file send. # options NSFBUFS=1024 # # Enable extra debugging code for locks. This stores the filename and # line of whatever acquired the lock in the lock itself, and change a # number of function calls to pass around the relevant data. This is # not at all useful unless you are debugging lock code. Also note # that it is likely to break e.g. fstat(1) unless you recompile your # userland with -DDEBUG_LOCKS as well. # options DEBUG_LOCKS ##################################################################### # ABI Emulation # Enable iBCS2 runtime support for SCO and ISC binaries options IBCS2 # Emulate spx device for client side of SVR3 local X interface options SPX_HACK # Enable Linux ABI emulation options COMPAT_LINUX # Enable the linux-like proc filesystem support (requires COMPAT_LINUX) options LINPROCFS # Linux debugging options DEBUG_LINUX # # SysVR4 ABI emulation # # The svr4 ABI emulator can be statically compiled into the kernel or loaded as # a KLD module. # The STREAMS network emulation code can also be compiled statically or as a # module. If loaded as a module, it must be loaded before the svr4 module # (the /usr/sbin/svr4 script does this for you). If compiling statically, # the `streams' device must be configured into any kernel which also # specifies COMPAT_SVR4. It is possible to have a statically-configured # STREAMS device and a dynamically loadable svr4 emulator; the /usr/sbin/svr4 # script understands that it doesn't need to load the `streams' module under # those circumstances. # Caveat: At this time, `options KTRACE' is required for the svr4 emulator # (whether static or dynamic). # options COMPAT_SVR4 # build emulator statically options DEBUG_SVR4 # enable verbose debugging device streams # STREAMS network driver (required for svr4). ##################################################################### # USB support # UHCI controller device uhci # OHCI controller device ohci # General USB code (mandatory for USB) device usb # # USB Double Bulk Pipe devices device udbp # Generic USB device driver device ugen # Human Interface Device (anything with buttons and dials) device uhid # USB keyboard device ukbd # USB printer device ulpt # USB Iomega Zip 100 Drive device umass # USB modem support device umodem # USB mouse device ums # Diamond Rio 500 Mp3 player device urio # USB scanners device uscanner # # ADMtek USB ethernet. Supports the LinkSys USB100TX, # the Billionton USB100, the Melco LU-ATX, the D-Link DSB-650TX # and the SMC 2202USB. Also works with the ADMtek AN986 Pegasus # eval board. device aue # # CATC USB-EL1201A USB ethernet. Supports the CATC Netmate # and Netmate II, and the Belkin F5U111. device cue # # Kawasaki LSI ethernet. Supports the LinkSys USB10T, # Entrega USB-NET-E45, Peracom Ethernet Adapter, the # 3Com 3c19250, the ADS Technologies USB-10BT, the ATen UC10T, # the Netgear EA101, the D-Link DSB-650, the SMC 2102USB # and 2104USB, and the Corega USB-T. device kue # debugging options for the USB subsystem # options UHCI_DEBUG options OHCI_DEBUG options USB_DEBUG options UGEN_DEBUG options UHID_DEBUG options UHUB_DEBUG options UKBD_DEBUG options ULPT_DEBUG options UMASS_DEBUG options UMS_DEBUG options URIO_DEBUG # options for ukbd: options UKBD_DFLT_KEYMAP # specify the built-in keymap makeoptions UKBD_DFLT_KEYMAP=it.iso # # Embedded system options: # # An embedded system might want to run something other than init. options INIT_PATH="/sbin/init:/stand/sysinstall" # Debug options options BUS_DEBUG # enable newbus debugging options DEBUG_VFS_LOCKS # enable vfs lock debugging options NPX_DEBUG # enable npx debugging (FPU/math emu) ##################################################################### # SYSV IPC KERNEL PARAMETERS # # Maximum number of entries in a semaphore map. options SEMMAP=31 # Maximum number of System V semaphores that can be used on the system at # one time. options SEMMNI=11 # Total number of semaphores system wide options SEMMNS=61 # Total number of undo structures in system options SEMMNU=31 # Maximum number of System V semaphores that can be used by a single process # at one time. options SEMMSL=61 # Maximum number of operations that can be outstanding on a single System V # semaphore at one time. options SEMOPM=101 # Maximum number of undo operations that can be outstanding on a single # System V semaphore at one time. options SEMUME=11 # Maximum number of shared memory pages system wide. options SHMALL=1025 # Maximum size, in bytes, of a single System V shared memory region. options SHMMAX="(SHMMAXPGS*PAGE_SIZE+1)" options SHMMAXPGS=1025 # Minimum size, in bytes, of a single System V shared memory region. options SHMMIN=2 # Maximum number of shared memory regions that can be used on the system # at one time. options SHMMNI=33 # Maximum number of System V shared memory regions that can be attached to # a single process at one time. options SHMSEG=9 ##################################################################### # More undocumented options for linting. # Note that documenting these are not considered an affront. options CAM_DEBUG_DELAY # VFS cluster debugging. options CLUSTERDEBUG # Eliminate unneeded cache flush instruction(s). options CPU_UPGRADE_HW_CACHE options DEBUG # PECOFF module (Win32 Execution Format) options PECOFF_SUPPORT options PECOFF_DEBUG # Disable the 4 MByte PSE CPU feature. #options DISABLE_PSE options ENABLE_ALART options I4B_SMP_WORKAROUND options I586_PMC_GUPROF=0x70000 options KBDIO_DEBUG=2 options KBD_MAXRETRY=4 options KBD_MAXWAIT=6 options KBD_RESETDELAY=201 # Enable the PF_KEY Key Management API. options KEY # Kernel filelock debugging. options LOCKF_DEBUG # System V compatible message queues # Please note that the values provided here are used to test kernel # building. The defaults in the sources provide almost the same numbers. # MSGSSZ must be a power of 2 between 8 and 1024. options MSGMNB=2049 # Max number of chars in queue options MSGMNI=41 # Max number of message queue identifiers options MSGSEG=2049 # Max number of message segments options MSGSSZ=16 # Size of a message segment options MSGTQL=41 # Max number of messages in system options NBUF=512 # Number of buffer headers options NMBCLUSTERS=1024 # Number of mbuf clusters options PANIC_REBOOT_WAIT_TIME=16 options PSM_DEBUG=1 options SCSI_NCR_DEBUG options SCSI_NCR_MAX_SYNC=10000 options SCSI_NCR_MAX_WIDE=1 options SCSI_NCR_MYADDR=7 options SC_DEBUG_LEVEL=5 # Syscons debug level options SC_RENDER_DEBUG # syscons rendering debugging options SHOW_BUSYBUFS # List buffers that prevent root unmount options SIMPLELOCK_DEBUG options SLIP_IFF_OPTS options TIMER_FREQ="((14318182+6)/12)" options VFS_BIO_DEBUG # VFS buffer I/O debugging options VM_KMEM_SIZE options VM_KMEM_SIZE_MAX options VM_KMEM_SIZE_SCALE diff --git a/sys/i386/include/i4b_debug.h b/sys/i386/include/i4b_debug.h index 26bfa507b0f8..d9380f740099 100644 --- a/sys/i386/include/i4b_debug.h +++ b/sys/i386/include/i4b_debug.h @@ -1,304 +1,301 @@ /* - * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved. + * Copyright (c) 1997, 2001 Hellmuth Michaelis. 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. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. * *--------------------------------------------------------------------------- * * i4b_debug.h - i4b debug header file * ----------------------------------- * - * $Id: i4b_debug.h,v 1.32 2000/07/24 12:22:08 hm Exp $ - * * $FreeBSD$ * - * last edit-date: [Wed Oct 18 09:48:16 2000] + * last edit-date: [Mon May 21 10:05:34 2001] * *---------------------------------------------------------------------------*/ #if !defined DO_I4B_DEBUG # define DO_I4B_DEBUG 1 /* default = include debugging code */ #elif DO_I4B_DEBUG != 0 # undef DO_I4B_DEBUG # define DO_I4B_DEBUG 1 #endif #undef DO_I4B_MAXDEBUG /* default = disable ALL debug messages */ #if DO_I4B_DEBUG extern unsigned int i4b_l1_debug; extern unsigned int i4b_l2_debug; extern unsigned int i4b_l3_debug; extern unsigned int i4b_l4_debug; #define NDBGL1(bits, fmt, args...) \ if(bits & i4b_l1_debug) \ { printf("i4b-L1 %s: " fmt "\n", __FUNCTION__ , ##args ); } #define NDBGL2(bits, fmt, args...) \ if(bits & i4b_l2_debug) \ { printf("i4b-L2 %s: " fmt "\n", __FUNCTION__ , ##args ); } #define NDBGL3(bits, fmt, args...) \ if(bits & i4b_l3_debug) \ { printf("i4b-L3 %s: " fmt "\n", __FUNCTION__ , ##args ); } #define NDBGL4(bits, fmt, args...) \ if(bits & i4b_l4_debug) \ { printf("i4b-L4 %s: " fmt "\n", __FUNCTION__ , ##args ); } #else /* !DO_I4B_DEBUG */ #define NDBGL1(bits, fmt, args...); #define NDBGL2(bits, fmt, args...); #define NDBGL3(bits, fmt, args...); #define NDBGL4(bits, fmt, args...); #endif /* DO_I4B_DEBUG */ /* Layer 1 */ #define L1_ERROR 0x000001 /* general error message*/ #define L1_PRIM 0x000002 /* interlayer primitives*/ #define L1_BCHAN 0x000004 /* B channel action */ #define L1_H_ERR 0x000008 /* HSCX errors */ #define L1_H_IRQ 0x000010 /* HSCX IRQ messages */ #define L1_I_ERR 0x000020 /* ISAC errors */ #define L1_I_MSG 0x000040 /* ISAC messages */ #define L1_I_SETUP 0x000080 /* ISAC setup messages */ #define L1_F_MSG 0x000100 /* FSM messages */ #define L1_F_ERR 0x000200 /* FSM error messages */ #define L1_T_MSG 0x000400 /* Timer messages */ #define L1_T_ERR 0x000800 /* Timer error messages */ #define L1_H_XFRERR 0x001000 /* HSCX data xfer error */ #define L1_I_CICO 0x002000 /* ISAC command in/out */ #define L1_S_MSG 0x004000 /* silent messages (soft-HDLC) */ #define L1_S_ERR 0x008000 /* error messages (soft-HDLC) */ #define L1_HFC_DBG 0x010000 /* HFC-S PCI messages */ #define L1_DEBUG_MAX 0x01ffef /* all messages on except IRQ! */ #define L1_DEBUG_ERR (L1_S_ERR | L1_H_ERR | L1_I_ERR | L1_F_ERR | L1_T_ERR | L1_ERROR) #ifndef L1_DEBUG_DEFAULT #ifdef DO_I4B_MAXDEBUG #define L1_DEBUG_DEFAULT L1_DEBUG_MAX #else #define L1_DEBUG_DEFAULT L1_DEBUG_ERR #endif #endif /* Layer 2 */ #define L2_ERROR 0x0001 /* general error message */ #define L2_PRIM 0x0002 /* interlayer primitives */ #define L2_U_MSG 0x0004 /* U frame messages */ #define L2_U_ERR 0x0008 /* U frame error messages */ #define L2_S_MSG 0x0010 /* S frame messages */ #define L2_S_ERR 0x0020 /* S frame error messages */ #define L2_I_MSG 0x0040 /* I frame messages */ #define L2_I_ERR 0x0080 /* I frame error messages */ #define L2_F_MSG 0x0100 /* FSM messages */ #define L2_F_ERR 0x0200 /* FSM error messages */ #define L2_T_MSG 0x0400 /* timer messages */ #define L2_T_ERR 0x0800 /* timer error messages */ #define L2_TEI_MSG 0x1000 /* TEI messages */ #define L2_TEI_ERR 0x2000 /* TEI error messages */ #define L2_DEBUG_MAX 0x3fff /* all messages on */ #define L2_DEBUG_ERR (L2_ERROR | L2_I_ERR | L2_F_ERR | L2_T_ERR | L2_S_ERR | L2_TEI_ERR | L2_U_ERR ) #ifndef L2_DEBUG_DEFAULT #ifdef DO_I4B_MAXDEBUG #define L2_DEBUG_DEFAULT L2_DEBUG_MAX #else #define L2_DEBUG_DEFAULT L2_DEBUG_ERR #endif #endif /* Layer 3 */ #define L3_ERR 0x0001 /* general error message */ #define L3_MSG 0x0002 /* general message */ #define L3_F_MSG 0x0004 /* FSM messages */ #define L3_F_ERR 0x0008 /* FSM error messages */ #define L3_T_MSG 0x0010 /* timer messages */ #define L3_T_ERR 0x0020 /* timer error messages */ #define L3_P_MSG 0x0040 /* protocol messages */ #define L3_P_ERR 0x0080 /* protocol error messages */ #define L3_A_MSG 0x0100 /* AOC messages */ #define L3_A_ERR 0x0200 /* AOC error messages */ #define L3_PRIM 0x0400 /* messages exchanged */ #define L3_DEBUG_MAX 0x07ff /* all messages on */ #define L3_DEBUG_ERR (L3_ERR | L3_F_ERR | L3_T_ERR | L3_P_ERR | L3_A_ERR) #ifndef L3_DEBUG_DEFAULT #ifdef DO_I4B_MAXDEBUG #define L3_DEBUG_DEFAULT L3_DEBUG_MAX #else #define L3_DEBUG_DEFAULT L3_DEBUG_ERR #endif #endif /* Layer 4 */ #define L4_ERR 0x0001 /* general error message */ #define L4_MSG 0x0002 /* general message */ #define L4_TIMO 0x0004 /* b channel idle timeout msgs */ #define L4_DIALST 0x0008 /* network driver dial states */ #define L4_IPRDBG 0x0010 /* ipr driver debug messages */ #define L4_RBCHDBG 0x0020 /* rbch driver debug messages */ #define L4_ISPDBG 0x0040 /* isp driver debug messages */ #define L4_TELDBG 0x0080 /* tel driver debug messages */ -#define L4_TINADBG 0x0100 /* tina driver debug messages */ -#define L4_TINAMSG 0x0200 /* tina driver messages */ -#define L4_TINAERR 0x0400 /* tina driver error messages */ -#define L4_INGDBG 0x0800 /* ing driver debug messages */ +#define L4_INGDBG 0x0100 /* ing driver debug messages */ +#define L4_IAVCDBG 0x0200 /* AVM B1 driver debug messages */ +#define L4_CAPIDBG 0x0400 /* CAPI driver debug messages */ #define L4_DEBUG_MAX 0x0fff /* all messages on */ -#define L4_DEBUG_ERR (L4_ERR | L4_TINADBG | L4_TINAMSG | L4_TINAERR) +#define L4_DEBUG_ERR L4_ERR #ifndef L4_DEBUG_DEFAULT #ifdef DO_I4B_MAXDEBUG #define L4_DEBUG_DEFAULT L4_DEBUG_MAX #else #define L4_DEBUG_DEFAULT L4_DEBUG_ERR #endif #endif /*---------------------------------------------------------------------------* * ioctl via /dev/i4bctl: * get/set current debug bits settings *---------------------------------------------------------------------------*/ typedef struct { unsigned int l1; unsigned int l2; unsigned int l3; unsigned int l4; } ctl_debug_t; #define I4B_CTL_GET_DEBUG _IOR('C', 0, ctl_debug_t) #define I4B_CTL_SET_DEBUG _IOW('C', 1, ctl_debug_t) /*---------------------------------------------------------------------------* * generic get chipset statistics *---------------------------------------------------------------------------*/ /* for the ihfc-driver: structure for HFC-1/S/SP statistics */ typedef struct { int txframes; int rxframes; int xdu; int rdo; int crc; int rab; } hfcstat_t; /* for the isic-driver: structure for HSCX statistics */ typedef struct { int unit; /* controller number */ int chan; /* channel number */ int vfr; int rdo; int crc; int rab; int xdu; int rfo; } hscxstat_t; /* generic statistics structure */ struct chipstat { int driver_type; /* type, L1DRVR_XXXX */ int driver_unit; /* the unit number */ int driver_bchannel; /* the B-channel */ union stats { /* union for all drivers */ hfcstat_t hfcstat; /* for ihfc driver, L1DRVR_IHFC */ hscxstat_t hscxstat; /* for isic driver, L1DRVR_ISIC */ } stats; }; /* get statistics */ #define I4B_CTL_GET_CHIPSTAT _IOWR('C', 2, struct chipstat) /* clear statistics */ #define I4B_CTL_CLR_CHIPSTAT _IOW('C', 3, struct chipstat) /*---------------------------------------------------------------------------* * get LAPD/Q.921 statistics *---------------------------------------------------------------------------*/ typedef struct { /* transmit */ u_long tx_i; /* I */ u_long tx_rr; /* RR */ u_long tx_rnr; /* RNR */ u_long tx_rej; /* REJ */ u_long tx_sabme; /* SABME*/ u_long tx_dm; /* DM */ u_long tx_disc; /* DISC */ u_long tx_ua; /* UA */ u_long tx_frmr; /* FRMR */ u_long tx_tei; /* TEI */ /* receive */ u_long rx_i; /* I */ u_long rx_rr; /* RR */ u_long rx_rnr; /* RNR */ u_long rx_rej; /* REJ */ u_long rx_sabme; /* SABME*/ u_long rx_tei; /* TEI */ u_long rx_ui; /* UI */ u_long rx_disc; /* DISC */ u_long rx_xid; /* XID */ u_long rx_dm; /* DM */ u_long rx_ua; /* UA */ u_long rx_frmr; /* FRMR */ /* errors */ u_long err_rx_len; /* incorrect length */ u_long err_rx_badf; /* bad frame type */ u_long err_rx_bads; /* bad s frame */ u_long err_rx_badu; /* bad u frame */ u_long err_rx_badui; /* bad ui frame */ } lapdstat_t; typedef struct { int unit; lapdstat_t lapdstat; } l2stat_t; #define I4B_CTL_GET_LAPDSTAT _IOWR('C', 4, l2stat_t) #define I4B_CTL_CLR_LAPDSTAT _IOW('C', 5, int) /* EOF */ diff --git a/sys/i386/include/i4b_ioctl.h b/sys/i386/include/i4b_ioctl.h index 8070f3ef2058..d357326b65ab 100644 --- a/sys/i386/include/i4b_ioctl.h +++ b/sys/i386/include/i4b_ioctl.h @@ -1,700 +1,710 @@ /* * Copyright (c) 1997, 2001 Hellmuth Michaelis. 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. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. * *--------------------------------------------------------------------------- * * i4b_ioctl.h - messages kernel <--> userland * ------------------------------------------- * * $FreeBSD$ * - * last edit-date: [Fri Jan 26 13:46:50 2001] + * last edit-date: [Fri May 25 10:04:37 2001] * *---------------------------------------------------------------------------*/ #ifndef _I4B_IOCTL_H_ #define _I4B_IOCTL_H_ #if defined(__FreeBSD__) && __FreeBSD__ >= 3 #ifndef _MACHINE_TYPES_H_ #include #endif /* _MACHINE_TYPES_H_ */ #endif /* __FreeBSD__ */ /*---------------------------------------------------------------------------* * version and release number for isdn4bsd package *---------------------------------------------------------------------------*/ -#define VERSION 0 /* version number */ -#define REL 96 /* release number */ -#define STEP 3 /* release step */ +#define VERSION 1 /* version number */ +#define REL 0 /* release number */ +#define STEP 0 /* release step */ /*---------------------------------------------------------------------------* * date/time format in i4b log messages * ------------------------------------ * Being year 2000 clean is not easy with the current state of the * ANSI C library standard and it's implementation for some locales. * You might like to use the "%c" format of "strftime" sometimes, * but this breaks Y2K in some locales. Also the old standard logfile * format "%d.%m.%y %H:%M:%S" is non compliant. * NetBSD's current toolset warns about this problems, and we compile * with -Werror, so this problems need to be resolved. *---------------------------------------------------------------------------*/ #define I4B_TIME_FORMAT "%d.%m.%Y %H:%M:%S" /*---------------------------------------------------------------------------* * max number of controllers in system *---------------------------------------------------------------------------*/ #define MAX_CONTROLLERS 8 /* max number of controllers */ /*---------------------------------------------------------------------------* * ISDN D-channel protocols *---------------------------------------------------------------------------*/ #define PROTOCOL_DSS1 0 /* default, Euro-ISDN/DSS1 */ #define PROTOCOL_D64S 1 /* 64k leased line, no protocol */ /*---------------------------------------------------------------------------* * controller types *---------------------------------------------------------------------------*/ #define CTRL_INVALID (-1) /* invalid, error */ #define CTRL_UNKNOWN 0 /* unknown controller type */ #define CTRL_PASSIVE 1 /* passive ISDN controller cards*/ #define CTRL_DAIC 2 /* Diehl active controller cards*/ #define CTRL_TINADD 3 /* Stollmann Tina-dd active card*/ #define CTRL_AVMB1 4 /* AVM B1 active card */ -#define CTRL_NUMTYPES 5 /* number of controller types */ +#define CTRL_CAPI 5 /* cards seen via the CAPI layer*/ +#define CTRL_NUMTYPES 6 /* number of controller types */ /*---------------------------------------------------------------------------* * CTRL_PASSIVE: driver types *---------------------------------------------------------------------------*/ #define MAXL1UNITS 8 /* max number of units */ #define L1DRVR_ISIC 0 /* isic - driver */ #define L1DRVR_IWIC 1 /* iwic - driver */ #define L1DRVR_IFPI 2 /* ifpi - driver */ #define L1DRVR_IHFC 3 /* ihfc - driver */ #define L1DRVR_IFPNP 4 /* ifpnp - driver */ #define L1DRVR_ICCHP 5 /* icchp - driver */ #define L1DRVR_ITJC 6 /* itjc - driver */ /* MAXL1DRVR MUST be updated when more passive drivers are added !!! */ #define MAXL1DRVR (L1DRVR_ITJC + 1) /*---------------------------------------------------------------------------* * card types for CTRL_PASSIVE *---------------------------------------------------------------------------*/ #define CARD_TYPEP_INVAL (-1) /* invalid, error */ #define CARD_TYPEP_UNK 0 /* unknown */ #define CARD_TYPEP_8 1 /* Teles, S0/8 */ #define CARD_TYPEP_16 2 /* Teles, S0/16 */ #define CARD_TYPEP_16_3 3 /* Teles, S0/16.3 */ #define CARD_TYPEP_AVMA1 4 /* AVM A1 or AVM Fritz!Card */ #define CARD_TYPEP_163P 5 /* Teles, S0/16.3 PnP */ #define CARD_TYPEP_CS0P 6 /* Creatix, S0 PnP */ #define CARD_TYPEP_USRTA 7 /* US Robotics ISDN TA internal */ #define CARD_TYPEP_DRNNGO 8 /* Dr. Neuhaus Niccy GO@ */ #define CARD_TYPEP_SWS 9 /* Sedlbauer Win Speed */ #define CARD_TYPEP_DYNALINK 10 /* Dynalink IS64PH */ #define CARD_TYPEP_BLMASTER 11 /* ISDN Blaster / ISDN Master */ #define CARD_TYPEP_PCFRITZ 12 /* AVM PCMCIA Fritz!Card */ #define CARD_TYPEP_ELSAQS1ISA 13 /* ELSA QuickStep 1000pro ISA */ #define CARD_TYPEP_ELSAQS1PCI 14 /* ELSA QuickStep 1000pro PCI */ #define CARD_TYPEP_SIEMENSITALK 15 /* Siemens I-Talk */ #define CARD_TYPEP_ELSAMLIMC 16 /* ELSA MicroLink ISDN/MC */ #define CARD_TYPEP_ELSAMLMCALL 17 /* ELSA MicroLink MCall */ #define CARD_TYPEP_ITKIX1 18 /* ITK ix1 micro */ #define CARD_TYPEP_AVMA1PCI 19 /* AVM FRITZ!CARD PCI */ #define CARD_TYPEP_PCC16 20 /* ELSA PCC-16 */ #define CARD_TYPEP_AVM_PNP 21 /* AVM FRITZ!CARD PnP */ #define CARD_TYPEP_SIE_ISURF2 22 /* Siemens I-Surf 2 PnP */ #define CARD_TYPEP_ASUSCOMIPAC 23 /* Asuscom ISDNlink 128 K PnP */ #define CARD_TYPEP_WINB6692 24 /* Winbond W6692 based */ #define CARD_TYPEP_16_3C 25 /* Teles S0/16.3c PnP (HFC-S/SP */ #define CARD_TYPEP_ACERP10 26 /* Acer ISDN P10 (HFC-S) */ #define CARD_TYPEP_TELEINT_NO_1 27 /* TELEINT ISDN SPEED No. 1 (HFC-1) */ #define CARD_TYPEP_CCD_HFCS_PCI 28 /* Cologne Chip HFC-S PCI based */ #define CARD_TYPEP_NETJET_S 29 /* Traverse NetJet-S (Tiger300) */ #define CARD_TYPEP_DIVA_ISA 30 /* Eicon DIVA ISA PnP 2.0 or 2.02 */ /* * in case you add support for more cards, please update: * * isdnd: controller.c, name_of_controller() * * and adjust CARD_TYPEP_MAX below. */ #define CARD_TYPEP_MAX 30 /* max type */ /*---------------------------------------------------------------------------* * card types for CTRL_DAIC *---------------------------------------------------------------------------*/ #define CARD_TYPEA_DAIC_UNK 0 #define CARD_TYPEA_DAIC_S 1 #define CARD_TYPEA_DAIC_SX 2 #define CARD_TYPEA_DAIC_SCOM 3 #define CARD_TYPEA_DAIC_QUAD 4 +/*---------------------------------------------------------------------------* + * card types for CTRL_CAPI + *---------------------------------------------------------------------------*/ +#define CARD_TYPEC_CAPI_UNK 0 +#define CARD_TYPEC_AVM_T1_PCI 1 +#define CARD_TYPEC_AVM_B1_PCI 2 +#define CARD_TYPEC_AVM_B1_ISA 3 + /*---------------------------------------------------------------------------* * max length of some strings *---------------------------------------------------------------------------*/ #define TELNO_MAX 41 /* max length of a telephone number (+ '\0') */ #define DISPLAY_MAX 91 /* max length of display information (+ '\0') */ #define DATETIME_MAX 21 /* max length of datetime information (+ '\0')*/ /*---------------------------------------------------------------------------* * in case the src or dst telephone number is empty *---------------------------------------------------------------------------*/ #define TELNO_EMPTY "NotAvailable" /*---------------------------------------------------------------------------* * B channel parameters *---------------------------------------------------------------------------*/ #define BCH_MAX_DATALEN 2048 /* max length of a B channel frame */ /*---------------------------------------------------------------------------* * userland driver types * --------------------- * a "driver" is defined here as a piece of software interfacing an * ISDN B channel with a userland service, such as IP, Telephony etc. *---------------------------------------------------------------------------*/ #define BDRV_RBCH 0 /* raw b-channel interface driver */ #define BDRV_TEL 1 /* telephone (speech) interface driver */ #define BDRV_IPR 2 /* IP over raw HDLC interface driver */ #define BDRV_ISPPP 3 /* sync Kernel PPP interface driver */ #define BDRV_IBC 4 /* BSD/OS point to point driver */ #define BDRV_ING 5 /* NetGraph ing driver */ /*---------------------------------------------------------------------------* * B channel protocol *---------------------------------------------------------------------------*/ #define BPROT_NONE 0 /* no protocol at all, raw data */ #define BPROT_RHDLC 1 /* raw HDLC: flag, data, crc, flag */ /*---------------------------------------------------------------------------* * causes data type *---------------------------------------------------------------------------*/ typedef unsigned int cause_t; /* 32 bit unsigned int */ /*---------------------------------------------------------------------------* * call descriptor id (cdid) definitions *---------------------------------------------------------------------------*/ #define CDID_UNUSED 0 /* cdid is invalid and unused */ #define CDID_MAX 99999 /* highest valid cdid, wraparound to 1 */ /*---------------------------------------------------------------------------* * The shorthold algorithm to use *---------------------------------------------------------------------------*/ #define SHA_FIXU 0 /* timeout algorithm for fix unit charging */ #define SHA_VARU 1 /* timeout algorithm for variable unit charging */ /*---------------------------------------------------------------------------* * The shorthold data struct *---------------------------------------------------------------------------*/ typedef struct { int shorthold_algorithm; /* shorthold algorithm to use */ int unitlen_time; /* length of a charging unit */ int idle_time; /* time without activity on b ch*/ int earlyhup_time; /* safety area at end of unit */ } msg_shorthold_t; /**************************************************************************** outgoing call: -------------- userland kernel -------- ------ CDID_REQ -----------------> <------------------ cdid CONNECT_REQ --------------> <------------------ PROCEEDING_IND (if connect req ok) <------------------ CONNECT_ACTIVE_IND (if connection ok) or <------------------ DISCONNECT_IND (if connection failed) incoming call: -------------- userland kernel -------- ------ <------------------ CONNECT_IND CONNECT_RESP -------------> <------------------ CONNECT_ACTIVE_IND (if accepted) active disconnect: ------------------ userland kernel -------- ------ DISCONNECT_REQ ------------> <------------------ DISCONNECT_IND passive disconnect: ------------------- userland kernel -------- ------ <------------------ DISCONNECT_IND ****************************************************************************/ /*===========================================================================* *===========================================================================* * "read" messages from kernel -> userland *===========================================================================* *===========================================================================*/ /*---------------------------------------------------------------------------* * message header, included in every message *---------------------------------------------------------------------------*/ typedef struct { char type; /* message identifier */ #define MSG_CONNECT_IND 'a' #define MSG_CONNECT_ACTIVE_IND 'b' #define MSG_DISCONNECT_IND 'c' #define MSG_DIALOUT_IND 'd' #define MSG_IDLE_TIMEOUT_IND 'e' #define MSG_ACCT_IND 'f' #define MSG_CHARGING_IND 'g' #define MSG_PROCEEDING_IND 'h' #define MSG_ALERT_IND 'i' #define MSG_DRVRDISC_REQ 'j' #define MSG_L12STAT_IND 'k' #define MSG_TEIASG_IND 'l' #define MSG_PDEACT_IND 'm' #define MSG_NEGCOMP_IND 'n' #define MSG_IFSTATE_CHANGED_IND 'o' #define MSG_DIALOUTNUMBER_IND 'p' #define MSG_PACKET_IND 'q' int cdid; /* call descriptor id */ } msg_hdr_t; /*---------------------------------------------------------------------------* * connect indication * indicates incoming connection *---------------------------------------------------------------------------*/ typedef struct { msg_hdr_t header; /* common header */ int controller; /* controller number */ int channel; /* channel number */ #define CHAN_B1 0 /* this _must_ be 0, HSCX B1 is also 0 */ #define CHAN_B2 1 /* this _must_ be 1, HSCX B2 is also 1 */ #define CHAN_ANY (-1) /* outgoing, not possible for incoming */ #define CHAN_NO (-2) /* call waiting (CW) for incoming */ int bprot; /* b channel protocot, see BPROT_XXX */ char dst_telno[TELNO_MAX]; /* destination telno */ char src_telno[TELNO_MAX]; /* source telno */ int scr_ind;/* screening indicator */ #define SCR_NONE 0 /* no screening indicator transmitted */ #define SCR_USR_NOSC 1 /* screening user provided, not screened*/ #define SCR_USR_PASS 2 /* screening user provided, verified & passed */ #define SCR_USR_FAIL 3 /* screening user provided, verified & failed */ #define SCR_NET 4 /* screening network provided */ int prs_ind;/* presentation indicator */ #define PRS_NONE 0 /* no presentation indicator transmitted*/ #define PRS_ALLOWED 1 /* presentation allowed */ #define PRS_RESTRICT 2 /* presentation restricted */ #define PRS_NNINTERW 3 /* number not available due to interworking */ #define PRS_RESERVED 4 /* reserved */ char display[DISPLAY_MAX]; /* content of display IE*/ } msg_connect_ind_t; /*---------------------------------------------------------------------------* * connect active indication * indicates active connection *---------------------------------------------------------------------------*/ typedef struct { msg_hdr_t header; /* common header */ int controller; /* controller number actually used */ int channel; /* channel number actually used */ char datetime[DATETIME_MAX]; /* content of date/time IE */ } msg_connect_active_ind_t; /*---------------------------------------------------------------------------* * disconnect indication * indicates a disconnect *---------------------------------------------------------------------------*/ typedef struct { msg_hdr_t header; /* common header */ cause_t cause; /* cause code */ } msg_disconnect_ind_t; /*---------------------------------------------------------------------------* * negotiation complete * indicates an interface is completely up & running *---------------------------------------------------------------------------*/ typedef struct { msg_hdr_t header; /* common header */ } msg_negcomplete_ind_t; /*---------------------------------------------------------------------------* * interface changes internal state * indicates an interface has somehow switched its FSM *---------------------------------------------------------------------------*/ typedef struct { msg_hdr_t header; /* common header */ int state; /* new interface state */ } msg_ifstatechg_ind_t; /*---------------------------------------------------------------------------* * initiate a call to a remote site * i.e. the IP driver got a packet and wants a connection *---------------------------------------------------------------------------*/ typedef struct { msg_hdr_t header; /* common header */ int driver; /* driver type */ int driver_unit; /* driver unit number */ } msg_dialout_ind_t; /*---------------------------------------------------------------------------* * dial a number *---------------------------------------------------------------------------*/ typedef struct { msg_hdr_t header; /* common header */ int driver; /* driver type */ int driver_unit; /* driver unit number */ int cmdlen; /* length of string */ char cmd[TELNO_MAX]; /* the number to dial */ } msg_dialoutnumber_ind_t; /*---------------------------------------------------------------------------* * idle timeout disconnect sent indication * kernel has sent disconnect request because of b-ch idle *---------------------------------------------------------------------------*/ typedef struct { msg_hdr_t header; /* common header */ } msg_idle_timeout_ind_t; /*---------------------------------------------------------------------------* * accounting information from userland interface driver to daemon *---------------------------------------------------------------------------*/ typedef struct { msg_hdr_t header; /* common header */ int accttype; /* accounting type */ #define ACCT_DURING 0 #define ACCT_FINAL 1 int driver; /* driver type */ int driver_unit; /* driver unit number */ int ioutbytes; /* ISDN # of bytes sent */ int iinbytes; /* ISDN # of bytes received */ int outbps; /* bytes per sec out */ int inbps; /* bytes per sec in */ int outbytes; /* driver # of bytes sent */ int inbytes; /* driver # of bytes received */ } msg_accounting_ind_t; /*---------------------------------------------------------------------------* * charging information from isdn driver to daemon *---------------------------------------------------------------------------*/ typedef struct { msg_hdr_t header; /* common header */ int units; /* number of units */ int units_type; /* type of units info */ #define CHARGE_INVALID 0 /* invalid, unknown */ #define CHARGE_AOCD 1 /* advice of charge during call */ #define CHARGE_AOCE 2 /* advice of charge at end of call */ #define CHARGE_CALC 3 /* locally calculated from rates information */ } msg_charging_ind_t; /*---------------------------------------------------------------------------* * call proceeding indication * indicates outgoing SETUP has been acknowleged *---------------------------------------------------------------------------*/ typedef struct { msg_hdr_t header; /* common header */ int controller; /* controller number actually used */ int channel; /* channel number actually used */ } msg_proceeding_ind_t; /*---------------------------------------------------------------------------* * alert indication * indicates remote user side "rings" *---------------------------------------------------------------------------*/ typedef struct { msg_hdr_t header; /* common header */ } msg_alert_ind_t; /*---------------------------------------------------------------------------* * driver requests to disconnect line *---------------------------------------------------------------------------*/ typedef struct { msg_hdr_t header; /* common header */ int driver; /* driver type */ int driver_unit; /* driver unit number */ } msg_drvrdisc_req_t; /*---------------------------------------------------------------------------* * connect packet logging *---------------------------------------------------------------------------*/ typedef struct { msg_hdr_t header; /* common header */ int driver; /* driver type */ int driver_unit; /* driver unit number */ int direction; /* 0=in 1=out */ #define DIRECTION_IN 0 /* sending packet to remote */ #define DIRECTION_OUT 1 /* received packet from remote */ #define MAX_PACKET_LOG 40 /* space for IP and TCP header */ u_int8_t pktdata[MAX_PACKET_LOG]; } msg_packet_ind_t; /*---------------------------------------------------------------------------* * state of layer 1/2 *---------------------------------------------------------------------------*/ typedef struct { msg_hdr_t header; /* common header */ int controller; /* controller unit */ int layer; /* layer number (1/2) */ #define LAYER_ONE 1 #define LAYER_TWO 2 int state; /* state info */ #define LAYER_IDLE 0 #define LAYER_ACTIVE 1 } msg_l12stat_ind_t; /*---------------------------------------------------------------------------* * TEI assignment messages *---------------------------------------------------------------------------*/ typedef struct { msg_hdr_t header; /* common header */ int controller; /* controller unit */ int tei; /* TEI or -1 if invalid */ } msg_teiasg_ind_t; /*---------------------------------------------------------------------------* * persistent deactivation state of stack *---------------------------------------------------------------------------*/ typedef struct { msg_hdr_t header; /* common header */ int controller; /* controller unit */ int numactive; /* number of active connections */ } msg_pdeact_ind_t; /*===========================================================================* *===========================================================================* * "ioctl" messages from userland -> kernel *===========================================================================* *===========================================================================*/ /*---------------------------------------------------------------------------* * request a unique cdid (to setup an outgoing call) *---------------------------------------------------------------------------*/ typedef struct { int cdid; /* call descriptor id */ } msg_cdid_req_t; #define I4B_CDID_REQ _IOWR('4', 0, int) /*---------------------------------------------------------------------------* * connect request * requests an outgoing connection *---------------------------------------------------------------------------*/ typedef struct { int cdid; /* call descriptor id */ int controller; /* controller to use */ int channel; /* channel to use */ int txdelay; /* tx delay after connect */ int bprot; /* b channel protocol */ int driver; /* driver to route b channel data to */ int driver_unit; /* unit number for above driver */ msg_shorthold_t shorthold_data; /* the shorthold data */ int unitlen_method; /* how to calculate the unitlength */ #define ULEN_METHOD_STATIC 0 /* use unitlen_time value (see above) */ #define ULEN_METHOD_DYNAMIC 1 /* use AOCD */ char dst_telno[TELNO_MAX]; /* destination telephone no */ char src_telno[TELNO_MAX]; /* source telephone number */ } msg_connect_req_t; #define I4B_CONNECT_REQ _IOW('4', 1, msg_connect_req_t) /*---------------------------------------------------------------------------* * connect response * this is the answer to an incoming connect indication *---------------------------------------------------------------------------*/ typedef struct { int cdid; /* call descriptor id */ int response; /* what to do with incoming call */ #define SETUP_RESP_DNTCRE 0 /* dont care, call is not for me */ #define SETUP_RESP_REJECT 1 /* reject call */ #define SETUP_RESP_ACCEPT 2 /* accept call */ cause_t cause; /* cause for case SETUP_RESP_REJECT */ /* the following are only used for SETUP_RESP_ACCEPT !! */ int txdelay; /* tx delay after connect */ int bprot; /* B chan protocol */ int driver; /* driver to route b channel data to */ int driver_unit; /* unit number for above driver */ int max_idle_time; /* max time without activity on b ch */ } msg_connect_resp_t; #define I4B_CONNECT_RESP _IOW('4', 2, msg_connect_resp_t) /*---------------------------------------------------------------------------* * disconnect request * active disconnect request *---------------------------------------------------------------------------*/ typedef struct { int cdid; /* call descriptor id */ cause_t cause; /* protocol independent cause */ } msg_discon_req_t; #define I4B_DISCONNECT_REQ _IOW('4', 3, msg_discon_req_t) /*---------------------------------------------------------------------------* * controller info request *---------------------------------------------------------------------------*/ typedef struct { int controller; /* controller number */ int ncontroller; /* number of controllers in system */ int ctrl_type; /* controller type passive/active */ int card_type; /* brand / version */ int tei; /* tei controller probably has */ + int nbch; /* number of b channels provided */ } msg_ctrl_info_req_t; #define I4B_CTRL_INFO_REQ _IOWR('4', 4, msg_ctrl_info_req_t) /*---------------------------------------------------------------------------* * dialout response * status report to driver who requested a dialout *---------------------------------------------------------------------------*/ typedef struct { int driver; /* driver to route b channel data to */ int driver_unit; /* unit number for above driver */ int stat; /* state of dialout request */ #define DSTAT_NONE 0 #define DSTAT_TFAIL 1 /* transient failure */ #define DSTAT_PFAIL 2 /* permanent failure */ #define DSTAT_INONLY 3 /* no outgoing dials allowed */ cause_t cause; /* exact i4b cause */ } msg_dialout_resp_t; #define I4B_DIALOUT_RESP _IOW('4', 5, msg_dialout_resp_t) /*---------------------------------------------------------------------------* * timeout value update *---------------------------------------------------------------------------*/ typedef struct { int cdid; /* call descriptor id */ msg_shorthold_t shorthold_data; } msg_timeout_upd_t; #define I4B_TIMEOUT_UPD _IOW('4', 6, msg_timeout_upd_t) /*---------------------------------------------------------------------------* * soft enable/disable *---------------------------------------------------------------------------*/ typedef struct { int driver; /* driver to route b channel data to */ int driver_unit; /* unit number for above driver */ int updown; /* what to do */ #define SOFT_ENA 0 /* enable interface */ #define SOFT_DIS 1 /* disable interface */ } msg_updown_ind_t; #define I4B_UPDOWN_IND _IOW('4', 7, msg_updown_ind_t) /*---------------------------------------------------------------------------* * send alert request *---------------------------------------------------------------------------*/ typedef struct { int cdid; /* call descriptor id */ } msg_alert_req_t; #define I4B_ALERT_REQ _IOW('4', 8, msg_alert_req_t) /*---------------------------------------------------------------------------* * request version and release info from kernel part * (msg_vr_req_t is also used by tel & rbch drivers) *---------------------------------------------------------------------------*/ typedef struct { int version; /* version number */ int release; /* release number */ int step; /* release step number */ } msg_vr_req_t; #define I4B_VR_REQ _IOR('4', 9, msg_vr_req_t) /*---------------------------------------------------------------------------* * set ISDN protocol used by a controller *---------------------------------------------------------------------------*/ typedef struct { int controller; /* controller number */ int protocol; /* ISDN D-channel protocol type */ } msg_prot_ind_t; #define I4B_PROT_IND _IOW('4', 10, msg_prot_ind_t) /*---------------------------------------------------------------------------* * Protocol download to active cards *---------------------------------------------------------------------------*/ struct isdn_dr_prot { size_t bytecount; /* length of code */ u_int8_t *microcode; /* pointer to microcode */ }; struct isdn_download_request { int controller; /* controller number */ int numprotos; /* number of protocols in 'protocols' */ struct isdn_dr_prot *protocols; }; #define I4B_CTRL_DOWNLOAD _IOW('4', 100, struct isdn_download_request) /*---------------------------------------------------------------------------* * Generic diagnostic interface for active cards *---------------------------------------------------------------------------*/ struct isdn_diagnostic_request { int controller; /* controller number */ u_int32_t cmd; /* diagnostic command to execute */ size_t in_param_len; /* length of additional input parameter */ void *in_param; /* optional input parameter */ size_t out_param_len; /* available output space */ void *out_param; /* output data goes here */ }; #define I4B_ACTIVE_DIAGNOSTIC _IOW('4', 102, struct isdn_diagnostic_request) #endif /* _I4B_IOCTL_H_ */ diff --git a/sys/i4b/capi/README b/sys/i4b/capi/README new file mode 100644 index 000000000000..91685258e161 --- /dev/null +++ b/sys/i4b/capi/README @@ -0,0 +1,150 @@ +$FreeBSD$ + +Message-ID: <3AF56886.7D92609A@cubical.fi> +Date: Sun, 06 May 2001 18:06:47 +0300 +From: Juha-Matti Liukkonen +Organization: Cubical Solutions Ltd + +Please find the attached diff and tarball for our support software for +CAPI 2.0 and AVM's active T1 and T1-B (primary rate) and B1 (basic rate) +ISDN adapters for isdn4bsd. The implementation has been made from +scratch by us, based on reverse engineering of the Linux driver provided +by AVM GmbH and available in ftp.avm.de. Cubical Solutions Ltd offers +this implementation for the BSD community free of charge and assuming +absolutely no liabilities whatsoever. Feel free to modify the +implementation any way you see fit, but please retain our one-liner +copyright statement somewhere in the comment headers in the capi and +iavc driver modules. + +That said, the attached tarball is i4b-00.96.00-beta with our +modifications integrated, and the diff contains all modifications we +have made to the original (including the new capi files). Our mods add +pseudo-device i4bcapi, which attaches to i4b layer 4, and device iavc0, +which implements a link layer driver for AVM's active B1 and T1 adapters +for i4bcapi. There are also a couple of related improvements to isdnd, +and a number of modifications to isdnd and layer 4 to implement support +for up to 30 channels per adapter (for primary rate use). + +We have developed the software explicitly for our telephony application, +to be used with AVM's T1 adapters, and the implementation has been +tested primarily with this functionality in mind. There may be +interesting side effects with eg. the ipr and isppp drivers; we do not +use them and therefore their testing has been cursory at best. The +i4btel driver works well with the T1 (our primary use), and the i4brbch +driver has been verified to work with T1, T1-B and B1 adapters (ftp'd +some files over a dialup PPP connection with each adapter). Only the PCI +versions of the adapters (equipped with the AMCC DMA controller) are +supported, although the basics (PIO mode communication) for the older +ISA model support is in place, so only the bus attachment modules should +be required to support the older hardware. + +All of the AVM active adapters use downloadable firmware, which is not +included in the attached package. The firmware files (t1.t4, t1b.t4, +b1.t4) can be found from ftp.avm.de in adapter specific subdirectories, +or from the CDs provided with the adapters (in directory +'cardware/firmware'). + +Our primary development platform is our own embedded build (we call it +'ebsd') based on FreeBSD 4.2-RELEASE. The implementation has also been +tested on standard FreeBSD 4.2-RELEASE system. The implementation should +not contain any FreeBSD (or even FreeBSD release) specific issues, but +it has not been tested or even compiled on any other platforms; +specifically, only the FreeBSD overinstall.sh script is modified to +install the capi/iavc support in the kernel source tree. + +This code is not under active development here since the functionality +we use (i4btel, T1) has been working since the beginning of March. We +are also not planning on any further development (no need seen at this +point), but I am naturally interested on whatever bugs and development +ideas pop up on the community and will keep a keen eye on the isdn +mailing list. I personally may be available for consultation, debugging +and possibly development projects, but with notable reservations on my +time (the current IT industry recession seems to be pushing even more +work for us, which tends to keep us pretty busy these days). + +Here are some specific technical notes: + +* isdnd supports new keyword 'firmware=' in section +'controller'. This keyword is supported for all controller types, and +causes I4B_CTRL_DOWNLOAD ioctl to be invoked with the specified file as +an argument. In systems equipped with both active and passive adapters, +and the passive cards being detected first, dummy 'controller' entries +are required for the passive cards to get the correct firmwares to +correct adapters. (I hope you did not have other uses for this ioctl in +mind?) + +* isdnd supports new keyword 'clone=' in section 'entry'. +This causes the entry to be copied from the existing named entry. At +least entry specific 'name' and 'usrdeviceunit' values should be +specified after a 'clone'. (Makes configuring 30 or 60 entries way much +easier.) + +* a bug in i4btel driver read routine corrected. The conditions in the +while() clause caused the receive queue to be referenced before checking +if a channel is connected, leading to kernel panic (do a 'dd +if=/dev/i4btel0 of=/dev/null' on an unconnected tel device, panic will +follow). Correction was to reorder the while clause conditions to check +for connectedness first. + +* isdnd and i4b layer 4 support up to CHANNELS_MAX (=30) channels per +adapter. The msg_ctrl_info_req_t message reports the number of channels +provided by the adapter, the number is stored in the nbchan field of the +controller state structure. The fixed stateb1 and stateb2 entries in +controller state stuctures are replaced with an array, and all fixed +references there are replaced with loops up to nbchan. Passive stack +layer 1 and 2 are not modified, layer 3 sets this field to fixed value 2 +for all adapters (but it could be delegated to the layer 1 driver's +attach request). + +* the i4bcapi driver maps i4b channels to logical channels identified +with PLCI/NCCI values in the CAPI protocol using the sc_bchan[] array. +The PLCI/NCCI handling is merged in the channel mapping and is greatly +simplified from the reference state machine model, because in practice +there can be only one PLCI/NCCI per channel active at any given time. + +* the i4bcapi driver does not provide any kind of user level interface +(such as the /dev/capi20 interface provided by the linux driver), but +could relatively easily be extended to do so (and if done, interface +compatibility with the linux implementation would probably be a good +goal). + +* there are some gritty details in the iavc driver, inherited from the +linux code. Despite us being a legitimate company in the telecom +business, AVM failed to produce any programming reference material for +us (at least in a reasonable time frame), so some guesswork remains due +to classic reverse engineering process (particularly there are a few +magic numbers in the card initialization sequence whose meaning I do not +know). + +* pseudo-devices i4bq931, i4bq921 and some passive stack layer 1 driver +(such as iwic) are required to compile, as the required ctrl_desc[] +array is in layer 3, which requires layer 2, which requires layer 1. +Some architectural cleanup would come in handy here, but we did not want +to start making any major changes (and we use iwic in test setups +anyway, so we simply always compile it in). + +To summarize: unpack, overinstall, add the following lines (with the +usual passive stack configuration including at least one L1 driver) to +your kernel configuration file: + +pseudo-device "i4bcapi" +device iavc0 + +...and the following to your isdnd.rc: + +controller +firmware = /usr/lib/isdn/b1.t4 + +...compile your new kernel, make sure the firmware file is in +/usr/lib/isdn, and your B1 adapter should boot up and Just Work (tm). If +you have multiple adapters, you need a 'controller' section for each to +have them loaded and booted on isdnd startup. + +Have fun -- and let me know if there are any complications, or if I can +be of further assistance, + + - Juha +-- +Juha-Matti Liukkonen, Cubical Solutions Ltd +Phone: +358(0)405280142 +Email: jml@cubical.fi diff --git a/sys/i4b/capi/capi.h b/sys/i4b/capi/capi.h new file mode 100644 index 000000000000..185d2f7a5f8e --- /dev/null +++ b/sys/i4b/capi/capi.h @@ -0,0 +1,129 @@ +/* + * Copyright (c) 2001 Cubical Solutions Ltd. 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. + * + * capi/capi.h The CAPI device interface. + * + * $FreeBSD$ + */ + +#ifndef _I4B_CAPI_H_ +#define _I4B_CAPI_H_ + +/* +// CAPI driver context: B channels and controller softcs. +*/ + +#define INVALID -1 + +enum capi_b_state { + B_FREE, /* channel free, ncci invalid */ + B_CONNECT_CONF, /* wait for CONNECT_CONF */ + B_CONNECT_IND, /* IND got, wait for appl RESP */ + B_CONNECT_ACTIVE_IND, /* wait for CONNECT_ACTIVE_IND */ + B_CONNECT_B3_CONF, /* wait for CONNECT_B3_CONF */ + B_CONNECT_B3_IND, /* wait for CONNECT_B3_IND */ + B_CONNECT_B3_ACTIVE_IND, /* wait for CONNECT_B3_ACTIVE_IND */ + B_CONNECTED, /* channel connected & in use */ + B_DISCONNECT_CONF, /* wait for DISCONNECT_CONF */ + B_DISCONNECT_B3_CONF, /* wait for DISCONNECT_B3_CONF */ + B_DISCONNECT_IND, /* wait for DISCONNECT_IND */ +}; + +typedef struct capi_bchan +{ + /* Channel state */ + + int ncci; +#define CAPI_CTRL_MASK 0x000000ff +#define CAPI_PLCI_MASK 0x0000ffff +#define CAPI_NCCI_MASK 0xffff0000 + u_int16_t msgid; + int busy; + enum capi_b_state state; + + struct ifqueue tx_queue; + struct ifqueue rx_queue; + int rxcount; + int txcount; + + /* The rest is needed for i4b integration */ + + int bprot; + int cdid; + + struct mbuf *in_mbuf; + isdn_link_t capi_isdn_linktab; + drvr_link_t *capi_drvr_linktab; +} capi_bchan_t; + +enum capi_c_state { + C_DOWN, /* controller uninitialized */ + C_READY, /* controller initialized but not listening */ + C_UP, /* controller listening */ +}; + +typedef struct capi_softc { + int sc_unit; /* index in capi_sc[] */ + int ctrl_unit; /* index in isdn_ctrl_tab[] */ + int card_type; /* CARD_TYPEC_xxx, filled by ll driver */ + int sc_nbch; /* number of b channels on this controller */ + int sc_enabled; /* is daemon connected TRUE/FALSE */ + int sc_msgid; /* next CAPI message id */ + char sc_profile[64];/* CAPI profile data */ + enum capi_c_state sc_state; + + capi_bchan_t sc_bchan[MAX_BCHAN]; + + /* Link layer driver context holder and methods */ + + void *ctx; + + int (*load)(struct capi_softc *, int, u_int8_t *); + int (*reg_appl)(struct capi_softc *, int, int); + int (*rel_appl)(struct capi_softc *, int); + int (*send)(struct capi_softc *, struct mbuf *); +} capi_softc_t; + +extern capi_softc_t *capi_sc[]; +extern int ncapi; + +/* +// CAPI upcalls for the link layer. +*/ + +#define I4BCAPI_APPLID 1 + +extern int capi_ll_attach(capi_softc_t *); +extern int capi_ll_control(capi_softc_t *, int op, int arg); + +#define CAPI_CTRL_READY 0 /* ctrl ready, value=TRUE/FALSE */ +#define CAPI_CTRL_PROFILE 1 /* set CAPI profile */ +#define CAPI_CTRL_NEW_NCCI 2 /* new ncci value, assign bchan */ +#define CAPI_CTRL_FREE_NCCI 3 /* free ncci value, clear bchan */ + +extern int capi_ll_receive(capi_softc_t *, struct mbuf *); + +extern int capi_start_tx(capi_softc_t *, int bchan); + +#endif /* _I4B_CAPI_H_ */ diff --git a/sys/i4b/capi/capi_l4if.c b/sys/i4b/capi/capi_l4if.c new file mode 100644 index 000000000000..9cb05f221781 --- /dev/null +++ b/sys/i4b/capi/capi_l4if.c @@ -0,0 +1,450 @@ +/* + * Copyright (c) 2001 Cubical Solutions Ltd. 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. + * + * capi/capi_l4if.c The CAPI i4b L4/device interface. + * + * $FreeBSD$ + */ + +#include "i4bcapi.h" +#if NI4BCAPI > 0 + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include + +#include + +#include +#include + +static void n_connect_request(u_int cdid); +static void n_connect_response(u_int cdid, int response, int cause); +static void n_disconnect_request(u_int cdid, int cause); +static void n_alert_request(u_int cdid); +static void n_mgmt_command(int unit, int cmd, void *parm); +static int n_download(int unit, int, struct isdn_dr_prot *); + +capi_softc_t *capi_sc[MAX_CONTROLLERS] = { NULL, }; +int ncapi = 0; + +/* +// i4b_capi_{ret,set}_linktab +// i4b driver glue. +// +// i4b_capi_bch_config +// Called by i4b driver to flush + {en,dis}able a channel. +// +// i4b_capi_bch_start_tx +// Called by i4b driver to transmit a queued mbuf. +// +// i4b_capi_bch_stat +// Called by i4b driver to obtain statistics information. +*/ + +static isdn_link_t * +i4b_capi_ret_linktab(int unit, int channel) +{ + capi_softc_t *sc = capi_sc[unit]; + return &sc->sc_bchan[channel].capi_isdn_linktab; +} + +static void +i4b_capi_set_linktab(int unit, int channel, drvr_link_t *dlt) +{ + capi_softc_t *sc = capi_sc[unit]; + sc->sc_bchan[channel].capi_drvr_linktab = dlt; +} + +static void +i4b_capi_bch_config(int unit, int chan, int bprot, int activate) +{ + capi_softc_t *sc = capi_sc[unit]; + + i4b_Bcleanifq(&sc->sc_bchan[chan].tx_queue); + sc->sc_bchan[chan].tx_queue.ifq_maxlen = IFQ_MAXLEN; + sc->sc_bchan[chan].txcount = 0; + + /* The telephony drivers use rx_queue for receive. */ + + i4b_Bcleanifq(&sc->sc_bchan[chan].rx_queue); + sc->sc_bchan[chan].rx_queue.ifq_maxlen = IFQ_MAXLEN; + sc->sc_bchan[chan].rxcount = 0; + + /* HDLC frames are put to in_mbuf */ + + i4b_Bfreembuf(sc->sc_bchan[chan].in_mbuf); + sc->sc_bchan[chan].in_mbuf = NULL; + + /* Because of the difference, we need to remember the protocol. */ + + sc->sc_bchan[chan].bprot = bprot; + sc->sc_bchan[chan].busy = 0; +} + +static void +i4b_capi_bch_start_tx(int unit, int chan) +{ + capi_softc_t *sc = capi_sc[unit]; + int s; + + s = SPLI4B(); + + if (sc->sc_bchan[chan].state != B_CONNECTED) { + splx(s); + printf("capi%d: start_tx on unconnected channel\n", sc->sc_unit); + return; + } + + if (sc->sc_bchan[chan].busy) { + splx(s); + return; + } + + capi_start_tx(sc, chan); + + splx(s); +} + +static void +i4b_capi_bch_stat(int unit, int chan, bchan_statistics_t *bsp) +{ + capi_softc_t *sc = capi_sc[unit]; + int s = SPLI4B(); + + bsp->outbytes = sc->sc_bchan[chan].txcount; + bsp->inbytes = sc->sc_bchan[chan].rxcount; + + sc->sc_bchan[chan].txcount = 0; + sc->sc_bchan[chan].rxcount = 0; + + splx(s); +} + +int capi_start_tx(capi_softc_t *sc, int chan) +{ + struct mbuf *m_b3; + int sent = 0; + + _IF_DEQUEUE(&sc->sc_bchan[chan].tx_queue, m_b3); + while (m_b3) { + struct mbuf *m = m_b3->m_next; + + sc->sc_bchan[chan].txcount += m_b3->m_len; + capi_data_b3_req(sc, chan, m_b3); + sent++; + + m_b3 = m; + } + + if (sc->sc_bchan[chan].capi_drvr_linktab) { + /* Notify i4b driver of activity, and if the queue is drained. */ + + if (sent) + (*sc->sc_bchan[chan].capi_drvr_linktab->bch_activity)( + sc->sc_bchan[chan].capi_drvr_linktab->unit, ACT_TX); + + if (IF_QEMPTY(&sc->sc_bchan[chan].tx_queue)) + (*sc->sc_bchan[chan].capi_drvr_linktab->bch_tx_queue_empty)( + sc->sc_bchan[chan].capi_drvr_linktab->unit); + } + + return sent; +} + +/* +// capi_ll_attach +// Called by a link layer driver at boot time. +*/ + +int +capi_ll_attach(capi_softc_t *sc) +{ + int i; + + if (ncapi == (sizeof(capi_sc) / sizeof(capi_sc[0]))) { + printf("capi%d: too many units, increase MAX_CONTROLLERS\n", ncapi); + return (ENXIO); + } + + /* Unit type and subtype; sc is partly filled by ll driver */ + + ctrl_desc[nctrl].unit = ncapi; + ctrl_desc[nctrl].ctrl_type = CTRL_CAPI; + ctrl_desc[nctrl].card_type = sc->card_type; + + /* L4 callbacks */ + + ctrl_types[CTRL_CAPI].get_linktab = i4b_capi_ret_linktab; + ctrl_types[CTRL_CAPI].set_linktab = i4b_capi_set_linktab; + + ctrl_desc[nctrl].N_CONNECT_REQUEST = n_connect_request; + ctrl_desc[nctrl].N_CONNECT_RESPONSE = n_connect_response; + ctrl_desc[nctrl].N_DISCONNECT_REQUEST = n_disconnect_request; + ctrl_desc[nctrl].N_ALERT_REQUEST = n_alert_request; + ctrl_desc[nctrl].N_DOWNLOAD = n_download; + ctrl_desc[nctrl].N_DIAGNOSTICS = NULL; /* XXX todo */ + ctrl_desc[nctrl].N_MGMT_COMMAND = n_mgmt_command; + + /* Unit state */ + + sc->sc_enabled = FALSE; + sc->sc_state = C_DOWN; + sc->sc_msgid = 0; + + ctrl_desc[nctrl].dl_est = DL_DOWN; + ctrl_desc[nctrl].nbch = sc->sc_nbch; + + for (i = 0; i < sc->sc_nbch; i++) { + ctrl_desc[nctrl].bch_state[i] = BCH_ST_FREE; + sc->sc_bchan[i].ncci = INVALID; + sc->sc_bchan[i].msgid = 0; + sc->sc_bchan[i].busy = 0; + sc->sc_bchan[i].state = B_FREE; + + memset(&sc->sc_bchan[i].tx_queue, 0, sizeof(struct ifqueue)); + memset(&sc->sc_bchan[i].rx_queue, 0, sizeof(struct ifqueue)); + sc->sc_bchan[i].tx_queue.ifq_maxlen = IFQ_MAXLEN; + sc->sc_bchan[i].rx_queue.ifq_maxlen = IFQ_MAXLEN; + +#if defined (__FreeBSD__) && __FreeBSD__ > 4 + mtx_init(&sc->sc_bchan[i].tx_queue.ifq_mtx, "i4b_capi_tx", MTX_DEF); + mtx_init(&sc->sc_bchan[i].rx_queue.ifq_mtx, "i4b_capi_rx", MTX_DEF); +#endif + + sc->sc_bchan[i].txcount = 0; + sc->sc_bchan[i].rxcount = 0; + + sc->sc_bchan[i].cdid = CDID_UNUSED; + sc->sc_bchan[i].bprot = BPROT_NONE; + sc->sc_bchan[i].in_mbuf = NULL; + + sc->sc_bchan[i].capi_drvr_linktab = NULL; + + sc->sc_bchan[i].capi_isdn_linktab.unit = ncapi; + sc->sc_bchan[i].capi_isdn_linktab.channel = i; + sc->sc_bchan[i].capi_isdn_linktab.bch_config = i4b_capi_bch_config; + sc->sc_bchan[i].capi_isdn_linktab.bch_tx_start = i4b_capi_bch_start_tx; + sc->sc_bchan[i].capi_isdn_linktab.bch_stat = i4b_capi_bch_stat; + sc->sc_bchan[i].capi_isdn_linktab.tx_queue = &sc->sc_bchan[i].tx_queue; + sc->sc_bchan[i].capi_isdn_linktab.rx_queue = &sc->sc_bchan[i].rx_queue; + sc->sc_bchan[i].capi_isdn_linktab.rx_mbuf = &sc->sc_bchan[i].in_mbuf; + } + + ctrl_desc[nctrl].tei = -1; + + /* Up the controller index and store the softc */ + + sc->sc_unit = ncapi; + capi_sc[ncapi++] = sc; + sc->ctrl_unit = nctrl++; + + printf("capi%d: card type %d attached\n", sc->sc_unit, sc->card_type); + + return(0); +} + +/* +// n_mgmt_command +// i4b L4 management command. +*/ + +static void +n_mgmt_command(int unit, int op, void *arg) +{ + capi_softc_t *sc = capi_sc[unit]; + + printf("capi%d: mgmt command %d\n", sc->sc_unit, op); + + switch(op) { + case CMR_DOPEN: + sc->sc_enabled = TRUE; + break; + + case CMR_DCLOSE: + sc->sc_enabled = FALSE; + break; + + case CMR_SETTRACE: + break; + + default: + break; + } +} + +/* +// n_connect_request +// i4b L4 wants to connect. We assign a B channel to the call, +// send a CAPI_CONNECT_REQ, and set the channel to B_CONNECT_CONF. +*/ + +static void +n_connect_request(u_int cdid) +{ + call_desc_t *cd = cd_by_cdid(cdid); + capi_softc_t *sc; + int bch, s; + + if (!cd) { + printf("capi?: invalid cdid %d\n", cdid); + return; + } + + sc = capi_sc[ctrl_desc[cd->controller].unit]; + bch = cd->channelid; + + s = SPLI4B(); + + if ((bch < 0) || (bch >= sc->sc_nbch)) + for (bch = 0; bch < sc->sc_nbch; bch++) + if (sc->sc_bchan[bch].state == B_FREE) + break; + + if (bch == sc->sc_nbch) { + splx(s); + printf("capi%d: no free B channel\n", sc->sc_unit); + return; + } + + cd->channelid = bch; + + capi_connect_req(sc, cd); + splx(s); +} + +/* +// n_connect_response +// i4b L4 answers a call. We send a CONNECT_RESP with the proper +// Reject code, and set the channel to B_CONNECT_B3_IND or B_FREE, +// depending whether we answer or not. +*/ + +static void +n_connect_response(u_int cdid, int response, int cause) +{ + call_desc_t *cd = cd_by_cdid(cdid); + capi_softc_t *sc; + int bch, s; + + if (!cd) { + printf("capi?: invalid cdid %d\n", cdid); + return; + } + + sc = capi_sc[ctrl_desc[cd->controller].unit]; + bch = cd->channelid; + + T400_stop(cd); + + cd->response = response; + cd->cause_out = cause; + + s = SPLI4B(); + capi_connect_resp(sc, cd); + splx(s); +} + +/* +// n_disconnect_request +// i4b L4 wants to disconnect. We send a DISCONNECT_REQ and +// set the channel to B_DISCONNECT_CONF. +*/ + +static void +n_disconnect_request(u_int cdid, int cause) +{ + call_desc_t *cd = cd_by_cdid(cdid); + capi_softc_t *sc; + int bch, s; + + if (!cd) { + printf("capi?: invalid cdid %d\n", cdid); + return; + } + + sc = capi_sc[ctrl_desc[cd->controller].unit]; + bch = cd->channelid; + + cd->cause_out = cause; + + s = SPLI4B(); + capi_disconnect_req(sc, cd); + splx(s); +} + +/* +// n_alert_request +// i4b L4 wants to alert an incoming call. We send ALERT_REQ. +*/ + +static void +n_alert_request(u_int cdid) +{ + call_desc_t *cd = cd_by_cdid(cdid); + capi_softc_t *sc; + int s; + + if (!cd) { + printf("capi?: invalid cdid %d\n", cdid); + return; + } + + sc = capi_sc[ctrl_desc[cd->controller].unit]; + + s = SPLI4B(); + capi_alert_req(sc, cd); + splx(s); +} + +/* +// n_download +// L4 -> firmware download +*/ + +static int +n_download(int unit, int numprotos, struct isdn_dr_prot *protocols) +{ + capi_softc_t *sc = capi_sc[unit]; + + if (sc->load) { + (*capi_sc[unit]->load)(sc, protocols[0].bytecount, + protocols[0].microcode); + } + + return(0); +} + +#endif /* NI4BCAPI > 0 */ diff --git a/sys/i4b/capi/capi_llif.c b/sys/i4b/capi/capi_llif.c new file mode 100644 index 000000000000..a02286143f7f --- /dev/null +++ b/sys/i4b/capi/capi_llif.c @@ -0,0 +1,166 @@ +/* + * Copyright (c) 2001 Cubical Solutions Ltd. 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. + * + * capi/capi_llif.c The i4b CAPI link layer interface. + * + * $FreeBSD$ + */ + +#include "i4bcapi.h" +#if NI4BCAPI > 0 + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include + +#include + +#include +#include + +/* +// capi_ll_control +// CAPI link layer control routine. Called by a link layer +// driver when its state changes. +*/ + +int +capi_ll_control(capi_softc_t *sc, int op, int arg) +{ + switch (op) { + case CAPI_CTRL_READY: + if (arg) { + sc->sc_state = C_READY; + + /* + * Register our CAPI ApplId and send CAPI_LISTEN_REQ + * with CIP Mask value 1 (match all). + */ + + sc->reg_appl(sc, I4BCAPI_APPLID, sc->sc_nbch); + capi_listen_req(sc, 0x10007); + + } else { + sc->sc_state = C_DOWN; + /* XXX go through cds and notify L4 of pdeact? XXX */ + } + break; + + case CAPI_CTRL_PROFILE: + bcopy((char*) arg, &sc->sc_profile, sizeof(sc->sc_profile)); + break; + + case CAPI_CTRL_NEW_NCCI: + case CAPI_CTRL_FREE_NCCI: + /* We ignore the controller's NCCI notifications. */ + break; + + default: + printf("capi%d: unknown control %d\n", sc->sc_unit, op); + } + + return 0; +} + +/* +// i4b_capi_handlers +// Array of message-handler pairs used to dispatch CAPI +// messages sent to I4BCAPI_APPLID. +*/ + +static struct capi_cmdtab { + u_int16_t cmd; + void (*handler)(capi_softc_t *, struct mbuf *); +} i4b_capi_handlers[] = { + { CAPI_LISTEN_CONF, capi_listen_conf }, + { CAPI_INFO_IND, capi_info_ind }, + { CAPI_ALERT_CONF, capi_alert_conf }, + { CAPI_CONNECT_CONF, capi_connect_conf }, + { CAPI_CONNECT_IND, capi_connect_ind }, + { CAPI_CONNECT_ACTIVE_IND, capi_connect_active_ind }, + { CAPI_CONNECT_B3_CONF, capi_connect_b3_conf }, + { CAPI_CONNECT_B3_IND, capi_connect_b3_ind }, + { CAPI_CONNECT_B3_ACTIVE_IND, capi_connect_b3_active_ind }, + { CAPI_DATA_B3_CONF, capi_data_b3_conf }, + { CAPI_DATA_B3_IND, capi_data_b3_ind }, + { CAPI_DISCONNECT_B3_IND, capi_disconnect_b3_ind }, + { CAPI_DISCONNECT_CONF, capi_disconnect_conf }, + { CAPI_DISCONNECT_IND, capi_disconnect_ind }, + { 0, 0 } +}; + +/* +// capi_ll_receive +// CAPI link layer receive upcall. Called by a link layer +// driver to dispatch incoming CAPI messages. +*/ + +int +capi_ll_receive(capi_softc_t *sc, struct mbuf *m) +{ + u_int8_t *p = mtod(m, u_int8_t*); + u_int16_t len, applid, msgid, cmd; + + capimsg_getu16(p + 0, &len); + capimsg_getu16(p + 2, &applid); + capimsg_getu16(p + 4, &cmd); + capimsg_getu16(p + 6, &msgid); + +#if 0 + printf("capi%d: ll_receive hdr %04x %04x %04x %04x\n", sc->sc_unit, + len, applid, cmd, msgid); +#endif + + if (applid == I4BCAPI_APPLID) { + struct capi_cmdtab *e; + for (e = i4b_capi_handlers; e->cmd && e->cmd != cmd; e++); + if (e->cmd) (*e->handler)(sc, m); + else printf("capi%d: unknown message %04x\n", sc->sc_unit, cmd); + + } else { + /* XXX we could handle arbitrary ApplIds here XXX */ + printf("capi%d: message %04x for unknown applid %d\n", sc->sc_unit, + cmd, applid); + } + + if (m->m_next) { + i4b_Bfreembuf(m->m_next); + m->m_next = NULL; + } + i4b_Dfreembuf(m); + return(0); +} + +#endif /* NI4BCAPI > 0*/ diff --git a/sys/i4b/capi/capi_msgs.c b/sys/i4b/capi/capi_msgs.c new file mode 100644 index 000000000000..a2ce023a20ea --- /dev/null +++ b/sys/i4b/capi/capi_msgs.c @@ -0,0 +1,948 @@ +/* + * Copyright (c) 2001 Cubical Solutions Ltd. 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. + * + * capi/capi_msgs.c The CAPI i4b message handlers. + * + * $FreeBSD$ + */ + +#include "i4bcapi.h" +#if NI4BCAPI > 0 + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include + +#include + +#include +#include + +/* +// Administrative messages: +// ------------------------ +*/ + +void capi_listen_req(capi_softc_t *sc, u_int32_t CIP) +{ + struct mbuf *m = i4b_Dgetmbuf(8 + 18); + u_int8_t *msg; + u_int16_t msgid; + + if (!m) { + printf("capi%d: can't get mbuf for listen_req\n", sc->sc_unit); + return; + } + + msgid = sc->sc_msgid++; + + msg = capimsg_setu16(mtod(m, u_int8_t*), m->m_len); + msg = capimsg_setu16(msg, I4BCAPI_APPLID); + msg = capimsg_setu16(msg, CAPI_LISTEN_REQ); + msg = capimsg_setu16(msg, msgid); + + msg = capimsg_setu32(msg, 1); /* Controller */ + msg = capimsg_setu32(msg, 0); /* Info mask */ + msg = capimsg_setu32(msg, CIP); + msg = capimsg_setu32(msg, 0); + msg = capimsg_setu8(msg, 0); + msg = capimsg_setu8(msg, 0); + + sc->send(sc, m); +} + +void capi_listen_conf(capi_softc_t *sc, struct mbuf *m_in) +{ + u_int8_t *msg = mtod(m_in, u_int8_t*); + u_int16_t Info; + + capimsg_getu16(msg + 12, &Info); + + if (Info == 0) { + /* We are now listening. */ + + sc->sc_state = C_UP; + ctrl_desc[sc->ctrl_unit].dl_est = DL_UP; + + i4b_l4_l12stat(sc->ctrl_unit, 1, 1); + i4b_l4_l12stat(sc->ctrl_unit, 2, 1); + + } else { + /* XXX sc->sc_state = C_DOWN ? XXX */ + printf("capi%d: can't listen, info=%04x\n", sc->sc_unit, Info); + } +} + +void capi_info_ind(capi_softc_t *sc, struct mbuf *m_in) +{ + struct mbuf *m = i4b_Dgetmbuf(8 + 4); + u_int8_t *msg = mtod(m_in, u_int8_t*); + u_int16_t applid, msgid; + u_int32_t PLCI; + + if (!m) { + printf("capi%d: can't get mbuf for info_resp\n", sc->sc_unit); + return; + } + + msg = capimsg_getu16(msg + 2, &applid); + msg = capimsg_getu16(msg + 2, &msgid); + msg = capimsg_getu32(msg, &PLCI); + + /* i4b_l4_info_ind() */ + + msg = capimsg_setu16(mtod(m, u_int8_t*), m->m_len); + msg = capimsg_setu16(msg, applid); + msg = capimsg_setu16(msg, CAPI_INFO_RESP); + msg = capimsg_setu16(msg, msgid); + + msg = capimsg_setu32(msg, PLCI); + + sc->send(sc, m); +} + +void capi_alert_req(capi_softc_t *sc, call_desc_t *cd) +{ + struct mbuf *m = i4b_Dgetmbuf(8 + 5); + u_int8_t *msg; + u_int16_t msgid; + u_int32_t PLCI; + + if (!m) { + printf("capi%d: can't get mbuf for alert_req\n", sc->sc_unit); + return; + } + + msgid = sc->sc_bchan[cd->channelid].msgid = sc->sc_msgid++; + PLCI = (sc->sc_bchan[cd->channelid].ncci & CAPI_PLCI_MASK); + + msg = capimsg_setu16(mtod(m, u_int8_t*), m->m_len); + msg = capimsg_setu16(msg, I4BCAPI_APPLID); + msg = capimsg_setu16(msg, CAPI_ALERT_REQ); + msg = capimsg_setu16(msg, msgid); + + msg = capimsg_setu32(msg, PLCI); + msg = capimsg_setu8(msg, 0); + + sc->send(sc, m); +} + +void capi_alert_conf(capi_softc_t *sc, struct mbuf *m_in) +{ + u_int8_t *msg = mtod(m_in, u_int8_t*); + u_int16_t Info; + + msg = capimsg_getu16(msg + 12, &Info); + + if (Info) { + printf("capi%d: can't alert, info=%04x\n", sc->sc_unit, Info); + } +} + +/* +// Outgoing call setup: +// -------------------- +// +// CAPI_CONNECT_REQ --> +// <-- CAPI_CONNECT_CONF +// (notify Layer 4) +// <-- CAPI_CONNECT_ACTIVE_IND +// CAPI_CONNECT_ACTIVE_RESP --> +// CAPI_CONNECT_B3_REQ --> +// <-- CAPI_CONNECT_B3_CONF +// <-- CAPI_CONNECT_B3_ACTIVE_IND +// CAPI_CONNECT_B3_ACTIVE_RESP --> +// (notify Layer 4) +*/ + +void capi_connect_req(capi_softc_t *sc, call_desc_t *cd) +{ + struct mbuf *m; + u_int8_t *msg; + u_int16_t msgid; + int slen = strlen(cd->src_telno); + int dlen = strlen(cd->dst_telno); + + m = i4b_Dgetmbuf(8 + 18 + slen + dlen); + if (!m) { + printf("capi%d: can't get mbuf for connect_req\n", sc->sc_unit); + return; + } + + cd->crflag = CRF_ORIG; + + sc->sc_bchan[cd->channelid].cdid = cd->cdid; + sc->sc_bchan[cd->channelid].bprot = cd->bprot; + sc->sc_bchan[cd->channelid].state = B_CONNECT_CONF; + msgid = sc->sc_bchan[cd->channelid].msgid = sc->sc_msgid++; + ctrl_desc[sc->ctrl_unit].bch_state[cd->channelid] = BCH_ST_RSVD; + + msg = capimsg_setu16(mtod(m, u_int8_t*), m->m_len); + msg = capimsg_setu16(msg, I4BCAPI_APPLID); + msg = capimsg_setu16(msg, CAPI_CONNECT_REQ); + msg = capimsg_setu16(msg, msgid); + + msg = capimsg_setu32(msg, 1); /* Controller */ + + switch (cd->bprot) { + case BPROT_NONE: + msg = capimsg_setu16(msg, 0x0010); /* Telephony */ + break; + + case BPROT_RHDLC: + msg = capimsg_setu16(msg, 0x0002); /* Unrestricted digital */ + break; + + default: + msg = capimsg_setu16(msg, 0x0002); /* Unrestricted digital */ + } + + msg = capimsg_setu8(msg, 1 + dlen); + msg = capimsg_setu8(msg, 0x80); + strncpy(msg, cd->dst_telno, dlen); + + msg = capimsg_setu8(msg + dlen, 2 + slen); + msg = capimsg_setu8(msg, 0x00); + msg = capimsg_setu8(msg, 0x80); /* Presentation and screening indicator */ + strncpy(msg, cd->src_telno, slen); + + msg = capimsg_setu8(msg + slen, 0); /* Called & */ + msg = capimsg_setu8(msg, 0); /* Calling party subaddress */ + + msg = capimsg_setu8(msg, 15); /* B protocol */ + if (cd->bprot == BPROT_NONE) + msg = capimsg_setu16(msg, 1); /* B1 protocol = transparent */ + else + msg = capimsg_setu16(msg, 0); /* B1 protocol = HDLC */ + msg = capimsg_setu16(msg, 1); /* B2 protocol = transparent */ + msg = capimsg_setu16(msg, 0); /* B3 protocol = transparent */ + msg = capimsg_setu8(msg, 0); /* B1 parameters */ + msg = capimsg_setu8(msg, 0); /* B2 parameters */ + msg = capimsg_setu8(msg, 0); /* B3 parameters */ + + msg = capimsg_setu8(msg, 0); /* Bearer Capability */ + msg = capimsg_setu8(msg, 0); /* Low Layer Compatibility */ + msg = capimsg_setu8(msg, 0); /* High Layer Compatibility */ + msg = capimsg_setu8(msg, 0); /* Additional Info */ + + sc->send(sc, m); +} + +void capi_connect_conf(capi_softc_t *sc, struct mbuf *m_in) +{ + u_int8_t *msg = mtod(m_in, u_int8_t*); + call_desc_t *cd; + u_int16_t msgid; + u_int32_t PLCI; + u_int16_t Info; + int bch; + + msg = capimsg_getu16(msg + 6, &msgid); + msg = capimsg_getu32(msg, &PLCI); + msg = capimsg_getu16(msg, &Info); + + for (bch = 0; bch < sc->sc_nbch; bch++) + if ((sc->sc_bchan[bch].state == B_CONNECT_CONF) && + (sc->sc_bchan[bch].msgid == msgid)) + break; + + if ((bch == sc->sc_nbch) || + (cd = cd_by_cdid(sc->sc_bchan[bch].cdid)) == NULL) { + printf("capi%d: can't find channel for connect_conf PLCI %x\n", + sc->sc_unit, PLCI); + return; + } + + if (Info == 0) { + sc->sc_bchan[bch].state = B_CONNECT_ACTIVE_IND; + sc->sc_bchan[bch].ncci = PLCI; + + i4b_l4_proceeding_ind(cd); + + } else { + SET_CAUSE_TV(cd->cause_out, CAUSET_I4B, CAUSE_I4B_L1ERROR); + i4b_l4_disconnect_ind(cd); + freecd_by_cd(cd); + + sc->sc_bchan[bch].state = B_FREE; + ctrl_desc[sc->ctrl_unit].bch_state[bch] = BCH_ST_FREE; + + printf("capi%d: can't connect out, info=%04x\n", sc->sc_unit, Info); + } +} + +void capi_connect_active_ind(capi_softc_t *sc, struct mbuf *m_in) +{ + struct mbuf *m = i4b_Dgetmbuf(8 + 4); + u_int8_t *msg = mtod(m_in, u_int8_t*); + call_desc_t *cd; + u_int16_t applid, msgid; + u_int32_t PLCI; + int bch; + + if (!m) { + printf("capi%d: can't get mbuf for active_ind\n", sc->sc_unit); + return; + } + + msg = capimsg_getu16(msg + 2, &applid); + msg = capimsg_getu16(msg + 2, &msgid); + msg = capimsg_getu32(msg, &PLCI); + + for (bch = 0; bch < sc->sc_nbch; bch++) + if ((sc->sc_bchan[bch].state == B_CONNECT_ACTIVE_IND) && + (sc->sc_bchan[bch].ncci == PLCI)) + break; + + if ((bch == sc->sc_nbch) || + (cd = cd_by_cdid(sc->sc_bchan[bch].cdid)) == NULL) { + printf("capi%d: can't find channel for active_resp, PLCI %x\n", + sc->sc_unit, PLCI); + return; + } + + msg = capimsg_setu16(mtod(m, u_int8_t*), m->m_len); + msg = capimsg_setu16(msg, applid); + msg = capimsg_setu16(msg, CAPI_CONNECT_ACTIVE_RESP); + msg = capimsg_setu16(msg, msgid); + + msg = capimsg_setu32(msg, PLCI); + + sc->send(sc, m); + + if (cd->crflag == CRF_ORIG) { + capi_connect_b3_req(sc, cd); + + } else { + sc->sc_bchan[bch].state = B_CONNECT_B3_IND; + } +} + +void capi_connect_b3_req(capi_softc_t *sc, call_desc_t *cd) +{ + struct mbuf *m = i4b_Dgetmbuf(8 + 5); + u_int8_t *msg; + u_int16_t msgid; + u_int32_t PLCI; + + if (!m) { + printf("capi%d: can't get mbuf for connect_b3_req\n", sc->sc_unit); + return; + } + + sc->sc_bchan[cd->channelid].state = B_CONNECT_B3_CONF; + msgid = sc->sc_bchan[cd->channelid].msgid = sc->sc_msgid++; + PLCI = (sc->sc_bchan[cd->channelid].ncci & CAPI_PLCI_MASK); + + msg = capimsg_setu16(mtod(m, u_int8_t*), m->m_len); + msg = capimsg_setu16(msg, I4BCAPI_APPLID); + msg = capimsg_setu16(msg, CAPI_CONNECT_B3_REQ); + msg = capimsg_setu16(msg, msgid); + + msg = capimsg_setu32(msg, PLCI); + msg = capimsg_setu8(msg, 0); /* NCPI */ + + sc->send(sc, m); +} + +void capi_connect_b3_conf(capi_softc_t *sc, struct mbuf *m_in) +{ + u_int8_t *msg = mtod(m_in, u_int8_t*); + call_desc_t *cd; + u_int16_t msgid; + u_int32_t NCCI; + u_int16_t Info; + int bch; + + msg = capimsg_getu16(msg + 6, &msgid); + msg = capimsg_getu32(msg, &NCCI); + msg = capimsg_getu16(msg, &Info); + + for (bch = 0; bch < sc->sc_nbch; bch++) + if ((sc->sc_bchan[bch].state == B_CONNECT_B3_CONF) && + (sc->sc_bchan[bch].ncci == (NCCI & CAPI_PLCI_MASK))) + break; + + if ((bch == sc->sc_nbch) || + (cd = cd_by_cdid(sc->sc_bchan[bch].cdid)) == NULL) { + printf("capi%d: can't find channel for connect_b3_conf NCCI %x\n", + sc->sc_unit, NCCI); + return; + } + + if (Info == 0) { + sc->sc_bchan[bch].ncci = NCCI; + sc->sc_bchan[bch].state = B_CONNECT_B3_ACTIVE_IND; + + } else { + SET_CAUSE_TV(cd->cause_in, CAUSET_I4B, CAUSE_I4B_OOO); /* XXX */ + i4b_l4_disconnect_ind(cd); + freecd_by_cd(cd); + + ctrl_desc[sc->ctrl_unit].bch_state[bch] = BCH_ST_RSVD; + + printf("capi%d: can't connect_b3 out, info=%04x\n", sc->sc_unit, Info); + + capi_disconnect_req(sc, cd); + } +} + +void capi_connect_b3_active_ind(capi_softc_t *sc, struct mbuf *m_in) +{ + struct mbuf *m = i4b_Dgetmbuf(8 + 4); + u_int8_t *msg = mtod(m_in, u_int8_t*); + call_desc_t *cd; + u_int16_t applid, msgid; + u_int32_t NCCI; + int bch; + + if (!m) { + printf("capi%d: can't get mbuf for b3_active_ind\n", sc->sc_unit); + return; + } + + msg = capimsg_getu16(msg + 2, &applid); + msg = capimsg_getu16(msg + 2, &msgid); + msg = capimsg_getu32(msg, &NCCI); + + for (bch = 0; bch < sc->sc_nbch; bch++) + if ((sc->sc_bchan[bch].state == B_CONNECT_B3_ACTIVE_IND) && + (sc->sc_bchan[bch].ncci == NCCI)) + break; + + if ((bch == sc->sc_nbch) || + (cd = cd_by_cdid(sc->sc_bchan[bch].cdid)) == NULL) { + printf("capi%d: can't find channel for b3_active_resp NCCI %x\n", + sc->sc_unit, NCCI); + return; + } + + msg = capimsg_setu16(mtod(m, u_int8_t*), m->m_len); + msg = capimsg_setu16(msg, I4BCAPI_APPLID); + msg = capimsg_setu16(msg, CAPI_CONNECT_B3_ACTIVE_RESP); + msg = capimsg_setu16(msg, msgid); + + msg = capimsg_setu32(msg, NCCI); + + sc->send(sc, m); + + sc->sc_bchan[bch].state = B_CONNECTED; + i4b_l4_connect_active_ind(cd); +} + +/* +// Incoming call setup: +// -------------------- +// +// <-- CAPI_CONNECT_IND +// (consult Layer 4) +// CAPI_CONNECT_RESP --> +// <-- CAPI_CONNECT_ACTIVE_IND +// CAPI_CONNECT_ACTIVE_RESP --> +// <-- CAPI_CONNECT_B3_IND +// CAPI_CONNECT_B3_RESP --> +// <-- CAPI_CONNECT_B3_ACTIVE_IND +// CAPI_CONNECT_B3_ACTIVE_RESP --> +// (notify Layer 4) +*/ + +void capi_connect_ind(capi_softc_t *sc, struct mbuf *m_in) +{ + u_int8_t *msg = mtod(m_in, u_int8_t*); + call_desc_t *cd; + u_int16_t applid, msgid; + u_int32_t PLCI; + u_int16_t CIP; + u_int8_t x, y, z; + int bch; + + if ((cd = reserve_cd()) == NULL) { + printf("capi%d: can't get cd for connect_ind\n", sc->sc_unit); + return; + } + + cd->controller = sc->ctrl_unit; + cd->channelexcl = FALSE; + + for (bch = 0; bch < sc->sc_nbch; bch++) + if (sc->sc_bchan[bch].state == B_FREE) break; + sc->sc_bchan[bch].state = B_CONNECT_IND; + cd->channelid = bch; /* XXX CHAN_ANY XXX */ + + cd->crflag = CRF_DEST; + cd->cr = get_rand_cr(sc->sc_unit); + cd->scr_ind = SCR_NONE; + cd->prs_ind = PRS_NONE; + cd->bprot = BPROT_NONE; + cd->ilt = NULL; + cd->dlt = NULL; + cd->display[0] = '\0'; + cd->datetime[0] = '\0'; + + msg = capimsg_getu16(msg + 2, &applid); + msg = capimsg_getu16(msg + 2, &msgid); + msg = capimsg_getu32(msg, &PLCI); + msg = capimsg_getu16(msg, &CIP); + + cd->event = (int) msgid; /* XXX overload */ + cd->Q931state = (int) PLCI; /* XXX overload */ + + switch (CIP) { + case 0x0010: + case 0x0001: cd->bprot = BPROT_NONE; break; + case 0x0002: cd->bprot = BPROT_RHDLC; break; + default: + NDBGL4(L4_CAPIDBG, "capi%d: unknown CIP = %d", sc->sc_unit, CIP); + cd->bprot = BPROT_NONE; + } + + msg = capimsg_getu8(msg, &x); /* Called party struct len */ + if (x) { + msg = capimsg_getu8(msg, &y); /* Numbering plan */ + z = x - 1; + if (z >= TELNO_MAX) z = (TELNO_MAX-1); + strncpy(cd->dst_telno, msg, z); + msg += x; + x = z; + } + cd->dst_telno[x] = '\0'; + + msg = capimsg_getu8(msg, &x); /* Calling party struct len */ + if (x) { + msg = capimsg_getu8(msg, &y); /* Numbering plan */ + msg = capimsg_getu8(msg, &y); /* Screening/Presentation */ + if ((y & 0x80) == 0) { /* screening used */ + cd->scr_ind = (y & 3) + SCR_USR_NOSC; + cd->prs_ind = ((y >> 5) & 3) + PRS_ALLOWED; + } + z = x - 2; + if (z >= TELNO_MAX) z = (TELNO_MAX-1); + strncpy(cd->src_telno, msg, z); + msg += x; + x = z; + } + cd->src_telno[x] = '\0'; + + i4b_l4_connect_ind(cd); +} + +void capi_connect_resp(capi_softc_t *sc, call_desc_t *cd) +{ + struct mbuf *m; + u_int8_t *msg; + u_int16_t msgid; + u_int32_t PLCI; + int dlen = strlen(cd->dst_telno); + + m = i4b_Dgetmbuf(8 + 11 + dlen); + if (!m) { + printf("capi%d: can't get mbuf for connect_resp\n", sc->sc_unit); + return; + } + + msgid = (u_int16_t) cd->event; + PLCI = (u_int32_t) cd->Q931state; + + msg = capimsg_setu16(mtod(m, u_int8_t*), m->m_len); + msg = capimsg_setu16(msg, I4BCAPI_APPLID); + msg = capimsg_setu16(msg, CAPI_CONNECT_RESP); + msg = capimsg_setu16(msg, msgid); + + msg = capimsg_setu32(msg, PLCI); + + switch (cd->response) { + case SETUP_RESP_ACCEPT: + sc->sc_bchan[cd->channelid].cdid = cd->cdid; + sc->sc_bchan[cd->channelid].ncci = PLCI; + sc->sc_bchan[cd->channelid].state = B_CONNECT_ACTIVE_IND; + ctrl_desc[sc->ctrl_unit].bch_state[cd->channelid] = BCH_ST_USED; + msg = capimsg_setu16(msg, 0); /* Accept the call */ + break; + + case SETUP_RESP_REJECT: + sc->sc_bchan[cd->channelid].state = B_FREE; + ctrl_desc[sc->ctrl_unit].bch_state[cd->channelid] = BCH_ST_FREE; + msg = capimsg_setu16(msg, 2); /* Reject, normal call clearing */ + break; + + case SETUP_RESP_DNTCRE: + sc->sc_bchan[cd->channelid].state = B_FREE; + ctrl_desc[sc->ctrl_unit].bch_state[cd->channelid] = BCH_ST_FREE; + msg = capimsg_setu16(msg, 1); /* Ignore */ + break; + + default: + sc->sc_bchan[cd->channelid].state = B_FREE; + ctrl_desc[sc->ctrl_unit].bch_state[cd->channelid] = BCH_ST_FREE; + msg = capimsg_setu16(msg, (0x3480|CAUSE_Q850_CALLREJ)); + } + + msg = capimsg_setu8(msg, 15); /* B protocol */ + if (cd->bprot == BPROT_NONE) + msg = capimsg_setu16(msg, 1); /* B1 protocol = transparent */ + else + msg = capimsg_setu16(msg, 0); /* B1 protocol = HDLC */ + msg = capimsg_setu16(msg, 1); /* B2 protocol = transparent */ + msg = capimsg_setu16(msg, 0); /* B3 protocol = transparent */ + msg = capimsg_setu8(msg, 0); /* B1 parameters */ + msg = capimsg_setu8(msg, 0); /* B2 parameters */ + msg = capimsg_setu8(msg, 0); /* B3 parameters */ + + msg = capimsg_setu8(msg, 1 + dlen); + msg = capimsg_setu8(msg, 0x80); /* Numbering plan */ + strncpy(msg, cd->dst_telno, dlen); + msg = capimsg_setu8(msg + dlen, 0); /* Connected subaddress */ + msg = capimsg_setu8(msg, 0); /* Low Layer Compatibility */ + msg = capimsg_setu8(msg, 0); /* Additional Info */ + + sc->send(sc, m); +} + +void capi_connect_b3_ind(capi_softc_t *sc, struct mbuf *m_in) +{ + struct mbuf *m = i4b_Dgetmbuf(8 + 7); + u_int8_t *msg = mtod(m_in, u_int8_t*); + u_int16_t applid, msgid; + u_int32_t NCCI; + int bch; + + if (!m) { + printf("capi%d: can't get mbuf for connect_b3_resp\n", sc->sc_unit); + return; + } + + msg = capimsg_getu16(msg + 2, &applid); + msg = capimsg_getu16(msg + 2, &msgid); + msg = capimsg_getu32(msg, &NCCI); + + for (bch = 0; bch < sc->sc_nbch; bch++) + if ((sc->sc_bchan[bch].state == B_CONNECT_B3_IND) && + (sc->sc_bchan[bch].ncci == (NCCI & CAPI_PLCI_MASK))) + break; + + msg = capimsg_setu16(mtod(m, u_int8_t*), m->m_len); + msg = capimsg_setu16(msg, applid); + msg = capimsg_setu16(msg, CAPI_CONNECT_B3_RESP); + msg = capimsg_setu16(msg, msgid); + + msg = capimsg_setu32(msg, NCCI); + + if (bch == sc->sc_nbch) { + printf("capi%d: can't get cd for connect_b3_resp NCCI %x\n", + sc->sc_unit, NCCI); + msg = capimsg_setu16(msg, 8); /* Reject, destination OOO */ + + } else { + sc->sc_bchan[bch].ncci = NCCI; + sc->sc_bchan[bch].state = B_CONNECT_B3_ACTIVE_IND; + msg = capimsg_setu16(msg, 0); /* Accept */ + } + + msg = capimsg_setu8(msg, 0); /* NCPI */ + + sc->send(sc, m); +} + +/* +// Data transfer: +// -------------- +*/ + +void capi_data_b3_req(capi_softc_t *sc, int chan, struct mbuf *m_b3) +{ + struct mbuf *m = i4b_Dgetmbuf(8 + 14); + u_int8_t *msg; + u_int16_t msgid; + + if (!m) { + printf("capi%d: can't get mbuf for data_b3_req\n", sc->sc_unit); + return; + } + + msgid = sc->sc_bchan[chan].msgid = sc->sc_msgid++; + sc->sc_bchan[chan].busy = 1; + + msg = capimsg_setu16(mtod(m, u_int8_t*), m->m_len); + msg = capimsg_setu16(msg, I4BCAPI_APPLID); + msg = capimsg_setu16(msg, CAPI_DATA_B3_REQ); + msg = capimsg_setu16(msg, msgid); + + msg = capimsg_setu32(msg, sc->sc_bchan[chan].ncci); + msg = capimsg_setu32(msg, (u_int32_t) m_b3->m_data); /* Pointer */ + msg = capimsg_setu16(msg, m_b3->m_len); + msg = capimsg_setu16(msg, chan); + msg = capimsg_setu16(msg, 0); /* Flags */ + + m->m_next = m_b3; + + sc->send(sc, m); +} + +void capi_data_b3_conf(capi_softc_t *sc, struct mbuf *m_in) +{ + u_int8_t *msg = mtod(m_in, u_int8_t*); + u_int32_t NCCI; + u_int16_t handle; + u_int16_t Info; + + msg = capimsg_getu32(msg + 8, &NCCI); + msg = capimsg_getu16(msg, &handle); + msg = capimsg_getu16(msg, &Info); + + if (Info == 0) { + sc->sc_bchan[handle].busy = 0; + capi_start_tx(sc, handle); + + } else { + printf("capi%d: data_b3_conf NCCI %x handle %x info=%04x\n", + sc->sc_unit, NCCI, handle, Info); + } +} + +void capi_data_b3_ind(capi_softc_t *sc, struct mbuf *m_in) +{ + struct mbuf *m = i4b_Dgetmbuf(8 + 14); + u_int8_t *msg = mtod(m_in, u_int8_t*); + u_int16_t applid, msgid; + u_int32_t NCCI; + u_int16_t handle; + int bch; + + if (!m) { + printf("capi%d: can't get mbuf for data_b3_resp\n", sc->sc_unit); + return; + } + + msg = capimsg_getu16(msg + 2, &applid); + msg = capimsg_getu16(msg + 2, &msgid); + msg = capimsg_getu32(msg, &NCCI); + msg = capimsg_getu16(msg + 6, &handle); + + for (bch = 0; bch < sc->sc_nbch; bch++) + if ((sc->sc_bchan[bch].state == B_CONNECTED) && + (sc->sc_bchan[bch].ncci == NCCI)) + break; + + if (bch == sc->sc_nbch) { + printf("capi%d: can't find channel for data_b3_ind NCCI %x\n", + sc->sc_unit, NCCI); + + } else { + if (sc->sc_bchan[bch].bprot == BPROT_RHDLC) { + /* HDLC drivers use rx_mbuf */ + + sc->sc_bchan[bch].in_mbuf = m_in->m_next; + sc->sc_bchan[bch].rxcount += m_in->m_next->m_len; + m_in->m_next = NULL; /* driver frees */ + + (*sc->sc_bchan[bch].capi_drvr_linktab->bch_rx_data_ready)( + sc->sc_bchan[bch].capi_drvr_linktab->unit); + + } else { + /* Telephony drivers use rx_queue */ + + if (!_IF_QFULL(&sc->sc_bchan[bch].rx_queue)) { + _IF_ENQUEUE(&sc->sc_bchan[bch].rx_queue, m_in->m_next); + sc->sc_bchan[bch].rxcount += m_in->m_next->m_len; + m_in->m_next = NULL; /* driver frees */ + } + + (*sc->sc_bchan[bch].capi_drvr_linktab->bch_rx_data_ready)( + sc->sc_bchan[bch].capi_drvr_linktab->unit); + } + } + + msg = capimsg_setu16(mtod(m, u_int8_t*), m->m_len); + msg = capimsg_setu16(msg, I4BCAPI_APPLID); + msg = capimsg_setu16(msg, CAPI_DATA_B3_RESP); + msg = capimsg_setu16(msg, msgid); + + msg = capimsg_setu32(msg, NCCI); + msg = capimsg_setu16(msg, handle); + + sc->send(sc, m); +} + +/* +// Connection teardown: +// -------------------- +*/ + +void capi_disconnect_req(capi_softc_t *sc, call_desc_t *cd) +{ + struct mbuf *m = i4b_Dgetmbuf(8 + 5); + u_int8_t *msg; + u_int16_t msgid; + u_int32_t PLCI; + + if (!m) { + printf("capi%d: can't get mbuf for disconnect_req\n", sc->sc_unit); + return; + } + + sc->sc_bchan[cd->channelid].state = B_DISCONNECT_CONF; + ctrl_desc[sc->ctrl_unit].bch_state[cd->channelid] = BCH_ST_RSVD; + msgid = sc->sc_bchan[cd->channelid].msgid = sc->sc_msgid++; + PLCI = (sc->sc_bchan[cd->channelid].ncci & CAPI_PLCI_MASK); + + msg = capimsg_setu16(mtod(m, u_int8_t*), m->m_len); + msg = capimsg_setu16(msg, I4BCAPI_APPLID); + msg = capimsg_setu16(msg, CAPI_DISCONNECT_REQ); + msg = capimsg_setu16(msg, msgid); + + msg = capimsg_setu32(msg, PLCI); + msg = capimsg_setu8(msg, 0); /* Additional Info */ + + sc->send(sc, m); +} + +void capi_disconnect_conf(capi_softc_t *sc, struct mbuf *m_in) +{ + u_int8_t *msg = mtod(m_in, u_int8_t*); + call_desc_t *cd; + u_int32_t PLCI; + int bch; + + msg = capimsg_getu32(msg + 8, &PLCI); + + for (bch = 0; bch < sc->sc_nbch; bch++) + if ((sc->sc_bchan[bch].state == B_DISCONNECT_CONF) && + ((sc->sc_bchan[bch].ncci & CAPI_PLCI_MASK) == PLCI)) + break; + + if (bch == sc->sc_nbch) { + printf("capi%d: can't find channel for disconnect_conf PLCI %x\n", + sc->sc_unit, PLCI); + return; + } + + cd = cd_by_cdid(sc->sc_bchan[bch].cdid); + if (!cd) { + printf("capi%d: can't find cd for disconnect_conf PLCI %x\n", + sc->sc_unit, PLCI); + } else { + i4b_l4_disconnect_ind(cd); + freecd_by_cd(cd); + } + + sc->sc_bchan[bch].state = B_FREE; + ctrl_desc[sc->ctrl_unit].bch_state[bch] = BCH_ST_FREE; +} + +void capi_disconnect_b3_ind(capi_softc_t *sc, struct mbuf *m_in) +{ + struct mbuf *m = i4b_Dgetmbuf(8 + 4); + u_int8_t *msg = mtod(m_in, u_int8_t*); + u_int16_t applid, msgid; + u_int32_t NCCI; + + if (!m) { + printf("capi%d: can't get mbuf for disconnect_b3_resp\n", sc->sc_unit); + return; + } + + msg = capimsg_getu16(msg + 2, &applid); + msg = capimsg_getu16(msg + 2, &msgid); + msg = capimsg_getu32(msg, &NCCI); + + /* XXX update bchan state? XXX */ + + msg = capimsg_setu16(mtod(m, u_int8_t*), m->m_len); + msg = capimsg_setu16(msg, applid); + msg = capimsg_setu16(msg, CAPI_DISCONNECT_B3_RESP); + msg = capimsg_setu16(msg, msgid); + + msg = capimsg_setu32(msg, NCCI); + + sc->send(sc, m); +} + +void capi_disconnect_ind(capi_softc_t *sc, struct mbuf *m_in) +{ + struct mbuf *m = i4b_Dgetmbuf(8 + 4); + u_int8_t *msg = mtod(m_in, u_int8_t*); + call_desc_t *cd; + u_int16_t applid, msgid; + u_int32_t PLCI; + u_int16_t Reason; + int bch; + + if (!m) { + printf("capi%d: can't get mbuf for disconnect_resp\n", sc->sc_unit); + return; + } + + msg = capimsg_getu16(msg + 2, &applid); + msg = capimsg_getu16(msg + 2, &msgid); + msg = capimsg_getu32(msg, &PLCI); + msg = capimsg_getu16(msg, &Reason); + + for (bch = 0; bch < sc->sc_nbch; bch++) + if ((sc->sc_bchan[bch].state != B_FREE) && + ((sc->sc_bchan[bch].ncci & CAPI_PLCI_MASK) == PLCI)) + break; + + if (bch < sc->sc_nbch) { + /* We may not have a bchan assigned if call was ignored. */ + + cd = cd_by_cdid(sc->sc_bchan[bch].cdid); + sc->sc_bchan[bch].state = B_DISCONNECT_IND; + } else cd = NULL; + + if (cd) { + if ((Reason & 0xff00) == 0x3400) { + SET_CAUSE_TV(cd->cause_in, CAUSET_Q850, (Reason & 0x7f)); + } else { + SET_CAUSE_TV(cd->cause_in, CAUSET_I4B, CAUSE_I4B_NORMAL); + } + + i4b_l4_disconnect_ind(cd); + freecd_by_cd(cd); + + sc->sc_bchan[bch].state = B_FREE; + ctrl_desc[sc->ctrl_unit].bch_state[bch] = BCH_ST_FREE; + } + + msg = capimsg_setu16(mtod(m, u_int8_t*), m->m_len); + msg = capimsg_setu16(msg, applid); + msg = capimsg_setu16(msg, CAPI_DISCONNECT_RESP); + msg = capimsg_setu16(msg, msgid); + + msg = capimsg_setu32(msg, PLCI); + + sc->send(sc, m); +} + +#endif /* NI4BCAPI > 0 */ diff --git a/sys/i4b/capi/capi_msgs.h b/sys/i4b/capi/capi_msgs.h new file mode 100644 index 000000000000..3cdce35991d6 --- /dev/null +++ b/sys/i4b/capi/capi_msgs.h @@ -0,0 +1,380 @@ +/* + * Copyright (c) 2001 Cubical Solutions Ltd. 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. + * + * capi/capi_msgs.h The CAPI i4b message and handler declarations. + * + * $FreeBSD$ + */ + +#ifndef _I4B_CAPI_MSGS_H_ +#define _I4B_CAPI_MSGS_H_ + +/* CAPI commands */ + +#define CAPI_ALERT 0x01 +#define CAPI_CONNECT 0x02 +#define CAPI_CONNECT_ACTIVE 0x03 +#define CAPI_CONNECT_B3 0x82 +#define CAPI_CONNECT_B3_ACTIVE 0x83 +#define CAPI_CONNECT_B3_T90_ACTIVE 0x88 +#define CAPI_DATA_B3 0x86 +#define CAPI_DISCONNECT_B3 0x84 +#define CAPI_DISCONNECT 0x04 +#define CAPI_FACILITY 0x80 +#define CAPI_INFO 0x08 +#define CAPI_LISTEN 0x05 +#define CAPI_MANUFACTURER 0xff +#define CAPI_RESET_B3 0x87 +#define CAPI_SELECT_B_PROTOCOL 0x41 + +/* CAPI subcommands */ + +#define CAPI_REQ 0x80 +#define CAPI_CONF 0x81 +#define CAPI_IND 0x82 +#define CAPI_RESP 0x83 + +/* CAPI combined commands */ + +#define CAPICMD(cmd,subcmd) (((subcmd)<<8)|(cmd)) + +#define CAPI_DISCONNECT_REQ CAPICMD(CAPI_DISCONNECT,CAPI_REQ) +#define CAPI_DISCONNECT_CONF CAPICMD(CAPI_DISCONNECT,CAPI_CONF) +#define CAPI_DISCONNECT_IND CAPICMD(CAPI_DISCONNECT,CAPI_IND) +#define CAPI_DISCONNECT_RESP CAPICMD(CAPI_DISCONNECT,CAPI_RESP) + +#define CAPI_ALERT_REQ CAPICMD(CAPI_ALERT,CAPI_REQ) +#define CAPI_ALERT_CONF CAPICMD(CAPI_ALERT,CAPI_CONF) + +#define CAPI_CONNECT_REQ CAPICMD(CAPI_CONNECT,CAPI_REQ) +#define CAPI_CONNECT_CONF CAPICMD(CAPI_CONNECT,CAPI_CONF) +#define CAPI_CONNECT_IND CAPICMD(CAPI_CONNECT,CAPI_IND) +#define CAPI_CONNECT_RESP CAPICMD(CAPI_CONNECT,CAPI_RESP) + +#define CAPI_CONNECT_ACTIVE_REQ CAPICMD(CAPI_CONNECT_ACTIVE,CAPI_REQ) +#define CAPI_CONNECT_ACTIVE_CONF CAPICMD(CAPI_CONNECT_ACTIVE,CAPI_CONF) +#define CAPI_CONNECT_ACTIVE_IND CAPICMD(CAPI_CONNECT_ACTIVE,CAPI_IND) +#define CAPI_CONNECT_ACTIVE_RESP CAPICMD(CAPI_CONNECT_ACTIVE,CAPI_RESP) + +#define CAPI_SELECT_B_PROTOCOL_REQ CAPICMD(CAPI_SELECT_B_PROTOCOL,CAPI_REQ) +#define CAPI_SELECT_B_PROTOCOL_CONF CAPICMD(CAPI_SELECT_B_PROTOCOL,CAPI_CONF) + +#define CAPI_CONNECT_B3_REQ CAPICMD(CAPI_CONNECT_B3,CAPI_REQ) +#define CAPI_CONNECT_B3_CONF CAPICMD(CAPI_CONNECT_B3,CAPI_CONF) +#define CAPI_CONNECT_B3_IND CAPICMD(CAPI_CONNECT_B3,CAPI_IND) +#define CAPI_CONNECT_B3_RESP CAPICMD(CAPI_CONNECT_B3,CAPI_RESP) + +#define CAPI_CONNECT_B3_ACTIVE_REQ CAPICMD(CAPI_CONNECT_B3_ACTIVE,CAPI_REQ) +#define CAPI_CONNECT_B3_ACTIVE_CONF CAPICMD(CAPI_CONNECT_B3_ACTIVE,CAPI_CONF) +#define CAPI_CONNECT_B3_ACTIVE_IND CAPICMD(CAPI_CONNECT_B3_ACTIVE,CAPI_IND) +#define CAPI_CONNECT_B3_ACTIVE_RESP CAPICMD(CAPI_CONNECT_B3_ACTIVE,CAPI_RESP) + +#define CAPI_CONNECT_B3_T90_ACTIVE_IND CAPICMD(CAPI_CONNECT_B3_T90_ACTIVE,CAPI_IND) +#define CAPI_CONNECT_B3_T90_ACTIVE_RESP CAPICMD(CAPI_CONNECT_B3_T90_ACTIVE,CAPI_RESP) + +#define CAPI_DATA_B3_REQ CAPICMD(CAPI_DATA_B3,CAPI_REQ) +#define CAPI_DATA_B3_CONF CAPICMD(CAPI_DATA_B3,CAPI_CONF) +#define CAPI_DATA_B3_IND CAPICMD(CAPI_DATA_B3,CAPI_IND) +#define CAPI_DATA_B3_RESP CAPICMD(CAPI_DATA_B3,CAPI_RESP) + +#define CAPI_DISCONNECT_B3_REQ CAPICMD(CAPI_DISCONNECT_B3,CAPI_REQ) +#define CAPI_DISCONNECT_B3_CONF CAPICMD(CAPI_DISCONNECT_B3,CAPI_CONF) +#define CAPI_DISCONNECT_B3_IND CAPICMD(CAPI_DISCONNECT_B3,CAPI_IND) +#define CAPI_DISCONNECT_B3_RESP CAPICMD(CAPI_DISCONNECT_B3,CAPI_RESP) + +#define CAPI_RESET_B3_REQ CAPICMD(CAPI_RESET_B3,CAPI_REQ) +#define CAPI_RESET_B3_CONF CAPICMD(CAPI_RESET_B3,CAPI_CONF) +#define CAPI_RESET_B3_IND CAPICMD(CAPI_RESET_B3,CAPI_IND) +#define CAPI_RESET_B3_RESP CAPICMD(CAPI_RESET_B3,CAPI_RESP) + +#define CAPI_LISTEN_REQ CAPICMD(CAPI_LISTEN,CAPI_REQ) +#define CAPI_LISTEN_CONF CAPICMD(CAPI_LISTEN,CAPI_CONF) + +#define CAPI_MANUFACTURER_REQ CAPICMD(CAPI_MANUFACTURER,CAPI_REQ) +#define CAPI_MANUFACTURER_CONF CAPICMD(CAPI_MANUFACTURER,CAPI_CONF) +#define CAPI_MANUFACTURER_IND CAPICMD(CAPI_MANUFACTURER,CAPI_IND) +#define CAPI_MANUFACTURER_RESP CAPICMD(CAPI_MANUFACTURER,CAPI_RESP) + +#define CAPI_FACILITY_REQ CAPICMD(CAPI_FACILITY,CAPI_REQ) +#define CAPI_FACILITY_CONF CAPICMD(CAPI_FACILITY,CAPI_CONF) +#define CAPI_FACILITY_IND CAPICMD(CAPI_FACILITY,CAPI_IND) +#define CAPI_FACILITY_RESP CAPICMD(CAPI_FACILITY,CAPI_RESP) + +#define CAPI_INFO_REQ CAPICMD(CAPI_INFO,CAPI_REQ) +#define CAPI_INFO_CONF CAPICMD(CAPI_INFO,CAPI_CONF) +#define CAPI_INFO_IND CAPICMD(CAPI_INFO,CAPI_IND) +#define CAPI_INFO_RESP CAPICMD(CAPI_INFO,CAPI_RESP) + +/* CAPI message access helpers */ + +/* + * CAPI message header: + * word Length + * word ApplId + * byte Command + * byte Subcommand + * word MsgId + * + * Note that in the following, Controller/PLCI/NCCI is coded as follows: + * bits 0..6 = controller, bit 7 = ext/int, bits 8..15 = PLCI, and + * bits 16..31 = NCCI value. + * + * ALERT_REQ, 01 80: + * dword PLCI + * struct Additional Info + * + * ALERT_CONF, 01 81: + * dword PLCI + * word Info (0 = OK, other = cause) + * + * CONNECT_REQ, 02 80: + * dword controller + * word CIP + * struct Called party number + * struct Calling party number + * struct Called party subaddress + * struct Calling party subaddress + * struct Bearer Capability + * struct Low Layer Compatibility + * struct High Layer Compatibility + * struct Additional Info + * + * CONNECT_CONF, 02 81: + * dword PLCI + * word Info (0 = OK, other = cause) + * + * CONNECT_IND, 02 82: + * dword PLCI + * word CIP + * struct Called party number + * struct Calling party number + * struct Called party subaddress + * struct Calling party subaddress + * struct Bearer Capability + * struct Low Layer Compatibility + * struct High Layer Compatibility + * struct Additional Info + * struct Second Calling party number + * + * CONNECT_RESP, 02 83: + * dword PLCI + * word Reject (0 = accept, 1 = ignore, 2 = reject/normal clearing) + * struct B protocol + * struct Connected number + * struct Connected subaddress + * struct Low Layer Compatibility + * struct Additional Info + * + * CONNECT_ACTIVE_IND, 03 82: + * dword PLCI + * struct Connected number + * struct Connected subaddress + * struct Low Layer Compatibility + * + * CONNECT_ACTIVE_RESP, 03 83: + * dword PLCI + * + * CONNECT_B3_REQ, 82 80: + * dword PLCI + * struct NCPI + * + * CONNECT_B3_CONF, 82 81: + * dword NCCI + * word Info (0 = connected, other = cause) + * + * CONNECT_B3_IND, 82 82: + * dword NCCI + * struct NCPI + * + * CONNECT_B3_RESP, 82 83: + * dword NCCI + * word Reject (0 = accept, 2 = reject/normal clearing) + * struct NCPI + * + * CONNECT_B3_ACTIVE_IND, 83 82: + * dword NCCI + * struct NCPI + * + * CONNECT_B3_ACTIVE_RESP, 83 83: + * dword NCCI + * + * DATA_B3_REQ, 86 80: + * dword NCCI + * dword Data pointer + * word Data length + * word Data handle (packet id) + * word Flags (02 = more) + * + * DATA_B3_CONF, 86 81: + * dword NCCI + * word Data handle (packet id) + * word Info (0 = OK, other = cause) + * + * DATA_B3_IND, 86 82: + * dword NCCI + * dword Data pointer + * word Data length + * word Data handle (packet id) + * word Flags (02 = more) + * + * DATA_B3_RESP, 86 83: + * dword NCCI + * word Data handle (packet id) + * + * DISCONNECT_B3_REQ, 84 80: + * dword NCCI + * struct NCPI + * + * DISCONNECT_B3_CONF, 84 81: + * dword NCCI + * word Info (0 = OK, other = cause) + * + * DISCONNECT_B3_IND, 84 82: + * dword NCCI + * word Reason + * struct NCPI + * + * DISCONNECT_B3_RESP, 84 83: + * dword NCCI + * + * DISCONNECT_REQ, 04 80: + * dword PLCI + * struct Additional Info + * + * DISCONNECT_CONF, 04 81: + * dword PLCI + * word Info (0 = OK, other = cause) + * + * DISCONNECT_IND, 04 82: + * dword PLCI + * word Reason + * + * DISCONNECT_RESP, 04 83: + * dword PLCI + * + * LISTEN_REQ, 05 80: + * dword Controller + * dword Info mask (bits 0..9 used) + * dword CIP Mask (bit 0 = any match) + * dword CIP Mask 2 (bit 0 = any match) + * struct Calling party number + * struct Calling party subaddress + * + * LISTEN_CONF, 05 81: + * dword Controller + * word Info (0 = OK, other = cause) + * + * INFO_REQ, 08 80: + * dword Controller/PLCI + * struct Called party number + * struct Additional Info + * + * INFO_CONF, 08 81: + * dword Controller/PLCI + * word Info (0 = OK, other = cause) + * + * INFO_IND, 08 82: + * dword Controller/PLCI + * word Info number + * struct Info element + * + * INFO_RESP, 08 83: + * dword Controller/PLCI + */ + +#define CAPIMSG_LEN(msg) (msg[0]|(msg[1]<<8)) +#define CAPIMSG_DATALEN(msg) (msg[16]|(msg[17]<<8)) + +static __inline u_int8_t* capimsg_getu8(u_int8_t *msg, u_int8_t *val) +{ + *val = *msg; + return (msg + 1); +} + +static __inline u_int8_t* capimsg_getu16(u_int8_t *msg, u_int16_t *val) +{ + *val = (msg[0]|(msg[1]<<8)); + return (msg + 2); +} + +static __inline u_int8_t* capimsg_getu32(u_int8_t *msg, u_int32_t *val) +{ + *val = (msg[0]|(msg[1]<<8)|(msg[2]<<16)|(msg[3]<<24)); + return (msg + 4); +} + +static __inline u_int8_t* capimsg_setu8(u_int8_t *msg, u_int8_t val) +{ + msg[0] = val; + return (msg + 1); +} + +static __inline u_int8_t* capimsg_setu16(u_int8_t *msg, u_int16_t val) +{ + msg[0] = (val & 0xff); + msg[1] = (val >> 8) & 0xff; + return (msg + 2); +} + +static __inline u_int8_t* capimsg_setu32(u_int8_t *msg, u_int32_t val) +{ + msg[0] = (val & 0xff); + msg[1] = (val >> 8) & 0xff; + msg[2] = (val >> 16) & 0xff; + msg[3] = (val >> 24) & 0xff; + return (msg + 4); +} + +/* +// CAPI message handlers called by higher layers +*/ + +extern void capi_listen_req(capi_softc_t *sc, u_int32_t CIP); +extern void capi_alert_req(capi_softc_t *sc, call_desc_t *cd); +extern void capi_connect_req(capi_softc_t *sc, call_desc_t *cd); +extern void capi_connect_b3_req(capi_softc_t *sc, call_desc_t *cd); +extern void capi_connect_resp(capi_softc_t *sc, call_desc_t *cd); +extern void capi_data_b3_req(capi_softc_t *sc, int chan, struct mbuf *m); +extern void capi_disconnect_req(capi_softc_t *sc, call_desc_t *cd); + +/* +// CAPI message handlers called by the receive routine +*/ + +extern void capi_listen_conf(capi_softc_t *sc, struct mbuf *m); +extern void capi_info_ind(capi_softc_t *sc, struct mbuf *m); +extern void capi_alert_conf(capi_softc_t *sc, struct mbuf *m); +extern void capi_connect_conf(capi_softc_t *sc, struct mbuf *m); +extern void capi_connect_active_ind(capi_softc_t *sc, struct mbuf *m); +extern void capi_connect_b3_conf(capi_softc_t *sc, struct mbuf *m); +extern void capi_connect_b3_active_ind(capi_softc_t *sc, struct mbuf *m); +extern void capi_connect_ind(capi_softc_t *sc, struct mbuf *m); +extern void capi_connect_b3_ind(capi_softc_t *sc, struct mbuf *m); +extern void capi_data_b3_conf(capi_softc_t *sc, struct mbuf *m); +extern void capi_data_b3_ind(capi_softc_t *sc, struct mbuf *m); +extern void capi_disconnect_conf(capi_softc_t *sc, struct mbuf *m); +extern void capi_disconnect_b3_ind(capi_softc_t *sc, struct mbuf *m); +extern void capi_disconnect_ind(capi_softc_t *sc, struct mbuf *m); + +#endif /* _I4B_CAPI_MSGS_H_ */ diff --git a/sys/i4b/capi/iavc/iavc.h b/sys/i4b/capi/iavc/iavc.h new file mode 100644 index 000000000000..a38ad70c39a9 --- /dev/null +++ b/sys/i4b/capi/iavc/iavc.h @@ -0,0 +1,586 @@ +/* + * Copyright (c) 2001 Cubical Solutions Ltd. 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. + * + * capi/iavc/iavc.h The AVM ISDN controllers' common declarations. + * + * $FreeBSD$ + */ + +#ifndef _CAPI_IAVC_H_ +#define _CAPI_IAVC_H_ + +/* max 4 units supported per machine */ + +#define IAVC_MAXUNIT 4 + +/* +// iavc_softc_t +// The software context of one AVM T1 controller. +*/ + +#define IAVC_IO_BASES 1 + +typedef struct i4b_info { + struct resource * io_base[IAVC_IO_BASES]; + int io_rid [IAVC_IO_BASES]; + struct resource * irq; + int irq_rid; + struct resource * mem; + int mem_rid; +} i4b_info_t; + +typedef struct iavc_softc { + capi_softc_t sc_capi; + int sc_unit; + int sc_cardtyp; + + u_int32_t sc_membase; + bus_space_handle_t sc_mem_bh; + bus_space_tag_t sc_mem_bt; + u_int32_t sc_iobase; + bus_space_handle_t sc_io_bh; + bus_space_tag_t sc_io_bt; + + int sc_state; +#define IAVC_DOWN 0 +#define IAVC_POLL 1 +#define IAVC_INIT 2 +#define IAVC_UP 3 + int sc_blocked; + int sc_dma; + int sc_t1; + int sc_intr; + + u_int32_t sc_csr; + + char sc_sendbuf[128+2048]; + char sc_recvbuf[128+2048]; + int sc_recvlen; + + struct ifqueue sc_txq; + + i4b_info_t sc_resources; +} iavc_softc_t; + +extern iavc_softc_t iavc_sc[]; + +#define iavc_find_sc(unit) (&iavc_sc[(unit)]) + +/* +// {b1,b1dma,t1}_{detect,reset} +// Routines to detect and manage the specific type of card. +*/ + +extern int b1_detect(iavc_softc_t *sc); +extern void b1_disable_irq(iavc_softc_t *sc); +extern void b1_reset(iavc_softc_t *sc); + +extern int b1dma_detect(iavc_softc_t *sc); +extern void b1dma_reset(iavc_softc_t *sc); + +extern int t1_detect(iavc_softc_t *sc); +extern void t1_disable_irq(iavc_softc_t *sc); +extern void t1_reset(iavc_softc_t *sc); + +/* +// AMCC_{READ,WRITE} +// Routines to access the memory mapped registers of the +// S5933 DMA controller. +*/ + +static __inline u_int32_t AMCC_READ(iavc_softc_t *sc, int off) +{ + return bus_space_read_4(sc->sc_mem_bt, sc->sc_mem_bh, off); +} + +static __inline void AMCC_WRITE(iavc_softc_t *sc, int off, u_int32_t value) +{ + bus_space_write_4(sc->sc_mem_bt, sc->sc_mem_bh, off, value); +} + +/* +// amcc_{put,get}_{byte,word} +// Routines to access the DMA buffers byte- or wordwise. +*/ + +static __inline u_int8_t* amcc_put_byte(u_int8_t *buf, u_int8_t value) +{ + *buf++ = value; + return buf; +} + +static __inline u_int8_t* amcc_get_byte(u_int8_t *buf, u_int8_t *value) +{ + *value = *buf++; + return buf; +} + +static __inline u_int8_t* amcc_put_word(u_int8_t *buf, u_int32_t value) +{ + *buf++ = (value & 0xff); + *buf++ = (value >> 8) & 0xff; + *buf++ = (value >> 16) & 0xff; + *buf++ = (value >> 24) & 0xff; + return buf; +} + +static __inline u_int8_t* amcc_get_word(u_int8_t *buf, u_int32_t *value) +{ + *value = *buf++; + *value |= (*buf++ << 8); + *value |= (*buf++ << 16); + *value |= (*buf++ << 24); + return buf; +} + +/* +// Controller LLI message numbers. +*/ + +#define SEND_POLL 0x72 +#define SEND_INIT 0x11 +#define SEND_REGISTER 0x12 +#define SEND_DATA_B3_REQ 0x13 +#define SEND_RELEASE 0x14 +#define SEND_MESSAGE 0x15 +#define SEND_CONFIG 0x71 +#define SEND_POLLACK 0x73 + +#define RECEIVE_POLL 0x32 +#define RECEIVE_INIT 0x27 +#define RECEIVE_MESSAGE 0x21 +#define RECEIVE_DATA_B3_IND 0x22 +#define RECEIVE_START 0x23 +#define RECEIVE_STOP 0x24 +#define RECEIVE_NEW_NCCI 0x25 +#define RECEIVE_FREE_NCCI 0x26 +#define RECEIVE_RELEASE 0x26 +#define RECEIVE_TASK_READY 0x31 +#define RECEIVE_DEBUGMSG 0x71 +#define RECEIVE_POLLDWORD 0x75 + +/* Operation constants */ + +#define WRITE_REGISTER 0x00 +#define READ_REGISTER 0x01 + +/* Port offsets in I/O space */ + +#define B1_READ 0x00 +#define B1_WRITE 0x01 +#define B1_INSTAT 0x02 +#define B1_OUTSTAT 0x03 +#define B1_ANALYSE 0x04 +#define B1_REVISION 0x05 +#define B1_RESET 0x10 + +#define T1_FASTLINK 0x00 +#define T1_SLOWLINK 0x08 + +#define T1_READ B1_READ +#define T1_WRITE B1_WRITE +#define T1_INSTAT B1_INSTAT +#define T1_OUTSTAT B1_OUTSTAT +#define T1_IRQENABLE 0x05 +#define T1_FIFOSTAT 0x06 +#define T1_RESETLINK 0x10 +#define T1_ANALYSE 0x11 +#define T1_IRQMASTER 0x12 +#define T1_IDENT 0x17 +#define T1_RESETBOARD 0x1f + +#define T1F_IREADY 0x01 +#define T1F_IHALF 0x02 +#define T1F_IFULL 0x04 +#define T1F_IEMPTY 0x08 +#define T1F_IFLAGS 0xf0 + +#define T1F_OREADY 0x10 +#define T1F_OHALF 0x20 +#define T1F_OEMPTY 0x40 +#define T1F_OFULL 0x80 +#define T1F_OFLAGS 0xf0 + +#define FIFO_OUTBSIZE 256 +#define FIFO_INPBSIZE 512 + +#define HEMA_VERSION_ID 0 +#define HEMA_PAL_ID 0 + +/* +// S5933 DMA controller register offsets in memory, and bitmasks. +*/ + +#define AMCC_RXPTR 0x24 +#define AMCC_RXLEN 0x28 +#define AMCC_TXPTR 0x2c +#define AMCC_TXLEN 0x30 + +#define AMCC_INTCSR 0x38 +#define EN_READ_TC_INT 0x00008000 +#define EN_WRITE_TC_INT 0x00004000 +#define EN_TX_TC_INT EN_READ_TC_INT +#define EN_RX_TC_INT EN_WRITE_TC_INT +#define AVM_FLAG 0x30000000 + +#define ANY_S5933_INT 0x00800000 +#define READ_TC_INT 0x00080000 +#define WRITE_TC_INT 0x00040000 +#define TX_TC_INT READ_TC_INT +#define RX_TC_INT WRITE_TC_INT +#define MASTER_ABORT_INT 0x00100000 +#define TARGET_ABORT_INT 0x00200000 +#define BUS_MASTER_INT 0x00200000 +#define ALL_INT 0x000c0000 + +#define AMCC_MCSR 0x3c +#define A2P_HI_PRIORITY 0x00000100 +#define EN_A2P_TRANSFERS 0x00000400 +#define P2A_HI_PRIORITY 0x00001000 +#define EN_P2A_TRANSFERS 0x00004000 +#define RESET_A2P_FLAGS 0x04000000 +#define RESET_P2A_FLAGS 0x02000000 + +/* +// (B1IO_WAIT_MAX * B1IO_WAIT_DLY) is the max wait in us for the card +// to become ready after an I/O operation. The default is 1 ms. +*/ + +#define B1IO_WAIT_MAX 1000 +#define B1IO_WAIT_DLY 1 + +/* +// b1io_outp +// Diagnostic output routine, returns the written value via +// the device's analysis register. +// +// b1io_rx_full +// Returns nonzero if data is readable from the card via the +// I/O ports. +// +// b1io_tx_empty +// Returns nonzero if data can be written to the card via the +// I/O ports. +*/ + +static __inline u_int8_t b1io_outp(iavc_softc_t *sc, int off, u_int8_t val) +{ + bus_space_write_1(sc->sc_io_bt, sc->sc_io_bh, off, val); + DELAY(1); + return bus_space_read_1(sc->sc_io_bt, sc->sc_io_bh, B1_ANALYSE); +} + +static __inline int b1io_rx_full(iavc_softc_t *sc) +{ + u_int8_t val = bus_space_read_1(sc->sc_io_bt, sc->sc_io_bh, B1_INSTAT); + return (val & 0x01); +} + +static __inline int b1io_tx_empty(iavc_softc_t *sc) +{ + u_int8_t val = bus_space_read_1(sc->sc_io_bt, sc->sc_io_bh, B1_OUTSTAT); + return (val & 0x01); +} + +/* +// b1io_{get,put}_{byte,word} +// Routines to read and write the device I/O registers byte- or +// wordwise. +// +// b1io_{get,put}_slice +// Routines to read and write sequential bytes to the device +// I/O registers. +*/ + +static __inline u_int8_t b1io_get_byte(iavc_softc_t *sc) +{ + int spin = 0; + while (!b1io_rx_full(sc) && spin < B1IO_WAIT_MAX) { + spin++; DELAY(B1IO_WAIT_DLY); + } + if (b1io_rx_full(sc)) + return bus_space_read_1(sc->sc_io_bt, sc->sc_io_bh, B1_READ); + printf("iavc%d: rx not completed\n", sc->sc_unit); + return 0xff; +} + +static __inline int b1io_put_byte(iavc_softc_t *sc, u_int8_t val) +{ + int spin = 0; + while (!b1io_tx_empty(sc) && spin < B1IO_WAIT_MAX) { + spin++; DELAY(B1IO_WAIT_DLY); + } + if (b1io_tx_empty(sc)) { + bus_space_write_1(sc->sc_io_bt, sc->sc_io_bh, B1_WRITE, val); + return 0; + } + printf("iavc%d: tx not emptied\n", sc->sc_unit); + return -1; +} + +static __inline int b1io_save_put_byte(iavc_softc_t *sc, u_int8_t val) +{ + int spin = 0; + while (!b1io_tx_empty(sc) && spin < B1IO_WAIT_MAX) { + spin++; DELAY(B1IO_WAIT_DLY); + } + if (b1io_tx_empty(sc)) { + b1io_outp(sc, B1_WRITE, val); + return 0; + } + printf("iavc%d: tx not emptied\n", sc->sc_unit); + return -1; +} + +static __inline u_int32_t b1io_get_word(iavc_softc_t *sc) +{ + u_int32_t val = 0; + val |= b1io_get_byte(sc); + val |= (b1io_get_byte(sc) << 8); + val |= (b1io_get_byte(sc) << 16); + val |= (b1io_get_byte(sc) << 24); + return val; +} + +static __inline void b1io_put_word(iavc_softc_t *sc, u_int32_t val) +{ + b1io_put_byte(sc, (val & 0xff)); + b1io_put_byte(sc, (val >> 8) & 0xff); + b1io_put_byte(sc, (val >> 16) & 0xff); + b1io_put_byte(sc, (val >> 24) & 0xff); +} + +static __inline int b1io_get_slice(iavc_softc_t *sc, u_int8_t *dp) +{ + int len, i; + len = i = b1io_get_word(sc); + while (i--) *dp++ = b1io_get_byte(sc); + return len; +} + +static __inline void b1io_put_slice(iavc_softc_t *sc, u_int8_t *dp, int len) +{ + b1io_put_word(sc, len); + while (len--) b1io_put_byte(sc, *dp++); +} + +/* +// b1io_{read,write}_reg +// Routines to read and write the device registers via the I/O +// ports. +*/ + +static __inline u_int32_t b1io_read_reg(iavc_softc_t *sc, int reg) +{ + b1io_put_byte(sc, READ_REGISTER); + b1io_put_word(sc, reg); + return b1io_get_word(sc); +} + +static __inline u_int32_t b1io_write_reg(iavc_softc_t *sc, int reg, u_int32_t val) +{ + b1io_put_byte(sc, WRITE_REGISTER); + b1io_put_word(sc, reg); + b1io_put_word(sc, val); + return b1io_get_word(sc); +} + +/* +// t1io_outp +// I/O port write operation for the T1, which does not seem +// to have the analysis port. +*/ + +static __inline void t1io_outp(iavc_softc_t *sc, int off, u_int8_t val) +{ + bus_space_write_1(sc->sc_io_bt, sc->sc_io_bh, off, val); +} + +static __inline u_int8_t t1io_inp(iavc_softc_t *sc, int off) +{ + return bus_space_read_1(sc->sc_io_bt, sc->sc_io_bh, off); +} + +static __inline int t1io_isfastlink(iavc_softc_t *sc) +{ + return ((bus_space_read_1(sc->sc_io_bt, sc->sc_io_bh, T1_IDENT) & ~0x82) == 1); +} + +static __inline u_int8_t t1io_fifostatus(iavc_softc_t *sc) +{ + return bus_space_read_1(sc->sc_io_bt, sc->sc_io_bh, T1_FIFOSTAT); +} + +static __inline int t1io_get_slice(iavc_softc_t *sc, u_int8_t *dp) +{ + int len, i; + len = i = b1io_get_word(sc); + if (t1io_isfastlink(sc)) { + int status; + while (i) { + status = t1io_fifostatus(sc) & (T1F_IREADY|T1F_IHALF); + if (i >= FIFO_INPBSIZE) status |= T1F_IFULL; + + switch (status) { + case T1F_IREADY|T1F_IHALF|T1F_IFULL: + bus_space_read_multi_1(sc->sc_io_bt, sc->sc_io_bh, + T1_READ, dp, FIFO_INPBSIZE); + dp += FIFO_INPBSIZE; + i -= FIFO_INPBSIZE; + break; + + case T1F_IREADY|T1F_IHALF: + bus_space_read_multi_1(sc->sc_io_bt, sc->sc_io_bh, + T1_READ, dp, i); + dp += i; + i = 0; + break; + + default: + *dp++ = b1io_get_byte(sc); + i--; + } + } + } else { /* not fastlink */ + if (i--) *dp++ = b1io_get_byte(sc); + } + return len; +} + +static __inline void t1io_put_slice(iavc_softc_t *sc, u_int8_t *dp, int len) +{ + int i = len; + b1io_put_word(sc, i); + if (t1io_isfastlink(sc)) { + int status; + while (i) { + status = t1io_fifostatus(sc) & (T1F_OREADY|T1F_OHALF); + if (i >= FIFO_OUTBSIZE) status |= T1F_OFULL; + + switch (status) { + case T1F_OREADY|T1F_OHALF|T1F_OFULL: + bus_space_write_multi_1(sc->sc_io_bt, sc->sc_io_bh, + T1_WRITE, dp, FIFO_OUTBSIZE); + dp += FIFO_OUTBSIZE; + i -= FIFO_OUTBSIZE; + break; + + case T1F_OREADY|T1F_OHALF: + bus_space_write_multi_1(sc->sc_io_bt, sc->sc_io_bh, + T1_WRITE, dp, i); + dp += i; + i = 0; + break; + + default: + b1io_put_byte(sc, *dp++); + i--; + } + } + } else { + while (i--) b1io_put_byte(sc, *dp++); + } +} + +/* +// An attempt to bring it all together: +// ------------------------------------ +// +// iavc_{read,write}_reg +// Routines to access the device registers via the I/O port. +// +// iavc_{read,write}_port +// Routines to access the device I/O ports. +// +// iavc_tx_empty, iavc_rx_full +// Routines to check when the device has drained the last written +// byte, or produced a full byte to read. +// +// iavc_{get,put}_byte +// Routines to read/write byte values to the device via the I/O port. +// +// iavc_{get,put}_word +// Routines to read/write 32-bit words to the device via the I/O port. +// +// iavc_{get,put}_slice +// Routines to read/write {length, data} pairs to the device via the +// ubiquituous I/O port. Uses the HEMA FIFO on a T1. +*/ + +#define iavc_read_reg(sc, reg) b1io_read_reg(sc, reg) +#define iavc_write_reg(sc, reg, val) b1io_write_reg(sc, reg, val) + +#define iavc_read_port(sc, port) \ + bus_space_read_1(sc->sc_io_bt, sc->sc_io_bh, (port)) +#define iavc_write_port(sc, port, val) \ + bus_space_write_1(sc->sc_io_bt, sc->sc_io_bh, (port), (val)) + +#define iavc_tx_empty(sc) b1io_tx_empty(sc) +#define iavc_rx_full(sc) b1io_rx_full(sc) + +#define iavc_get_byte(sc) b1io_get_byte(sc) +#define iavc_put_byte(sc, val) b1io_put_byte(sc, val) +#define iavc_get_word(sc) b1io_get_word(sc) +#define iavc_put_word(sc, val) b1io_put_word(sc, val) + +static __inline u_int32_t iavc_get_slice(iavc_softc_t *sc, u_int8_t *dp) +{ + if (sc->sc_t1) return t1io_get_slice(sc, dp); + else return b1io_get_slice(sc, dp); +} + +static __inline void iavc_put_slice(iavc_softc_t *sc, u_int8_t *dp, int len) +{ + if (sc->sc_t1) t1io_put_slice(sc, dp, len); + else b1io_put_slice(sc, dp, len); +} + +/* +// iavc_handle_intr +// Interrupt handler, called by the bus specific interrupt routine +// in iavc_.c module. +// +// iavc_load +// CAPI callback. Resets device and loads firmware. +// +// iavc_register +// CAPI callback. Registers an application id. +// +// iavc_release +// CAPI callback. Releases an application id. +// +// iavc_send +// CAPI callback. Sends a CAPI message. A B3_DATA_REQ message has +// m_next point to a data mbuf. +*/ + +extern void iavc_handle_intr(iavc_softc_t *); +extern int iavc_load(capi_softc_t *, int, u_int8_t *); +extern int iavc_register(capi_softc_t *, int, int); +extern int iavc_release(capi_softc_t *, int); +extern int iavc_send(capi_softc_t *, struct mbuf *); + +extern void b1isa_setup_irq(struct iavc_softc *sc); + +#endif /* _CAPI_IAVC_H_ */ diff --git a/sys/i4b/capi/iavc/iavc_card.c b/sys/i4b/capi/iavc/iavc_card.c new file mode 100644 index 000000000000..831dc6870424 --- /dev/null +++ b/sys/i4b/capi/iavc/iavc_card.c @@ -0,0 +1,292 @@ +/* + * Copyright (c) 2001 Cubical Solutions Ltd. 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. + * + * capi/iavc/iavc_card.c + * The AVM ISDN controllers' card specific support routines. + * + * $FreeBSD$ + */ + +#include "iavc.h" +#include "i4bcapi.h" +#include "pci.h" + +#if (NIAVC > 0) && (NI4BCAPI > 0) + +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include + +#include + +#include + +/* +// AVM B1 (active BRI, PIO mode) +*/ + +int b1_detect(iavc_softc_t *sc) +{ + if ((iavc_read_port(sc, B1_INSTAT) & 0xfc) || + (iavc_read_port(sc, B1_OUTSTAT) & 0xfc)) + return (1); + + b1io_outp(sc, B1_INSTAT, 0x02); + b1io_outp(sc, B1_OUTSTAT, 0x02); + if ((iavc_read_port(sc, B1_INSTAT) & 0xfe) != 2 || + (iavc_read_port(sc, B1_OUTSTAT) & 0xfe) != 2) + return (2); + + b1io_outp(sc, B1_INSTAT, 0x00); + b1io_outp(sc, B1_OUTSTAT, 0x00); + if ((iavc_read_port(sc, B1_INSTAT) & 0xfe) || + (iavc_read_port(sc, B1_OUTSTAT) & 0xfe)) + return (3); + + return (0); /* found */ +} + +void b1_disable_irq(iavc_softc_t *sc) +{ + b1io_outp(sc, B1_INSTAT, 0x00); +} + +void b1_reset(iavc_softc_t *sc) +{ + b1io_outp(sc, B1_RESET, 0); + DELAY(55*2*1000); + + b1io_outp(sc, B1_RESET, 1); + DELAY(55*2*1000); + + b1io_outp(sc, B1_RESET, 0); + DELAY(55*2*1000); +} + +/* +// Newer PCI-based B1's, and T1's, supports DMA +*/ + +int b1dma_detect(iavc_softc_t *sc) +{ + AMCC_WRITE(sc, AMCC_MCSR, 0); + DELAY(10*1000); + AMCC_WRITE(sc, AMCC_MCSR, 0x0f000000); + DELAY(10*1000); + AMCC_WRITE(sc, AMCC_MCSR, 0); + DELAY(42*1000); + + AMCC_WRITE(sc, AMCC_RXLEN, 0); + AMCC_WRITE(sc, AMCC_TXLEN, 0); + sc->sc_csr = 0; + AMCC_WRITE(sc, AMCC_INTCSR, sc->sc_csr); + + if (AMCC_READ(sc, AMCC_INTCSR) != 0) + return 1; + + AMCC_WRITE(sc, AMCC_RXPTR, 0xffffffff); + AMCC_WRITE(sc, AMCC_TXPTR, 0xffffffff); + if ((AMCC_READ(sc, AMCC_RXPTR) != 0xfffffffc) || + (AMCC_READ(sc, AMCC_TXPTR) != 0xfffffffc)) + return 2; + + AMCC_WRITE(sc, AMCC_RXPTR, 0); + AMCC_WRITE(sc, AMCC_TXPTR, 0); + if ((AMCC_READ(sc, AMCC_RXPTR) != 0) || + (AMCC_READ(sc, AMCC_TXPTR) != 0)) + return 3; + + iavc_write_port(sc, 0x10, 0x00); + iavc_write_port(sc, 0x07, 0x00); + + iavc_write_port(sc, 0x02, 0x02); + iavc_write_port(sc, 0x03, 0x02); + + if (((iavc_read_port(sc, 0x02) & 0xfe) != 0x02) || + (iavc_read_port(sc, 0x03) != 0x03)) + return 4; + + iavc_write_port(sc, 0x02, 0x00); + iavc_write_port(sc, 0x03, 0x00); + + if (((iavc_read_port(sc, 0x02) & 0xfe) != 0x00) || + (iavc_read_port(sc, 0x03) != 0x01)) + return 5; + + return (0); /* found */ +} + +void b1dma_reset(iavc_softc_t *sc) +{ + int s = SPLI4B(); + + sc->sc_csr = 0; + AMCC_WRITE(sc, AMCC_INTCSR, sc->sc_csr); + AMCC_WRITE(sc, AMCC_MCSR, 0); + AMCC_WRITE(sc, AMCC_RXLEN, 0); + AMCC_WRITE(sc, AMCC_TXLEN, 0); + + iavc_write_port(sc, 0x10, 0x00); /* XXX magic numbers from */ + iavc_write_port(sc, 0x07, 0x00); /* XXX the linux driver */ + + splx(s); + + AMCC_WRITE(sc, AMCC_MCSR, 0); + DELAY(10 * 1000); + AMCC_WRITE(sc, AMCC_MCSR, 0x0f000000); + DELAY(10 * 1000); + AMCC_WRITE(sc, AMCC_MCSR, 0); + DELAY(42 * 1000); +} + +/* +// AVM T1 (active PRI) +*/ + +/* XXX how do these differ from b1io_{read,write}_reg()? XXX */ + +static int b1dma_tx_empty(int iobase) +{ return inb(iobase + 3) & 1; } + +static int b1dma_rx_full(int iobase) +{ return inb(iobase + 2) & 1; } + +static int b1dma_tolink(iavc_softc_t *sc, void *buf, int len) +{ + volatile int spin; + char *s = (char*) buf; + while (len--) { + spin = 0; + while (!b1dma_tx_empty(sc->sc_iobase) && spin < 100000) + spin++; + if (!b1dma_tx_empty(sc->sc_iobase)) + return -1; + t1io_outp(sc, 1, *s++); + } + return 0; +} + +static int b1dma_fromlink(iavc_softc_t *sc, void *buf, int len) +{ + volatile int spin; + char *s = (char*) buf; + while (len--) { + spin = 0; + while (!b1dma_rx_full(sc->sc_iobase) && spin < 100000) + spin++; + if (!b1dma_rx_full(sc->sc_iobase)) + return -1; + *s++ = t1io_inp(sc, 0); + } + return 0; +} + +static int WriteReg(iavc_softc_t *sc, u_int32_t reg, u_int8_t val) +{ + u_int8_t cmd = 0; + if (b1dma_tolink(sc, &cmd, 1) == 0 && + b1dma_tolink(sc, ®, 4) == 0) { + u_int32_t tmp = val; + return b1dma_tolink(sc, &tmp, 4); + } + return -1; +} + +static u_int8_t ReadReg(iavc_softc_t *sc, u_int32_t reg) +{ + u_int8_t cmd = 1; + if (b1dma_tolink(sc, &cmd, 1) == 0 && + b1dma_tolink(sc, ®, 4) == 0) { + u_int32_t tmp; + if (b1dma_fromlink(sc, &tmp, 4) == 0) + return (u_int8_t) tmp; + } + return 0xff; +} + +int t1_detect(iavc_softc_t *sc) +{ + int ret = b1dma_detect(sc); + if (ret) return ret; + + if ((WriteReg(sc, 0x80001000, 0x11) != 0) || + (WriteReg(sc, 0x80101000, 0x22) != 0) || + (WriteReg(sc, 0x80201000, 0x33) != 0) || + (WriteReg(sc, 0x80301000, 0x44) != 0)) + return 6; + + if ((ReadReg(sc, 0x80001000) != 0x11) || + (ReadReg(sc, 0x80101000) != 0x22) || + (ReadReg(sc, 0x80201000) != 0x33) || + (ReadReg(sc, 0x80301000) != 0x44)) + return 7; + + if ((WriteReg(sc, 0x80001000, 0x55) != 0) || + (WriteReg(sc, 0x80101000, 0x66) != 0) || + (WriteReg(sc, 0x80201000, 0x77) != 0) || + (WriteReg(sc, 0x80301000, 0x88) != 0)) + return 8; + + if ((ReadReg(sc, 0x80001000) != 0x55) || + (ReadReg(sc, 0x80101000) != 0x66) || + (ReadReg(sc, 0x80201000) != 0x77) || + (ReadReg(sc, 0x80301000) != 0x88)) + return 9; + + return 0; /* found */ +} + +void t1_disable_irq(iavc_softc_t *sc) +{ + iavc_write_port(sc, T1_IRQMASTER, 0x00); +} + +void t1_reset(iavc_softc_t *sc) +{ + b1_reset(sc); + iavc_write_port(sc, B1_INSTAT, 0x00); + iavc_write_port(sc, B1_OUTSTAT, 0x00); + iavc_write_port(sc, T1_IRQMASTER, 0x00); + iavc_write_port(sc, T1_RESETBOARD, 0x0f); +} + +#endif diff --git a/sys/i4b/capi/iavc/iavc_isa.c b/sys/i4b/capi/iavc/iavc_isa.c new file mode 100644 index 000000000000..96ea1c91bc96 --- /dev/null +++ b/sys/i4b/capi/iavc/iavc_isa.c @@ -0,0 +1,297 @@ +/* + * Copyright (c) 2001 Hellmuth Michaelis. 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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$ + */ + +#include "iavc.h" +#include "i4bcapi.h" + +#if (NIAVC > 0) && (NI4BCAPI > 0) + +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include + +#include + +#include + +/* ISA driver linkage */ + +static void iavc_isa_intr(iavc_softc_t *sc); +static int iavc_isa_probe(device_t dev); +static int iavc_isa_attach(device_t dev); + +static device_method_t iavc_isa_methods[] = +{ + DEVMETHOD(device_probe, iavc_isa_probe), + DEVMETHOD(device_attach, iavc_isa_attach), + { 0, 0 } +}; + +static driver_t iavc_isa_driver = +{ + "iavc", + iavc_isa_methods, + 0 +}; + +static devclass_t iavc_isa_devclass; + +DRIVER_MODULE(iavc, isa, iavc_isa_driver, iavc_isa_devclass, 0, 0); + +#define B1_IOLENGTH 0x20 + +static int b1_irq_table[] = +{0, 0, 0, 192, 32, 160, 96, 224, 0, 64, 80, 208, 48, 0, 0, 112}; +/* 3 4 5 6 7 9 10 11 12 15 */ + +/*---------------------------------------------------------------------------* + * device probe + *---------------------------------------------------------------------------*/ + +static int +iavc_isa_probe(device_t dev) +{ + struct iavc_softc *sc; + int ret = ENXIO; + int unit = device_get_unit(dev); + + if(isa_get_vendorid(dev)) /* no PnP probes here */ + return ENXIO; + + /* check max unit range */ + + if (unit >= IAVC_MAXUNIT) + { + printf("iavc%d: too many units\n", unit); + return(ENXIO); + } + + sc = iavc_find_sc(unit); /* get softc */ + + sc->sc_unit = unit; + + if (!(sc->sc_resources.io_base[0] = + bus_alloc_resource(dev, SYS_RES_IOPORT, + &sc->sc_resources.io_rid[0], + 0UL, ~0UL, B1_IOLENGTH, RF_ACTIVE))) + { + printf("iavc%d: can't allocate io region\n", unit); + return(ENXIO); + } + + sc->sc_iobase = rman_get_start(sc->sc_resources.io_base[0]); + + switch(sc->sc_iobase) + { + case 0x150: + case 0x250: + case 0x300: + case 0x340: + break; + default: + printf("iavc%d: ERROR, invalid i/o base addr 0x%x configured!\n", sc->sc_unit, sc->sc_iobase); + bus_release_resource(dev, SYS_RES_IOPORT, + sc->sc_resources.io_rid[0], + sc->sc_resources.io_base[0]); + return(ENXIO); + } + + sc->sc_io_bt = rman_get_bustag(sc->sc_resources.io_base[0]); + sc->sc_io_bh = rman_get_bushandle(sc->sc_resources.io_base[0]); + + /* setup characteristics */ + + sc->sc_t1 = FALSE; + sc->sc_dma = FALSE; + + sc->sc_capi.card_type = CARD_TYPEC_AVM_B1_ISA; + sc->sc_capi.sc_nbch = 2; + + b1_reset(sc); + DELAY(100); + + ret = b1_detect(sc); + + if(ret) + { + printf("iavc%d: no card ? b1_detect returns 0x02x\n", sc->sc_unit, ret); + return(ENXIO); + } + + DELAY(100); + + b1_reset(sc); + + DELAY(100); + + if(bootverbose) + { + printf("iavc%d: class = 0x%02x, rev = 0x%02x\n", sc->sc_unit, + iavc_read_port(sc, B1_ANALYSE), + iavc_read_port(sc, B1_REVISION)); + } + + device_set_desc(dev, "AVM B1 ISA"); + return(0); +} + +/*---------------------------------------------------------------------------* + * attach + *---------------------------------------------------------------------------*/ +static int +iavc_isa_attach(device_t dev) +{ + struct iavc_softc *sc; + void *ih = 0; + int unit = device_get_unit(dev); + int irq; + + sc = iavc_find_sc(unit); /* get softc */ + + sc->sc_resources.irq_rid = 0; + + if(!(sc->sc_resources.irq = + bus_alloc_resource(dev, SYS_RES_IRQ, + &sc->sc_resources.irq_rid, + 0UL, ~0UL, 1, RF_ACTIVE))) + { + printf("iavc%d: can't allocate irq\n",unit); + bus_release_resource(dev, SYS_RES_IOPORT, + sc->sc_resources.io_rid[0], + sc->sc_resources.io_base[0]); + return(ENXIO); + } + + irq = rman_get_start(sc->sc_resources.irq); + + if(b1_irq_table[irq] == 0) + { + printf("iavc%d: ERROR, illegal irq %d configured!\n",unit, irq); + bus_release_resource(dev, SYS_RES_IOPORT, + sc->sc_resources.io_rid[0], + sc->sc_resources.io_base[0]); + bus_release_resource(dev, SYS_RES_IRQ, + sc->sc_resources.irq_rid, + sc->sc_resources.irq); + return(ENXIO); + } + + memset(&sc->sc_txq, 0, sizeof(struct ifqueue)); + sc->sc_txq.ifq_maxlen = sc->sc_capi.sc_nbch * 4; + +#if defined (__FreeBSD__) && __FreeBSD__ > 4 + mtx_init(&sc->sc_txq.ifq_mtx, "i4b_ivac_isa", MTX_DEF); +#endif + + sc->sc_intr = FALSE; + sc->sc_state = IAVC_DOWN; + sc->sc_blocked = FALSE; + + /* setup capi link */ + + sc->sc_capi.load = iavc_load; + sc->sc_capi.reg_appl = iavc_register; + sc->sc_capi.rel_appl = iavc_release; + sc->sc_capi.send = iavc_send; + sc->sc_capi.ctx = (void*) sc; + + if (capi_ll_attach(&sc->sc_capi)) + { + printf("iavc%d: capi attach failed\n", unit); + return(ENXIO); + } + + /* setup the interrupt */ + + if(bus_setup_intr(dev, sc->sc_resources.irq, INTR_TYPE_NET, + (void(*)(void*))iavc_isa_intr, + sc, &ih)) + { + printf("iavc%d: irq setup failed\n", unit); + bus_release_resource(dev, SYS_RES_IOPORT, + sc->sc_resources.io_rid[0], + sc->sc_resources.io_base[0]); + bus_release_resource(dev, SYS_RES_IRQ, + sc->sc_resources.irq_rid, + sc->sc_resources.irq); + return(ENXIO); + } + + /* the board is now ready to be loaded */ + + return(0); +} + +/*---------------------------------------------------------------------------* + * setup interrupt + *---------------------------------------------------------------------------*/ +void +b1isa_setup_irq(struct iavc_softc *sc) +{ + int irq = rman_get_start(sc->sc_resources.irq); + + if(bootverbose) + printf("iavc%d: using irq %d\n", sc->sc_unit, irq); + + /* enable the interrupt */ + + b1io_outp(sc, B1_INSTAT, 0x00); + b1io_outp(sc, B1_RESET, b1_irq_table[irq]); + b1io_outp(sc, B1_INSTAT, 0x02); +} + +/*---------------------------------------------------------------------------* + * IRQ handler + *---------------------------------------------------------------------------*/ +static void +iavc_isa_intr(struct iavc_softc *sc) +{ + iavc_handle_intr(sc); +} + +#endif diff --git a/sys/i4b/capi/iavc/iavc_lli.c b/sys/i4b/capi/iavc/iavc_lli.c new file mode 100644 index 000000000000..7ce7eb454b22 --- /dev/null +++ b/sys/i4b/capi/iavc/iavc_lli.c @@ -0,0 +1,834 @@ +/* + * Copyright (c) 2001 Cubical Solutions Ltd. 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. + * + * capi/iavc/iavc_lli.c + * The AVM ISDN controllers' Low Level Interface. + * + * $FreeBSD$ + */ + +#include "iavc.h" +#include "i4bcapi.h" +#include "pci.h" + +#if (NIAVC > 0) && (NI4BCAPI > 0) + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include + +#include +#include + +#include + +/* Forward declarations of local subroutines... */ + +static int iavc_send_init(iavc_softc_t *); + +static void iavc_handle_rx(iavc_softc_t *); +static void iavc_start_tx(iavc_softc_t *); + +/* +// Callbacks from the upper (capi) layer: +// -------------------------------------- +// +// iavc_load +// Resets the board and loads the firmware, then initiates +// board startup. +// +// iavc_register +// Registers a CAPI application id. +// +// iavc_release +// Releases a CAPI application id. +// +// iavc_send +// Sends a capi message. +*/ + +int iavc_load(capi_softc_t *capi_sc, int len, u_int8_t *cp) +{ + iavc_softc_t *sc = (iavc_softc_t*) capi_sc->ctx; + u_int8_t val; + + if(bootverbose) + printf("iavc%d: reset card ....\n", sc->sc_unit); + + if (sc->sc_dma) + b1dma_reset(sc); /* PCI cards */ + else if (sc->sc_t1) + t1_reset(sc); /* ISA attachment T1 */ + else + b1_reset(sc); /* ISA attachment B1 */ + + DELAY(1000); + + if(bootverbose) + printf("iavc%d: start loading %d bytes firmware ....\n", sc->sc_unit, len); + + while (len && b1io_save_put_byte(sc, *cp++) == 0) + len--; + + if (len) { + printf("iavc%d: loading failed, can't write to card, len = %d\n", + sc->sc_unit, len); + return (EIO); + } + + if(bootverbose) + printf("iavc%d: firmware loaded, wait for ACK ....\n", sc->sc_unit); + + if(sc->sc_capi.card_type == CARD_TYPEC_AVM_B1_ISA) + iavc_put_byte(sc, SEND_POLL); + else + iavc_put_byte(sc, SEND_POLLACK); + + for (len = 0; len < 1000 && !iavc_rx_full(sc); len++) + DELAY(100); + + if (!iavc_rx_full(sc)) { + printf("iavc%d: loading failed, no ack\n", sc->sc_unit); + return (EIO); + } + + val = iavc_get_byte(sc); + + if ((sc->sc_dma && val != RECEIVE_POLLDWORD) || + (!sc->sc_dma && val != RECEIVE_POLL)) { + printf("iavc%d: loading failed, bad ack = %02x\n", sc->sc_unit, val); + return (EIO); + } + + if(bootverbose) + printf("iavc%d: got ACK = 0x%02x\n", sc->sc_unit, val); + + if (sc->sc_dma) { + /* Start the DMA engine */ + + int s = SPLI4B(); + + sc->sc_csr = AVM_FLAG; + AMCC_WRITE(sc, AMCC_INTCSR, sc->sc_csr); + AMCC_WRITE(sc, AMCC_MCSR, (EN_A2P_TRANSFERS|EN_P2A_TRANSFERS| + A2P_HI_PRIORITY|P2A_HI_PRIORITY| + RESET_A2P_FLAGS|RESET_P2A_FLAGS)); + + iavc_write_port(sc, 0x07, 0x30); /* XXX magic numbers from */ + iavc_write_port(sc, 0x10, 0xf0); /* XXX the linux driver */ + + sc->sc_recvlen = 0; + AMCC_WRITE(sc, AMCC_RXPTR, vtophys(&sc->sc_recvbuf[0])); + AMCC_WRITE(sc, AMCC_RXLEN, 4); + sc->sc_csr |= EN_RX_TC_INT|EN_TX_TC_INT; + AMCC_WRITE(sc, AMCC_INTCSR, sc->sc_csr); + + splx(s); + } + + if(sc->sc_capi.card_type == CARD_TYPEC_AVM_B1_ISA) + b1isa_setup_irq(sc); + + iavc_send_init(sc); + + return 0; +} + +int iavc_register(capi_softc_t *capi_sc, int applid, int nchan) +{ + iavc_softc_t *sc = (iavc_softc_t*) capi_sc->ctx; + struct mbuf *m = i4b_Dgetmbuf(23); + u_int8_t *p; + + if (!m) { + printf("iavc%d: can't get memory\n", sc->sc_unit); + return (ENOMEM); + } + + /* + * byte 0x12 = SEND_REGISTER + * dword ApplId + * dword NumMessages + * dword NumB3Connections 0..nbch + * dword NumB3Blocks + * dword B3Size + */ + + p = amcc_put_byte(mtod(m, u_int8_t*), 0); + p = amcc_put_byte(p, 0); + p = amcc_put_byte(p, SEND_REGISTER); + p = amcc_put_word(p, applid); +#if 0 + p = amcc_put_word(p, 1024 + (nchan + 1)); +#else + p = amcc_put_word(p, 1024 * (nchan + 1)); +#endif + p = amcc_put_word(p, nchan); + p = amcc_put_word(p, 8); + p = amcc_put_word(p, 2048); + + _IF_ENQUEUE(&sc->sc_txq, m); + + iavc_start_tx(sc); + + return 0; +} + +int iavc_release(capi_softc_t *capi_sc, int applid) +{ + iavc_softc_t *sc = (iavc_softc_t*) capi_sc->ctx; + struct mbuf *m = i4b_Dgetmbuf(7); + u_int8_t *p; + + if (!m) { + printf("iavc%d: can't get memory\n", sc->sc_unit); + return (ENOMEM); + } + + /* + * byte 0x14 = SEND_RELEASE + * dword ApplId + */ + + p = amcc_put_byte(mtod(m, u_int8_t*), 0); + p = amcc_put_byte(p, 0); + p = amcc_put_byte(p, SEND_RELEASE); + p = amcc_put_word(p, applid); + + _IF_ENQUEUE(&sc->sc_txq, m); + + iavc_start_tx(sc); + return 0; +} + +int iavc_send(capi_softc_t *capi_sc, struct mbuf *m) +{ + iavc_softc_t *sc = (iavc_softc_t*) capi_sc->ctx; + + if (sc->sc_state != IAVC_UP) { + printf("iavc%d: attempt to send before device up\n", sc->sc_unit); + + if (m->m_next) i4b_Bfreembuf(m->m_next); + i4b_Dfreembuf(m); + + return (ENXIO); + } + + if (_IF_QFULL(&sc->sc_txq)) { + _IF_DROP(&sc->sc_txq); + + printf("iavc%d: tx overflow, message dropped\n", sc->sc_unit); + + if (m->m_next) i4b_Bfreembuf(m->m_next); + i4b_Dfreembuf(m); + + } else { + _IF_ENQUEUE(&sc->sc_txq, m); + + iavc_start_tx(sc); + } + + return 0; +} + +/* +// Functions called by ourself during the initialization sequence: +// --------------------------------------------------------------- +// +// iavc_send_init +// Sends the system initialization message to a newly loaded +// board, and sets state to INIT. +*/ + +static int iavc_send_init(iavc_softc_t *sc) +{ + struct mbuf *m = i4b_Dgetmbuf(15); + u_int8_t *p; + int s; + + if (!m) { + printf("iavc%d: can't get memory\n", sc->sc_unit); + return (ENOMEM); + } + + /* + * byte 0x11 = SEND_INIT + * dword NumApplications + * dword NumNCCIs + * dword BoardNumber + */ + + p = amcc_put_byte(mtod(m, u_int8_t*), 0); + p = amcc_put_byte(p, 0); + p = amcc_put_byte(p, SEND_INIT); + p = amcc_put_word(p, 1); /* XXX MaxAppl XXX */ + p = amcc_put_word(p, sc->sc_capi.sc_nbch); + p = amcc_put_word(p, sc->sc_unit); + + s = SPLI4B(); + _IF_ENQUEUE(&sc->sc_txq, m); + + iavc_start_tx(sc); + + sc->sc_state = IAVC_INIT; + splx(s); + return 0; +} + +/* +// Functions called during normal operation: +// ----------------------------------------- +// +// iavc_receive_init +// Reads the initialization reply and calls capi_ll_control(). +// +// iavc_receive_new_ncci +// Reads a new NCCI notification and calls capi_ll_control(). +// +// iavc_receive_free_ncci +// Reads a freed NCCI notification and calls capi_ll_control(). +// +// iavc_receive_task_ready +// Reads a task ready message -- which should not occur XXX. +// +// iavc_receive_debugmsg +// Reads a debug message -- which should not occur XXX. +// +// iavc_receive_start +// Reads a START TRANSMIT message and unblocks device. +// +// iavc_receive_stop +// Reads a STOP TRANSMIT message and blocks device. +// +// iavc_receive +// Reads an incoming message and calls capi_ll_receive(). +*/ + +static int iavc_receive_init(iavc_softc_t *sc, u_int8_t *dmabuf) +{ + u_int32_t Length; + u_int8_t *p; + u_int8_t *cardtype, *serial, *profile, *version, *caps, *prot; + + if (sc->sc_dma) { + p = amcc_get_word(dmabuf, &Length); + } else { + Length = iavc_get_slice(sc, sc->sc_recvbuf); + p = sc->sc_recvbuf; + } + +#if 0 + { + int len = 0; + printf("iavc%d: rx_init: ", sc->sc_unit); + while (len < Length) { + printf(" %02x", p[len]); + if (len && (len % 16) == 0) printf("\n"); + len++; + } + if (len % 16) printf("\n"); + } +#endif + + version = (p + 1); + p += (*p + 1); /* driver version */ + cardtype = (p + 1); + p += (*p + 1); /* card type */ + p += (*p + 1); /* hardware ID */ + serial = (p + 1); + p += (*p + 1); /* serial number */ + caps = (p + 1); + p += (*p + 1); /* supported options */ + prot = (p + 1); + p += (*p + 1); /* supported protocols */ + profile = (p + 1); + + if (cardtype && serial && profile) { + int nbch = ((profile[3]<<8) | profile[2]); + + printf("iavc%d: AVM %s, s/n %s, %d chans, f/w rev %s, prot %s\n", + sc->sc_unit, cardtype, serial, nbch, version, prot); + + if(bootverbose) + printf("iavc%d: %s\n", sc->sc_unit, caps); + + capi_ll_control(&sc->sc_capi, CAPI_CTRL_PROFILE, (int) profile); + + } else { + printf("iavc%d: no profile data in info response?\n", sc->sc_unit); + } + + sc->sc_blocked = TRUE; /* controller will send START when ready */ + return 0; +} + +static int iavc_receive_start(iavc_softc_t *sc, u_int8_t *dmabuf) +{ + struct mbuf *m = i4b_Dgetmbuf(3); + u_int8_t *p; + + if (sc->sc_blocked && sc->sc_state == IAVC_UP) + printf("iavc%d: receive_start\n", sc->sc_unit); + + if (!m) { + printf("iavc%d: can't get memory\n", sc->sc_unit); + return (ENOMEM); + } + + /* + * byte 0x73 = SEND_POLLACK + */ + + p = amcc_put_byte(mtod(m, u_int8_t*), 0); + p = amcc_put_byte(p, 0); + p = amcc_put_byte(p, SEND_POLLACK); + + _IF_PREPEND(&sc->sc_txq, m); + + NDBGL4(L4_IAVCDBG, "iavc%d: blocked = %d, state = %d", + sc->sc_unit, sc->sc_blocked, sc->sc_state); + + sc->sc_blocked = FALSE; + iavc_start_tx(sc); + + /* If this was our first START, register our readiness */ + + if (sc->sc_state != IAVC_UP) { + sc->sc_state = IAVC_UP; + capi_ll_control(&sc->sc_capi, CAPI_CTRL_READY, TRUE); + } + + return 0; +} + +static int iavc_receive_stop(iavc_softc_t *sc, u_int8_t *dmabuf) +{ + printf("iavc%d: receive_stop\n", sc->sc_unit); + sc->sc_blocked = TRUE; + return 0; +} + +static int iavc_receive_new_ncci(iavc_softc_t *sc, u_int8_t *dmabuf) +{ + u_int32_t ApplId, NCCI, WindowSize; + + if (sc->sc_dma) { + dmabuf = amcc_get_word(dmabuf, &ApplId); + dmabuf = amcc_get_word(dmabuf, &NCCI); + dmabuf = amcc_get_word(dmabuf, &WindowSize); + } else { + ApplId = iavc_get_word(sc); + NCCI = iavc_get_word(sc); + WindowSize = iavc_get_word(sc); + } + + capi_ll_control(&sc->sc_capi, CAPI_CTRL_NEW_NCCI, NCCI); + return 0; +} + +static int iavc_receive_free_ncci(iavc_softc_t *sc, u_int8_t *dmabuf) +{ + u_int32_t ApplId, NCCI; + + if (sc->sc_dma) { + dmabuf = amcc_get_word(dmabuf, &ApplId); + dmabuf = amcc_get_word(dmabuf, &NCCI); + } else { + ApplId = iavc_get_word(sc); + NCCI = iavc_get_word(sc); + } + + capi_ll_control(&sc->sc_capi, CAPI_CTRL_FREE_NCCI, NCCI); + return 0; +} + +static int iavc_receive_task_ready(iavc_softc_t *sc, u_int8_t *dmabuf) +{ + u_int32_t TaskId, Length; + u_int8_t *p; + printf("iavc%d: receive_task_ready\n", sc->sc_unit); + + if (sc->sc_dma) { + p = amcc_get_word(dmabuf, &TaskId); + p = amcc_get_word(p, &Length); + } else { + TaskId = iavc_get_word(sc); + Length = iavc_get_slice(sc, sc->sc_recvbuf); + p = sc->sc_recvbuf; + } + + /* XXX could show the message if trace enabled? XXX */ + return 0; +} + +static int iavc_receive_debugmsg(iavc_softc_t *sc, u_int8_t *dmabuf) +{ + u_int32_t Length; + u_int8_t *p; + printf("iavc%d: receive_debugmsg\n", sc->sc_unit); + + if (sc->sc_dma) { + p = amcc_get_word(dmabuf, &Length); + } else { + Length = iavc_get_slice(sc, sc->sc_recvbuf); + p = sc->sc_recvbuf; + } + + /* XXX could show the message if trace enabled? XXX */ + return 0; +} + +static int iavc_receive(iavc_softc_t *sc, u_int8_t *dmabuf, int b3data) +{ + struct mbuf *m; + u_int32_t ApplId, Length; + + /* + * byte 0x21 = RECEIVE_MESSAGE + * dword ApplId + * dword length + * ... CAPI msg + * + * --or-- + * + * byte 0x22 = RECEIVE_DATA_B3_IND + * dword ApplId + * dword length + * ... CAPI msg + * dword datalen + * ... B3 data + */ + + if (sc->sc_dma) { + dmabuf = amcc_get_word(dmabuf, &ApplId); + dmabuf = amcc_get_word(dmabuf, &Length); + } else { + ApplId = iavc_get_word(sc); + Length = iavc_get_slice(sc, sc->sc_recvbuf); + dmabuf = sc->sc_recvbuf; + } + + m = i4b_Dgetmbuf(Length); + if (!m) { + printf("iavc%d: can't get memory for receive\n", sc->sc_unit); + return (ENOMEM); + } + + bcopy(dmabuf, mtod(m, u_int8_t*), Length); + +#if 0 + { + u_int8_t *p = mtod(m, u_int8_t*); + int len = 0; + printf("iavc%d: applid=%d, len=%d\n", sc->sc_unit, ApplId, Length); + while (len < m->m_len) { + printf(" %02x", p[len]); + if (len && (len % 16) == 0) printf("\n"); + len++; + } + if (len % 16) printf("\n"); + } +#endif + + if (b3data) { + if (sc->sc_dma) { + dmabuf = amcc_get_word(dmabuf + Length, &Length); + } else { + Length = iavc_get_slice(sc, sc->sc_recvbuf); + dmabuf = sc->sc_recvbuf; + } + + m->m_next = i4b_Bgetmbuf(Length); + if (!m->m_next) { + printf("iavc%d: can't get memory for receive\n", sc->sc_unit); + i4b_Dfreembuf(m); + return (ENOMEM); + } + + bcopy(dmabuf, mtod(m->m_next, u_int8_t*), Length); + } + + capi_ll_receive(&sc->sc_capi, m); + return 0; +} + +/* +// iavc_handle_intr +// Checks device interrupt status and calls iavc_handle_{rx,tx}() +// as necessary. +// +// iavc_handle_rx +// Reads in the command byte and calls the subroutines above. +// +// iavc_start_tx +// Initiates DMA on the next queued message if possible. +*/ + +void iavc_handle_intr(iavc_softc_t *sc) +{ + u_int32_t status; + u_int32_t newcsr; + + if (!sc->sc_dma) { + while (iavc_rx_full(sc)) + iavc_handle_rx(sc); + return; + } + + status = AMCC_READ(sc, AMCC_INTCSR); + if ((status & ANY_S5933_INT) == 0) + return; + + newcsr = sc->sc_csr | (status & ALL_INT); + if (status & TX_TC_INT) newcsr &= ~EN_TX_TC_INT; + if (status & RX_TC_INT) newcsr &= ~EN_RX_TC_INT; + AMCC_WRITE(sc, AMCC_INTCSR, newcsr); + sc->sc_intr = TRUE; + + if (status & RX_TC_INT) { + u_int32_t rxlen; + + if (sc->sc_recvlen == 0) { + sc->sc_recvlen = *((u_int32_t*)(&sc->sc_recvbuf[0])); + rxlen = (sc->sc_recvlen + 3) & ~3; + AMCC_WRITE(sc, AMCC_RXPTR, vtophys(&sc->sc_recvbuf[4])); + AMCC_WRITE(sc, AMCC_RXLEN, rxlen); + } else { + iavc_handle_rx(sc); + sc->sc_recvlen = 0; + AMCC_WRITE(sc, AMCC_RXPTR, vtophys(&sc->sc_recvbuf[0])); + AMCC_WRITE(sc, AMCC_RXLEN, 4); + } + } + + if (status & TX_TC_INT) { + sc->sc_csr &= ~EN_TX_TC_INT; + iavc_start_tx(sc); + } + + AMCC_WRITE(sc, AMCC_INTCSR, sc->sc_csr); + sc->sc_intr = FALSE; +} + +static void iavc_handle_rx(iavc_softc_t *sc) +{ + u_int8_t *dmabuf = 0, cmd; + + if (sc->sc_dma) { + dmabuf = amcc_get_byte(&sc->sc_recvbuf[4], &cmd); + } else { + cmd = iavc_get_byte(sc); + } + + NDBGL4(L4_IAVCDBG, "iavc%d: command = 0x%02x", sc->sc_unit, cmd); + + switch (cmd) { + case RECEIVE_DATA_B3_IND: + iavc_receive(sc, dmabuf, TRUE); + break; + + case RECEIVE_MESSAGE: + iavc_receive(sc, dmabuf, FALSE); + break; + + case RECEIVE_NEW_NCCI: + iavc_receive_new_ncci(sc, dmabuf); + break; + + case RECEIVE_FREE_NCCI: + iavc_receive_free_ncci(sc, dmabuf); + break; + + case RECEIVE_START: + iavc_receive_start(sc, dmabuf); + break; + + case RECEIVE_STOP: + iavc_receive_stop(sc, dmabuf); + break; + + case RECEIVE_INIT: + iavc_receive_init(sc, dmabuf); + break; + + case RECEIVE_TASK_READY: + iavc_receive_task_ready(sc, dmabuf); + break; + + case RECEIVE_DEBUGMSG: + iavc_receive_debugmsg(sc, dmabuf); + break; + + default: + printf("iavc%d: unknown msg %02x\n", sc->sc_unit, cmd); + } +} + +static void iavc_start_tx(iavc_softc_t *sc) +{ + struct mbuf *m; + u_int8_t *dmabuf; + u_int32_t txlen = 0; + + /* If device has put us on hold, punt. */ + + if (sc->sc_blocked) { + return; + } + + /* If using DMA and transmitter busy, punt. */ + + if (sc->sc_dma && (sc->sc_csr & EN_TX_TC_INT)) { + return; + } + + /* Else, see if we have messages to send. */ + + _IF_DEQUEUE(&sc->sc_txq, m); + if (!m) { + return; + } + + /* Have message, will send. */ + + if (CAPIMSG_LEN(m->m_data)) { + /* A proper CAPI message, possibly with B3 data */ + + if (sc->sc_dma) { + /* Copy message to DMA buffer. */ + + if (m->m_next) { + dmabuf = amcc_put_byte(&sc->sc_sendbuf[0], SEND_DATA_B3_REQ); + } else { + dmabuf = amcc_put_byte(&sc->sc_sendbuf[0], SEND_MESSAGE); + } + + dmabuf = amcc_put_word(dmabuf, m->m_len); + bcopy(m->m_data, dmabuf, m->m_len); + dmabuf += m->m_len; + txlen = 5 + m->m_len; + + if (m->m_next) { + dmabuf = amcc_put_word(dmabuf, m->m_next->m_len); + bcopy(m->m_next->m_data, dmabuf, m->m_next->m_len); + txlen += 4 + m->m_next->m_len; + } + + } else { + /* Use PIO. */ + + if (m->m_next) { + iavc_put_byte(sc, SEND_DATA_B3_REQ); + NDBGL4(L4_IAVCDBG, "iavc%d: tx SDB3R msg, len = %d", sc->sc_unit, m->m_len); + } else { + iavc_put_byte(sc, SEND_MESSAGE); + NDBGL4(L4_IAVCDBG, "iavc%d: tx SM msg, len = %d", sc->sc_unit, m->m_len); + } +#if 0 + { + u_int8_t *p = mtod(m, u_int8_t*); + int len; + for (len = 0; len < m->m_len; len++) { + printf(" %02x", *p++); + if (len && (len % 16) == 0) printf("\n"); + } + if (len % 16) printf("\n"); + } +#endif + + iavc_put_slice(sc, m->m_data, m->m_len); + + if (m->m_next) { + iavc_put_slice(sc, m->m_next->m_data, m->m_next->m_len); + } + } + + } else { + /* A board control message to be sent as is */ + + if (sc->sc_dma) { + bcopy(m->m_data + 2, &sc->sc_sendbuf[0], m->m_len - 2); + txlen = m->m_len - 2; + + } else { +#if 0 + { + u_int8_t *p = mtod(m, u_int8_t*) + 2; + int len; + printf("iavc%d: tx BDC msg, len = %d, msg =", sc->sc_unit, m->m_len-2); + for (len = 0; len < m->m_len-2; len++) { + printf(" %02x", *p++); + if (len && (len % 16) == 0) printf("\n"); + } + if (len % 16) printf("\n"); + } +#endif + + txlen = m->m_len - 2; + dmabuf = mtod(m, char*) + 2; + while(txlen--) + b1io_put_byte(sc, *dmabuf++); + } + } + + if (m->m_next) { + i4b_Bfreembuf(m->m_next); + m->m_next = NULL; + } + i4b_Dfreembuf(m); + + if (sc->sc_dma) { + /* Start transmitter */ + + txlen = (txlen + 3) & ~3; + AMCC_WRITE(sc, AMCC_TXPTR, vtophys(&sc->sc_sendbuf[0])); + AMCC_WRITE(sc, AMCC_TXLEN, txlen); + sc->sc_csr |= EN_TX_TC_INT; + + if (!sc->sc_intr) + AMCC_WRITE(sc, AMCC_INTCSR, sc->sc_csr); + } +} + +#endif diff --git a/sys/i4b/capi/iavc/iavc_pci.c b/sys/i4b/capi/iavc/iavc_pci.c new file mode 100644 index 000000000000..5579a3c27b7a --- /dev/null +++ b/sys/i4b/capi/iavc/iavc_pci.c @@ -0,0 +1,283 @@ +/* + * Copyright (c) 2001 Cubical Solutions Ltd. 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. + * + * capi/iavc/iavc_pci.c + * The AVM ISDN controllers' PCI bus attachment handling. + * + * $FreeBSD$ + */ + +#include "iavc.h" +#include "i4bcapi.h" +#include "pci.h" + +#if (NIAVC > 0) && (NI4BCAPI > 0) && (NPCI > 0) + +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include + +#include +#include +#include + +#include + +#include + +/* PCI device ids */ + +#define PCI_AVM_VID 0x1244 +#define PCI_AVMT1_DID 0x1200 +#define PCI_AVMB1_DID 0x0700 + +/* PCI driver linkage */ + +static void iavc_pci_intr(iavc_softc_t *sc); +static int iavc_pci_probe(device_t dev); +static int iavc_pci_attach(device_t dev); + +static device_method_t iavc_pci_methods[] = +{ + DEVMETHOD(device_probe, iavc_pci_probe), + DEVMETHOD(device_attach, iavc_pci_attach), + { 0, 0 } +}; + +static driver_t iavc_pci_driver = +{ + "iavc", + iavc_pci_methods, + 0 +}; + +static devclass_t iavc_pci_devclass; + +DRIVER_MODULE(iavc, pci, iavc_pci_driver, iavc_pci_devclass, 0, 0); + +/* Driver soft contexts */ + +iavc_softc_t iavc_sc[IAVC_MAXUNIT]; + +/*---------------------------------------------------------------------------* + * + *---------------------------------------------------------------------------*/ + +static int +iavc_pci_probe(device_t dev) +{ + u_int16_t did = pci_get_device(dev); + u_int16_t vid = pci_get_vendor(dev); + + if ((vid == PCI_AVM_VID) && (did == PCI_AVMT1_DID)) { + device_set_desc(dev, "AVM T1 PCI"); + } else if ((vid == PCI_AVM_VID) && (did == PCI_AVMB1_DID)) { + device_set_desc(dev, "AVM B1 PCI"); + } else { + return(ENXIO); + } + + return(0); +} + +/*---------------------------------------------------------------------------* + * + *---------------------------------------------------------------------------*/ + +static int +iavc_pci_attach(device_t dev) +{ + struct iavc_softc *sc; + void *ih = 0; + u_int16_t did = pci_get_device(dev); + int unit = device_get_unit(dev), ret; + + /* check max unit range */ + + if (unit >= IAVC_MAXUNIT) { + printf("iavc%d: too many units\n", unit); + return(ENXIO); + } + + sc = iavc_find_sc(unit); /* get softc */ + + sc->sc_unit = unit; + + /* use the i/o mapped base address */ + + sc->sc_resources.io_rid[0] = 0x14; + + if (!(sc->sc_resources.io_base[0] = + bus_alloc_resource(dev, SYS_RES_IOPORT, + &sc->sc_resources.io_rid[0], + 0UL, ~0UL, 1, RF_ACTIVE))) { + printf("iavc%d: can't allocate io region\n", unit); + return(ENXIO); + } + + sc->sc_iobase = rman_get_start(sc->sc_resources.io_base[0]); + sc->sc_io_bt = rman_get_bustag(sc->sc_resources.io_base[0]); + sc->sc_io_bh = rman_get_bushandle(sc->sc_resources.io_base[0]); + + /* use the memory mapped DMA controller */ + + sc->sc_resources.mem_rid = 0x10; + + if (!(sc->sc_resources.mem = + bus_alloc_resource(dev, SYS_RES_MEMORY, + &sc->sc_resources.mem_rid, + 0UL, ~0UL, 1, RF_ACTIVE))) { + printf("iavc%d: can't allocate memory region\n", unit); + return(ENXIO); + } + + sc->sc_membase = rman_get_start(sc->sc_resources.mem); + sc->sc_mem_bt = rman_get_bustag(sc->sc_resources.mem); + sc->sc_mem_bh = rman_get_bushandle(sc->sc_resources.mem); + + /* do some detection */ + + sc->sc_t1 = FALSE; + sc->sc_dma = FALSE; + b1dma_reset(sc); + + if (did == PCI_AVMT1_DID) { + sc->sc_capi.card_type = CARD_TYPEC_AVM_T1_PCI; + sc->sc_capi.sc_nbch = 30; + ret = t1_detect(sc); + if (ret) { + if (ret < 6) { + printf("iavc%d: no card detected?\n", sc->sc_unit); + } else { + printf("iavc%d: black box not on\n", sc->sc_unit); + } + return(ENXIO); + } else { + sc->sc_dma = TRUE; + sc->sc_t1 = TRUE; + } + + } else if (did == PCI_AVMB1_DID) { + sc->sc_capi.card_type = CARD_TYPEC_AVM_B1_PCI; + sc->sc_capi.sc_nbch = 2; + ret = b1dma_detect(sc); + if (ret) { + ret = b1_detect(sc); + if (ret) { + printf("iavc%d: no card detected?\n", sc->sc_unit); + return(ENXIO); + } + } else { + sc->sc_dma = TRUE; + } + } + + if (sc->sc_dma) b1dma_reset(sc); +#if 0 + if (sc->sc_t1) t1_reset(sc); + else b1_reset(sc); +#endif + + /* of course we need an interrupt */ + + sc->sc_resources.irq_rid = 0x00; + + if(!(sc->sc_resources.irq = + bus_alloc_resource(dev, SYS_RES_IRQ, + &sc->sc_resources.irq_rid, + 0UL, ~0UL, 1, RF_SHAREABLE|RF_ACTIVE))) { + printf("iavc%d: can't allocate irq\n",unit); + return(ENXIO); + } + + /* finalize our own context */ + + memset(&sc->sc_txq, 0, sizeof(struct ifqueue)); + sc->sc_txq.ifq_maxlen = sc->sc_capi.sc_nbch * 4; + +#if defined (__FreeBSD__) && __FreeBSD__ > 4 + mtx_init(&sc->sc_txq.ifq_mtx, "i4b_ivac_pci", MTX_DEF); +#endif + + sc->sc_intr = FALSE; + sc->sc_state = IAVC_DOWN; + sc->sc_blocked = FALSE; + + /* setup capi link */ + + sc->sc_capi.load = iavc_load; + sc->sc_capi.reg_appl = iavc_register; + sc->sc_capi.rel_appl = iavc_release; + sc->sc_capi.send = iavc_send; + sc->sc_capi.ctx = (void*) sc; + + if (capi_ll_attach(&sc->sc_capi)) { + printf("iavc%d: capi attach failed\n", unit); + return(ENXIO); + } + + /* setup the interrupt */ + + if(bus_setup_intr(dev, sc->sc_resources.irq, INTR_TYPE_NET, + (void(*)(void*))iavc_pci_intr, + sc, &ih)) { + printf("iavc%d: irq setup failed\n", unit); + return(ENXIO); + } + + /* the board is now ready to be loaded */ + + return(0); +} + +/*---------------------------------------------------------------------------* + * IRQ handler + *---------------------------------------------------------------------------*/ + +static void +iavc_pci_intr(struct iavc_softc *sc) +{ + iavc_handle_intr(sc); +} + +#endif diff --git a/sys/i4b/include/i4b_debug.h b/sys/i4b/include/i4b_debug.h index 26bfa507b0f8..d9380f740099 100644 --- a/sys/i4b/include/i4b_debug.h +++ b/sys/i4b/include/i4b_debug.h @@ -1,304 +1,301 @@ /* - * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved. + * Copyright (c) 1997, 2001 Hellmuth Michaelis. 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. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. * *--------------------------------------------------------------------------- * * i4b_debug.h - i4b debug header file * ----------------------------------- * - * $Id: i4b_debug.h,v 1.32 2000/07/24 12:22:08 hm Exp $ - * * $FreeBSD$ * - * last edit-date: [Wed Oct 18 09:48:16 2000] + * last edit-date: [Mon May 21 10:05:34 2001] * *---------------------------------------------------------------------------*/ #if !defined DO_I4B_DEBUG # define DO_I4B_DEBUG 1 /* default = include debugging code */ #elif DO_I4B_DEBUG != 0 # undef DO_I4B_DEBUG # define DO_I4B_DEBUG 1 #endif #undef DO_I4B_MAXDEBUG /* default = disable ALL debug messages */ #if DO_I4B_DEBUG extern unsigned int i4b_l1_debug; extern unsigned int i4b_l2_debug; extern unsigned int i4b_l3_debug; extern unsigned int i4b_l4_debug; #define NDBGL1(bits, fmt, args...) \ if(bits & i4b_l1_debug) \ { printf("i4b-L1 %s: " fmt "\n", __FUNCTION__ , ##args ); } #define NDBGL2(bits, fmt, args...) \ if(bits & i4b_l2_debug) \ { printf("i4b-L2 %s: " fmt "\n", __FUNCTION__ , ##args ); } #define NDBGL3(bits, fmt, args...) \ if(bits & i4b_l3_debug) \ { printf("i4b-L3 %s: " fmt "\n", __FUNCTION__ , ##args ); } #define NDBGL4(bits, fmt, args...) \ if(bits & i4b_l4_debug) \ { printf("i4b-L4 %s: " fmt "\n", __FUNCTION__ , ##args ); } #else /* !DO_I4B_DEBUG */ #define NDBGL1(bits, fmt, args...); #define NDBGL2(bits, fmt, args...); #define NDBGL3(bits, fmt, args...); #define NDBGL4(bits, fmt, args...); #endif /* DO_I4B_DEBUG */ /* Layer 1 */ #define L1_ERROR 0x000001 /* general error message*/ #define L1_PRIM 0x000002 /* interlayer primitives*/ #define L1_BCHAN 0x000004 /* B channel action */ #define L1_H_ERR 0x000008 /* HSCX errors */ #define L1_H_IRQ 0x000010 /* HSCX IRQ messages */ #define L1_I_ERR 0x000020 /* ISAC errors */ #define L1_I_MSG 0x000040 /* ISAC messages */ #define L1_I_SETUP 0x000080 /* ISAC setup messages */ #define L1_F_MSG 0x000100 /* FSM messages */ #define L1_F_ERR 0x000200 /* FSM error messages */ #define L1_T_MSG 0x000400 /* Timer messages */ #define L1_T_ERR 0x000800 /* Timer error messages */ #define L1_H_XFRERR 0x001000 /* HSCX data xfer error */ #define L1_I_CICO 0x002000 /* ISAC command in/out */ #define L1_S_MSG 0x004000 /* silent messages (soft-HDLC) */ #define L1_S_ERR 0x008000 /* error messages (soft-HDLC) */ #define L1_HFC_DBG 0x010000 /* HFC-S PCI messages */ #define L1_DEBUG_MAX 0x01ffef /* all messages on except IRQ! */ #define L1_DEBUG_ERR (L1_S_ERR | L1_H_ERR | L1_I_ERR | L1_F_ERR | L1_T_ERR | L1_ERROR) #ifndef L1_DEBUG_DEFAULT #ifdef DO_I4B_MAXDEBUG #define L1_DEBUG_DEFAULT L1_DEBUG_MAX #else #define L1_DEBUG_DEFAULT L1_DEBUG_ERR #endif #endif /* Layer 2 */ #define L2_ERROR 0x0001 /* general error message */ #define L2_PRIM 0x0002 /* interlayer primitives */ #define L2_U_MSG 0x0004 /* U frame messages */ #define L2_U_ERR 0x0008 /* U frame error messages */ #define L2_S_MSG 0x0010 /* S frame messages */ #define L2_S_ERR 0x0020 /* S frame error messages */ #define L2_I_MSG 0x0040 /* I frame messages */ #define L2_I_ERR 0x0080 /* I frame error messages */ #define L2_F_MSG 0x0100 /* FSM messages */ #define L2_F_ERR 0x0200 /* FSM error messages */ #define L2_T_MSG 0x0400 /* timer messages */ #define L2_T_ERR 0x0800 /* timer error messages */ #define L2_TEI_MSG 0x1000 /* TEI messages */ #define L2_TEI_ERR 0x2000 /* TEI error messages */ #define L2_DEBUG_MAX 0x3fff /* all messages on */ #define L2_DEBUG_ERR (L2_ERROR | L2_I_ERR | L2_F_ERR | L2_T_ERR | L2_S_ERR | L2_TEI_ERR | L2_U_ERR ) #ifndef L2_DEBUG_DEFAULT #ifdef DO_I4B_MAXDEBUG #define L2_DEBUG_DEFAULT L2_DEBUG_MAX #else #define L2_DEBUG_DEFAULT L2_DEBUG_ERR #endif #endif /* Layer 3 */ #define L3_ERR 0x0001 /* general error message */ #define L3_MSG 0x0002 /* general message */ #define L3_F_MSG 0x0004 /* FSM messages */ #define L3_F_ERR 0x0008 /* FSM error messages */ #define L3_T_MSG 0x0010 /* timer messages */ #define L3_T_ERR 0x0020 /* timer error messages */ #define L3_P_MSG 0x0040 /* protocol messages */ #define L3_P_ERR 0x0080 /* protocol error messages */ #define L3_A_MSG 0x0100 /* AOC messages */ #define L3_A_ERR 0x0200 /* AOC error messages */ #define L3_PRIM 0x0400 /* messages exchanged */ #define L3_DEBUG_MAX 0x07ff /* all messages on */ #define L3_DEBUG_ERR (L3_ERR | L3_F_ERR | L3_T_ERR | L3_P_ERR | L3_A_ERR) #ifndef L3_DEBUG_DEFAULT #ifdef DO_I4B_MAXDEBUG #define L3_DEBUG_DEFAULT L3_DEBUG_MAX #else #define L3_DEBUG_DEFAULT L3_DEBUG_ERR #endif #endif /* Layer 4 */ #define L4_ERR 0x0001 /* general error message */ #define L4_MSG 0x0002 /* general message */ #define L4_TIMO 0x0004 /* b channel idle timeout msgs */ #define L4_DIALST 0x0008 /* network driver dial states */ #define L4_IPRDBG 0x0010 /* ipr driver debug messages */ #define L4_RBCHDBG 0x0020 /* rbch driver debug messages */ #define L4_ISPDBG 0x0040 /* isp driver debug messages */ #define L4_TELDBG 0x0080 /* tel driver debug messages */ -#define L4_TINADBG 0x0100 /* tina driver debug messages */ -#define L4_TINAMSG 0x0200 /* tina driver messages */ -#define L4_TINAERR 0x0400 /* tina driver error messages */ -#define L4_INGDBG 0x0800 /* ing driver debug messages */ +#define L4_INGDBG 0x0100 /* ing driver debug messages */ +#define L4_IAVCDBG 0x0200 /* AVM B1 driver debug messages */ +#define L4_CAPIDBG 0x0400 /* CAPI driver debug messages */ #define L4_DEBUG_MAX 0x0fff /* all messages on */ -#define L4_DEBUG_ERR (L4_ERR | L4_TINADBG | L4_TINAMSG | L4_TINAERR) +#define L4_DEBUG_ERR L4_ERR #ifndef L4_DEBUG_DEFAULT #ifdef DO_I4B_MAXDEBUG #define L4_DEBUG_DEFAULT L4_DEBUG_MAX #else #define L4_DEBUG_DEFAULT L4_DEBUG_ERR #endif #endif /*---------------------------------------------------------------------------* * ioctl via /dev/i4bctl: * get/set current debug bits settings *---------------------------------------------------------------------------*/ typedef struct { unsigned int l1; unsigned int l2; unsigned int l3; unsigned int l4; } ctl_debug_t; #define I4B_CTL_GET_DEBUG _IOR('C', 0, ctl_debug_t) #define I4B_CTL_SET_DEBUG _IOW('C', 1, ctl_debug_t) /*---------------------------------------------------------------------------* * generic get chipset statistics *---------------------------------------------------------------------------*/ /* for the ihfc-driver: structure for HFC-1/S/SP statistics */ typedef struct { int txframes; int rxframes; int xdu; int rdo; int crc; int rab; } hfcstat_t; /* for the isic-driver: structure for HSCX statistics */ typedef struct { int unit; /* controller number */ int chan; /* channel number */ int vfr; int rdo; int crc; int rab; int xdu; int rfo; } hscxstat_t; /* generic statistics structure */ struct chipstat { int driver_type; /* type, L1DRVR_XXXX */ int driver_unit; /* the unit number */ int driver_bchannel; /* the B-channel */ union stats { /* union for all drivers */ hfcstat_t hfcstat; /* for ihfc driver, L1DRVR_IHFC */ hscxstat_t hscxstat; /* for isic driver, L1DRVR_ISIC */ } stats; }; /* get statistics */ #define I4B_CTL_GET_CHIPSTAT _IOWR('C', 2, struct chipstat) /* clear statistics */ #define I4B_CTL_CLR_CHIPSTAT _IOW('C', 3, struct chipstat) /*---------------------------------------------------------------------------* * get LAPD/Q.921 statistics *---------------------------------------------------------------------------*/ typedef struct { /* transmit */ u_long tx_i; /* I */ u_long tx_rr; /* RR */ u_long tx_rnr; /* RNR */ u_long tx_rej; /* REJ */ u_long tx_sabme; /* SABME*/ u_long tx_dm; /* DM */ u_long tx_disc; /* DISC */ u_long tx_ua; /* UA */ u_long tx_frmr; /* FRMR */ u_long tx_tei; /* TEI */ /* receive */ u_long rx_i; /* I */ u_long rx_rr; /* RR */ u_long rx_rnr; /* RNR */ u_long rx_rej; /* REJ */ u_long rx_sabme; /* SABME*/ u_long rx_tei; /* TEI */ u_long rx_ui; /* UI */ u_long rx_disc; /* DISC */ u_long rx_xid; /* XID */ u_long rx_dm; /* DM */ u_long rx_ua; /* UA */ u_long rx_frmr; /* FRMR */ /* errors */ u_long err_rx_len; /* incorrect length */ u_long err_rx_badf; /* bad frame type */ u_long err_rx_bads; /* bad s frame */ u_long err_rx_badu; /* bad u frame */ u_long err_rx_badui; /* bad ui frame */ } lapdstat_t; typedef struct { int unit; lapdstat_t lapdstat; } l2stat_t; #define I4B_CTL_GET_LAPDSTAT _IOWR('C', 4, l2stat_t) #define I4B_CTL_CLR_LAPDSTAT _IOW('C', 5, int) /* EOF */ diff --git a/sys/i4b/include/i4b_ioctl.h b/sys/i4b/include/i4b_ioctl.h index 8070f3ef2058..d357326b65ab 100644 --- a/sys/i4b/include/i4b_ioctl.h +++ b/sys/i4b/include/i4b_ioctl.h @@ -1,700 +1,710 @@ /* * Copyright (c) 1997, 2001 Hellmuth Michaelis. 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. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. * *--------------------------------------------------------------------------- * * i4b_ioctl.h - messages kernel <--> userland * ------------------------------------------- * * $FreeBSD$ * - * last edit-date: [Fri Jan 26 13:46:50 2001] + * last edit-date: [Fri May 25 10:04:37 2001] * *---------------------------------------------------------------------------*/ #ifndef _I4B_IOCTL_H_ #define _I4B_IOCTL_H_ #if defined(__FreeBSD__) && __FreeBSD__ >= 3 #ifndef _MACHINE_TYPES_H_ #include #endif /* _MACHINE_TYPES_H_ */ #endif /* __FreeBSD__ */ /*---------------------------------------------------------------------------* * version and release number for isdn4bsd package *---------------------------------------------------------------------------*/ -#define VERSION 0 /* version number */ -#define REL 96 /* release number */ -#define STEP 3 /* release step */ +#define VERSION 1 /* version number */ +#define REL 0 /* release number */ +#define STEP 0 /* release step */ /*---------------------------------------------------------------------------* * date/time format in i4b log messages * ------------------------------------ * Being year 2000 clean is not easy with the current state of the * ANSI C library standard and it's implementation for some locales. * You might like to use the "%c" format of "strftime" sometimes, * but this breaks Y2K in some locales. Also the old standard logfile * format "%d.%m.%y %H:%M:%S" is non compliant. * NetBSD's current toolset warns about this problems, and we compile * with -Werror, so this problems need to be resolved. *---------------------------------------------------------------------------*/ #define I4B_TIME_FORMAT "%d.%m.%Y %H:%M:%S" /*---------------------------------------------------------------------------* * max number of controllers in system *---------------------------------------------------------------------------*/ #define MAX_CONTROLLERS 8 /* max number of controllers */ /*---------------------------------------------------------------------------* * ISDN D-channel protocols *---------------------------------------------------------------------------*/ #define PROTOCOL_DSS1 0 /* default, Euro-ISDN/DSS1 */ #define PROTOCOL_D64S 1 /* 64k leased line, no protocol */ /*---------------------------------------------------------------------------* * controller types *---------------------------------------------------------------------------*/ #define CTRL_INVALID (-1) /* invalid, error */ #define CTRL_UNKNOWN 0 /* unknown controller type */ #define CTRL_PASSIVE 1 /* passive ISDN controller cards*/ #define CTRL_DAIC 2 /* Diehl active controller cards*/ #define CTRL_TINADD 3 /* Stollmann Tina-dd active card*/ #define CTRL_AVMB1 4 /* AVM B1 active card */ -#define CTRL_NUMTYPES 5 /* number of controller types */ +#define CTRL_CAPI 5 /* cards seen via the CAPI layer*/ +#define CTRL_NUMTYPES 6 /* number of controller types */ /*---------------------------------------------------------------------------* * CTRL_PASSIVE: driver types *---------------------------------------------------------------------------*/ #define MAXL1UNITS 8 /* max number of units */ #define L1DRVR_ISIC 0 /* isic - driver */ #define L1DRVR_IWIC 1 /* iwic - driver */ #define L1DRVR_IFPI 2 /* ifpi - driver */ #define L1DRVR_IHFC 3 /* ihfc - driver */ #define L1DRVR_IFPNP 4 /* ifpnp - driver */ #define L1DRVR_ICCHP 5 /* icchp - driver */ #define L1DRVR_ITJC 6 /* itjc - driver */ /* MAXL1DRVR MUST be updated when more passive drivers are added !!! */ #define MAXL1DRVR (L1DRVR_ITJC + 1) /*---------------------------------------------------------------------------* * card types for CTRL_PASSIVE *---------------------------------------------------------------------------*/ #define CARD_TYPEP_INVAL (-1) /* invalid, error */ #define CARD_TYPEP_UNK 0 /* unknown */ #define CARD_TYPEP_8 1 /* Teles, S0/8 */ #define CARD_TYPEP_16 2 /* Teles, S0/16 */ #define CARD_TYPEP_16_3 3 /* Teles, S0/16.3 */ #define CARD_TYPEP_AVMA1 4 /* AVM A1 or AVM Fritz!Card */ #define CARD_TYPEP_163P 5 /* Teles, S0/16.3 PnP */ #define CARD_TYPEP_CS0P 6 /* Creatix, S0 PnP */ #define CARD_TYPEP_USRTA 7 /* US Robotics ISDN TA internal */ #define CARD_TYPEP_DRNNGO 8 /* Dr. Neuhaus Niccy GO@ */ #define CARD_TYPEP_SWS 9 /* Sedlbauer Win Speed */ #define CARD_TYPEP_DYNALINK 10 /* Dynalink IS64PH */ #define CARD_TYPEP_BLMASTER 11 /* ISDN Blaster / ISDN Master */ #define CARD_TYPEP_PCFRITZ 12 /* AVM PCMCIA Fritz!Card */ #define CARD_TYPEP_ELSAQS1ISA 13 /* ELSA QuickStep 1000pro ISA */ #define CARD_TYPEP_ELSAQS1PCI 14 /* ELSA QuickStep 1000pro PCI */ #define CARD_TYPEP_SIEMENSITALK 15 /* Siemens I-Talk */ #define CARD_TYPEP_ELSAMLIMC 16 /* ELSA MicroLink ISDN/MC */ #define CARD_TYPEP_ELSAMLMCALL 17 /* ELSA MicroLink MCall */ #define CARD_TYPEP_ITKIX1 18 /* ITK ix1 micro */ #define CARD_TYPEP_AVMA1PCI 19 /* AVM FRITZ!CARD PCI */ #define CARD_TYPEP_PCC16 20 /* ELSA PCC-16 */ #define CARD_TYPEP_AVM_PNP 21 /* AVM FRITZ!CARD PnP */ #define CARD_TYPEP_SIE_ISURF2 22 /* Siemens I-Surf 2 PnP */ #define CARD_TYPEP_ASUSCOMIPAC 23 /* Asuscom ISDNlink 128 K PnP */ #define CARD_TYPEP_WINB6692 24 /* Winbond W6692 based */ #define CARD_TYPEP_16_3C 25 /* Teles S0/16.3c PnP (HFC-S/SP */ #define CARD_TYPEP_ACERP10 26 /* Acer ISDN P10 (HFC-S) */ #define CARD_TYPEP_TELEINT_NO_1 27 /* TELEINT ISDN SPEED No. 1 (HFC-1) */ #define CARD_TYPEP_CCD_HFCS_PCI 28 /* Cologne Chip HFC-S PCI based */ #define CARD_TYPEP_NETJET_S 29 /* Traverse NetJet-S (Tiger300) */ #define CARD_TYPEP_DIVA_ISA 30 /* Eicon DIVA ISA PnP 2.0 or 2.02 */ /* * in case you add support for more cards, please update: * * isdnd: controller.c, name_of_controller() * * and adjust CARD_TYPEP_MAX below. */ #define CARD_TYPEP_MAX 30 /* max type */ /*---------------------------------------------------------------------------* * card types for CTRL_DAIC *---------------------------------------------------------------------------*/ #define CARD_TYPEA_DAIC_UNK 0 #define CARD_TYPEA_DAIC_S 1 #define CARD_TYPEA_DAIC_SX 2 #define CARD_TYPEA_DAIC_SCOM 3 #define CARD_TYPEA_DAIC_QUAD 4 +/*---------------------------------------------------------------------------* + * card types for CTRL_CAPI + *---------------------------------------------------------------------------*/ +#define CARD_TYPEC_CAPI_UNK 0 +#define CARD_TYPEC_AVM_T1_PCI 1 +#define CARD_TYPEC_AVM_B1_PCI 2 +#define CARD_TYPEC_AVM_B1_ISA 3 + /*---------------------------------------------------------------------------* * max length of some strings *---------------------------------------------------------------------------*/ #define TELNO_MAX 41 /* max length of a telephone number (+ '\0') */ #define DISPLAY_MAX 91 /* max length of display information (+ '\0') */ #define DATETIME_MAX 21 /* max length of datetime information (+ '\0')*/ /*---------------------------------------------------------------------------* * in case the src or dst telephone number is empty *---------------------------------------------------------------------------*/ #define TELNO_EMPTY "NotAvailable" /*---------------------------------------------------------------------------* * B channel parameters *---------------------------------------------------------------------------*/ #define BCH_MAX_DATALEN 2048 /* max length of a B channel frame */ /*---------------------------------------------------------------------------* * userland driver types * --------------------- * a "driver" is defined here as a piece of software interfacing an * ISDN B channel with a userland service, such as IP, Telephony etc. *---------------------------------------------------------------------------*/ #define BDRV_RBCH 0 /* raw b-channel interface driver */ #define BDRV_TEL 1 /* telephone (speech) interface driver */ #define BDRV_IPR 2 /* IP over raw HDLC interface driver */ #define BDRV_ISPPP 3 /* sync Kernel PPP interface driver */ #define BDRV_IBC 4 /* BSD/OS point to point driver */ #define BDRV_ING 5 /* NetGraph ing driver */ /*---------------------------------------------------------------------------* * B channel protocol *---------------------------------------------------------------------------*/ #define BPROT_NONE 0 /* no protocol at all, raw data */ #define BPROT_RHDLC 1 /* raw HDLC: flag, data, crc, flag */ /*---------------------------------------------------------------------------* * causes data type *---------------------------------------------------------------------------*/ typedef unsigned int cause_t; /* 32 bit unsigned int */ /*---------------------------------------------------------------------------* * call descriptor id (cdid) definitions *---------------------------------------------------------------------------*/ #define CDID_UNUSED 0 /* cdid is invalid and unused */ #define CDID_MAX 99999 /* highest valid cdid, wraparound to 1 */ /*---------------------------------------------------------------------------* * The shorthold algorithm to use *---------------------------------------------------------------------------*/ #define SHA_FIXU 0 /* timeout algorithm for fix unit charging */ #define SHA_VARU 1 /* timeout algorithm for variable unit charging */ /*---------------------------------------------------------------------------* * The shorthold data struct *---------------------------------------------------------------------------*/ typedef struct { int shorthold_algorithm; /* shorthold algorithm to use */ int unitlen_time; /* length of a charging unit */ int idle_time; /* time without activity on b ch*/ int earlyhup_time; /* safety area at end of unit */ } msg_shorthold_t; /**************************************************************************** outgoing call: -------------- userland kernel -------- ------ CDID_REQ -----------------> <------------------ cdid CONNECT_REQ --------------> <------------------ PROCEEDING_IND (if connect req ok) <------------------ CONNECT_ACTIVE_IND (if connection ok) or <------------------ DISCONNECT_IND (if connection failed) incoming call: -------------- userland kernel -------- ------ <------------------ CONNECT_IND CONNECT_RESP -------------> <------------------ CONNECT_ACTIVE_IND (if accepted) active disconnect: ------------------ userland kernel -------- ------ DISCONNECT_REQ ------------> <------------------ DISCONNECT_IND passive disconnect: ------------------- userland kernel -------- ------ <------------------ DISCONNECT_IND ****************************************************************************/ /*===========================================================================* *===========================================================================* * "read" messages from kernel -> userland *===========================================================================* *===========================================================================*/ /*---------------------------------------------------------------------------* * message header, included in every message *---------------------------------------------------------------------------*/ typedef struct { char type; /* message identifier */ #define MSG_CONNECT_IND 'a' #define MSG_CONNECT_ACTIVE_IND 'b' #define MSG_DISCONNECT_IND 'c' #define MSG_DIALOUT_IND 'd' #define MSG_IDLE_TIMEOUT_IND 'e' #define MSG_ACCT_IND 'f' #define MSG_CHARGING_IND 'g' #define MSG_PROCEEDING_IND 'h' #define MSG_ALERT_IND 'i' #define MSG_DRVRDISC_REQ 'j' #define MSG_L12STAT_IND 'k' #define MSG_TEIASG_IND 'l' #define MSG_PDEACT_IND 'm' #define MSG_NEGCOMP_IND 'n' #define MSG_IFSTATE_CHANGED_IND 'o' #define MSG_DIALOUTNUMBER_IND 'p' #define MSG_PACKET_IND 'q' int cdid; /* call descriptor id */ } msg_hdr_t; /*---------------------------------------------------------------------------* * connect indication * indicates incoming connection *---------------------------------------------------------------------------*/ typedef struct { msg_hdr_t header; /* common header */ int controller; /* controller number */ int channel; /* channel number */ #define CHAN_B1 0 /* this _must_ be 0, HSCX B1 is also 0 */ #define CHAN_B2 1 /* this _must_ be 1, HSCX B2 is also 1 */ #define CHAN_ANY (-1) /* outgoing, not possible for incoming */ #define CHAN_NO (-2) /* call waiting (CW) for incoming */ int bprot; /* b channel protocot, see BPROT_XXX */ char dst_telno[TELNO_MAX]; /* destination telno */ char src_telno[TELNO_MAX]; /* source telno */ int scr_ind;/* screening indicator */ #define SCR_NONE 0 /* no screening indicator transmitted */ #define SCR_USR_NOSC 1 /* screening user provided, not screened*/ #define SCR_USR_PASS 2 /* screening user provided, verified & passed */ #define SCR_USR_FAIL 3 /* screening user provided, verified & failed */ #define SCR_NET 4 /* screening network provided */ int prs_ind;/* presentation indicator */ #define PRS_NONE 0 /* no presentation indicator transmitted*/ #define PRS_ALLOWED 1 /* presentation allowed */ #define PRS_RESTRICT 2 /* presentation restricted */ #define PRS_NNINTERW 3 /* number not available due to interworking */ #define PRS_RESERVED 4 /* reserved */ char display[DISPLAY_MAX]; /* content of display IE*/ } msg_connect_ind_t; /*---------------------------------------------------------------------------* * connect active indication * indicates active connection *---------------------------------------------------------------------------*/ typedef struct { msg_hdr_t header; /* common header */ int controller; /* controller number actually used */ int channel; /* channel number actually used */ char datetime[DATETIME_MAX]; /* content of date/time IE */ } msg_connect_active_ind_t; /*---------------------------------------------------------------------------* * disconnect indication * indicates a disconnect *---------------------------------------------------------------------------*/ typedef struct { msg_hdr_t header; /* common header */ cause_t cause; /* cause code */ } msg_disconnect_ind_t; /*---------------------------------------------------------------------------* * negotiation complete * indicates an interface is completely up & running *---------------------------------------------------------------------------*/ typedef struct { msg_hdr_t header; /* common header */ } msg_negcomplete_ind_t; /*---------------------------------------------------------------------------* * interface changes internal state * indicates an interface has somehow switched its FSM *---------------------------------------------------------------------------*/ typedef struct { msg_hdr_t header; /* common header */ int state; /* new interface state */ } msg_ifstatechg_ind_t; /*---------------------------------------------------------------------------* * initiate a call to a remote site * i.e. the IP driver got a packet and wants a connection *---------------------------------------------------------------------------*/ typedef struct { msg_hdr_t header; /* common header */ int driver; /* driver type */ int driver_unit; /* driver unit number */ } msg_dialout_ind_t; /*---------------------------------------------------------------------------* * dial a number *---------------------------------------------------------------------------*/ typedef struct { msg_hdr_t header; /* common header */ int driver; /* driver type */ int driver_unit; /* driver unit number */ int cmdlen; /* length of string */ char cmd[TELNO_MAX]; /* the number to dial */ } msg_dialoutnumber_ind_t; /*---------------------------------------------------------------------------* * idle timeout disconnect sent indication * kernel has sent disconnect request because of b-ch idle *---------------------------------------------------------------------------*/ typedef struct { msg_hdr_t header; /* common header */ } msg_idle_timeout_ind_t; /*---------------------------------------------------------------------------* * accounting information from userland interface driver to daemon *---------------------------------------------------------------------------*/ typedef struct { msg_hdr_t header; /* common header */ int accttype; /* accounting type */ #define ACCT_DURING 0 #define ACCT_FINAL 1 int driver; /* driver type */ int driver_unit; /* driver unit number */ int ioutbytes; /* ISDN # of bytes sent */ int iinbytes; /* ISDN # of bytes received */ int outbps; /* bytes per sec out */ int inbps; /* bytes per sec in */ int outbytes; /* driver # of bytes sent */ int inbytes; /* driver # of bytes received */ } msg_accounting_ind_t; /*---------------------------------------------------------------------------* * charging information from isdn driver to daemon *---------------------------------------------------------------------------*/ typedef struct { msg_hdr_t header; /* common header */ int units; /* number of units */ int units_type; /* type of units info */ #define CHARGE_INVALID 0 /* invalid, unknown */ #define CHARGE_AOCD 1 /* advice of charge during call */ #define CHARGE_AOCE 2 /* advice of charge at end of call */ #define CHARGE_CALC 3 /* locally calculated from rates information */ } msg_charging_ind_t; /*---------------------------------------------------------------------------* * call proceeding indication * indicates outgoing SETUP has been acknowleged *---------------------------------------------------------------------------*/ typedef struct { msg_hdr_t header; /* common header */ int controller; /* controller number actually used */ int channel; /* channel number actually used */ } msg_proceeding_ind_t; /*---------------------------------------------------------------------------* * alert indication * indicates remote user side "rings" *---------------------------------------------------------------------------*/ typedef struct { msg_hdr_t header; /* common header */ } msg_alert_ind_t; /*---------------------------------------------------------------------------* * driver requests to disconnect line *---------------------------------------------------------------------------*/ typedef struct { msg_hdr_t header; /* common header */ int driver; /* driver type */ int driver_unit; /* driver unit number */ } msg_drvrdisc_req_t; /*---------------------------------------------------------------------------* * connect packet logging *---------------------------------------------------------------------------*/ typedef struct { msg_hdr_t header; /* common header */ int driver; /* driver type */ int driver_unit; /* driver unit number */ int direction; /* 0=in 1=out */ #define DIRECTION_IN 0 /* sending packet to remote */ #define DIRECTION_OUT 1 /* received packet from remote */ #define MAX_PACKET_LOG 40 /* space for IP and TCP header */ u_int8_t pktdata[MAX_PACKET_LOG]; } msg_packet_ind_t; /*---------------------------------------------------------------------------* * state of layer 1/2 *---------------------------------------------------------------------------*/ typedef struct { msg_hdr_t header; /* common header */ int controller; /* controller unit */ int layer; /* layer number (1/2) */ #define LAYER_ONE 1 #define LAYER_TWO 2 int state; /* state info */ #define LAYER_IDLE 0 #define LAYER_ACTIVE 1 } msg_l12stat_ind_t; /*---------------------------------------------------------------------------* * TEI assignment messages *---------------------------------------------------------------------------*/ typedef struct { msg_hdr_t header; /* common header */ int controller; /* controller unit */ int tei; /* TEI or -1 if invalid */ } msg_teiasg_ind_t; /*---------------------------------------------------------------------------* * persistent deactivation state of stack *---------------------------------------------------------------------------*/ typedef struct { msg_hdr_t header; /* common header */ int controller; /* controller unit */ int numactive; /* number of active connections */ } msg_pdeact_ind_t; /*===========================================================================* *===========================================================================* * "ioctl" messages from userland -> kernel *===========================================================================* *===========================================================================*/ /*---------------------------------------------------------------------------* * request a unique cdid (to setup an outgoing call) *---------------------------------------------------------------------------*/ typedef struct { int cdid; /* call descriptor id */ } msg_cdid_req_t; #define I4B_CDID_REQ _IOWR('4', 0, int) /*---------------------------------------------------------------------------* * connect request * requests an outgoing connection *---------------------------------------------------------------------------*/ typedef struct { int cdid; /* call descriptor id */ int controller; /* controller to use */ int channel; /* channel to use */ int txdelay; /* tx delay after connect */ int bprot; /* b channel protocol */ int driver; /* driver to route b channel data to */ int driver_unit; /* unit number for above driver */ msg_shorthold_t shorthold_data; /* the shorthold data */ int unitlen_method; /* how to calculate the unitlength */ #define ULEN_METHOD_STATIC 0 /* use unitlen_time value (see above) */ #define ULEN_METHOD_DYNAMIC 1 /* use AOCD */ char dst_telno[TELNO_MAX]; /* destination telephone no */ char src_telno[TELNO_MAX]; /* source telephone number */ } msg_connect_req_t; #define I4B_CONNECT_REQ _IOW('4', 1, msg_connect_req_t) /*---------------------------------------------------------------------------* * connect response * this is the answer to an incoming connect indication *---------------------------------------------------------------------------*/ typedef struct { int cdid; /* call descriptor id */ int response; /* what to do with incoming call */ #define SETUP_RESP_DNTCRE 0 /* dont care, call is not for me */ #define SETUP_RESP_REJECT 1 /* reject call */ #define SETUP_RESP_ACCEPT 2 /* accept call */ cause_t cause; /* cause for case SETUP_RESP_REJECT */ /* the following are only used for SETUP_RESP_ACCEPT !! */ int txdelay; /* tx delay after connect */ int bprot; /* B chan protocol */ int driver; /* driver to route b channel data to */ int driver_unit; /* unit number for above driver */ int max_idle_time; /* max time without activity on b ch */ } msg_connect_resp_t; #define I4B_CONNECT_RESP _IOW('4', 2, msg_connect_resp_t) /*---------------------------------------------------------------------------* * disconnect request * active disconnect request *---------------------------------------------------------------------------*/ typedef struct { int cdid; /* call descriptor id */ cause_t cause; /* protocol independent cause */ } msg_discon_req_t; #define I4B_DISCONNECT_REQ _IOW('4', 3, msg_discon_req_t) /*---------------------------------------------------------------------------* * controller info request *---------------------------------------------------------------------------*/ typedef struct { int controller; /* controller number */ int ncontroller; /* number of controllers in system */ int ctrl_type; /* controller type passive/active */ int card_type; /* brand / version */ int tei; /* tei controller probably has */ + int nbch; /* number of b channels provided */ } msg_ctrl_info_req_t; #define I4B_CTRL_INFO_REQ _IOWR('4', 4, msg_ctrl_info_req_t) /*---------------------------------------------------------------------------* * dialout response * status report to driver who requested a dialout *---------------------------------------------------------------------------*/ typedef struct { int driver; /* driver to route b channel data to */ int driver_unit; /* unit number for above driver */ int stat; /* state of dialout request */ #define DSTAT_NONE 0 #define DSTAT_TFAIL 1 /* transient failure */ #define DSTAT_PFAIL 2 /* permanent failure */ #define DSTAT_INONLY 3 /* no outgoing dials allowed */ cause_t cause; /* exact i4b cause */ } msg_dialout_resp_t; #define I4B_DIALOUT_RESP _IOW('4', 5, msg_dialout_resp_t) /*---------------------------------------------------------------------------* * timeout value update *---------------------------------------------------------------------------*/ typedef struct { int cdid; /* call descriptor id */ msg_shorthold_t shorthold_data; } msg_timeout_upd_t; #define I4B_TIMEOUT_UPD _IOW('4', 6, msg_timeout_upd_t) /*---------------------------------------------------------------------------* * soft enable/disable *---------------------------------------------------------------------------*/ typedef struct { int driver; /* driver to route b channel data to */ int driver_unit; /* unit number for above driver */ int updown; /* what to do */ #define SOFT_ENA 0 /* enable interface */ #define SOFT_DIS 1 /* disable interface */ } msg_updown_ind_t; #define I4B_UPDOWN_IND _IOW('4', 7, msg_updown_ind_t) /*---------------------------------------------------------------------------* * send alert request *---------------------------------------------------------------------------*/ typedef struct { int cdid; /* call descriptor id */ } msg_alert_req_t; #define I4B_ALERT_REQ _IOW('4', 8, msg_alert_req_t) /*---------------------------------------------------------------------------* * request version and release info from kernel part * (msg_vr_req_t is also used by tel & rbch drivers) *---------------------------------------------------------------------------*/ typedef struct { int version; /* version number */ int release; /* release number */ int step; /* release step number */ } msg_vr_req_t; #define I4B_VR_REQ _IOR('4', 9, msg_vr_req_t) /*---------------------------------------------------------------------------* * set ISDN protocol used by a controller *---------------------------------------------------------------------------*/ typedef struct { int controller; /* controller number */ int protocol; /* ISDN D-channel protocol type */ } msg_prot_ind_t; #define I4B_PROT_IND _IOW('4', 10, msg_prot_ind_t) /*---------------------------------------------------------------------------* * Protocol download to active cards *---------------------------------------------------------------------------*/ struct isdn_dr_prot { size_t bytecount; /* length of code */ u_int8_t *microcode; /* pointer to microcode */ }; struct isdn_download_request { int controller; /* controller number */ int numprotos; /* number of protocols in 'protocols' */ struct isdn_dr_prot *protocols; }; #define I4B_CTRL_DOWNLOAD _IOW('4', 100, struct isdn_download_request) /*---------------------------------------------------------------------------* * Generic diagnostic interface for active cards *---------------------------------------------------------------------------*/ struct isdn_diagnostic_request { int controller; /* controller number */ u_int32_t cmd; /* diagnostic command to execute */ size_t in_param_len; /* length of additional input parameter */ void *in_param; /* optional input parameter */ size_t out_param_len; /* available output space */ void *out_param; /* output data goes here */ }; #define I4B_ACTIVE_DIAGNOSTIC _IOW('4', 102, struct isdn_diagnostic_request) #endif /* _I4B_IOCTL_H_ */ diff --git a/sys/i4b/include/i4b_l3l4.h b/sys/i4b/include/i4b_l3l4.h index 518aa601b1e9..d70a2119de2e 100644 --- a/sys/i4b/include/i4b_l3l4.h +++ b/sys/i4b/include/i4b_l3l4.h @@ -1,286 +1,288 @@ /* * Copyright (c) 1997, 1999 Hellmuth Michaelis. 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. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. * *--------------------------------------------------------------------------- * * i4b_l3l4.h - layer 3 / layer 4 interface * ------------------------------------------ * * $Id: i4b_l3l4.h,v 1.32 2000/08/24 11:48:57 hm Exp $ * * $FreeBSD$ * * last edit-date: [Fri Jun 2 14:29:35 2000] * *---------------------------------------------------------------------------*/ #ifndef _I4B_L3L4_H_ #define _I4B_L3L4_H_ #define T303VAL (hz*4) /* 4 seconds timeout */ #define T305VAL (hz*30) /* 30 seconds timeout */ #define T308VAL (hz*4) /* 4 seconds timeout */ #define T309VAL (hz*90) /* 90 seconds timeout */ #define T310VAL (hz*60) /* 30-120 seconds timeout */ #define T313VAL (hz*4) /* 4 seconds timeout */ #define T400DEF (hz*10) /* 10 seconds timeout */ -#define N_CALL_DESC (MAX_CONTROLLERS*2) /* no of call descriptors */ +#define MAX_BCHAN 30 +#define N_CALL_DESC (MAX_CONTROLLERS*MAX_BCHAN) /* no of call descriptors */ extern int nctrl; /* number of controllers detected in system */ typedef struct bchan_statistics { int outbytes; int inbytes; } bchan_statistics_t; /*---------------------------------------------------------------------------* * table of things the driver needs to know about the b channel * it is connected to for data transfer *---------------------------------------------------------------------------*/ typedef struct i4l_isdn_bchan_linktab { int unit; int channel; void (*bch_config)(int unit, int channel, int bprot, int updown); void (*bch_tx_start)(int unit, int channel); void (*bch_stat)(int unit, int channel, bchan_statistics_t *bsp); struct ifqueue *tx_queue; struct ifqueue *rx_queue; /* data xfer for NON-HDLC traffic */ struct mbuf **rx_mbuf; /* data xfer for HDLC based traffic */ } isdn_link_t; /*---------------------------------------------------------------------------* * table of things the b channel handler needs to know about * the driver it is connected to for data transfer *---------------------------------------------------------------------------*/ typedef struct i4l_driver_bchan_linktab { int unit; void (*bch_rx_data_ready)(int unit); void (*bch_tx_queue_empty)(int unit); void (*bch_activity)(int unit, int rxtx); #define ACT_RX 0 #define ACT_TX 1 void (*line_connected)(int unit, void *cde); void (*line_disconnected)(int unit, void *cde); void (*dial_response)(int unit, int stat, cause_t cause); void (*updown_ind)(int unit, int updown); } drvr_link_t; /* global linktab functions for controller types (aka hardware drivers) */ struct ctrl_type_desc { isdn_link_t* (*get_linktab)(int unit, int channel); void (*set_linktab)(int unit, int channel, drvr_link_t *dlt); }; extern struct ctrl_type_desc ctrl_types[]; /* global linktab functions for RBCH userland driver */ drvr_link_t *rbch_ret_linktab(int unit); void rbch_set_linktab(int unit, isdn_link_t *ilt); /* global linktab functions for IPR network driver */ drvr_link_t *ipr_ret_linktab(int unit); void ipr_set_linktab(int unit, isdn_link_t *ilt); /* global linktab functions for TEL userland driver */ drvr_link_t *tel_ret_linktab(int unit); void tel_set_linktab(int unit, isdn_link_t *ilt); /* global linktab functions for ISPPP userland driver */ drvr_link_t *i4bisppp_ret_linktab(int unit); void i4bisppp_set_linktab(int unit, isdn_link_t *ilt); #ifdef __bsdi__ /* global linktab functions for IBC userland driver */ drvr_link_t *ibc_ret_linktab(int unit); void ibc_set_linktab(int unit, isdn_link_t *ilt); #endif /* global linktab functions for ING network driver */ drvr_link_t *ing_ret_linktab(int unit); void ing_set_linktab(int unit, isdn_link_t *ilt); /*---------------------------------------------------------------------------* * this structure describes one call/connection on one B-channel * and all its parameters *---------------------------------------------------------------------------*/ typedef struct { u_int cdid; /* call descriptor id */ int controller; /* isdn controller number */ int cr; /* call reference value */ int crflag; /* call reference flag */ #define CRF_ORIG 0 /* originating side */ #define CRF_DEST 1 /* destinating side */ int channelid; /* channel id value */ int channelexcl; /* channel exclusive */ int bprot; /* B channel protocol BPROT_XXX */ int driver; /* driver to use for B channel */ int driver_unit; /* unit for above driver number */ cause_t cause_in; /* cause value from NT */ cause_t cause_out; /* cause value to NT */ int call_state; /* from incoming SETUP */ u_char dst_telno[TELNO_MAX]; /* destination number */ u_char src_telno[TELNO_MAX]; /* source number */ int scr_ind; /* screening ind for incoming call */ int prs_ind; /* presentation ind for incoming call */ int Q931state; /* Q.931 state for call */ int event; /* event to be processed */ int response; /* setup response type */ int T303; /* SETUP sent response timeout */ int T303_first_to; /* first timeout flag */ int T305; /* DISC without PROG IND */ int T308; /* RELEASE sent response timeout*/ int T308_first_to; /* first timeout flag */ int T309; /* data link disconnect timeout */ int T310; /* CALL PROC received */ int T313; /* CONNECT sent timeout */ int T400; /* L4 timeout */ isdn_link_t *ilt; /* isdn B channel linktab */ drvr_link_t *dlt; /* driver linktab */ int dir; /* outgoing or incoming call */ #define DIR_OUTGOING 0 #define DIR_INCOMING 1 int timeout_active; /* idle timeout() active flag */ #if (defined(__FreeBSD_version) && __FreeBSD_version >= 300001) || \ (!defined(__FreeBSD_version) && defined(__FreeBSD__) && __FreeBSD__ >= 3) struct callout_handle idle_timeout_handle; struct callout_handle T303_callout; struct callout_handle T305_callout; struct callout_handle T308_callout; struct callout_handle T309_callout; struct callout_handle T310_callout; struct callout_handle T313_callout; struct callout_handle T400_callout; int callouts_inited; /* must init before use */ #endif #if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000 struct callout idle_timeout_handle; struct callout T303_callout; struct callout T305_callout; struct callout T308_callout; struct callout T309_callout; struct callout T310_callout; struct callout T313_callout; struct callout T400_callout; int callouts_inited; /* must init before use */ #endif int idletime_state; /* wait for idle_time begin */ #define IST_IDLE 0 /* shorthold mode disabled */ #define IST_NONCHK 1 /* in non-checked window */ #define IST_CHECK 2 /* in idle check window */ #define IST_SAFE 3 /* in safety zone */ time_t idletimechk_start; /* check idletime window start */ time_t connect_time; /* time connect was made */ time_t last_active_time; /* last time with activity */ /* for incoming connections: */ time_t max_idle_time; /* max time without activity */ /* for outgoing connections: */ msg_shorthold_t shorthold_data; /* shorthold data to use */ int aocd_flag; /* AOCD used for unitlength calc*/ time_t last_aocd_time; /* last time AOCD received */ int units; /* number of AOCD charging units*/ int units_type; /* units type: AOCD, AOCE */ int cunits; /* calculated units */ int isdntxdelay; /* isdn tx delay after connect */ u_char display[DISPLAY_MAX]; /* display information element */ char datetime[DATETIME_MAX]; /* date/time information element*/ } call_desc_t; extern call_desc_t call_desc[N_CALL_DESC]; /* forward decl. */ struct isdn_diagnostic_request; struct isdn_dr_prot; /*---------------------------------------------------------------------------* * this structure "describes" one controller *---------------------------------------------------------------------------*/ typedef struct { int unit; /* unit number of this contr. */ int ctrl_type; /* controller type (CTRL_XXX) */ int card_type; /* card manufacturer (CARD_XXX) */ int protocol; /* D-channel protocol type */ int dl_est; /* layer 2 established */ #define DL_DOWN 0 #define DL_UP 1 - int bch_state[2]; /* states of the b channels */ + int nbch; /* number of b channels */ + int bch_state[MAX_BCHAN]; /* states of the b channels */ #define BCH_ST_FREE 0 /* free to be used, idle */ #define BCH_ST_RSVD 1 /* reserved, may become free or used */ #define BCH_ST_USED 2 /* in use for data transfer */ int tei; /* current tei or -1 if invalid */ /* pointers to functions to be called from L4 */ void (*N_CONNECT_REQUEST) (unsigned int); void (*N_CONNECT_RESPONSE) (unsigned int, int, int); void (*N_DISCONNECT_REQUEST) (unsigned int, int); void (*N_ALERT_REQUEST) (unsigned int); int (*N_DOWNLOAD) (int unit, int numprotos, struct isdn_dr_prot *protocols); int (*N_DIAGNOSTICS) (int unit, struct isdn_diagnostic_request*); void (*N_MGMT_COMMAND) (int unit, int cmd, void *); } ctrl_desc_t; extern ctrl_desc_t ctrl_desc[MAX_CONTROLLERS]; #endif /* _I4B_Q931_H_ */ diff --git a/sys/i4b/layer3/i4b_l3fsm.c b/sys/i4b/layer3/i4b_l3fsm.c index bd60d5afb809..cde6e7ccb823 100644 --- a/sys/i4b/layer3/i4b_l3fsm.c +++ b/sys/i4b/layer3/i4b_l3fsm.c @@ -1,1054 +1,1058 @@ /* * Copyright (c) 1997, 2000 Hellmuth Michaelis. 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. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. * *--------------------------------------------------------------------------- * * i4b_l3fsm.c - layer 3 FSM * ------------------------- * * $Id: i4b_l3fsm.c,v 1.22 2000/08/24 11:48:58 hm Exp $ * * $FreeBSD$ * * last edit-date: [Thu Oct 12 17:58:35 2000] * *---------------------------------------------------------------------------*/ #ifdef __FreeBSD__ #include "i4bq931.h" #else #define NI4BQ931 1 #endif #if NI4BQ931 > 0 #include #include #include #if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000 #include #endif #ifdef __FreeBSD__ #include #include #include #else #include #include #include #endif #include #include #include #include #include #include static void F_00A(call_desc_t *cd), F_00H(call_desc_t *cd), F_00I(call_desc_t *cd); static void F_00J(call_desc_t *cd); static void F_01B(call_desc_t *cd), F_01K(call_desc_t *cd), F_01L(call_desc_t *cd); static void F_01M(call_desc_t *cd), F_01N(call_desc_t *cd), F_01U(call_desc_t *cd); static void F_01O(call_desc_t *cd); static void F_03C(call_desc_t *cd), F_03N(call_desc_t *cd), F_03O(call_desc_t *cd); static void F_03P(call_desc_t *cd), F_03Y(call_desc_t *cd); static void F_04O(call_desc_t *cd); static void F_06D(call_desc_t *cd), F_06E(call_desc_t *cd), F_06F(call_desc_t *cd); static void F_06G(call_desc_t *cd), F_06J(call_desc_t *cd), F_06Q(call_desc_t *cd); static void F_07E(call_desc_t *cd), F_07F(call_desc_t *cd), F_07G(call_desc_t *cd); static void F_08R(call_desc_t *cd), F_08Z(call_desc_t *cd); static void F_09D(call_desc_t *cd), F_09E(call_desc_t *cd), F_09F(call_desc_t *cd); static void F_09G(call_desc_t *cd); static void F_11J(call_desc_t *cd), F_11Q(call_desc_t *cd), F_11V(call_desc_t *cd); static void F_12C(call_desc_t *cd), F_12J(call_desc_t *cd); static void F_19I(call_desc_t *cd), F_19J(call_desc_t *cd), F_19K(call_desc_t *cd); static void F_19W(call_desc_t *cd); static void F_NCNA(call_desc_t *cd), F_STENQ(call_desc_t *cd), F_STAT(call_desc_t *cd); static void F_INFO(call_desc_t *cd), F_RELCP(call_desc_t *cd), F_REL(call_desc_t *cd); static void F_DISC(call_desc_t *cd), F_DCRQ(call_desc_t *cd), F_UEM(call_desc_t *cd); static void F_SIGN(call_desc_t *cd), F_DLEI(call_desc_t *cd), F_ILL(call_desc_t *cd); static void F_309TO(call_desc_t *cd), F_DECF(call_desc_t *cd), F_FCTY(call_desc_t *cd); static void F_DECF1(call_desc_t *cd), F_DECF2(call_desc_t *cd), F_DECF3(call_desc_t *cd); static void F_DLRI(call_desc_t *cd), F_DLRIA(call_desc_t *cd), F_DECF4(call_desc_t *cd); static void F_308TO(call_desc_t *cd); #if DO_I4B_DEBUG static char *l3state_text[N_STATES] = { "ST_U0 - Null", "ST_U1 - Out Init", "ST_U3 - Out Proc", "ST_U4 - Out Delv", "ST_U6 - In Pres", "ST_U7 - In Rxd", "ST_U8 - In ConReq", "ST_U9 - In Proc", "ST_U10 - Active", "ST_U11 - Disc Req", "ST_U12 - Disc Ind", "ST_U19 - Rel Req", "ST_IWA - In Wait EST-Accept", "ST_IWR - In Wait EST-Reject", "ST_OW - Out Wait EST", "ST_IWL - In Wait EST-Alert", "ST_SUSE - Subroutine sets state", "Illegal State" }; static char *l3event_text[N_EVENTS] = { "EV_SETUPRQ - L4 SETUP REQ", /* setup request from L4 */ "EV_DISCRQ - L4 DISC REQ", /* disconnect request from L4 */ "EV_RELRQ - L4 REL REQ", /* release request from L4 */ "EV_ALERTRQ - L4 ALERT REQ", /* alerting request from L4 */ "EV_SETACRS - L4 accept RSP", /* setup response accept from l4 */ "EV_SETRJRS - L4 reject RSP", /* setup response reject from l4 */ "EV_SETDCRS - L4 ignore RSP", /* setup response dontcare from l4 */ "EV_SETUP - rxd SETUP", /* incoming SETUP message from L2 */ "EV_STATUS - rxd STATUS", /* incoming STATUS message from L2 */ "EV_RELEASE - rxd REL", /* incoming RELEASE message from L2 */ "EV_RELCOMP - rxd REL COMPL", /* incoming RELEASE COMPLETE from L2 */ "EV_SETUPAK - rxd SETUP ACK", /* incoming SETUP ACK message from L2 */ "EV_CALLPRC - rxd CALL PROC", /* incoming CALL PROCEEDING from L2 */ "EV_ALERT - rxd ALERT", /* incoming ALERT message from L2 */ "EV_CONNECT - rxd CONNECT", /* incoming CONNECT message from L2 */ "EV_PROGIND - rxd PROG IND", /* incoming Progress IND from L2 */ "EV_DISCONN - rxd DISC", /* incoming DISCONNECT message from L2 */ "EV_CONACK - rxd CONN ACK", /* incoming CONNECT ACK message from L2 */ "EV_STATENQ - rxd STAT ENQ", /* incoming STATUS ENQ message from L2 */ "EV_INFO - rxd INFO", /* incoming INFO message from L2 */ "EV_FACILITY - rxd FACILITY", /* incoming FACILITY message */ "EV_T303EXP - T303 timeout", /* Timer T303 expired */ "EV_T305EXP - T305 timeout", /* Timer T305 expired */ "EV_T308EXP - T308 timeout", /* Timer T308 expired */ "EV_T309EXP - T309 timeout", /* Timer T309 expired */ "EV_T310EXP - T310 timeout", /* Timer T310 expired */ "EV_T313EXP - T313 timeout", /* Timer T313 expired */ "EV_DLESTIN - L2 DL_Est_Ind", /* dl establish indication from l2 */ "EV_DLRELIN - L2 DL_Rel_Ind", /* dl release indication from l2 */ "EV_DLESTCF - L2 DL_Est_Cnf", /* dl establish confirm from l2 */ "EV_DLRELCF - L2 DL_Rel_Cnf", /* dl release confirm from l2 */ "EV_ILL - Illegal event!!" /* Illegal */ }; #endif /*---------------------------------------------------------------------------* * layer 3 state transition table *---------------------------------------------------------------------------*/ struct l3state_tab { void (*func) (call_desc_t *); /* function to execute */ int newstate; /* next state */ } l3state_tab[N_EVENTS][N_STATES] = { /* STATE: ST_U0 ST_U1 ST_U3 ST_U4 ST_U6 ST_U7 ST_U8 ST_U9 ST_U10 ST_U11 ST_U12 ST_U19 ST_IWA ST_IWR ST_OW ST_IWL ST_SUBSET ST_ILL */ /* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ /*EV_SETUPRQ*/ {{F_00A, ST_SUSE}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, /*EV_DISCRQ */ {{F_ILL, ST_ILL}, {F_01B, ST_U11}, {F_DCRQ, ST_U11}, {F_DCRQ, ST_U11}, {F_ILL, ST_ILL}, {F_DCRQ, ST_U11}, {F_DCRQ, ST_U11}, {F_DCRQ, ST_U11}, {F_DCRQ, ST_U11}, {F_ILL, ST_ILL}, {F_NCNA, ST_U12}, {F_ILL, ST_ILL}, {F_DCRQ, ST_U11}, {F_DCRQ, ST_U11}, {F_DCRQ, ST_U11}, {F_DCRQ, ST_U11}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, /*EV_RELRQ */ {{F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_03C, ST_U19}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_12C, ST_U19}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, /*EV_ALERTRQ*/ {{F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_06D, ST_SUSE}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_09D, ST_U7}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, /*EV_SETACRS*/ {{F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_06E, ST_SUSE}, {F_07E, ST_U8}, {F_ILL, ST_ILL}, {F_09E, ST_U8}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, /*EV_SETRJRS*/ {{F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_06F, ST_SUSE}, {F_07F, ST_U0}, {F_ILL, ST_ILL}, {F_09F, ST_U0}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, /*EV_SETDCRS*/ {{F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_06G, ST_U0}, {F_07G, ST_U0}, {F_ILL, ST_ILL}, {F_09G, ST_U0}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, /* STATE: ST_U0 ST_U1 ST_U3 ST_U4 ST_U6 ST_U7 ST_U8 ST_U9 ST_U10 ST_U11 ST_U12 ST_U19 ST_IWA ST_IWR ST_OW ST_IWL ST_SUBSET ST_ILL */ /* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ /*EV_SETUP */ {{F_00H, ST_U6}, {F_SIGN, ST_U1}, {F_SIGN, ST_U3}, {F_SIGN, ST_U4}, {F_SIGN, ST_U6}, {F_SIGN, ST_U7}, {F_SIGN, ST_U8}, {F_SIGN, ST_U9}, {F_SIGN, ST_U10}, {F_SIGN, ST_U11}, {F_SIGN, ST_U12}, {F_SIGN, ST_U19}, {F_SIGN, ST_IWA}, {F_SIGN, ST_IWR}, {F_SIGN, ST_OW}, {F_SIGN, ST_IWL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, /*EV_STATUS */ {{F_00I, ST_SUSE}, {F_STAT, ST_SUSE}, {F_STAT, ST_SUSE}, {F_STAT, ST_SUSE}, {F_STAT, ST_SUSE}, {F_STAT, ST_SUSE}, {F_STAT, ST_SUSE}, {F_STAT, ST_SUSE}, {F_STAT, ST_SUSE}, {F_STAT, ST_SUSE}, {F_STAT, ST_SUSE}, {F_19I, ST_SUSE}, {F_STAT, ST_SUSE}, {F_STAT, ST_SUSE}, {F_STAT, ST_SUSE}, {F_STAT, ST_SUSE}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, /*EV_RELEASE*/ {{F_00J, ST_U0}, {F_UEM, ST_SUSE}, {F_REL, ST_U0}, {F_REL, ST_U0}, {F_06J, ST_U0}, {F_REL, ST_U0}, {F_REL, ST_U0}, {F_REL, ST_U0}, {F_REL, ST_U0}, {F_11J, ST_U0}, {F_12J, ST_U0}, {F_19J, ST_U0}, {F_REL, ST_U0}, {F_REL, ST_U0}, {F_REL, ST_U0}, {F_REL, ST_U0}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, /*EV_RELCOMP*/ {{F_NCNA, ST_U0}, {F_01K, ST_U0}, {F_RELCP,ST_U0}, {F_RELCP,ST_U0}, {F_RELCP,ST_U0}, {F_RELCP,ST_U0}, {F_RELCP,ST_U0}, {F_RELCP,ST_U0}, {F_RELCP,ST_U0}, {F_RELCP,ST_U0}, {F_RELCP,ST_U0}, {F_19K, ST_U0}, {F_RELCP,ST_U0}, {F_RELCP,ST_U0}, {F_RELCP,ST_U0}, {F_RELCP,ST_U0}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, /*EV_SETUPAK*/ {{F_UEM, ST_SUSE}, {F_01L, ST_U3}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, /*EV_CALLPRC*/ {{F_UEM, ST_SUSE}, {F_01M, ST_U3}, {F_NCNA, ST_U3}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, /*EV_ALERT */ {{F_UEM, ST_SUSE}, {F_01N, ST_U4}, {F_03N, ST_U4}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, /*EV_CONNECT*/ {{F_UEM, ST_SUSE}, {F_01O, ST_U10}, {F_03O, ST_U10}, {F_04O, ST_U10}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, /*EV_PROGIND*/ {{F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_03P, ST_U3}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, /*EV_DISCONN*/ {{F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_DISC, ST_U12}, {F_DISC, ST_U12}, {F_06Q, ST_U12}, {F_DISC, ST_U12}, {F_DISC, ST_U12}, {F_DISC, ST_U12}, {F_DISC, ST_U12}, {F_11Q, ST_U19}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_DISC, ST_U12}, {F_DISC, ST_U12}, {F_DISC, ST_U12}, {F_DISC, ST_U12}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, /*EV_CONACK */ {{F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_08R, ST_U10}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, /*EV_STATENQ*/ {{F_STENQ,ST_U0}, {F_STENQ,ST_U1}, {F_STENQ,ST_U3}, {F_STENQ,ST_U4}, {F_STENQ,ST_U6}, {F_STENQ,ST_U7}, {F_STENQ,ST_U8}, {F_STENQ,ST_U9}, {F_STENQ,ST_U10}, {F_STENQ,ST_U11}, {F_STENQ,ST_U12}, {F_STENQ,ST_U19}, {F_STENQ,ST_IWA}, {F_STENQ,ST_IWR}, {F_STENQ,ST_OW}, {F_STENQ,ST_OW}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, /*EV_INFO */ {{F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_INFO, ST_U3}, {F_INFO, ST_U4}, {F_UEM, ST_SUSE}, {F_INFO, ST_U7}, {F_INFO, ST_U8}, {F_INFO, ST_U9}, {F_INFO, ST_U10}, {F_INFO, ST_U11}, {F_INFO, ST_U12}, {F_UEM, ST_SUSE}, {F_INFO, ST_IWA}, {F_INFO, ST_IWR}, {F_INFO, ST_OW}, {F_INFO, ST_OW}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, /*EV_FACILITY*/ {{F_FCTY, ST_SUSE}, {F_FCTY, ST_SUSE}, {F_FCTY, ST_SUSE}, {F_FCTY, ST_SUSE}, {F_FCTY, ST_SUSE}, {F_FCTY, ST_SUSE}, {F_FCTY, ST_SUSE}, {F_FCTY, ST_SUSE}, {F_FCTY, ST_SUSE}, {F_FCTY, ST_SUSE}, {F_FCTY, ST_SUSE}, {F_FCTY, ST_SUSE}, {F_FCTY, ST_SUSE}, {F_FCTY, ST_SUSE}, {F_FCTY, ST_SUSE}, {F_FCTY, ST_SUSE}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, /* STATE: ST_U0 ST_U1 ST_U3 ST_U4 ST_U6 ST_U7 ST_U8 ST_U9 ST_U10 ST_U11 ST_U12 ST_U19 ST_IWA ST_IWR ST_OW ST_IWL ST_SUBSET ST_ILL */ /* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ /*EV_T303EXP*/ {{F_ILL, ST_ILL}, {F_01U, ST_SUSE}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, /*EV_T305EXP*/ {{F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_11V, ST_U19}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, /*EV_T308EXP*/ {{F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_308TO,ST_ILL}, {F_19W, ST_SUSE}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, /*EV_T309EXP*/ {{F_309TO,ST_U0}, {F_309TO,ST_U0}, {F_309TO,ST_U0}, {F_309TO,ST_U0}, {F_309TO,ST_U0}, {F_309TO,ST_U0}, {F_309TO,ST_U0}, {F_309TO,ST_U0}, {F_309TO,ST_U0}, {F_309TO,ST_U0}, {F_309TO,ST_U0}, {F_309TO,ST_U0}, {F_309TO,ST_U0}, {F_309TO,ST_U0}, {F_309TO,ST_U0}, {F_309TO,ST_U0}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, /*EV_T310EXP*/ {{F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_03Y, ST_U11}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, /*EV_T313EXP*/ {{F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_08Z, ST_U11}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, /* STATE: ST_U0 ST_U1 ST_U3 ST_U4 ST_U6 ST_U7 ST_U8 ST_U9 ST_U10 ST_U11 ST_U12 ST_U19 ST_IWA ST_IWR ST_OW ST_IWL ST_SUBSET ST_ILL */ /* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ /*EV_DLESTIN*/ {{F_ILL, ST_ILL}, {F_DLEI, ST_U1}, {F_DLEI, ST_U3}, {F_DLEI, ST_U4}, {F_DLEI, ST_U1}, {F_DLEI, ST_U1}, {F_DLEI, ST_U1}, {F_DLEI, ST_U1}, {F_DLEI, ST_U1}, {F_DLEI, ST_U1}, {F_DLEI, ST_U1}, {F_DLEI, ST_U1}, {F_DLEI, ST_U1}, {F_DLEI, ST_U1}, {F_DLEI, ST_U1}, {F_DLEI, ST_U1}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, -/*EV_DLRELIN*/ {{F_NCNA, ST_U0}, {F_DLRI, ST_U0}, {F_DLRI, ST_U0}, {F_DLRI, ST_U0}, {F_DLRI, ST_U0}, {F_DLRI, ST_U0}, {F_DLRI, ST_U0}, {F_DLRI, ST_U0}, {F_DLRIA,ST_U10}, {F_DLRI, ST_U0}, {F_DLRI, ST_U0}, {F_DLRI, ST_U0}, {F_DLRI, ST_U0}, {F_DLRI, ST_U0}, {F_DLRI, ST_U0}, {F_DLRI, ST_U0}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, +/*EV_DLRELIN*/ {{F_NCNA, ST_U0}, {F_DLRIA, ST_OW}, {F_DLRI, ST_U0}, {F_DLRI, ST_U0}, {F_DLRI, ST_U0}, {F_DLRI, ST_U0}, {F_DLRI, ST_U0}, {F_DLRI, ST_U0}, {F_DLRIA,ST_U10}, {F_DLRI, ST_U0}, {F_DLRI, ST_U0}, {F_DLRI, ST_U0}, {F_DLRI, ST_U0}, {F_DLRI, ST_U0}, {F_DLRI, ST_U0}, {F_DLRI, ST_U0}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, /*EV_DLESTCF*/ {{F_DECF, ST_SUSE}, {F_DECF, ST_SUSE}, {F_DECF, ST_SUSE}, {F_DECF, ST_SUSE}, {F_DECF, ST_SUSE}, {F_DECF, ST_SUSE}, {F_DECF, ST_SUSE}, {F_DECF, ST_SUSE}, {F_DECF, ST_SUSE}, {F_DECF, ST_SUSE}, {F_DECF, ST_SUSE}, {F_DECF, ST_SUSE}, {F_DECF2,ST_U8}, {F_DECF3,ST_U0}, {F_DECF1,ST_U1}, {F_DECF4,ST_U7}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, /*EV_DLRELCF*/ {{F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, /*EV_ILL */ {{F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}} }; /*---------------------------------------------------------------------------* * event handler *---------------------------------------------------------------------------*/ void next_l3state(call_desc_t *cd, int event) { int currstate, newstate; if(event > N_EVENTS) panic("i4b_l3fsm.c: event > N_EVENTS\n"); currstate = cd->Q931state; if(currstate > N_STATES) panic("i4b_l3fsm.c: currstate > N_STATES\n"); newstate = l3state_tab[event][currstate].newstate; if(newstate > N_STATES) panic("i4b_l3fsm.c: newstate > N_STATES\n"); NDBGL3(L3_F_MSG, "L3 FSM event [%s]: [%s => %s]", l3event_text[event], l3state_text[currstate], l3state_text[newstate]); /* execute function */ (*l3state_tab[event][currstate].func)(cd); if(newstate == ST_ILL) { newstate = currstate; NDBGL3(L3_F_ERR, "FSM illegal state, state = %s, event = %s!", l3state_text[newstate], l3event_text[event]); } if(newstate != ST_SUSE) cd->Q931state = newstate; } #if DO_I4B_DEBUG /*---------------------------------------------------------------------------* * return pointer to current state description *---------------------------------------------------------------------------*/ char *print_l3state(call_desc_t *cd) { return((char *) l3state_text[cd->Q931state]); } #endif /*---------------------------------------------------------------------------* * L3 FSM state U0 event L4 setup req *---------------------------------------------------------------------------*/ static void F_00A(call_desc_t *cd) { + int s; NDBGL3(L3_F_MSG, "FSM function F_00A executing"); + cd->T303_first_to = 1; + T303_start(cd); + + s = SPLI4B(); if(i4b_get_dl_stat(cd) == DL_DOWN) { + splx(s); DL_Est_Req(ctrl_desc[cd->controller].unit); cd->Q931state = ST_OW; } else { - i4b_l3_tx_setup(cd); cd->Q931state = ST_U1; + splx(s); + i4b_l3_tx_setup(cd); } - - cd->T303_first_to = 1; - T303_start(cd); } /*---------------------------------------------------------------------------* * L3 FSM state U0 event SETUP from L2 *---------------------------------------------------------------------------*/ static void F_00H(call_desc_t *cd) { NDBGL3(L3_F_MSG, "FSM function F_00H executing"); i4b_l4_connect_ind(cd); /* tell l4 we have an incoming setup */ } /*---------------------------------------------------------------------------* * L3 FSM state U0 event STATUS from L2 *---------------------------------------------------------------------------*/ static void F_00I(call_desc_t *cd) { NDBGL3(L3_F_MSG, "FSM function F_00I executing"); if(cd->call_state != 0) { cd->cause_out = 101; i4b_l3_tx_release_complete(cd, 1); /* 1 = send cause */ } cd->Q931state = ST_U0; } /*---------------------------------------------------------------------------* * L3 FSM state U0 event RELEASE from L2 *---------------------------------------------------------------------------*/ static void F_00J(call_desc_t *cd) { NDBGL3(L3_F_MSG, "FSM function F_00J executing"); i4b_l3_tx_release_complete(cd, 0); /* 0 = don't send cause */ } /*---------------------------------------------------------------------------* * L3 FSM state U1 event disconnect req from L4 *---------------------------------------------------------------------------*/ static void F_01B(call_desc_t *cd) { NDBGL3(L3_F_MSG, "FSM function F_01B executing"); /* cause from L4 */ i4b_l3_tx_disconnect(cd); T303_stop(cd); T305_start(cd); } /*---------------------------------------------------------------------------* * L3 FSM state U1 event RELEASE COMPLETE from L2 *---------------------------------------------------------------------------*/ static void F_01K(call_desc_t *cd) { NDBGL3(L3_F_MSG, "FSM function F_01K executing"); T303_stop(cd); i4b_l4_disconnect_ind(cd); /* tell l4 we were rejected */ freecd_by_cd(cd); } /*---------------------------------------------------------------------------* * L3 FSM state U1 event SETUP ACK from L2 *---------------------------------------------------------------------------*/ static void F_01L(call_desc_t *cd) { NDBGL3(L3_F_MSG, "FSM function F_01L executing"); T303_stop(cd); /* * since this implementation does NOT support overlap sending, * we react here as if we received a CALL PROCEEDING because * several PBX's react with a SETUP ACK even if the called * number is complete AND we sent a SENDING COMPLETE in the * preceding SETUP message. (-hm) */ T310_start(cd); i4b_l4_proceeding_ind(cd); } /*---------------------------------------------------------------------------* * L3 FSM state U1 event CALL PROCEEDING from L2 *---------------------------------------------------------------------------*/ static void F_01M(call_desc_t *cd) { NDBGL3(L3_F_MSG, "FSM function F_01M executing"); T303_stop(cd); T310_start(cd); i4b_l4_proceeding_ind(cd); } /*---------------------------------------------------------------------------* * L3 FSM state U1 event ALERT from L2 (XXX !) *---------------------------------------------------------------------------*/ static void F_01N(call_desc_t *cd) { NDBGL3(L3_F_MSG, "FSM function F_01N executing"); T303_stop(cd); i4b_l4_alert_ind(cd); } /*---------------------------------------------------------------------------* * L3 FSM state U1 event CONNECT from L2 (XXX !) *---------------------------------------------------------------------------*/ static void F_01O(call_desc_t *cd) { NDBGL3(L3_F_MSG, "FSM function F_01O executing"); T303_stop(cd); i4b_l3_tx_connect_ack(cd); i4b_l4_connect_active_ind(cd); } /*---------------------------------------------------------------------------* * L3 FSM state U1 event T303 timeout *---------------------------------------------------------------------------*/ static void F_01U(call_desc_t *cd) { NDBGL3(L3_F_MSG, "FSM function F_01U executing"); if(cd->T303_first_to == 1) { cd->T303_first_to = 0; i4b_l3_tx_setup(cd); T303_start(cd); cd->Q931state = ST_U1; } else { i4b_l4_disconnect_ind(cd); freecd_by_cd(cd); cd->Q931state = ST_U0; } } /*---------------------------------------------------------------------------* * L3 FSM state U3 event release req from L4 *---------------------------------------------------------------------------*/ static void F_03C(call_desc_t *cd) { NDBGL3(L3_F_MSG, "FSM function F_03C executing"); T310_stop(cd); cd->cause_out = 6; i4b_l3_tx_release(cd, 1); /* 0 = don't send cause */ cd->T308_first_to = 1; T308_start(cd); } /*---------------------------------------------------------------------------* * L3 FSM state U3 event ALERT from L2 *---------------------------------------------------------------------------*/ static void F_03N(call_desc_t *cd) { NDBGL3(L3_F_MSG, "FSM function F_03N executing"); T310_stop(cd); i4b_l4_alert_ind(cd); } /*---------------------------------------------------------------------------* * L3 FSM state U3 event CONNECT from L2 *---------------------------------------------------------------------------*/ static void F_03O(call_desc_t *cd) { NDBGL3(L3_F_MSG, "FSM function F_03O executing"); T310_stop(cd); i4b_l3_tx_connect_ack(cd); /* CONNECT ACK to network */ i4b_l4_connect_active_ind(cd); } /*---------------------------------------------------------------------------* * L3 FSM state U3 event PROGESS IND from L2 *---------------------------------------------------------------------------*/ static void F_03P(call_desc_t *cd) { NDBGL3(L3_F_MSG, "FSM function F_03P executing"); T310_stop(cd); #ifdef NOTDEF i4b_l4_progress_ind(cd); #endif } /*---------------------------------------------------------------------------* * L3 FSM state U3 event T310 timeout *---------------------------------------------------------------------------*/ static void F_03Y(call_desc_t *cd) { NDBGL3(L3_F_MSG, "FSM function F_03Y executing"); cd->cause_out = 102; /* recovery on timer expiry */ i4b_l3_tx_disconnect(cd); T305_start(cd); i4b_l4_disconnect_ind(cd); } /*---------------------------------------------------------------------------* * L3 FSM state U4 event CONNECT from L2 *---------------------------------------------------------------------------*/ static void F_04O(call_desc_t *cd) { NDBGL3(L3_F_MSG, "FSM function F_04O executing"); i4b_l3_tx_connect_ack(cd); /* CONNECT ACK to network */ i4b_l4_connect_active_ind(cd); } /*---------------------------------------------------------------------------* * L3 FSM state U6 event alert req from L4 *---------------------------------------------------------------------------*/ static void F_06D(call_desc_t *cd) { NDBGL3(L3_F_MSG, "FSM function F_06D executing"); if(i4b_get_dl_stat(cd) == DL_DOWN) { DL_Est_Req(ctrl_desc[cd->controller].unit); cd->Q931state = ST_IWL; } else { i4b_l3_tx_alert(cd); cd->Q931state = ST_U7; } } /*---------------------------------------------------------------------------* * L3 FSM state U6 event incoming setup accept from L4 *---------------------------------------------------------------------------*/ static void F_06E(call_desc_t *cd) { NDBGL3(L3_F_MSG, "FSM function F_06E executing"); if(i4b_get_dl_stat(cd) == DL_DOWN) { DL_Est_Req(ctrl_desc[cd->controller].unit); cd->Q931state = ST_IWA; } else { i4b_l3_tx_connect(cd); cd->Q931state = ST_U8; } T313_start(cd); } /*---------------------------------------------------------------------------* * L3 FSM state U6 event incoming setup reject from L4 *---------------------------------------------------------------------------*/ static void F_06F(call_desc_t *cd) { NDBGL3(L3_F_MSG, "FSM function F_06F executing"); if(i4b_get_dl_stat(cd) == DL_DOWN) { DL_Est_Req(ctrl_desc[cd->controller].unit); cd->Q931state = ST_IWR; } else { int s = SPLI4B(); i4b_l3_tx_release_complete(cd, 1); cd->Q931state = ST_U0; freecd_by_cd(cd); splx(s); } } /*---------------------------------------------------------------------------* * L3 FSM state U6 event incoming setup ignore from L4 *---------------------------------------------------------------------------*/ static void F_06G(call_desc_t *cd) { NDBGL3(L3_F_MSG, "FSM function F_06G executing"); freecd_by_cd(cd); } /*---------------------------------------------------------------------------* * L3 FSM state U6 event RELEASE from L2 *---------------------------------------------------------------------------*/ static void F_06J(call_desc_t *cd) { NDBGL3(L3_F_MSG, "FSM function F_06J executing"); i4b_l3_tx_release_complete(cd, 0); i4b_l4_disconnect_ind(cd); freecd_by_cd(cd); } /*---------------------------------------------------------------------------* * L3 FSM state U6 event DISCONNECT from L2 *---------------------------------------------------------------------------*/ static void F_06Q(call_desc_t *cd) { NDBGL3(L3_F_MSG, "FSM function F_06Q executing"); i4b_l4_disconnect_ind(cd); } /*---------------------------------------------------------------------------* * L3 FSM state U7 event setup response accept from L4 *---------------------------------------------------------------------------*/ static void F_07E(call_desc_t *cd) { NDBGL3(L3_F_MSG, "FSM function F_07E executing"); i4b_l3_tx_connect(cd); T313_start(cd); } /*---------------------------------------------------------------------------* * L3 FSM state U7 event setup response reject from L4 *---------------------------------------------------------------------------*/ static void F_07F(call_desc_t *cd) { NDBGL3(L3_F_MSG, "FSM function F_07F executing"); i4b_l3_tx_release_complete(cd, 1); freecd_by_cd(cd); } /*---------------------------------------------------------------------------* * L3 FSM state U7 event setup response ignore from L4 *---------------------------------------------------------------------------*/ static void F_07G(call_desc_t *cd) { NDBGL3(L3_F_MSG, "FSM function F_07G executing"); freecd_by_cd(cd); } /*---------------------------------------------------------------------------* * L3 FSM state U8 event CONNECT ACK from L2 *---------------------------------------------------------------------------*/ static void F_08R(call_desc_t *cd) { NDBGL3(L3_F_MSG, "FSM function F_08R executing"); T313_stop(cd); i4b_l4_connect_active_ind(cd); } /*---------------------------------------------------------------------------* * L3 FSM state U8 event T313 timeout *---------------------------------------------------------------------------*/ static void F_08Z(call_desc_t *cd) { NDBGL3(L3_F_MSG, "FSM function F_08Z executing"); cd->cause_out = 102; /* recovery on timer expiry */ i4b_l3_tx_disconnect(cd); T305_start(cd); i4b_l4_disconnect_ind(cd); } /*---------------------------------------------------------------------------* * L3 FSM state U9 event alert req from L4 *---------------------------------------------------------------------------*/ static void F_09D(call_desc_t *cd) { NDBGL3(L3_F_MSG, "FSM function F_09D executing"); i4b_l3_tx_alert(cd); } /*---------------------------------------------------------------------------* * L3 FSM state U9 event setup response accept from L4 *---------------------------------------------------------------------------*/ static void F_09E(call_desc_t *cd) { NDBGL3(L3_F_MSG, "FSM function F_09E executing"); i4b_l3_tx_connect(cd); T313_start(cd); } /*---------------------------------------------------------------------------* * L3 FSM state U9 event setup response reject from L4 *---------------------------------------------------------------------------*/ static void F_09F(call_desc_t *cd) { NDBGL3(L3_F_MSG, "FSM function F_09F executing"); i4b_l3_tx_release_complete(cd, 1); freecd_by_cd(cd); } /*---------------------------------------------------------------------------* * L3 FSM state U9 event setup response ignore from L4 *---------------------------------------------------------------------------*/ static void F_09G(call_desc_t *cd) { NDBGL3(L3_F_MSG, "FSM function F_09G executing"); freecd_by_cd(cd); } /*---------------------------------------------------------------------------* * L3 FSM state U11 event RELEASE from L2 *---------------------------------------------------------------------------*/ static void F_11J(call_desc_t *cd) { NDBGL3(L3_F_MSG, "FSM function F_11J executing"); T305_stop(cd); i4b_l3_tx_release_complete(cd, 0); i4b_l4_disconnect_ind(cd); freecd_by_cd(cd); } /*---------------------------------------------------------------------------* * L3 FSM state U11 event DISCONNECT from L2 *---------------------------------------------------------------------------*/ static void F_11Q(call_desc_t *cd) { NDBGL3(L3_F_MSG, "FSM function F_11Q executing"); T305_stop(cd); i4b_l3_tx_release(cd, 0); cd->T308_first_to = 1; T308_start(cd); } /*---------------------------------------------------------------------------* * L3 FSM state U11 event T305 timeout *---------------------------------------------------------------------------*/ static void F_11V(call_desc_t *cd) { NDBGL3(L3_F_MSG, "FSM function F_11V executing"); cd->cause_out = 102; i4b_l3_tx_release(cd, 1); cd->T308_first_to = 1; T308_start(cd); } /*---------------------------------------------------------------------------* * L3 FSM state U12 event release req from L4 *---------------------------------------------------------------------------*/ static void F_12C(call_desc_t *cd) { NDBGL3(L3_F_MSG, "FSM function F_12C executing"); i4b_l3_tx_release(cd, 1); cd->T308_first_to = 1; T308_start(cd); } /*---------------------------------------------------------------------------* * L3 FSM state U12 event RELEASE from L2 *---------------------------------------------------------------------------*/ static void F_12J(call_desc_t *cd) { NDBGL3(L3_F_MSG, "FSM function F_12J executing"); i4b_l3_tx_release_complete(cd, 0); i4b_l4_disconnect_ind(cd); freecd_by_cd(cd); } /*---------------------------------------------------------------------------* * L3 FSM state U19 event STATUS from L2 *---------------------------------------------------------------------------*/ static void F_19I(call_desc_t *cd) { NDBGL3(L3_F_MSG, "FSM function F_19I executing"); if(cd->call_state == 0) { i4b_l4_status_ind(cd); freecd_by_cd(cd); cd->Q931state = ST_U0; } else { cd->Q931state = ST_U19; } } /*---------------------------------------------------------------------------* * L3 FSM state U19 event RELEASE from L2 *---------------------------------------------------------------------------*/ static void F_19J(call_desc_t *cd) { NDBGL3(L3_F_MSG, "FSM function F_19J executing"); T308_stop(cd); i4b_l4_disconnect_ind(cd); freecd_by_cd(cd); } /*---------------------------------------------------------------------------* * L3 FSM state U19 event RELEASE COMPLETE from L2 *---------------------------------------------------------------------------*/ static void F_19K(call_desc_t *cd) { NDBGL3(L3_F_MSG, "FSM function F_19K executing"); T308_stop(cd); i4b_l4_disconnect_ind(cd); freecd_by_cd(cd); } /*---------------------------------------------------------------------------* * L3 FSM state U19 event T308 timeout *---------------------------------------------------------------------------*/ static void F_19W(call_desc_t *cd) { NDBGL3(L3_F_MSG, "FSM function F_19W executing"); if(cd->T308_first_to == 0) { cd->T308_first_to = 1; i4b_l3_tx_release(cd, 0); T308_start(cd); cd->Q931state = ST_U19; } else { cd->T308_first_to = 0; i4b_l4_disconnect_ind(cd); freecd_by_cd(cd); cd->Q931state = ST_U0; } } /*---------------------------------------------------------------------------* * L3 FSM routine no change no action *---------------------------------------------------------------------------*/ static void F_NCNA(call_desc_t *cd) { } /*---------------------------------------------------------------------------* * L3 FSM any state event STATUS ENQ from L2 *---------------------------------------------------------------------------*/ static void F_STENQ(call_desc_t *cd) { NDBGL3(L3_F_MSG, "FSM function F_STENQ executing"); i4b_l3_tx_status(cd, CAUSE_Q850_STENQRSP); /* 30, resonse to stat enq */ } /*---------------------------------------------------------------------------* * L3 FSM any state except 0 & 19 event STATUS from L2 *---------------------------------------------------------------------------*/ static void F_STAT(call_desc_t *cd) { NDBGL3(L3_F_MSG, "FSM function F_STAT executing"); if(cd->call_state == 0) { i4b_l4_status_ind(cd); cd->Q931state = ST_U0; freecd_by_cd(cd); } else { /* XXX !!!!!!!!!!!!!!!!!! */ i4b_l4_status_ind(cd); cd->cause_out = 101; /* message not compatible with call state */ i4b_l3_tx_disconnect(cd); T305_start(cd); cd->Q931state = ST_U11; } } /*---------------------------------------------------------------------------* * L3 FSM some states event INFORMATION from L2 *---------------------------------------------------------------------------*/ static void F_INFO(call_desc_t *cd) { NDBGL3(L3_F_MSG, "FSM function F_INFO executing"); i4b_l4_info_ind(cd); /* remain in current state */ } /*---------------------------------------------------------------------------* * L3 FSM T308 timeout while expecting RELEASE COMPLETE *---------------------------------------------------------------------------*/ static void F_308TO(call_desc_t *cd) { NDBGL3(L3_F_MSG, "FSM function F_308TO executing"); i4b_l3_stop_all_timers(cd); i4b_l4_disconnect_ind(cd); freecd_by_cd(cd); } /*---------------------------------------------------------------------------* * L3 FSM some states event RELEASE COMPLETE from L2 *---------------------------------------------------------------------------*/ static void F_RELCP(call_desc_t *cd) { NDBGL3(L3_F_MSG, "FSM function F_RELCP executing"); i4b_l3_stop_all_timers(cd); i4b_l4_disconnect_ind(cd); freecd_by_cd(cd); } /*---------------------------------------------------------------------------* * L3 FSM some states event RELEASE from L2 *---------------------------------------------------------------------------*/ static void F_REL(call_desc_t *cd) { NDBGL3(L3_F_MSG, "FSM function F_REL executing"); i4b_l3_stop_all_timers(cd); i4b_l3_tx_release_complete(cd, 0); i4b_l4_disconnect_ind(cd); freecd_by_cd(cd); } /*---------------------------------------------------------------------------* * L3 FSM some states event DISCONNECT from L2 *---------------------------------------------------------------------------*/ static void F_DISC(call_desc_t *cd) { NDBGL3(L3_F_MSG, "FSM function F_DISC executing"); i4b_l3_stop_all_timers(cd); /* * no disconnect ind to L4, no jump to state U12 * instead we issue a RELEASE and jump to U19 */ i4b_l3_tx_release(cd, 0); cd->T308_first_to = 1; T308_start(cd); cd->Q931state = ST_U19; } /*---------------------------------------------------------------------------* * L3 FSM some states event disconnect request from L4 *---------------------------------------------------------------------------*/ static void F_DCRQ(call_desc_t *cd) { NDBGL3(L3_F_MSG, "FSM function F_DCRQ executing"); /* stop T310 in case this is the result of an incoming call for a */ /* calledback connection */ if(cd->T310 == TIMER_ACTIVE) T310_stop(cd); /* cause from L4 */ i4b_l3_tx_disconnect(cd); T305_start(cd); cd->Q931state = ST_U11; } /*---------------------------------------------------------------------------* * L3 FSM any state except 0 event unexpected message from L2 *---------------------------------------------------------------------------*/ static void F_UEM(call_desc_t *cd) { NDBGL3(L3_F_ERR, "FSM function F_UEM executing, state = %s", print_l3state(cd)); i4b_l3_tx_status(cd, CAUSE_Q850_MSGNCWCS); /* 101, message not compatible with call state */ } /*---------------------------------------------------------------------------* * L3 FSM any state except 0 event SETUP from L2 *---------------------------------------------------------------------------*/ static void F_SIGN(call_desc_t *cd) { NDBGL3(L3_F_ERR, "FSM function F_SIGN executing"); /* XXX */ /* freecd_by_cd(cd); ?????????? XXX */ } /*---------------------------------------------------------------------------* * L3 FSM relevant states event DL ESTABLISH IND from L2 *---------------------------------------------------------------------------*/ static void F_DLEI(call_desc_t *cd) { NDBGL3(L3_F_MSG, "FSM function F_DLEI executing"); /* XXX */ /* remain in current state */ } /*---------------------------------------------------------------------------* * L3 FSM any state event illegal event occured *---------------------------------------------------------------------------*/ static void F_ILL(call_desc_t *cd) { NDBGL3(L3_F_MSG, "FSM function F_ILL executing"); } /*---------------------------------------------------------------------------* * L3 FSM any state event T309 timeout *---------------------------------------------------------------------------*/ static void F_309TO(call_desc_t *cd) { NDBGL3(L3_F_ERR, "FSM function F_309TO executing"); /* XXX */ #ifdef NOTDEF i4b_l4_dl_fail_ind(cd); #endif freecd_by_cd(cd); } /*---------------------------------------------------------------------------* * L3 FSM any state event FACILITY message received *---------------------------------------------------------------------------*/ static void F_FCTY(call_desc_t *cd) { NDBGL3(L3_F_MSG, "FSM function F_FCTY executing"); /* ST_SUSE, no change in state ! */ } /*---------------------------------------------------------------------------* * L3 FSM state ST_OW event DL ESTABLISH CONF from L2 *---------------------------------------------------------------------------*/ static void F_DECF1(call_desc_t *cd) { NDBGL3(L3_F_MSG, "FSM function F_DECF1 executing"); i4b_l3_tx_setup(cd); } /*---------------------------------------------------------------------------* * L3 FSM state ST_IWA event DL ESTABLISH CONF from L2 *---------------------------------------------------------------------------*/ static void F_DECF2(call_desc_t *cd) { NDBGL3(L3_F_MSG, "FSM function F_DECF2 executing"); i4b_l3_tx_connect(cd); } /*---------------------------------------------------------------------------* * L3 FSM state ST_IWR event DL ESTABLISH CONF from L2 *---------------------------------------------------------------------------*/ static void F_DECF3(call_desc_t *cd) { NDBGL3(L3_F_MSG, "FSM function F_DECF3 executing"); i4b_l3_tx_release_complete(cd, 1); freecd_by_cd(cd); } /*---------------------------------------------------------------------------* * L3 FSM state ST_IWL event DL ESTABLISH CONF from L2 *---------------------------------------------------------------------------*/ static void F_DECF4(call_desc_t *cd) { NDBGL3(L3_F_MSG, "FSM function F_DECF4 executing"); i4b_l3_tx_alert(cd); } /*---------------------------------------------------------------------------* * L3 FSM any state event DL ESTABLISH CONF from L2 *---------------------------------------------------------------------------*/ static void F_DECF(call_desc_t *cd) { NDBGL3(L3_F_MSG, "FSM function F_DECF executing"); T309_stop(cd); i4b_l3_tx_status(cd, CAUSE_Q850_NORMUNSP); /* 31, normal unspecified */ } /*---------------------------------------------------------------------------* * L3 FSM any state except U10 event DL RELEASE IND from L2 *---------------------------------------------------------------------------*/ static void F_DLRI(call_desc_t *cd) { NDBGL3(L3_F_MSG, "FSM function F_DLRI executing"); i4b_l3_stop_all_timers(cd); i4b_l4_disconnect_ind(cd); freecd_by_cd(cd); } /*---------------------------------------------------------------------------* * L3 FSM state U10 event DL RELEASE IND from L2 *---------------------------------------------------------------------------*/ static void F_DLRIA(call_desc_t *cd) { NDBGL3(L3_F_MSG, "FSM function F_DLRIA executing"); if(cd->T309 == TIMER_IDLE) T309_start(cd); DL_Est_Req(ctrl_desc[cd->controller].unit); } #endif /* NI4BQ931 > 0 */ diff --git a/sys/i4b/layer3/i4b_l4if.c b/sys/i4b/layer3/i4b_l4if.c index 112f0a496920..36812198863b 100644 --- a/sys/i4b/layer3/i4b_l4if.c +++ b/sys/i4b/layer3/i4b_l4if.c @@ -1,340 +1,342 @@ /* * Copyright (c) 1997, 2000 Hellmuth Michaelis. 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. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. * *--------------------------------------------------------------------------- * * i4b_l4if.c - Layer 3 interface to Layer 4 * ------------------------------------------- * * $Id: i4b_l4if.c,v 1.27 2000/08/24 11:48:58 hm Exp $ * * $FreeBSD$ * * last edit-date: [Fri Jun 2 14:32:19 2000] * *---------------------------------------------------------------------------*/ #ifdef __FreeBSD__ #include "i4bq931.h" #else #define NI4BQ931 1 #endif #if NI4BQ931 > 0 #include #include #include #if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000 #include #endif #ifdef __FreeBSD__ #include #include #include #else #include #include #include #endif #include #include #include #include #include #include extern void isic_settrace(int unit, int val); /*XXX*/ extern int isic_gettrace(int unit); /*XXX*/ static void n_connect_request(u_int cdid); static void n_connect_response(u_int cdid, int response, int cause); static void n_disconnect_request(u_int cdid, int cause); static void n_alert_request(u_int cdid); static void n_mgmt_command(int unit, int cmd, void *parm); /*---------------------------------------------------------------------------* * i4b_mdl_status_ind - status indication from lower layers *---------------------------------------------------------------------------*/ int i4b_mdl_status_ind(int unit, int status, int parm) { int sendup; int i; NDBGL3(L3_MSG, "unit = %d, status = %d, parm = %d", unit, status, parm); switch(status) { case STI_ATTACH: NDBGL3(L3_MSG, "STI_ATTACH: attaching unit %d to controller %d", unit, nctrl); /* init function pointers */ ctrl_desc[nctrl].N_CONNECT_REQUEST = n_connect_request; ctrl_desc[nctrl].N_CONNECT_RESPONSE = n_connect_response; ctrl_desc[nctrl].N_DISCONNECT_REQUEST = n_disconnect_request; ctrl_desc[nctrl].N_ALERT_REQUEST = n_alert_request; ctrl_desc[nctrl].N_DOWNLOAD = NULL; /* only used by active cards */ ctrl_desc[nctrl].N_DIAGNOSTICS = NULL; /* only used by active cards */ ctrl_desc[nctrl].N_MGMT_COMMAND = n_mgmt_command; /* init type and unit */ ctrl_desc[nctrl].unit = unit; ctrl_desc[nctrl].ctrl_type = CTRL_PASSIVE; ctrl_desc[nctrl].card_type = parm; /* state fields */ ctrl_desc[nctrl].dl_est = DL_DOWN; - ctrl_desc[nctrl].bch_state[CHAN_B1] = BCH_ST_FREE; - ctrl_desc[nctrl].bch_state[CHAN_B2] = BCH_ST_FREE; + ctrl_desc[nctrl].nbch = 2; /* XXX extra param? */ + for (i = 0; i < ctrl_desc[nctrl].nbch; i++) + ctrl_desc[nctrl].bch_state[i] = BCH_ST_FREE; + ctrl_desc[nctrl].tei = -1; /* init unit to controller table */ utoc_tab[unit] = nctrl; /* increment no. of controllers */ nctrl++; break; case STI_L1STAT: i4b_l4_l12stat(unit, 1, parm); NDBGL3(L3_MSG, "STI_L1STAT: unit %d layer 1 = %s", unit, status ? "up" : "down"); break; case STI_L2STAT: i4b_l4_l12stat(unit, 2, parm); NDBGL3(L3_MSG, "STI_L2STAT: unit %d layer 2 = %s", unit, status ? "up" : "down"); break; case STI_TEIASG: ctrl_desc[unit].tei = parm; i4b_l4_teiasg(unit, parm); NDBGL3(L3_MSG, "STI_TEIASG: unit %d TEI = %d = 0x%02x", unit, parm, parm); break; case STI_PDEACT: /* L1 T4 timeout */ NDBGL3(L3_ERR, "STI_PDEACT: unit %d TEI = %d = 0x%02x", unit, parm, parm); sendup = 0; for(i=0; i < N_CALL_DESC; i++) { if( (ctrl_desc[call_desc[i].controller].ctrl_type == CTRL_PASSIVE) && (ctrl_desc[call_desc[i].controller].unit == unit)) { i4b_l3_stop_all_timers(&(call_desc[i])); if(call_desc[i].cdid != CDID_UNUSED) sendup++; } } ctrl_desc[utoc_tab[unit]].dl_est = DL_DOWN; - ctrl_desc[utoc_tab[unit]].bch_state[CHAN_B1] = BCH_ST_FREE; - ctrl_desc[utoc_tab[unit]].bch_state[CHAN_B2] = BCH_ST_FREE; + for (i = 0; i < ctrl_desc[utoc_tab[unit]].nbch; i++) + ctrl_desc[utoc_tab[unit]].bch_state[i] = BCH_ST_FREE; ctrl_desc[utoc_tab[unit]].tei = -1; if(sendup) { i4b_l4_pdeact(unit, sendup); call_desc[i].cdid = CDID_UNUSED; } break; case STI_NOL1ACC: /* no outgoing access to S0 */ NDBGL3(L3_ERR, "STI_NOL1ACC: unit %d no outgoing access to S0", unit); for(i=0; i < N_CALL_DESC; i++) { if( (ctrl_desc[call_desc[i].controller].ctrl_type == CTRL_PASSIVE) && (ctrl_desc[call_desc[i].controller].unit == unit)) { if(call_desc[i].cdid != CDID_UNUSED) { SET_CAUSE_TYPE(call_desc[i].cause_in, CAUSET_I4B); SET_CAUSE_VAL(call_desc[i].cause_in, CAUSE_I4B_L1ERROR); i4b_l4_disconnect_ind(&(call_desc[i])); } } } ctrl_desc[utoc_tab[unit]].dl_est = DL_DOWN; - ctrl_desc[utoc_tab[unit]].bch_state[CHAN_B1] = BCH_ST_FREE; - ctrl_desc[utoc_tab[unit]].bch_state[CHAN_B2] = BCH_ST_FREE; + for (i = 0; i < ctrl_desc[utoc_tab[unit]].nbch; i++) + ctrl_desc[utoc_tab[unit]].bch_state[i] = BCH_ST_FREE; ctrl_desc[utoc_tab[unit]].tei = -1; break; default: NDBGL3(L3_ERR, "ERROR, unit %d, unknown status value %d!", unit, status); break; } return(0); } /*---------------------------------------------------------------------------* * send command to the lower layers *---------------------------------------------------------------------------*/ static void n_mgmt_command(int unit, int cmd, void *parm) { int i; switch(cmd) { case CMR_DOPEN: NDBGL3(L3_MSG, "CMR_DOPEN for unit %d", unit); for(i=0; i < N_CALL_DESC; i++) { if( (ctrl_desc[call_desc[i].controller].ctrl_type == CTRL_PASSIVE) && (ctrl_desc[call_desc[i].controller].unit == unit)) { call_desc[i].cdid = CDID_UNUSED; } } ctrl_desc[utoc_tab[unit]].dl_est = DL_DOWN; - ctrl_desc[utoc_tab[unit]].bch_state[CHAN_B1] = BCH_ST_FREE; - ctrl_desc[utoc_tab[unit]].bch_state[CHAN_B2] = BCH_ST_FREE; + for (i = 0; i < ctrl_desc[utoc_tab[unit]].nbch; i++) + ctrl_desc[utoc_tab[unit]].bch_state[i] = BCH_ST_FREE; ctrl_desc[utoc_tab[unit]].tei = -1; break; case CMR_DCLOSE: NDBGL3(L3_MSG, "CMR_DCLOSE for unit %d", unit); break; case CMR_SETTRACE: NDBGL3(L3_MSG, "CMR_SETTRACE for unit %d", unit); break; default: NDBGL3(L3_MSG, "unknown cmd %d for unit %d", cmd, unit); break; } MDL_Command_Req(unit, cmd, parm); } /*---------------------------------------------------------------------------* * handle connect request message from userland *---------------------------------------------------------------------------*/ static void n_connect_request(u_int cdid) { call_desc_t *cd; cd = cd_by_cdid(cdid); next_l3state(cd, EV_SETUPRQ); } /*---------------------------------------------------------------------------* * handle setup response message from userland *---------------------------------------------------------------------------*/ static void n_connect_response(u_int cdid, int response, int cause) { call_desc_t *cd; int chstate; cd = cd_by_cdid(cdid); T400_stop(cd); cd->response = response; cd->cause_out = cause; switch(response) { case SETUP_RESP_ACCEPT: next_l3state(cd, EV_SETACRS); chstate = BCH_ST_USED; break; case SETUP_RESP_REJECT: next_l3state(cd, EV_SETRJRS); chstate = BCH_ST_FREE; break; case SETUP_RESP_DNTCRE: next_l3state(cd, EV_SETDCRS); chstate = BCH_ST_FREE; break; default: /* failsafe */ next_l3state(cd, EV_SETDCRS); chstate = BCH_ST_FREE; NDBGL3(L3_ERR, "unknown response, doing SETUP_RESP_DNTCRE"); break; } - if((cd->channelid == CHAN_B1) || (cd->channelid == CHAN_B2)) + if((cd->channelid >= 0) && (cd->channelid < ctrl_desc[cd->controller].nbch)) { ctrl_desc[cd->controller].bch_state[cd->channelid] = chstate; } else { NDBGL3(L3_MSG, "Warning, invalid channelid %d, response = %d\n", cd->channelid, response); } } /*---------------------------------------------------------------------------* * handle disconnect request message from userland *---------------------------------------------------------------------------*/ static void n_disconnect_request(u_int cdid, int cause) { call_desc_t *cd; cd = cd_by_cdid(cdid); cd->cause_out = cause; next_l3state(cd, EV_DISCRQ); } /*---------------------------------------------------------------------------* * handle alert request message from userland *---------------------------------------------------------------------------*/ static void n_alert_request(u_int cdid) { call_desc_t *cd; cd = cd_by_cdid(cdid); next_l3state(cd, EV_ALERTRQ); } #endif /* NI4BQ931 > 0 */ diff --git a/sys/i4b/layer4/i4b_i4bdrv.c b/sys/i4b/layer4/i4b_i4bdrv.c index 29620ad2cbae..71c200f20af2 100644 --- a/sys/i4b/layer4/i4b_i4bdrv.c +++ b/sys/i4b/layer4/i4b_i4bdrv.c @@ -1,1053 +1,1062 @@ /* * Copyright (c) 1997, 2001 Hellmuth Michaelis. 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. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. * *--------------------------------------------------------------------------- * * i4b_i4bdrv.c - i4b userland interface driver * -------------------------------------------- * * $FreeBSD$ * * last edit-date: [Fri Jan 12 16:49:34 2001] * *---------------------------------------------------------------------------*/ #include "i4b.h" #include "i4bipr.h" #include "i4btel.h" #if NI4B > 1 #error "only 1 (one) i4b device possible!" #endif #if NI4B > 0 #include #if defined(__FreeBSD__) #include #include #include #else #include #endif #include #include #include #include #include #if __FreeBSD_version >= 500014 #include #else #include #endif #include #ifdef __NetBSD__ #include #endif #if defined(__FreeBSD__) #include "i4bing.h" #endif #ifdef __bsdi__ #include "ibc.h" #else #ifdef __FreeBSD__ #include "i4bisppp.h" #else #include #endif #endif #ifdef __FreeBSD__ #if defined(__FreeBSD__) && __FreeBSD__ == 3 #include "opt_devfs.h" #endif #ifdef DEVFS #include #endif #endif /* __FreeBSD__*/ #ifdef __FreeBSD__ #include #include #include #else #include #include #include #endif #include #include #include #include #ifdef OS_USES_POLL #include #endif struct selinfo select_rd_info; static struct ifqueue i4b_rdqueue; static int openflag = 0; static int selflag = 0; static int readflag = 0; #if defined(__FreeBSD__) && __FreeBSD__ == 3 #ifdef DEVFS static void *devfs_token; #endif #endif #ifndef __FreeBSD__ #define PDEVSTATIC /* - not static - */ PDEVSTATIC void i4battach __P((void)); PDEVSTATIC int i4bopen __P((dev_t dev, int flag, int fmt, struct proc *p)); PDEVSTATIC int i4bclose __P((dev_t dev, int flag, int fmt, struct proc *p)); PDEVSTATIC int i4bread __P((dev_t dev, struct uio *uio, int ioflag)); #ifdef __bsdi__ PDEVSTATIC int i4bioctl __P((dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)); #else PDEVSTATIC int i4bioctl __P((dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)); #endif #ifdef OS_USES_POLL PDEVSTATIC int i4bpoll __P((dev_t dev, int events, struct proc *p)); #else PDEVSTATIC int i4bselect __P((dev_t dev, int rw, struct proc *p)); #endif #endif /* #ifndef __FreeBSD__ */ #if BSD > 199306 && defined(__FreeBSD__) #define PDEVSTATIC static PDEVSTATIC d_open_t i4bopen; PDEVSTATIC d_close_t i4bclose; PDEVSTATIC d_read_t i4bread; PDEVSTATIC d_ioctl_t i4bioctl; #ifdef OS_USES_POLL PDEVSTATIC d_poll_t i4bpoll; #define POLLFIELD i4bpoll #else PDEVSTATIC d_select_t i4bselect; #define POLLFIELD i4bselect #endif #define CDEV_MAJOR 60 #if defined(__FreeBSD__) && __FreeBSD__ >= 4 static struct cdevsw i4b_cdevsw = { /* open */ i4bopen, /* close */ i4bclose, /* read */ i4bread, /* write */ nowrite, /* ioctl */ i4bioctl, /* poll */ POLLFIELD, /* mmap */ nommap, /* strategy */ nostrategy, /* name */ "i4b", /* maj */ CDEV_MAJOR, /* dump */ nodump, /* psize */ nopsize, /* flags */ 0, }; #else static struct cdevsw i4b_cdevsw = { i4bopen, i4bclose, i4bread, nowrite, i4bioctl, nostop, nullreset, nodevtotty, POLLFIELD, nommap, NULL, "i4b", NULL, -1 }; #endif PDEVSTATIC void i4battach(void *); PSEUDO_SET(i4battach, i4b_i4bdrv); static void i4b_drvinit(void *unused) { #if defined(__FreeBSD__) && __FreeBSD__ >= 4 cdevsw_add(&i4b_cdevsw); #else static int i4b_devsw_installed = 0; dev_t dev; if( ! i4b_devsw_installed ) { dev = makedev(CDEV_MAJOR,0); cdevsw_add(&dev,&i4b_cdevsw,NULL); i4b_devsw_installed = 1; } #endif } SYSINIT(i4bdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,i4b_drvinit,NULL) #endif /* BSD > 199306 && defined(__FreeBSD__) */ #ifdef __bsdi__ #include int i4bmatch(struct device *parent, struct cfdata *cf, void *aux); void dummy_i4battach(struct device*, struct device *, void *); #define CDEV_MAJOR 65 static struct cfdriver i4bcd = { NULL, "i4b", i4bmatch, dummy_i4battach, DV_DULL, sizeof(struct cfdriver) }; struct devsw i4bsw = { &i4bcd, i4bopen, i4bclose, i4bread, nowrite, i4bioctl, i4bselect, nommap, nostrat, nodump, nopsize, 0, nostop }; int i4bmatch(struct device *parent, struct cfdata *cf, void *aux) { printf("i4bmatch: aux=0x%x\n", aux); return 1; } void dummy_i4battach(struct device *parent, struct device *self, void *aux) { printf("dummy_i4battach: aux=0x%x\n", aux); } #endif /* __bsdi__ */ /*---------------------------------------------------------------------------* * interface attach routine *---------------------------------------------------------------------------*/ PDEVSTATIC void #ifdef __FreeBSD__ i4battach(void *dummy) #else i4battach() #endif { printf("i4b: ISDN call control device attached\n"); i4b_rdqueue.ifq_maxlen = IFQ_MAXLEN; #if defined(__FreeBSD__) && __FreeBSD__ > 4 mtx_init(&i4b_rdqueue.ifq_mtx, "i4b_rdqueue", MTX_DEF); #endif #if defined(__FreeBSD__) make_dev(&i4b_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600, "i4b"); #endif } /*---------------------------------------------------------------------------* * i4bopen - device driver open routine *---------------------------------------------------------------------------*/ PDEVSTATIC int i4bopen(dev_t dev, int flag, int fmt, struct proc *p) { int x; if(minor(dev)) return(ENXIO); if(openflag) return(EBUSY); x = splimp(); openflag = 1; i4b_l4_daemon_attached(); splx(x); return(0); } /*---------------------------------------------------------------------------* * i4bclose - device driver close routine *---------------------------------------------------------------------------*/ PDEVSTATIC int i4bclose(dev_t dev, int flag, int fmt, struct proc *p) { int x = splimp(); openflag = 0; i4b_l4_daemon_detached(); i4b_Dcleanifq(&i4b_rdqueue); splx(x); return(0); } /*---------------------------------------------------------------------------* * i4bread - device driver read routine *---------------------------------------------------------------------------*/ PDEVSTATIC int i4bread(dev_t dev, struct uio *uio, int ioflag) { struct mbuf *m; int x; int error = 0; if(minor(dev)) return(ENODEV); x = splimp(); IF_LOCK(&i4b_rdqueue); while(IF_QEMPTY(&i4b_rdqueue)) { readflag = 1; #if defined (__FreeBSD__) && __FreeBSD__ > 4 error = msleep((caddr_t) &i4b_rdqueue, &i4b_rdqueue.ifq_mtx, (PZERO + 1) | PCATCH, "bird", 0); #else error = tsleep((caddr_t) &i4b_rdqueue, (PZERO + 1) | PCATCH, "bird", 0); #endif if (error != 0) { IF_UNLOCK(&i4b_rdqueue); splx(x); return error; } } _IF_DEQUEUE(&i4b_rdqueue, m); IF_UNLOCK(&i4b_rdqueue); splx(x); if(m && m->m_len) error = uiomove(m->m_data, m->m_len, uio); else error = EIO; if(m) i4b_Dfreembuf(m); return(error); } /*---------------------------------------------------------------------------* * i4bioctl - device driver ioctl routine *---------------------------------------------------------------------------*/ PDEVSTATIC int #if defined (__FreeBSD_version) && __FreeBSD_version >= 300003 i4bioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) #elif defined(__bsdi__) i4bioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) #else i4bioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p) #endif { call_desc_t *cd; int error = 0; if(minor(dev)) return(ENODEV); switch(cmd) { /* cdid request, reserve cd and return cdid */ case I4B_CDID_REQ: { msg_cdid_req_t *mir; mir = (msg_cdid_req_t *)data; cd = reserve_cd(); mir->cdid = cd->cdid; break; } /* connect request, dial out to remote */ case I4B_CONNECT_REQ: { msg_connect_req_t *mcr; mcr = (msg_connect_req_t *)data; /* setup ptr */ if((cd = cd_by_cdid(mcr->cdid)) == NULL)/* get cd */ { NDBGL4(L4_ERR, "I4B_CONNECT_REQ ioctl, cdid not found!"); error = EINVAL; break; } /* prevent dialling on leased lines */ if(ctrl_desc[mcr->controller].protocol == PROTOCOL_D64S) { SET_CAUSE_TYPE(cd->cause_in, CAUSET_I4B); SET_CAUSE_VAL(cd->cause_in, CAUSE_I4B_LLDIAL); i4b_l4_disconnect_ind(cd); freecd_by_cd(cd); break; } cd->controller = mcr->controller; /* fill cd */ cd->bprot = mcr->bprot; cd->driver = mcr->driver; cd->driver_unit = mcr->driver_unit; cd->cr = get_rand_cr(ctrl_desc[cd->controller].unit); cd->shorthold_data.shorthold_algorithm = mcr->shorthold_data.shorthold_algorithm; cd->shorthold_data.unitlen_time = mcr->shorthold_data.unitlen_time; cd->shorthold_data.idle_time = mcr->shorthold_data.idle_time; cd->shorthold_data.earlyhup_time = mcr->shorthold_data.earlyhup_time; cd->last_aocd_time = 0; if(mcr->unitlen_method == ULEN_METHOD_DYNAMIC) cd->aocd_flag = 1; else cd->aocd_flag = 0; cd->cunits = 0; cd->max_idle_time = 0; /* this is outgoing */ cd->dir = DIR_OUTGOING; NDBGL4(L4_TIMO, "I4B_CONNECT_REQ times, algorithm=%ld unitlen=%ld idle=%ld earlyhup=%ld", (long)cd->shorthold_data.shorthold_algorithm, (long)cd->shorthold_data.unitlen_time, (long)cd->shorthold_data.idle_time, (long)cd->shorthold_data.earlyhup_time); strcpy(cd->dst_telno, mcr->dst_telno); strcpy(cd->src_telno, mcr->src_telno); cd->display[0] = '\0'; SET_CAUSE_TYPE(cd->cause_in, CAUSET_I4B); SET_CAUSE_VAL(cd->cause_in, CAUSE_I4B_NORMAL); switch(mcr->channel) { case CHAN_B1: case CHAN_B2: if(ctrl_desc[mcr->controller].bch_state[mcr->channel] != BCH_ST_FREE) SET_CAUSE_VAL(cd->cause_in, CAUSE_I4B_NOCHAN); break; case CHAN_ANY: - if((ctrl_desc[mcr->controller].bch_state[CHAN_B1] != BCH_ST_FREE) && - (ctrl_desc[mcr->controller].bch_state[CHAN_B2] != BCH_ST_FREE)) + { + int i; + for (i = 0; + i < ctrl_desc[mcr->controller].nbch && + ctrl_desc[mcr->controller].bch_state[i] != BCH_ST_FREE; + i++); + if (i == ctrl_desc[mcr->controller].nbch) SET_CAUSE_VAL(cd->cause_in, CAUSE_I4B_NOCHAN); + /* else mcr->channel = i; XXX */ + } break; default: SET_CAUSE_VAL(cd->cause_in, CAUSE_I4B_NOCHAN); break; } cd->channelid = mcr->channel; cd->isdntxdelay = mcr->txdelay; /* check whether we have a pointer. Seems like */ /* this should be adequate. GJ 19.09.97 */ if(ctrl_desc[cd->controller].N_CONNECT_REQUEST == NULL) /*XXX*/ SET_CAUSE_VAL(cd->cause_in, CAUSE_I4B_NOCHAN); if((GET_CAUSE_VAL(cd->cause_in)) != CAUSE_I4B_NORMAL) { i4b_l4_disconnect_ind(cd); freecd_by_cd(cd); } else { (*ctrl_desc[cd->controller].N_CONNECT_REQUEST)(mcr->cdid); } break; } /* connect response, accept/reject/ignore incoming call */ case I4B_CONNECT_RESP: { msg_connect_resp_t *mcrsp; mcrsp = (msg_connect_resp_t *)data; if((cd = cd_by_cdid(mcrsp->cdid)) == NULL)/* get cd */ { NDBGL4(L4_ERR, "I4B_CONNECT_RESP ioctl, cdid not found!"); error = EINVAL; break; } T400_stop(cd); cd->driver = mcrsp->driver; cd->driver_unit = mcrsp->driver_unit; cd->max_idle_time = mcrsp->max_idle_time; cd->shorthold_data.shorthold_algorithm = SHA_FIXU; cd->shorthold_data.unitlen_time = 0; /* this is incoming */ cd->shorthold_data.idle_time = 0; cd->shorthold_data.earlyhup_time = 0; cd->isdntxdelay = mcrsp->txdelay; NDBGL4(L4_TIMO, "I4B_CONNECT_RESP max_idle_time set to %ld seconds", (long)cd->max_idle_time); (*ctrl_desc[cd->controller].N_CONNECT_RESPONSE)(mcrsp->cdid, mcrsp->response, mcrsp->cause); break; } /* disconnect request, actively terminate connection */ case I4B_DISCONNECT_REQ: { msg_discon_req_t *mdr; mdr = (msg_discon_req_t *)data; if((cd = cd_by_cdid(mdr->cdid)) == NULL)/* get cd */ { NDBGL4(L4_ERR, "I4B_DISCONNECT_REQ ioctl, cdid not found!"); error = EINVAL; break; } /* preset causes with our cause */ cd->cause_in = cd->cause_out = mdr->cause; (*ctrl_desc[cd->controller].N_DISCONNECT_REQUEST)(mdr->cdid, mdr->cause); break; } /* controller info request */ case I4B_CTRL_INFO_REQ: { msg_ctrl_info_req_t *mcir; mcir = (msg_ctrl_info_req_t *)data; mcir->ncontroller = nctrl; if(mcir->controller > nctrl) { mcir->ctrl_type = -1; mcir->card_type = -1; } else { mcir->ctrl_type = ctrl_desc[mcir->controller].ctrl_type; mcir->card_type = ctrl_desc[mcir->controller].card_type; + mcir->nbch = + ctrl_desc[mcir->controller].nbch; if(ctrl_desc[mcir->controller].ctrl_type == CTRL_PASSIVE) mcir->tei = ctrl_desc[mcir->controller].tei; else mcir->tei = -1; } break; } /* dial response */ case I4B_DIALOUT_RESP: { drvr_link_t *dlt = NULL; msg_dialout_resp_t *mdrsp; mdrsp = (msg_dialout_resp_t *)data; switch(mdrsp->driver) { #if NI4BIPR > 0 case BDRV_IPR: dlt = ipr_ret_linktab(mdrsp->driver_unit); break; #endif #if NI4BISPPP > 0 case BDRV_ISPPP: dlt = i4bisppp_ret_linktab(mdrsp->driver_unit); break; #endif #if NI4BTEL > 0 case BDRV_TEL: dlt = tel_ret_linktab(mdrsp->driver_unit); break; #endif #if NIBC > 0 case BDRV_IBC: dlt = ibc_ret_linktab(mdrsp->driver_unit); break; #endif #if NI4BING > 0 case BDRV_ING: dlt = ing_ret_linktab(mdrsp->driver_unit); break; #endif } if(dlt != NULL) (*dlt->dial_response)(mdrsp->driver_unit, mdrsp->stat, mdrsp->cause); break; } /* update timeout value */ case I4B_TIMEOUT_UPD: { msg_timeout_upd_t *mtu; int x; mtu = (msg_timeout_upd_t *)data; NDBGL4(L4_TIMO, "I4B_TIMEOUT_UPD ioctl, alg %d, unit %d, idle %d, early %d!", mtu->shorthold_data.shorthold_algorithm, mtu->shorthold_data.unitlen_time, mtu->shorthold_data.idle_time, mtu->shorthold_data.earlyhup_time); if((cd = cd_by_cdid(mtu->cdid)) == NULL)/* get cd */ { NDBGL4(L4_ERR, "I4B_TIMEOUT_UPD ioctl, cdid not found!"); error = EINVAL; break; } switch( mtu->shorthold_data.shorthold_algorithm ) { case SHA_FIXU: /* * For this algorithm unitlen_time, * idle_time and earlyhup_time are used. */ if(!(mtu->shorthold_data.unitlen_time >= 0 && mtu->shorthold_data.idle_time >= 0 && mtu->shorthold_data.earlyhup_time >= 0)) { NDBGL4(L4_ERR, "I4B_TIMEOUT_UPD ioctl, invalid args for fix unit algorithm!"); error = EINVAL; } break; case SHA_VARU: /* * For this algorithm unitlen_time and * idle_time are used. both must be * positive integers. earlyhup_time is * not used and must be 0. */ if(!(mtu->shorthold_data.unitlen_time > 0 && mtu->shorthold_data.idle_time >= 0 && mtu->shorthold_data.earlyhup_time == 0)) { NDBGL4(L4_ERR, "I4B_TIMEOUT_UPD ioctl, invalid args for var unit algorithm!"); error = EINVAL; } break; default: NDBGL4(L4_ERR, "I4B_TIMEOUT_UPD ioctl, invalid algorithm!"); error = EINVAL; break; } /* * any error set above requires us to break * out of the outer switch */ if(error != 0) break; x = SPLI4B(); cd->shorthold_data.shorthold_algorithm = mtu->shorthold_data.shorthold_algorithm; cd->shorthold_data.unitlen_time = mtu->shorthold_data.unitlen_time; cd->shorthold_data.idle_time = mtu->shorthold_data.idle_time; cd->shorthold_data.earlyhup_time = mtu->shorthold_data.earlyhup_time; splx(x); break; } /* soft enable/disable interface */ case I4B_UPDOWN_IND: { msg_updown_ind_t *mui; mui = (msg_updown_ind_t *)data; #if NI4BIPR > 0 if(mui->driver == BDRV_IPR) { drvr_link_t *dlt; dlt = ipr_ret_linktab(mui->driver_unit); (*dlt->updown_ind)(mui->driver_unit, mui->updown); } #endif break; } /* send ALERT request */ case I4B_ALERT_REQ: { msg_alert_req_t *mar; mar = (msg_alert_req_t *)data; if((cd = cd_by_cdid(mar->cdid)) == NULL) { NDBGL4(L4_ERR, "I4B_ALERT_REQ ioctl, cdid not found!"); error = EINVAL; break; } T400_stop(cd); (*ctrl_desc[cd->controller].N_ALERT_REQUEST)(mar->cdid); break; } /* version/release number request */ case I4B_VR_REQ: { msg_vr_req_t *mvr; mvr = (msg_vr_req_t *)data; mvr->version = VERSION; mvr->release = REL; mvr->step = STEP; break; } /* set D-channel protocol for a controller */ case I4B_PROT_IND: { msg_prot_ind_t *mpi; mpi = (msg_prot_ind_t *)data; ctrl_desc[mpi->controller].protocol = mpi->protocol; break; } /* Download request */ case I4B_CTRL_DOWNLOAD: { struct isdn_dr_prot *prots = NULL, *prots2 = NULL; struct isdn_download_request *r = (struct isdn_download_request*)data; int i; if (r->controller < 0 || r->controller >= nctrl) { error = ENODEV; goto download_done; } if(!ctrl_desc[r->controller].N_DOWNLOAD) { error = ENODEV; goto download_done; } prots = malloc(r->numprotos * sizeof(struct isdn_dr_prot), M_DEVBUF, M_WAITOK); prots2 = malloc(r->numprotos * sizeof(struct isdn_dr_prot), M_DEVBUF, M_WAITOK); if(!prots || !prots2) { error = ENOMEM; goto download_done; } copyin(r->protocols, prots, r->numprotos * sizeof(struct isdn_dr_prot)); for(i = 0; i < r->numprotos; i++) { prots2[i].microcode = malloc(prots[i].bytecount, M_DEVBUF, M_WAITOK); copyin(prots[i].microcode, prots2[i].microcode, prots[i].bytecount); prots2[i].bytecount = prots[i].bytecount; } error = ctrl_desc[r->controller].N_DOWNLOAD( ctrl_desc[r->controller].unit, r->numprotos, prots2); download_done: if(prots2) { for(i = 0; i < r->numprotos; i++) { if(prots2[i].microcode) { free(prots2[i].microcode, M_DEVBUF); } } free(prots2, M_DEVBUF); } if(prots) { free(prots, M_DEVBUF); } break; } /* Diagnostic request */ case I4B_ACTIVE_DIAGNOSTIC: { struct isdn_diagnostic_request req, *r = (struct isdn_diagnostic_request*)data; req.in_param = req.out_param = NULL; if (r->controller < 0 || r->controller >= nctrl) { error = ENODEV; goto diag_done; } if(!ctrl_desc[r->controller].N_DIAGNOSTICS) { error = ENODEV; goto diag_done; } memcpy(&req, r, sizeof(req)); if(req.in_param_len) { req.in_param = malloc(r->in_param_len, M_DEVBUF, M_WAITOK); if(!req.in_param) { error = ENOMEM; goto diag_done; } error = copyin(r->in_param, req.in_param, req.in_param_len); if (error) goto diag_done; } if(req.out_param_len) { req.out_param = malloc(r->out_param_len, M_DEVBUF, M_WAITOK); if(!req.out_param) { error = ENOMEM; goto diag_done; } } error = ctrl_desc[r->controller].N_DIAGNOSTICS(r->controller, &req); if(!error && req.out_param_len) error = copyout(req.out_param, r->out_param, req.out_param_len); diag_done: if(req.in_param) free(req.in_param, M_DEVBUF); if(req.out_param) free(req.out_param, M_DEVBUF); break; } /* default */ default: error = ENOTTY; break; } return(error); } #ifdef OS_USES_SELECT /*---------------------------------------------------------------------------* * i4bselect - device driver select routine *---------------------------------------------------------------------------*/ PDEVSTATIC int i4bselect(dev_t dev, int rw, struct proc *p) { int x; if(minor(dev)) return(ENODEV); switch(rw) { case FREAD: if(!IF_QEMPTY(&i4b_rdqueue)) return(1); x = splimp(); selrecord(p, &select_rd_info); selflag = 1; splx(x); return(0); break; case FWRITE: return(1); break; } return(0); } #else /* OS_USES_SELECT */ /*---------------------------------------------------------------------------* * i4bpoll - device driver poll routine *---------------------------------------------------------------------------*/ PDEVSTATIC int i4bpoll(dev_t dev, int events, struct proc *p) { int x; if(minor(dev)) return(ENODEV); if((events & POLLIN) || (events & POLLRDNORM)) { if(!IF_QEMPTY(&i4b_rdqueue)) return(1); x = splimp(); selrecord(p, &select_rd_info); selflag = 1; splx(x); return(0); } else if((events & POLLOUT) || (events & POLLWRNORM)) { return(1); } return(0); } #endif /* OS_USES_SELECT */ /*---------------------------------------------------------------------------* * i4bputqueue - put message into queue to userland *---------------------------------------------------------------------------*/ void i4bputqueue(struct mbuf *m) { int x; if(!openflag) { i4b_Dfreembuf(m); return; } x = splimp(); IF_LOCK(&i4b_rdqueue); if(_IF_QFULL(&i4b_rdqueue)) { struct mbuf *m1; _IF_DEQUEUE(&i4b_rdqueue, m1); i4b_Dfreembuf(m1); NDBGL4(L4_ERR, "ERROR, queue full, removing entry!"); } _IF_ENQUEUE(&i4b_rdqueue, m); IF_UNLOCK(&i4b_rdqueue); splx(x); if(readflag) { readflag = 0; wakeup((caddr_t) &i4b_rdqueue); } if(selflag) { selflag = 0; selwakeup(&select_rd_info); } } /*---------------------------------------------------------------------------* * i4bputqueue_hipri - put message into front of queue to userland *---------------------------------------------------------------------------*/ void i4bputqueue_hipri(struct mbuf *m) { int x; if(!openflag) { i4b_Dfreembuf(m); return; } x = splimp(); IF_LOCK(&i4b_rdqueue); if(_IF_QFULL(&i4b_rdqueue)) { struct mbuf *m1; _IF_DEQUEUE(&i4b_rdqueue, m1); i4b_Dfreembuf(m1); NDBGL4(L4_ERR, "ERROR, queue full, removing entry!"); } _IF_PREPEND(&i4b_rdqueue, m); IF_UNLOCK(&i4b_rdqueue); splx(x); if(readflag) { readflag = 0; wakeup((caddr_t) &i4b_rdqueue); } if(selflag) { selflag = 0; selwakeup(&select_rd_info); } } #endif /* NI4B > 0 */ diff --git a/sys/i4b/layer4/i4b_l4.c b/sys/i4b/layer4/i4b_l4.c index 5430c3aa0988..9cb3f26272cd 100644 --- a/sys/i4b/layer4/i4b_l4.c +++ b/sys/i4b/layer4/i4b_l4.c @@ -1,1085 +1,1085 @@ /* * Copyright (c) 1997, 2000 Hellmuth Michaelis. 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. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. * *--------------------------------------------------------------------------- * * i4b_l4.c - kernel interface to userland * ----------------------------------------- * * $Id: i4b_l4.c,v 1.54 2000/08/28 07:24:59 hm Exp $ * * $FreeBSD$ * * last edit-date: [Sun Aug 27 14:53:42 2000] * *---------------------------------------------------------------------------*/ #include "i4b.h" #include "i4bipr.h" #if NI4B > 0 #include #include #include #include #ifdef __NetBSD__ #include #endif #if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000 #include #endif #if defined(__FreeBSD__) #include "i4bing.h" #endif #ifdef __bsdi__ #define NI4BISPPP 0 #include "ibc.h" #else #include "i4bisppp.h" #endif #include "i4brbch.h" #include "i4btel.h" #ifdef __FreeBSD__ #include #include #include #else #include #include #include #endif #include #include #include #include #if !defined(__FreeBSD__) && !defined(__NetBSD__) #define memcpy(dst, src, len) bcopy((src), (dst), (len)) #endif unsigned int i4b_l4_debug = L4_DEBUG_DEFAULT; struct ctrl_type_desc ctrl_types[CTRL_NUMTYPES] = { { NULL, NULL} }; static int i4b_link_bchandrvr(call_desc_t *cd); static void i4b_unlink_bchandrvr(call_desc_t *cd); static void i4b_l4_setup_timeout(call_desc_t *cd); static void i4b_idle_check_fix_unit(call_desc_t *cd); static void i4b_idle_check_var_unit(call_desc_t *cd); static void i4b_l4_setup_timeout_fix_unit(call_desc_t *cd); static void i4b_l4_setup_timeout_var_unit(call_desc_t *cd); static time_t i4b_get_idletime(call_desc_t *cd); #if NI4BISPPP > 0 extern time_t i4bisppp_idletime(int); #endif /*---------------------------------------------------------------------------* * send MSG_PDEACT_IND message to userland *---------------------------------------------------------------------------*/ void i4b_l4_pdeact(int controller, int numactive) { struct mbuf *m; int i; call_desc_t *cd; for(i=0; i < N_CALL_DESC; i++) { if((call_desc[i].cdid != CDID_UNUSED) && (ctrl_desc[call_desc[i].controller].ctrl_type == CTRL_PASSIVE) && (ctrl_desc[call_desc[i].controller].unit == controller)) { cd = &call_desc[i]; if(cd->timeout_active) { STOP_TIMER(cd->idle_timeout_handle, i4b_idle_check, cd); } if(cd->dlt != NULL) { (*cd->dlt->line_disconnected)(cd->driver_unit, (void *)cd); i4b_unlink_bchandrvr(cd); } - if((cd->channelid == CHAN_B1) || (cd->channelid == CHAN_B2)) + if((cd->channelid >= 0) & (cd->channelid < ctrl_desc[cd->controller].nbch)) { ctrl_desc[cd->controller].bch_state[cd->channelid] = BCH_ST_FREE; } cd->cdid = CDID_UNUSED; } } if((m = i4b_Dgetmbuf(sizeof(msg_pdeact_ind_t))) != NULL) { msg_pdeact_ind_t *md = (msg_pdeact_ind_t *)m->m_data; md->header.type = MSG_PDEACT_IND; md->header.cdid = -1; md->controller = controller; md->numactive = numactive; i4bputqueue_hipri(m); /* URGENT !!! */ } } /*---------------------------------------------------------------------------* * send MSG_L12STAT_IND message to userland *---------------------------------------------------------------------------*/ void i4b_l4_l12stat(int controller, int layer, int state) { struct mbuf *m; if((m = i4b_Dgetmbuf(sizeof(msg_l12stat_ind_t))) != NULL) { msg_l12stat_ind_t *md = (msg_l12stat_ind_t *)m->m_data; md->header.type = MSG_L12STAT_IND; md->header.cdid = -1; md->controller = controller; md->layer = layer; md->state = state; i4bputqueue(m); } } /*---------------------------------------------------------------------------* * send MSG_TEIASG_IND message to userland *---------------------------------------------------------------------------*/ void i4b_l4_teiasg(int controller, int tei) { struct mbuf *m; if((m = i4b_Dgetmbuf(sizeof(msg_teiasg_ind_t))) != NULL) { msg_teiasg_ind_t *md = (msg_teiasg_ind_t *)m->m_data; md->header.type = MSG_TEIASG_IND; md->header.cdid = -1; md->controller = controller; md->tei = ctrl_desc[controller].tei; i4bputqueue(m); } } /*---------------------------------------------------------------------------* * send MSG_DIALOUT_IND message to userland *---------------------------------------------------------------------------*/ void i4b_l4_dialout(int driver, int driver_unit) { struct mbuf *m; if((m = i4b_Dgetmbuf(sizeof(msg_dialout_ind_t))) != NULL) { msg_dialout_ind_t *md = (msg_dialout_ind_t *)m->m_data; md->header.type = MSG_DIALOUT_IND; md->header.cdid = -1; md->driver = driver; md->driver_unit = driver_unit; i4bputqueue(m); } } /*---------------------------------------------------------------------------* * send MSG_DIALOUTNUMBER_IND message to userland *---------------------------------------------------------------------------*/ void i4b_l4_dialoutnumber(int driver, int driver_unit, int cmdlen, char *cmd) { struct mbuf *m; if((m = i4b_Dgetmbuf(sizeof(msg_dialoutnumber_ind_t))) != NULL) { msg_dialoutnumber_ind_t *md = (msg_dialoutnumber_ind_t *)m->m_data; md->header.type = MSG_DIALOUTNUMBER_IND; md->header.cdid = -1; md->driver = driver; md->driver_unit = driver_unit; if(cmdlen > TELNO_MAX) cmdlen = TELNO_MAX; md->cmdlen = cmdlen; bcopy(cmd, md->cmd, cmdlen); i4bputqueue(m); } } /*---------------------------------------------------------------------------* * send MSG_NEGOTIATION_COMPL message to userland *---------------------------------------------------------------------------*/ void i4b_l4_negcomplete(call_desc_t *cd) { struct mbuf *m; if((m = i4b_Dgetmbuf(sizeof(msg_negcomplete_ind_t))) != NULL) { msg_negcomplete_ind_t *md = (msg_negcomplete_ind_t *)m->m_data; md->header.type = MSG_NEGCOMP_IND; md->header.cdid = cd->cdid; i4bputqueue(m); } } /*---------------------------------------------------------------------------* * send MSG_IFSTATE_CHANGED_IND message to userland *---------------------------------------------------------------------------*/ void i4b_l4_ifstate_changed(call_desc_t *cd, int new_state) { struct mbuf *m; if((m = i4b_Dgetmbuf(sizeof(msg_ifstatechg_ind_t))) != NULL) { msg_ifstatechg_ind_t *md = (msg_ifstatechg_ind_t *)m->m_data; md->header.type = MSG_IFSTATE_CHANGED_IND; md->header.cdid = cd->cdid; md->state = new_state; i4bputqueue(m); } } /*---------------------------------------------------------------------------* * send MSG_DRVRDISC_REQ message to userland *---------------------------------------------------------------------------*/ void i4b_l4_drvrdisc(int driver, int driver_unit) { struct mbuf *m; if((m = i4b_Dgetmbuf(sizeof(msg_drvrdisc_req_t))) != NULL) { msg_drvrdisc_req_t *md = (msg_drvrdisc_req_t *)m->m_data; md->header.type = MSG_DRVRDISC_REQ; md->header.cdid = -1; md->driver = driver; md->driver_unit = driver_unit; i4bputqueue(m); } } /*---------------------------------------------------------------------------* * send MSG_ACCT_IND message to userland *---------------------------------------------------------------------------*/ void i4b_l4_accounting(int driver, int driver_unit, int accttype, int ioutbytes, int iinbytes, int ro, int ri, int outbytes, int inbytes) { struct mbuf *m; if((m = i4b_Dgetmbuf(sizeof(msg_accounting_ind_t))) != NULL) { msg_accounting_ind_t *md = (msg_accounting_ind_t *)m->m_data; md->header.type = MSG_ACCT_IND; md->header.cdid = -1; md->driver = driver; md->driver_unit = driver_unit; md->accttype = accttype; md->ioutbytes = ioutbytes; md->iinbytes = iinbytes; md->outbps = ro; md->inbps = ri; md->outbytes = outbytes; md->inbytes = inbytes; i4bputqueue(m); } } /*---------------------------------------------------------------------------* * send MSG_CONNECT_IND message to userland *---------------------------------------------------------------------------*/ void i4b_l4_connect_ind(call_desc_t *cd) { struct mbuf *m; if((m = i4b_Dgetmbuf(sizeof(msg_connect_ind_t))) != NULL) { msg_connect_ind_t *mp = (msg_connect_ind_t *)m->m_data; mp->header.type = MSG_CONNECT_IND; mp->header.cdid = cd->cdid; mp->controller = cd->controller; mp->channel = cd->channelid; mp->bprot = cd->bprot; cd->dir = DIR_INCOMING; if(strlen(cd->dst_telno) > 0) strcpy(mp->dst_telno, cd->dst_telno); else strcpy(mp->dst_telno, TELNO_EMPTY); if(strlen(cd->src_telno) > 0) strcpy(mp->src_telno, cd->src_telno); else strcpy(mp->src_telno, TELNO_EMPTY); strcpy(mp->display, cd->display); mp->scr_ind = cd->scr_ind; mp->prs_ind = cd->prs_ind; T400_start(cd); i4bputqueue(m); } } /*---------------------------------------------------------------------------* * send MSG_CONNECT_ACTIVE_IND message to userland *---------------------------------------------------------------------------*/ void i4b_l4_connect_active_ind(call_desc_t *cd) { int s; struct mbuf *m; s = SPLI4B(); cd->last_active_time = cd->connect_time = SECOND; NDBGL4(L4_TIMO, "last_active/connect_time=%ld", (long)cd->connect_time); i4b_link_bchandrvr(cd); (*cd->dlt->line_connected)(cd->driver_unit, (void *)cd); i4b_l4_setup_timeout(cd); splx(s); if((m = i4b_Dgetmbuf(sizeof(msg_connect_active_ind_t))) != NULL) { msg_connect_active_ind_t *mp = (msg_connect_active_ind_t *)m->m_data; mp->header.type = MSG_CONNECT_ACTIVE_IND; mp->header.cdid = cd->cdid; mp->controller = cd->controller; mp->channel = cd->channelid; if(cd->datetime[0] != '\0') strcpy(mp->datetime, cd->datetime); else mp->datetime[0] = '\0'; i4bputqueue(m); } } /*---------------------------------------------------------------------------* * send MSG_DISCONNECT_IND message to userland *---------------------------------------------------------------------------*/ void i4b_l4_disconnect_ind(call_desc_t *cd) { struct mbuf *m; if(cd->timeout_active) STOP_TIMER(cd->idle_timeout_handle, i4b_idle_check, cd); if(cd->dlt != NULL) { (*cd->dlt->line_disconnected)(cd->driver_unit, (void *)cd); i4b_unlink_bchandrvr(cd); } - if((cd->channelid == CHAN_B1) || (cd->channelid == CHAN_B2)) + if((cd->channelid >= 0) && (cd->channelid < ctrl_desc[cd->controller].nbch)) { ctrl_desc[cd->controller].bch_state[cd->channelid] = BCH_ST_FREE; } else { /* no error, might be hunting call for callback */ - NDBGL4(L4_MSG, "channel free not B1/B2 but %d!", cd->channelid); + NDBGL4(L4_MSG, "channel free not valid but %d!", cd->channelid); } if((m = i4b_Dgetmbuf(sizeof(msg_disconnect_ind_t))) != NULL) { msg_disconnect_ind_t *mp = (msg_disconnect_ind_t *)m->m_data; mp->header.type = MSG_DISCONNECT_IND; mp->header.cdid = cd->cdid; mp->cause = cd->cause_in; i4bputqueue(m); } } /*---------------------------------------------------------------------------* * send MSG_IDLE_TIMEOUT_IND message to userland *---------------------------------------------------------------------------*/ void i4b_l4_idle_timeout_ind(call_desc_t *cd) { struct mbuf *m; if((m = i4b_Dgetmbuf(sizeof(msg_idle_timeout_ind_t))) != NULL) { msg_idle_timeout_ind_t *mp = (msg_idle_timeout_ind_t *)m->m_data; mp->header.type = MSG_IDLE_TIMEOUT_IND; mp->header.cdid = cd->cdid; i4bputqueue(m); } } /*---------------------------------------------------------------------------* * send MSG_CHARGING_IND message to userland *---------------------------------------------------------------------------*/ void i4b_l4_charging_ind(call_desc_t *cd) { struct mbuf *m; if((m = i4b_Dgetmbuf(sizeof(msg_charging_ind_t))) != NULL) { msg_charging_ind_t *mp = (msg_charging_ind_t *)m->m_data; mp->header.type = MSG_CHARGING_IND; mp->header.cdid = cd->cdid; mp->units_type = cd->units_type; /*XXX*/ if(mp->units_type == CHARGE_CALC) mp->units = cd->cunits; else mp->units = cd->units; i4bputqueue(m); } } /*---------------------------------------------------------------------------* * send MSG_STATUS_IND message to userland *---------------------------------------------------------------------------*/ void i4b_l4_status_ind(call_desc_t *cd) { } /*---------------------------------------------------------------------------* * send MSG_ALERT_IND message to userland *---------------------------------------------------------------------------*/ void i4b_l4_alert_ind(call_desc_t *cd) { struct mbuf *m; if((m = i4b_Dgetmbuf(sizeof(msg_alert_ind_t))) != NULL) { msg_alert_ind_t *mp = (msg_alert_ind_t *)m->m_data; mp->header.type = MSG_ALERT_IND; mp->header.cdid = cd->cdid; i4bputqueue(m); } } /*---------------------------------------------------------------------------* * send MSG_INFO_IND message to userland *---------------------------------------------------------------------------*/ void i4b_l4_info_ind(call_desc_t *cd) { } /*---------------------------------------------------------------------------* * send MSG_INFO_IND message to userland *---------------------------------------------------------------------------*/ void i4b_l4_proceeding_ind(call_desc_t *cd) { struct mbuf *m; if((m = i4b_Dgetmbuf(sizeof(msg_proceeding_ind_t))) != NULL) { msg_proceeding_ind_t *mp = (msg_proceeding_ind_t *)m->m_data; mp->header.type = MSG_PROCEEDING_IND; mp->header.cdid = cd->cdid; mp->controller = cd->controller; mp->channel = cd->channelid; i4bputqueue(m); } } /*---------------------------------------------------------------------------* * send MSG_PACKET_IND message to userland *---------------------------------------------------------------------------*/ void i4b_l4_packet_ind(int driver, int driver_unit, int dir, struct mbuf *pkt) { struct mbuf *m; int len = pkt->m_pkthdr.len; unsigned char *ip = pkt->m_data; if((m = i4b_Dgetmbuf(sizeof(msg_packet_ind_t))) != NULL) { msg_packet_ind_t *mp = (msg_packet_ind_t *)m->m_data; mp->header.type = MSG_PACKET_IND; mp->header.cdid = -1; mp->driver = driver; mp->driver_unit = driver_unit; mp->direction = dir; memcpy(mp->pktdata, ip, len controller].ctrl_type; if(t < 0 || t >= CTRL_NUMTYPES || ctrl_types[t].get_linktab == NULL) { cd->ilt = NULL; } else { cd->ilt = ctrl_types[t].get_linktab( ctrl_desc[cd->controller].unit, cd->channelid); } switch(cd->driver) { #if NI4BRBCH > 0 case BDRV_RBCH: cd->dlt = rbch_ret_linktab(cd->driver_unit); break; #endif #if NI4BTEL > 0 case BDRV_TEL: cd->dlt = tel_ret_linktab(cd->driver_unit); break; #endif #if NI4BIPR > 0 case BDRV_IPR: cd->dlt = ipr_ret_linktab(cd->driver_unit); break; #endif #if NI4BISPPP > 0 case BDRV_ISPPP: cd->dlt = i4bisppp_ret_linktab(cd->driver_unit); break; #endif #if defined(__bsdi__) && NIBC > 0 case BDRV_IBC: cd->dlt = ibc_ret_linktab(cd->driver_unit); break; #endif #if NI4BING > 0 case BDRV_ING: cd->dlt = ing_ret_linktab(cd->driver_unit); break; #endif default: cd->dlt = NULL; break; } if(cd->dlt == NULL || cd->ilt == NULL) return(-1); if(t >= 0 && t < CTRL_NUMTYPES && ctrl_types[t].set_linktab != NULL) { ctrl_types[t].set_linktab( ctrl_desc[cd->controller].unit, cd->channelid, cd->dlt); } switch(cd->driver) { #if NI4BRBCH > 0 case BDRV_RBCH: rbch_set_linktab(cd->driver_unit, cd->ilt); break; #endif #if NI4BTEL > 0 case BDRV_TEL: tel_set_linktab(cd->driver_unit, cd->ilt); break; #endif #if NI4BIPR > 0 case BDRV_IPR: ipr_set_linktab(cd->driver_unit, cd->ilt); break; #endif #if NI4BISPPP > 0 case BDRV_ISPPP: i4bisppp_set_linktab(cd->driver_unit, cd->ilt); break; #endif #if defined(__bsdi__) && NIBC > 0 case BDRV_IBC: ibc_set_linktab(cd->driver_unit, cd->ilt); break; #endif #if NI4BING > 0 case BDRV_ING: ing_set_linktab(cd->driver_unit, cd->ilt); break; #endif default: return(0); break; } /* activate B channel */ (*cd->ilt->bch_config)(cd->ilt->unit, cd->ilt->channel, cd->bprot, 1); return(0); } /*---------------------------------------------------------------------------* * unlink a driver(unit) from a B-channel(controller,unit,channel) *---------------------------------------------------------------------------*/ static void i4b_unlink_bchandrvr(call_desc_t *cd) { int t = ctrl_desc[cd->controller].ctrl_type; if(t < 0 || t >= CTRL_NUMTYPES || ctrl_types[t].get_linktab == NULL) { cd->ilt = NULL; return; } else { cd->ilt = ctrl_types[t].get_linktab( ctrl_desc[cd->controller].unit, cd->channelid); } /* deactivate B channel */ (*cd->ilt->bch_config)(cd->ilt->unit, cd->ilt->channel, cd->bprot, 0); } /*--------------------------------------------------------------------------- How shorthold mode works for OUTGOING connections ================================================= |<---- unchecked-window ------->|<-checkwindow->|<-safetywindow>| idletime_state: IST_NONCHK IST_CHECK IST_SAFE | | | | time>>+-------------------------------+---------------+---------------+-... | | | | | |<--idle_time-->|<--earlyhup--->| |<-----------------------unitlen------------------------------->| unitlen - specifies the time a charging unit lasts idle_time - specifies the thime the line must be idle at the end of the unit to be elected for hangup earlyhup - is the beginning of a timing safety zone before the next charging unit starts The algorithm works as follows: lets assume the unitlen is 100 secons, idle_time is 40 seconds and earlyhup is 10 seconds. The line then must be idle 50 seconds after the begin of the current unit and it must then be quiet for 40 seconds. if it has been quiet for this 40 seconds, the line is closed 10 seconds before the next charging unit starts. In case there was any traffic within the idle_time, the line is not closed. It does not matter whether there was any traffic between second 0 and second 50 or not. How shorthold mode works for INCOMING connections ================================================= it is just possible to specify a maximum idle time for incoming connections, after this time of no activity on the line the line is closed. ---------------------------------------------------------------------------*/ static time_t i4b_get_idletime(call_desc_t *cd) { switch (cd->driver) { #if NI4BISPPP > 0 case BDRV_ISPPP: return i4bisppp_idletime(cd->driver_unit); break; #endif default: return cd->last_active_time; break; } } /*---------------------------------------------------------------------------* * B channel idle check timeout setup *---------------------------------------------------------------------------*/ static void i4b_l4_setup_timeout(call_desc_t *cd) { NDBGL4(L4_TIMO, "%ld: direction %d, shorthold algorithm %d", (long)SECOND, cd->dir, cd->shorthold_data.shorthold_algorithm); cd->timeout_active = 0; cd->idletime_state = IST_IDLE; if((cd->dir == DIR_INCOMING) && (cd->max_idle_time > 0)) { /* incoming call: simple max idletime check */ START_TIMER(cd->idle_timeout_handle, i4b_idle_check, cd, hz/2); cd->timeout_active = 1; NDBGL4(L4_TIMO, "%ld: incoming-call, setup max_idle_time to %ld", (long)SECOND, (long)cd->max_idle_time); } else if((cd->dir == DIR_OUTGOING) && (cd->shorthold_data.idle_time > 0)) { switch( cd->shorthold_data.shorthold_algorithm ) { default: /* fall into the old fix algorithm */ case SHA_FIXU: i4b_l4_setup_timeout_fix_unit( cd ); break; case SHA_VARU: i4b_l4_setup_timeout_var_unit( cd ); break; } } else { NDBGL4(L4_TIMO, "no idle_timeout configured"); } } /*---------------------------------------------------------------------------* * fixed unit algorithm B channel idle check timeout setup *---------------------------------------------------------------------------*/ static void i4b_l4_setup_timeout_fix_unit(call_desc_t *cd) { /* outgoing call */ if((cd->shorthold_data.idle_time > 0) && (cd->shorthold_data.unitlen_time == 0)) { /* outgoing call: simple max idletime check */ START_TIMER(cd->idle_timeout_handle, i4b_idle_check, cd, hz/2); cd->timeout_active = 1; NDBGL4(L4_TIMO, "%ld: outgoing-call, setup idle_time to %ld", (long)SECOND, (long)cd->shorthold_data.idle_time); } else if((cd->shorthold_data.unitlen_time > 0) && (cd->shorthold_data.unitlen_time > (cd->shorthold_data.idle_time + cd->shorthold_data.earlyhup_time))) { /* outgoing call: full shorthold mode check */ START_TIMER(cd->idle_timeout_handle, i4b_idle_check, cd, hz*(cd->shorthold_data.unitlen_time - (cd->shorthold_data.idle_time + cd->shorthold_data.earlyhup_time))); cd->timeout_active = 1; cd->idletime_state = IST_NONCHK; NDBGL4(L4_TIMO, "%ld: outgoing-call, start %ld sec nocheck window", (long)SECOND, (long)(cd->shorthold_data.unitlen_time - (cd->shorthold_data.idle_time + cd->shorthold_data.earlyhup_time))); if(cd->aocd_flag == 0) { cd->units_type = CHARGE_CALC; cd->cunits++; i4b_l4_charging_ind(cd); } } else { /* parms somehow got wrong .. */ NDBGL4(L4_ERR, "%ld: ERROR: idletime[%ld]+earlyhup[%ld] > unitlength[%ld]!", (long)SECOND, (long)cd->shorthold_data.idle_time, (long)cd->shorthold_data.earlyhup_time, (long)cd->shorthold_data.unitlen_time); } } /*---------------------------------------------------------------------------* * variable unit algorithm B channel idle check timeout setup *---------------------------------------------------------------------------*/ static void i4b_l4_setup_timeout_var_unit(call_desc_t *cd) { /* outgoing call: variable unit idletime check */ /* * start checking for an idle connect one second before the end of the unit. * The one second takes into account of rounding due to the driver only * using the seconds and not the uSeconds of the current time */ cd->idletime_state = IST_CHECK; /* move directly to the checking state */ START_TIMER(cd->idle_timeout_handle, i4b_idle_check, cd, hz * (cd->shorthold_data.unitlen_time - 1) ); cd->timeout_active = 1; NDBGL4(L4_TIMO, "%ld: outgoing-call, var idle time - setup to %ld", (long)SECOND, (long)cd->shorthold_data.unitlen_time); } /*---------------------------------------------------------------------------* * B channel idle check timeout function *---------------------------------------------------------------------------*/ void i4b_idle_check(call_desc_t *cd) { int s; if(cd->cdid == CDID_UNUSED) return; s = SPLI4B(); /* failsafe */ if(cd->timeout_active == 0) { NDBGL4(L4_ERR, "ERROR: timeout_active == 0 !!!"); } else { cd->timeout_active = 0; } /* incoming connections, simple idletime check */ if(cd->dir == DIR_INCOMING) { if((i4b_get_idletime(cd) + cd->max_idle_time) <= SECOND) { NDBGL4(L4_TIMO, "%ld: incoming-call, line idle timeout, disconnecting!", (long)SECOND); (*ctrl_desc[cd->controller].N_DISCONNECT_REQUEST)(cd->cdid, (CAUSET_I4B << 8) | CAUSE_I4B_NORMAL); i4b_l4_idle_timeout_ind(cd); } else { NDBGL4(L4_TIMO, "%ld: incoming-call, activity, last_active=%ld, max_idle=%ld", (long)SECOND, (long)i4b_get_idletime(cd), (long)cd->max_idle_time); START_TIMER(cd->idle_timeout_handle, i4b_idle_check, cd, hz/2); cd->timeout_active = 1; } } /* outgoing connections */ else if(cd->dir == DIR_OUTGOING) { switch( cd->shorthold_data.shorthold_algorithm ) { case SHA_FIXU: i4b_idle_check_fix_unit( cd ); break; case SHA_VARU: i4b_idle_check_var_unit( cd ); break; default: NDBGL4(L4_TIMO, "%ld: bad value for shorthold_algorithm of %d", (long)SECOND, cd->shorthold_data.shorthold_algorithm); i4b_idle_check_fix_unit( cd ); break; } } splx(s); } /*---------------------------------------------------------------------------* * fixed unit algorithm B channel idle check timeout function *---------------------------------------------------------------------------*/ static void i4b_idle_check_fix_unit(call_desc_t *cd) { /* simple idletime calculation */ if((cd->shorthold_data.idle_time > 0) && (cd->shorthold_data.unitlen_time == 0)) { if((i4b_get_idletime(cd) + cd->shorthold_data.idle_time) <= SECOND) { NDBGL4(L4_TIMO, "%ld: outgoing-call-st, idle timeout, disconnecting!", (long)SECOND); (*ctrl_desc[cd->controller].N_DISCONNECT_REQUEST)(cd->cdid, (CAUSET_I4B << 8) | CAUSE_I4B_NORMAL); i4b_l4_idle_timeout_ind(cd); } else { NDBGL4(L4_TIMO, "%ld: outgoing-call-st, activity, last_active=%ld, max_idle=%ld", (long)SECOND, (long)i4b_get_idletime(cd), (long)cd->shorthold_data.idle_time); START_TIMER(cd->idle_timeout_handle, i4b_idle_check, cd, hz/2); cd->timeout_active = 1; } } /* full shorthold mode calculation */ else if((cd->shorthold_data.unitlen_time > 0) && (cd->shorthold_data.unitlen_time > (cd->shorthold_data.idle_time + cd->shorthold_data.earlyhup_time))) { switch(cd->idletime_state) { case IST_NONCHK: /* end of non-check time */ START_TIMER(cd->idle_timeout_handle, i4b_idle_check, cd, hz*(cd->shorthold_data.idle_time)); cd->idletimechk_start = SECOND; cd->idletime_state = IST_CHECK; cd->timeout_active = 1; NDBGL4(L4_TIMO, "%ld: outgoing-call, idletime check window reached!", (long)SECOND); break; case IST_CHECK: /* end of idletime chk */ if((i4b_get_idletime(cd) > cd->idletimechk_start) && (i4b_get_idletime(cd) <= SECOND)) { /* activity detected */ START_TIMER(cd->idle_timeout_handle, i4b_idle_check, cd, hz*(cd->shorthold_data.earlyhup_time)); cd->timeout_active = 1; cd->idletime_state = IST_SAFE; NDBGL4(L4_TIMO, "%ld: outgoing-call, activity at %ld, wait earlyhup-end", (long)SECOND, (long)i4b_get_idletime(cd)); } else { /* no activity, hangup */ NDBGL4(L4_TIMO, "%ld: outgoing-call, idle timeout, last activity at %ld", (long)SECOND, (long)i4b_get_idletime(cd)); (*ctrl_desc[cd->controller].N_DISCONNECT_REQUEST)(cd->cdid, (CAUSET_I4B << 8) | CAUSE_I4B_NORMAL); i4b_l4_idle_timeout_ind(cd); cd->idletime_state = IST_IDLE; } break; case IST_SAFE: /* end of earlyhup time */ START_TIMER(cd->idle_timeout_handle, i4b_idle_check, cd, hz*(cd->shorthold_data.unitlen_time - (cd->shorthold_data.idle_time+cd->shorthold_data.earlyhup_time))); cd->timeout_active = 1; cd->idletime_state = IST_NONCHK; if(cd->aocd_flag == 0) { cd->units_type = CHARGE_CALC; cd->cunits++; i4b_l4_charging_ind(cd); } NDBGL4(L4_TIMO, "%ld: outgoing-call, earlyhup end, wait for idletime start", (long)SECOND); break; default: NDBGL4(L4_ERR, "outgoing-call: invalid idletime_state value!"); cd->idletime_state = IST_IDLE; break; } } } /*---------------------------------------------------------------------------* * variable unit algorithm B channel idle check timeout function *---------------------------------------------------------------------------*/ static void i4b_idle_check_var_unit(call_desc_t *cd) { switch(cd->idletime_state) { /* see if there has been any activity within the last idle_time seconds */ case IST_CHECK: if( i4b_get_idletime(cd) > (SECOND - cd->shorthold_data.idle_time)) { /* activity detected */ #if defined(__FreeBSD_version) && __FreeBSD_version >= 300001 cd->idle_timeout_handle = #endif /* check again in one second */ START_TIMER(cd->idle_timeout_handle, i4b_idle_check, cd, hz); cd->timeout_active = 1; cd->idletime_state = IST_CHECK; NDBGL4(L4_TIMO, "%ld: outgoing-call, var idle timeout - activity at %ld, continuing", (long)SECOND, (long)i4b_get_idletime(cd)); } else { /* no activity, hangup */ NDBGL4(L4_TIMO, "%ld: outgoing-call, var idle timeout - last activity at %ld", (long)SECOND, (long)i4b_get_idletime(cd)); (*ctrl_desc[cd->controller].N_DISCONNECT_REQUEST)(cd->cdid, (CAUSET_I4B << 8) | CAUSE_I4B_NORMAL); i4b_l4_idle_timeout_ind(cd); cd->idletime_state = IST_IDLE; } break; default: NDBGL4(L4_ERR, "outgoing-call: var idle timeout invalid idletime_state value!"); cd->idletime_state = IST_IDLE; break; } } #endif /* NI4B > 0 */ diff --git a/usr.sbin/i4b/isdnd/config.h b/usr.sbin/i4b/isdnd/config.h index 4a7aa8c2b650..a4b05f171bc8 100644 --- a/usr.sbin/i4b/isdnd/config.h +++ b/usr.sbin/i4b/isdnd/config.h @@ -1,63 +1,61 @@ /* - * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved. + * Copyright (c) 1997, 2001 Hellmuth Michaelis. 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. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. * *--------------------------------------------------------------------------- * * i4b daemon - compile time configuration header file * --------------------------------------------------- * - * $Id: config.h,v 1.8 1999/12/13 21:25:24 hm Exp $ - * * $FreeBSD$ * - * last edit-date: [Mon Dec 13 21:45:27 1999] + * last edit-date: [Mon May 21 11:21:15 2001] * *---------------------------------------------------------------------------*/ #ifndef _CONFIG_H_ #define _CONFIG_H_ /* general values */ #define UMASK 022 /* file creation perm mask */ -#define CFG_ENTRY_MAX 32 /* max no of config entries */ +#define CFG_ENTRY_MAX 60 /* max no of config entries */ #define ISDN_CTRL_MAX 4 /* max no of controllers */ #define MAX_RE 8 /* max regular expression entries */ /* monitor max values */ #define MAX_MHOSTS 8 /* max allowed monitor hosts */ /* timouts */ #define TIMEOUT_CONNECT_ACTIVE 30 /* seconds to wait for MSG_CONN_ACT */ /* utility programs forked */ #define REGPROG_DEF "program" /* default program to use for regexpr */ #define ANSWERPROG_DEF "answer" /* default telephone answer program */ #endif /* _CONFIG_H_ */ /* EOF */ diff --git a/usr.sbin/i4b/isdnd/controller.c b/usr.sbin/i4b/isdnd/controller.c index 9c4fe9e09d28..95f5c90266af 100644 --- a/usr.sbin/i4b/isdnd/controller.c +++ b/usr.sbin/i4b/isdnd/controller.c @@ -1,512 +1,523 @@ /* * Copyright (c) 1997, 2001 Hellmuth Michaelis. 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. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. * *--------------------------------------------------------------------------- * * i4b daemon - controller state support routines * ---------------------------------------------- * * $FreeBSD$ * - * last edit-date: [Fri Jan 26 14:00:10 2001] + * last edit-date: [Sun May 20 10:03:53 2001] * *---------------------------------------------------------------------------*/ +#include +#include + #include "isdnd.h" static int -init_controller_state(int controller, int ctrl_type, int card_type, int tei); +init_controller_state(int controller, int ctrl_type, int card_type, int tei, int nbch); /*---------------------------------------------------------------------------* * get name of a controller *---------------------------------------------------------------------------*/ const char * name_of_controller(int ctrl_type, int card_type) { static char *passive_card[] = { "Teles S0/8", "Teles S0/16", "Teles S0/16.3", "AVM A1 or Fritz!Card", "Teles S0/16.3 PnP", "Creatix S0 PnP", "USRobotics Sportster ISDN TA", "Dr. Neuhaus NICCY Go@", "Sedlbauer win speed", "Dynalink IS64PH", "ISDN Master, MasterII or Blaster", "AVM PCMCIA Fritz!Card", "ELSA QuickStep 1000pro/ISA", "ELSA QuickStep 1000pro/PCI", "Siemens I-Talk", "ELSA MicroLink ISDN/MC", "ELSA MicroLink MCall", "ITK ix1 micro", "AVM Fritz!Card PCI", "ELSA PCC-16", "AVM Fritz!Card PnP", "Siemens I-Surf 2.0 PnP", "Asuscom ISDNlink 128K PnP", "ASUSCOM P-IN100-ST-D (Winbond W6692)", "Teles S0/16.3c PnP", "AcerISDN P10 PnP", "TELEINT ISDN SPEED No. 1", "Cologne Chip HFC-S PCI based", "Traverse Tech NETjet-S / Teles PCI-TJ", "Eicon.Diehl DIVA 2.0 / 2.02 ISA PnP", }; static char *daic_card[] = { "EICON.Diehl S", "EICON.Diehl SX/SXn", "EICON.Diehl SCOM", "EICON.Diehl QUADRO", }; + static char *capi_card[] = { + "AVM T1 PCI", + "AVM B1 PCI", + "AVM B1 ISA", + }; + if(ctrl_type == CTRL_PASSIVE) { int index = card_type - CARD_TYPEP_8; if (index >= 0 && index < (sizeof passive_card / sizeof passive_card[0])) return passive_card[index]; } else if(ctrl_type == CTRL_DAIC) { int index = card_type - CARD_TYPEA_DAIC_S; if (index >= 0 && index < (sizeof daic_card / sizeof daic_card[0] )) return daic_card[index]; } else if(ctrl_type == CTRL_TINADD) { return "Stollmann tina-dd"; } + else if(ctrl_type == CTRL_CAPI) + { + int index = card_type - CARD_TYPEC_AVM_T1_PCI; + if (index >= 0 && index < (sizeof capi_card / sizeof capi_card[0] )) + return capi_card[index]; + } return "unknown card type"; } /*---------------------------------------------------------------------------* * init controller state array *---------------------------------------------------------------------------*/ void init_controller(void) { int i; int max = 1; msg_ctrl_info_req_t mcir; for(i=0; i < max; i++) { mcir.controller = i; if((ioctl(isdnfd, I4B_CTRL_INFO_REQ, &mcir)) < 0) { log(LL_ERR, "init_controller: ioctl I4B_CTRL_INFO_REQ failed: %s", strerror(errno)); do_exit(1); } if((ncontroller = max = mcir.ncontroller) == 0) { log(LL_ERR, "init_controller: no ISDN controller found!"); do_exit(1); } if(mcir.ctrl_type == -1 || mcir.card_type == -1) { log(LL_ERR, "init_controller: ctrl/card is invalid!"); do_exit(1); } /* init controller tab */ - if((init_controller_state(i, mcir.ctrl_type, mcir.card_type, mcir.tei)) == ERROR) + if((init_controller_state(i, mcir.ctrl_type, mcir.card_type, mcir.tei, mcir.nbch)) == ERROR) { log(LL_ERR, "init_controller: init_controller_state for controller %d failed", i); do_exit(1); } } DBGL(DL_RCCF, (log(LL_DBG, "init_controller: found %d ISDN controller(s)", max))); } /*--------------------------------------------------------------------------* * init controller state table entry *--------------------------------------------------------------------------*/ static int -init_controller_state(int controller, int ctrl_type, int card_type, int tei) +init_controller_state(int controller, int ctrl_type, int card_type, int tei, + int nbch) { + int i; + if((controller < 0) || (controller >= ncontroller)) { log(LL_ERR, "init_controller_state: invalid controller number [%d]!", controller); return(ERROR); } /* init controller tab */ - if(ctrl_type == CTRL_PASSIVE) - { + switch (ctrl_type) { + case CTRL_PASSIVE: if((card_type > CARD_TYPEP_UNK) && (card_type <= CARD_TYPEP_MAX)) { isdn_ctrl_tab[controller].ctrl_type = ctrl_type; isdn_ctrl_tab[controller].card_type = card_type; isdn_ctrl_tab[controller].state = CTRL_UP; - isdn_ctrl_tab[controller].stateb1 = CHAN_IDLE; - isdn_ctrl_tab[controller].stateb2 = CHAN_IDLE; - isdn_ctrl_tab[controller].freechans = MAX_CHANCTRL; - isdn_ctrl_tab[controller].tei = tei; - isdn_ctrl_tab[controller].l1stat = LAYER_IDLE; - isdn_ctrl_tab[controller].l2stat = LAYER_IDLE; - DBGL(DL_RCCF, (log(LL_DBG, "init_controller_state: controller %d is %s", - controller, - name_of_controller(isdn_ctrl_tab[controller].ctrl_type, - isdn_ctrl_tab[controller].card_type)))); } else { log(LL_ERR, "init_controller_state: unknown card type %d", card_type); return(ERROR); } + break; - } - else if(ctrl_type == CTRL_DAIC) - { + case CTRL_DAIC: isdn_ctrl_tab[controller].ctrl_type = ctrl_type; isdn_ctrl_tab[controller].card_type = card_type; isdn_ctrl_tab[controller].state = CTRL_DOWN; - isdn_ctrl_tab[controller].stateb1 = CHAN_IDLE; - isdn_ctrl_tab[controller].stateb2 = CHAN_IDLE; - isdn_ctrl_tab[controller].freechans = MAX_CHANCTRL; - isdn_ctrl_tab[controller].tei = tei; - isdn_ctrl_tab[controller].l1stat = LAYER_IDLE; - isdn_ctrl_tab[controller].l2stat = LAYER_IDLE; + break; - log(LL_DMN, "init_controller_state: controller %d is %s", - controller, - name_of_controller(isdn_ctrl_tab[controller].ctrl_type, - isdn_ctrl_tab[controller].card_type)); - } - else if(ctrl_type == CTRL_TINADD) - { + case CTRL_TINADD: isdn_ctrl_tab[controller].ctrl_type = ctrl_type; isdn_ctrl_tab[controller].card_type = 0; isdn_ctrl_tab[controller].state = CTRL_DOWN; - isdn_ctrl_tab[controller].stateb1 = CHAN_IDLE; - isdn_ctrl_tab[controller].stateb2 = CHAN_IDLE; - isdn_ctrl_tab[controller].freechans = MAX_CHANCTRL; + break; + + case CTRL_CAPI: + isdn_ctrl_tab[controller].ctrl_type = ctrl_type; + isdn_ctrl_tab[controller].card_type = card_type; + isdn_ctrl_tab[controller].state = CTRL_UP; + break; + + default: + log(LL_ERR, "init_controller_state: unknown controller type %d", ctrl_type); + return(ERROR); + } + + isdn_ctrl_tab[controller].nbch = nbch; + isdn_ctrl_tab[controller].freechans = nbch; + for (i = 0; i < nbch; i++) + isdn_ctrl_tab[controller].stateb[i] = CHAN_IDLE; isdn_ctrl_tab[controller].tei = tei; isdn_ctrl_tab[controller].l1stat = LAYER_IDLE; isdn_ctrl_tab[controller].l2stat = LAYER_IDLE; log(LL_DMN, "init_controller_state: controller %d is %s", controller, name_of_controller(isdn_ctrl_tab[controller].ctrl_type, isdn_ctrl_tab[controller].card_type)); - } - else - { - log(LL_ERR, "init_controller_state: unknown controller type %d", ctrl_type); - return(ERROR); - } return(GOOD); } /*--------------------------------------------------------------------------* - * init active controller + * init active or capi controller *--------------------------------------------------------------------------*/ void init_active_controller(void) { int ret; int unit = 0; int controller; char cmdbuf[MAXPATHLEN+128]; for(controller = 0; controller < ncontroller; controller++) { if(isdn_ctrl_tab[controller].ctrl_type == CTRL_TINADD) { DBGL(DL_RCCF, (log(LL_DBG, "init_active_controller, tina-dd %d: executing [%s %d]", unit, tinainitprog, unit))); snprintf(cmdbuf, sizeof(cmdbuf), "%s %d", tinainitprog, unit); if((ret = system(cmdbuf)) != 0) { log(LL_ERR, "init_active_controller, tina-dd %d: %s returned %d!", unit, tinainitprog, ret); do_exit(1); } } + + /* + * Generic microcode loading. If a controller has + * defined a microcode file, load it using the + * I4B_CTRL_DOWNLOAD ioctl. + */ + + if(isdn_ctrl_tab[controller].firmware != NULL) + { + int fd, ret; + struct isdn_dr_prot idp; + struct isdn_download_request idr; + + fd = open(isdn_ctrl_tab[controller].firmware, O_RDONLY); + if (fd < 0) { + log(LL_ERR, "init_active_controller %d: open %s: %s!", + controller, isdn_ctrl_tab[controller].firmware, + strerror(errno)); + do_exit(1); + } + + idp.bytecount = lseek(fd, 0, SEEK_END); + idp.microcode = mmap(0, idp.bytecount, PROT_READ, + MAP_SHARED, fd, 0); + if (idp.microcode == MAP_FAILED) { + log(LL_ERR, "init_active_controller %d: mmap %s: %s!", + controller, isdn_ctrl_tab[controller].firmware, + strerror(errno)); + do_exit(1); + } + + DBGL(DL_RCCF, (log(LL_DBG, "init_active_controller %d: loading firmware from [%s]", controller, isdn_ctrl_tab[controller].firmware))); + + idr.controller = controller; + idr.numprotos = 1; + idr.protocols = &idp; + + ret = ioctl(isdnfd, I4B_CTRL_DOWNLOAD, &idr, sizeof(idr)); + if (ret) { + log(LL_ERR, "init_active_controller %d: load %s: %s!", + controller, isdn_ctrl_tab[controller].firmware, + strerror(errno)); + do_exit(1); + } + + munmap(idp.microcode, idp.bytecount); + close(fd); + } } } /*--------------------------------------------------------------------------* * init controller D-channel ISDN protocol *--------------------------------------------------------------------------*/ void init_controller_protocol(void) { int controller; msg_prot_ind_t mpi; for(controller = 0; controller < ncontroller; controller++) { mpi.controller = controller; mpi.protocol = isdn_ctrl_tab[controller].protocol; if((ioctl(isdnfd, I4B_PROT_IND, &mpi)) < 0) { log(LL_ERR, "init_controller_protocol: ioctl I4B_PROT_IND failed: %s", strerror(errno)); do_exit(1); } } } /*--------------------------------------------------------------------------* * set controller state to UP/DOWN *--------------------------------------------------------------------------*/ int set_controller_state(int controller, int state) { if((controller < 0) || (controller >= ncontroller)) { log(LL_ERR, "set_controller_state: invalid controller number [%d]!", controller); return(ERROR); } if(state == CTRL_UP) { isdn_ctrl_tab[controller].state = CTRL_UP; DBGL(DL_CNST, (log(LL_DBG, "set_controller_state: controller [%d] set UP!", controller))); } else if (state == CTRL_DOWN) { isdn_ctrl_tab[controller].state = CTRL_DOWN; DBGL(DL_CNST, (log(LL_DBG, "set_controller_state: controller [%d] set DOWN!", controller))); } else { log(LL_ERR, "set_controller_state: invalid controller state [%d]!", state); return(ERROR); } return(GOOD); } /*--------------------------------------------------------------------------* * get controller state *--------------------------------------------------------------------------*/ int get_controller_state(int controller) { if((controller < 0) || (controller >= ncontroller)) { log(LL_ERR, "set_controller_state: invalid controller number [%d]!", controller); return(ERROR); } return(isdn_ctrl_tab[controller].state); } /*--------------------------------------------------------------------------* * decrement number of free channels for controller *--------------------------------------------------------------------------*/ int decr_free_channels(int controller) { if((controller < 0) || (controller >= ncontroller)) { log(LL_ERR, "decr_free_channels: invalid controller number [%d]!", controller); return(ERROR); } if(isdn_ctrl_tab[controller].freechans > 0) { (isdn_ctrl_tab[controller].freechans)--; DBGL(DL_CNST, (log(LL_DBG, "decr_free_channels: ctrl %d, now %d chan free", controller, isdn_ctrl_tab[controller].freechans))); return(GOOD); } else { log(LL_ERR, "decr_free_channels: controller [%d] already 0 free chans!", controller); return(ERROR); } } /*--------------------------------------------------------------------------* * increment number of free channels for controller *--------------------------------------------------------------------------*/ int incr_free_channels(int controller) { if((controller < 0) || (controller >= ncontroller)) { log(LL_ERR, "incr_free_channels: invalid controller number [%d]!", controller); return(ERROR); } - if(isdn_ctrl_tab[controller].freechans < MAX_CHANCTRL) + if(isdn_ctrl_tab[controller].freechans < isdn_ctrl_tab[controller].nbch) { (isdn_ctrl_tab[controller].freechans)++; DBGL(DL_CNST, (log(LL_DBG, "incr_free_channels: ctrl %d, now %d chan free", controller, isdn_ctrl_tab[controller].freechans))); return(GOOD); } else { - log(LL_ERR, "incr_free_channels: controller [%d] already 2 free chans!", controller); + log(LL_ERR, "incr_free_channels: controller [%d] already %d free chans!", controller, isdn_ctrl_tab[controller].nbch); return(ERROR); } } /*--------------------------------------------------------------------------* * get number of free channels for controller *--------------------------------------------------------------------------*/ int get_free_channels(int controller) { if((controller < 0) || (controller >= ncontroller)) { log(LL_ERR, "get_free_channels: invalid controller number [%d]!", controller); return(ERROR); } DBGL(DL_CNST, (log(LL_DBG, "get_free_channels: ctrl %d, %d chan free", controller, isdn_ctrl_tab[controller].freechans))); return(isdn_ctrl_tab[controller].freechans); } /*--------------------------------------------------------------------------* * set channel state to busy *--------------------------------------------------------------------------*/ int set_channel_busy(int controller, int channel) { if((controller < 0) || (controller >= ncontroller)) { log(LL_ERR, "set_channel_busy: invalid controller number [%d]!", controller); return(ERROR); } - switch(channel) - { - case CHAN_B1: - if(isdn_ctrl_tab[controller].stateb1 == CHAN_RUN) + if ((channel < 0) || (channel >= isdn_ctrl_tab[controller].nbch)) { - DBGL(DL_CNST, (log(LL_DBG, "set_channel_busy: controller [%d] channel B1 already busy!", controller))); - } - else - { - isdn_ctrl_tab[controller].stateb1 = CHAN_RUN; - DBGL(DL_CNST, (log(LL_DBG, "set_channel_busy: controller [%d] channel B1 set to BUSY!", controller))); + log(LL_ERR, "set_channel_busy: controller [%d] invalid channel [%d]!", controller, channel); + return(ERROR); } - break; - case CHAN_B2: - if(isdn_ctrl_tab[controller].stateb2 == CHAN_RUN) + if(isdn_ctrl_tab[controller].stateb[channel] == CHAN_RUN) { - DBGL(DL_CNST, (log(LL_DBG, "set_channel_busy: controller [%d] channel B2 already busy!", controller))); + DBGL(DL_CNST, (log(LL_DBG, "set_channel_busy: controller [%d] channel B%d already busy!", controller, channel+1))); } else { - isdn_ctrl_tab[controller].stateb2 = CHAN_RUN; - DBGL(DL_CNST, (log(LL_DBG, "set_channel_busy: controller [%d] channel B2 set to BUSY!", controller))); - } - break; - - default: - log(LL_ERR, "set_channel_busy: controller [%d], invalid channel [%d]!", controller, channel); - return(ERROR); - break; + isdn_ctrl_tab[controller].stateb[channel] = CHAN_RUN; + DBGL(DL_CNST, (log(LL_DBG, "set_channel_busy: controller [%d] channel B%d set to BUSY!", controller, channel+1))); } return(GOOD); } /*--------------------------------------------------------------------------* * set channel state to idle *--------------------------------------------------------------------------*/ int set_channel_idle(int controller, int channel) { if((controller < 0) || (controller >= ncontroller)) { log(LL_ERR, "set_channel_idle: invalid controller number [%d]!", controller); return(ERROR); } - switch(channel) - { - case CHAN_B1: - if(isdn_ctrl_tab[controller].stateb1 == CHAN_IDLE) - { - DBGL(DL_CNST, (log(LL_DBG, "set_channel_idle: controller [%d] channel B1 already idle!", controller))); - } - else + if ((channel < 0) || (channel >= isdn_ctrl_tab[controller].nbch)) { - isdn_ctrl_tab[controller].stateb1 = CHAN_IDLE; - DBGL(DL_CNST, (log(LL_DBG, "set_channel_idle: controller [%d] channel B1 set to IDLE!", controller))); + log(LL_ERR, "set_channel_busy: controller [%d] invalid channel [%d]!", controller, channel); + return(ERROR); } - break; - case CHAN_B2: - if(isdn_ctrl_tab[controller].stateb2 == CHAN_IDLE) + if (isdn_ctrl_tab[controller].stateb[channel] == CHAN_IDLE) { - DBGL(DL_CNST, (log(LL_DBG, "set_channel_idle: controller [%d] channel B2 already idle!", controller))); + DBGL(DL_CNST, (log(LL_DBG, "set_channel_idle: controller [%d] channel B%d already idle!", controller, channel+1))); } else { - isdn_ctrl_tab[controller].stateb2 = CHAN_IDLE; - DBGL(DL_CNST, (log(LL_DBG, "set_channel_idle: controller [%d] channel B2 set to IDLE!", controller))); - } - break; - - default: - DBGL(DL_CNST, (log(LL_DBG, "set_channel_idle: controller [%d], invalid channel [%d]!", controller, channel))); - return(ERROR); - break; + isdn_ctrl_tab[controller].stateb[channel] = CHAN_IDLE; + DBGL(DL_CNST, (log(LL_DBG, "set_channel_idle: controller [%d] channel B%d set to IDLE!", controller, channel+1))); } return(GOOD); } /*--------------------------------------------------------------------------* * return channel state *--------------------------------------------------------------------------*/ int ret_channel_state(int controller, int channel) { if((controller < 0) || (controller >= ncontroller)) { log(LL_ERR, "ret_channel_state: invalid controller number [%d]!", controller); return(ERROR); } - switch(channel) + if ((channel < 0) || (channel >= isdn_ctrl_tab[controller].nbch)) { - case CHAN_B1: - return(isdn_ctrl_tab[controller].stateb1); - break; - - case CHAN_B2: - return(isdn_ctrl_tab[controller].stateb2); - break; - - default: - log(LL_ERR, "ret_channel_state: controller [%d], invalid channel [%d]!", controller, channel); + log(LL_ERR, "set_channel_busy: controller [%d] invalid channel [%d]!", controller, channel); return(ERROR); - break; } - return(ERROR); + + return(isdn_ctrl_tab[controller].stateb[channel]); } /* EOF */ diff --git a/usr.sbin/i4b/isdnd/isdnd.h b/usr.sbin/i4b/isdnd/isdnd.h index 64abbd96149f..fb88546ab704 100644 --- a/usr.sbin/i4b/isdnd/isdnd.h +++ b/usr.sbin/i4b/isdnd/isdnd.h @@ -1,875 +1,877 @@ /* * Copyright (c) 1997, 2001 Hellmuth Michaelis. 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. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. * *--------------------------------------------------------------------------- * * i4b daemon - main header file * ----------------------------- * * $FreeBSD$ * * last edit-date: [Wed May 2 09:34:44 2001] * *---------------------------------------------------------------------------*/ #ifndef _ISDND_H_ #define _ISDND_H_ #include #include #include #include #include #include #include #include #include #include #include #ifdef USE_CURSES #include #endif #include #include #include #include /* TAILQ_ macros */ #include #include #include #include #include #ifdef USE_RTPRIO #include #endif #include #include #include "config.h" /* compile time configuration */ #include "pathnames.h" /* location of files */ #include "alias.h" /* alias file processing */ /*---------------------------------------------------------------------------* * some general definitions *---------------------------------------------------------------------------*/ #define GOOD 0 /* general "good" or "ok" return*/ #define ERROR (-1) /* general error return */ #define WARNING (-2) /* warning return */ #define INVALID (-1) /* an invalid integer */ /*---------------------------------------------------------------------------* * misc *---------------------------------------------------------------------------*/ #define RTPRIO_NOTUSED (-1) /* rtprio is not used for isdnd */ /*---------------------------------------------------------------------------* * debug flag bits *---------------------------------------------------------------------------*/ #define DL_MSG 0x0001 /* general debug messages */ #define DL_RATES 0x0002 /* messages related to rates */ #define DL_TIME 0x0004 /* messages related to timing */ #define DL_STATE 0x0008 /* messages related to states changes */ #define DL_RCVRY 0x0010 /* messages related to dial recovery */ #define DL_DIAL 0x0020 /* messages related to dial recovery */ #define DL_PROC 0x0040 /* messages related to process handling */ #define DL_DRVR 0x0080 /* messages related to kernel i4b msg i/o*/ #define DL_CNST 0x0100 /* messages related to controller state */ #define DL_RCCF 0x0200 /* messages related to isdnd.rc at boot */ #define DL_BDGT 0x0400 /* messages related to budgets */ #define DL_VALID 0x0800 /* messages related to valid keyword */ #ifdef DEBUG #define DBGL(cond, dolog) if(cond & debug_flags) dolog #else #define DBGL(cond, dolog) #endif /*---------------------------------------------------------------------------* * curses fullscreen display definitions *---------------------------------------------------------------------------*/ /* window dimensions */ #define UPPER_B 2 /* upper window start */ /* horizontal positions for upper window */ #define H_CNTL 0 /* controller */ #define H_TEI 2 /* TEI */ #define H_CHAN (H_TEI+4) /* channel */ #define H_TELN (H_CHAN+2) /* telephone number */ #define H_IFN (H_TELN+23) /* interfacename */ #define H_IO (H_IFN+7) /* incoming or outgoing */ #define H_OUT (H_IO+4) /* # of bytes out */ #define H_OUTBPS (H_OUT+11) /* bytes per second out */ #define H_IN (H_OUTBPS+5) /* # of bytes in */ #define H_INBPS (H_IN+11) /* bytes per second in */ #define H_UNITS (H_INBPS+6) /* # of charging units */ /* fullscreen mode menu window */ #define WMENU_LEN 35 /* width of menu window */ #define WMENU_TITLE "Command" /* title string */ #define WMENU_POSLN 10 /* menu position, line */ #define WMENU_POSCO 5 /* menu position, col */ #define WMITEMS 6 /* no of menu items */ #define WMENU_HGT (WMITEMS + 4) /* menu window height */ #define WREFRESH 0 #define WHANGUP 1 #define WREREAD 2 #define WSHOW 3 #define WBUDGET 4 #define WQUIT 5 #define WMTIMEOUT 5 /* timeout in seconds */ /*---------------------------------------------------------------------------* * charging rates *---------------------------------------------------------------------------*/ #define NDAYS 7 /* number of days in a week */ #define NRATES 4 /* number of rate structures supported */ /* struct for rates - each day has one or more */ struct rates { int start_time; /* hour and min at which this rate starts, e.g. 12:20 12*60+20*/ int end_time; /* hour and min at which this rate ends, e.g. 19:10 19*60+10*/ int rate; /* how long can I telephone at this price, seconds */ struct rates *next; }; /*---------------------------------------------------------------------------* * the internal identifiers for isdnd log levels. CAUTION: this has to stay * in sync with the loglevel to text and sysloglevel table in log.c !! *---------------------------------------------------------------------------*/ enum logids { LL_ERR, /* error conditions - everything which caused an error */ LL_WRN, /* warning conditions - nonfatal abnormal conditions */ LL_DMN, /* normal but significant condition - status of daemon */ LL_CHD, /* informational - everything regarding call handling */ LL_DBG, /* debug messages - everything which helps debugging */ LL_MER, /* monitor error messages - not sent to remote */ LL_PKT /* packet logging - log the first few packets */ }; /*---------------------------------------------------------------------------* * state machine events *---------------------------------------------------------------------------*/ enum events { /* incoming messages */ EV_MCI, /* MSG_CONNECT_IND */ EV_MCAI, /* MSG_CONNECT_ACTIVE_IND */ EV_MDI, /* MSG_DISCONNECT_IND */ EV_MDO, /* MSG_DIALOUT */ /* local requests */ EV_TIMO, /* timer expired */ EV_DRQ, /* disconnect request */ EV_CBRQ, /* callback request */ EV_ALRT, /* alerting request */ /* illegal */ EV_ILL /* illegal event */ }; #define N_EVENTS (EV_ILL+1) /* no of possible events */ /*---------------------------------------------------------------------------* * this struct describes the numbers to try to dial out *---------------------------------------------------------------------------*/ typedef struct { char number[TELNO_MAX]; /* remote number to dial */ int flag; /* usage flag */ #define RNF_IDLE 0 #define RNF_SUCC 1 /* last dial was ok */ } remote_number_t; /*---------------------------------------------------------------------------* * this struct describes numbers allowed to dial in *---------------------------------------------------------------------------*/ typedef struct { char number[TELNO_MAX]; /* calling party number */ } incoming_number_t; /*---------------------------------------------------------------------------* * this structure describes a prematurely aborted called-back dialout *---------------------------------------------------------------------------*/ typedef struct { int cdid; /* call handle */ int controller; /* the controller used to dial out */ int channel; /* the channel assigned to the outgoing call */ /* XXX - timeout handling and error recovery? */ } phantom_t; /*---------------------------------------------------------------------------* * this struct describes one complete configuration entry *---------------------------------------------------------------------------*/ typedef struct cfg_entry { /* ====== filled in at startup configuration, then static ===========*/ char name[32]; /* id for this entry */ int isdncontroller; /* controller to use 0 ... n */ int isdnchannel; /* channel to use */ int isdntxdelin; /* tx delay, incoming connections */ int isdntxdelout; /* tx delay, outgoing connections */ int usrdevicename; /* userland device to use */ int usrdeviceunit; /* userland unit to use */ int remote_numbers_count; /* number of remote numbers */ #define MAXRNUMBERS 8 /* max remote numbers */ remote_number_t remote_numbers[MAXRNUMBERS]; /* remote numbers to dial */ int remote_numbers_handling; /* how to handle the remote dialing */ #define RNH_NEXT 0 /* use next number after last successfull */ #define RNH_LAST 1 /* use last successfull for next call */ #define RNH_FIRST 2 /* always use first number for next call */ char local_phone_dialout[TELNO_MAX]; /* our number to tell remote*/ char local_phone_incoming[TELNO_MAX]; /* answer calls for this local number */ #define MAX_INCOMING 8 int incoming_numbers_count; /* number of incoming allowed numbers */ incoming_number_t remote_phone_incoming[MAX_INCOMING]; /* answer calls from this remote machine */ int dialin_reaction; /* what to do with incoming calls */ #define REACT_ACCEPT 0 #define REACT_REJECT 1 #define REACT_IGNORE 2 #define REACT_ANSWER 3 #define REACT_CALLBACK 4 int b1protocol; /* hdlc / raw */ int idle_time_in; /* max idle time incoming calls */ int idle_time_out; /* max idle time outgoing calls */ int shorthold_algorithm; /* shorthold algorithm */ int unitlength; /* length of a charging unit */ #define UNITLENGTH_DEFAULT 60 /* last resort unit length */ int earlyhangup; /* time in seconds to hangup */ /* before the next expected */ /* charging unit */ #define EARLYHANGUP_DEFAULT 5 int ratetype; /* type of rate */ #define NO_RATE (NRATES+1) #define INVALID_RATE (-1) int unitlengthsrc; /* where we get the unit length from */ #define ULSRC_NONE 0 /* nowhere specified */ #define ULSRC_CMDL 1 /* specified on commandline */ #define ULSRC_CMDLMIN 5 /* minimum value from cmdl */ #define ULSRC_CMDLMAX 3600 /* minimum value from cmdl */ #define ULSRC_CONF 2 /* get it from config file */ #define ULSRC_RATE 3 /* get it dynamic from ratesfile*/ #define ULSRC_DYN 4 /* dynamic calculated from AOCD */ char *answerprog; /* program to use for answering */ char *connectprog; /* program run after negotiation finished */ char *disconnectprog; /* program run after shutdown is complete */ int callbackwait; /* time to wait before calling back */ #define CALLBACKWAIT_MIN 1 int calledbackwait; /* time to wait for remote callback */ #define CALLEDBACKWAIT_MIN 2 int dialretries; /* no. of dial tries */ #define DIALRETRIES_DEF 1 int recoverytime; /* time between 2 dial tries */ #define RECOVERYTIME_MIN 1 int dialrandincr; /* use random dial time incr */ int usedown; /* set interface down yes/no */ int downtries; /* retries before i/f is set down */ #define DOWN_TRIES_MIN 2 #define DOWN_TRIES_MAX 20 int downtime; /* time i/f is down */ #define DOWN_TIME_MIN 10 /* 10 seconds */ #define DOWN_TIME_MAX 3600 /* 1 hour */ int dialouttype; /* type of outgoing connection */ #define DIALOUT_NORMAL 0 /* normal dialout behaviour */ #define DIALOUT_CALLEDBACK 1 /* remote is expected to callback */ int alert; /* alert time in sec if nonzero */ #define MINALERT 5 /* 5 secs min */ #define MAXALERT (3*60) /* 3 minutes max */ int inout; /* in/out, in-only or out-only */ #define DIR_INOUT 0 #define DIR_INONLY 1 #define DIR_OUTONLY 2 int budget_callbackperiod; /* length of a budget period (s)*/ int budget_callbackncalls; /* call budget for a period */ char *budget_callbacks_file; /* filename to store callback stats */ char budget_callbacksfile_rotate; int budget_calloutperiod; /* length of a budget period (s)*/ int budget_calloutncalls; /* call budget for a period */ char *budget_callouts_file; /* filename to store callout stats */ char budget_calloutsfile_rotate; int ppp_expect_auth; int ppp_send_auth; #define AUTH_UNDEF 0 #define AUTH_NONE 1 #define AUTH_PAP 2 #define AUTH_CHAP 3 int ppp_auth_flags; #define AUTH_RECHALLENGE 0x01 #define AUTH_REQUIRED 0x02 #define AUTHNAMELEN 32 /* AUTHNAMELEN must match in */ #define AUTHKEYLEN 16 char ppp_expect_name[AUTHNAMELEN]; /* PPP PAP/CHAP login name */ char ppp_send_name[AUTHNAMELEN]; char ppp_expect_password[AUTHKEYLEN]; char ppp_send_password[AUTHKEYLEN]; int day; /* days valid */ #define SU 0x01 #define MO 0x02 #define TU 0x04 #define WE 0x08 #define TH 0x10 #define FR 0x20 #define SA 0x40 #define HD 0x80 /* holiday */ int fromhr; /* time valid */ int frommin; int tohr; int tomin; /*===========================================================================*/ /*============ filled in after start, then dynamic ==========================*/ /*===========================================================================*/ int cdid; /* cdid for call */ #define CDID_RESERVED (-1) int isdncontrollerused; /* the one we are using */ int isdnchannelused; /* the one we are using */ int fs_position; /* fullscreen position */ int state; /* state of connection */ #define ST_IDLE 0 /* connection is idle / disconnected */ /* normal dial out to remote */ #define ST_DIAL 1 /* dialing */ #define ST_DIALRTMRCHD 2 /* wait for dial retry time reached */ #define ST_DIALRETRY 3 /* last/first dialing failed, retry */ /* PCB: passive callback, i'm being called back */ #define ST_PCB_DIAL 4 /* dialing, trigger a callback */ #define ST_PCB_DIALFAIL 5 /* dialing failed triggering a callbk */ #define ST_PCB_WAITCALL 6 /* waiting for callback from remote */ /* ACB: active callback, i'm calling back */ #define ST_ACB_WAITDISC 7 /* got call, wait for disconnect */ #define ST_ACB_WAITDIAL 8 /* wait until allowed to callback */ #define ST_ACB_DIAL 9 /* callback to remote */ #define ST_ACB_DIALFAIL 10 /* callback to remote failed */ /* normal non-dialling states */ #define ST_ACCEPTED 11 /* remote accepted */ #define ST_CONNECTED 12 /* connected with remote */ #define ST_WAITDISCI 13 /* tx disc req, wait for disc ind */ #define ST_DOWN 14 /* interface is down */ #define ST_ALERT 15 /* interface is waiting for alert time*/ /* illegal and pseudo states */ #define ST_ILL 16 /* illegal state */ #define ST_SUSE 17 /* subroutine sets new state */ #define N_STATES (ST_ILL+1) /* max number of states */ cause_t disc_cause; /* cause from disconnect */ int local_disconnect; /* flag, who disconnected */ #define DISCON_LOC 0 #define DISCON_REM 1 int timerval; /* value for timer, 0 if inactive */ int timerremain; /* remaining time */ int hangup; /* flag, hangup connection asap */ char real_phone_incoming[TELNO_MAX]; /* real remote telno in case of wildcard */ int last_remote_number; /* index of last used dialout number*/ char remote_phone_dialout[TELNO_MAX]; /* used remote number to dial */ int direction; /* incoming or outgoing */ #define DIR_IN 0 #define DIR_OUT 1 int charge; /* charge in units */ int last_charge; /* last charge in units */ int inbytes; /* # of bytes from remote */ int iinbytes; /* # of bytes from remote on the line */ int inbps; /* bytes/sec from remote */ int outbytes; /* # of bytes to remote */ int ioutbytes; /* # of bytes to remote on the line */ int outbps; /* bytes/sec to remote */ time_t connect_time; /* time connection was established */ time_t aoc_last; /* last AOCD timestamp */ time_t aoc_now; /* current AOCD timestamp */ time_t aoc_diff; /* current unit length */ time_t aoc_lastdiff; /* last charge unit length */ int aoc_valid; /* flag: time diff is valid */ #define AOC_INVALID 0 /* aoc_diff is NOT valid */ #define AOC_VALID 1 /* aoc_diff is valid */ time_t last_dial_time; /* time of last dialing */ time_t last_release_time; /* time of last hangup */ int dial_count; /* number of dialout tries */ int randomtime; /* random() part of recoverytime*/ #define RANDOM_MASK 0x04 /* bits used from randomtime */ int down_retry_count; /* retry cycle count for usedown*/ time_t went_down_time; /* time i/f went down */ phantom_t saved_call; /* outgoing call state if called back too early */ int alert_time; /* count down of alert time */ char display[DISPLAY_MAX]; time_t budget_callbackperiod_time; /* end of current period */ int budget_callbackncalls_cnt; /* amount of calls left */ int budget_callback_req; /* requests */ int budget_callback_done; /* call done */ int budget_callback_rej; /* call refused */ time_t budget_calloutperiod_time; /* end of current period */ int budget_calloutncalls_cnt; /* amount of calls left */ int budget_callout_req; /* requests */ int budget_callout_done; /* call done */ int budget_callout_rej; /* call refused */ int budget_calltype; /* type of call */ #define BUDGET_TYPE_CBACK 1 #define BUDGET_TYPE_COUT 2 } cfg_entry_t; /*---------------------------------------------------------------------------* - * this struct describes state of controller with 2 b channels + * this struct describes state of controller with MAX_BCHAN b channels *---------------------------------------------------------------------------*/ typedef struct isdn_ctrl_state { int ctrl_type; /* type: active/passive */ int card_type; /* manufacturer (CARD_XXXX) */ int protocol; /* ISDN D-channel protocol */ + char* firmware; /* loadable fimrware file name */ + int state; /* controller state */ #define CTRL_DOWN 0 /* controller inoparable */ #define CTRL_UP 1 /* controller may be used */ - int stateb1; /* B-channel 1 */ - int stateb2; /* B-channel 2 */ +#define MAX_BCHAN 30 + int stateb[MAX_BCHAN]; /* b channel state */ #define CHAN_IDLE 0 /* channel is free for usage */ #define CHAN_RUN 1 /* channel is occupied */ + int nbch; /* number of b channels */ int freechans; /* number of unused channels */ -#define MAX_CHANCTRL 2 /* free channels per controller */ int tei; /* tei or -1 if invalid */ int l1stat; /* layer 1 state */ int l2stat; /* layer 2 state */ } isdn_ctrl_state_t; /*---------------------------------------------------------------------------* * this struct describes a logging regular expression *---------------------------------------------------------------------------*/ struct rarr { int re_flg; /* valid entry flag */ char *re_expr; /* plain text expression */ regex_t re; /* compiled expression */ char *re_prog; /* the program to be executed */ }; #ifdef I4B_EXTERNAL_MONITOR /* for each rights entry we keep one of this structures around: */ struct monitor_rights { TAILQ_ENTRY(monitor_rights) list; /* a list of this structures */ char name[FILENAME_MAX]; /* net/host spec or filename */ int rights; /* bitmask of allowed acces rights */ u_int32_t net; /* net/host address (host byte order!) */ u_int32_t mask; /* bitmask 1 = network, 0 = host (host byte order!) */ int local; /* zero if remote access via tcp/ip */ }; #endif /*---------------------------------------------------------------------------* * global variables, storage allocation *---------------------------------------------------------------------------*/ #ifdef MAIN int isdnfd; /* file handle, /dev/i4b */ char mailto[MAXPATHLEN] = ""; /* panic mail address */ char mailer[MAXPATHLEN] = ""; /* panic mail address */ char *configfile = CONFIG_FILE_DEF; /* configuration filename */ int config_error_flag = 0; /* error counter */ #ifdef DEBUG int do_debug = 0; /* debug mode flag */ int debug_flags = 0; /* debug options */ int debug_noscreen = 0; /* not on fullscreen */ #endif int do_bell = 0; /* bell on connect/disconnect */ int do_fork = 1; /* run as daemon/foreground */ int do_ttytype = 0; /* got new terminal type */ char *ttype = ""; /* termcap entry name string */ int do_rdev = 0; /* redirect output */ char *rdev = ""; /* new device string */ int do_print = 0; /* config file printout */ int got_unitlen = 0; /* flag, got length of a unit */ time_t unit_length; /* length of a unit */ cfg_entry_t cfg_entry_tab[CFG_ENTRY_MAX]; /* configuration table */ isdn_ctrl_state_t isdn_ctrl_tab[ISDN_CTRL_MAX]; /* controller states table */ int ncontroller = 0; /* # of controllers available */ int nentries = 0; /* # of entries in config tab */ int uselogfile = 0; /* flag, use a logfile */ char logfile[MAXPATHLEN] = LOG_FILE_DEF; /* log filename */ FILE *logfp = NULL; /* log file pointer */ int logfacility = LOG_LOCAL0; /* the syslog facility used */ int nregex = 0; /* number of reg expr */ struct rarr rarr[MAX_RE]; /* regexpr & progs table */ char ratesfile[MAXPATHLEN] = RATES_FILE_DEF; /* rates filename */ char *rate_error = NULL; /* errorcase: error string */ int got_rate = 0; /* flag, ratesfile found */ struct rates *rates[NRATES][NDAYS]; /* the rates structure */ int useacctfile = 0; /* flag, write accounting */ char acctfile[MAXPATHLEN] = ACCT_FILE_DEF; /* accounting filename */ FILE *acctfp = NULL; /* accounting file pointer */ int acct_all = 1; /* account all connections */ int aliasing = 0; /* enable alias processing */ char aliasfile[MAXPATHLEN] = ALIASFILE; /* alias file location */ int do_fullscreen = 0; /* fullscreen log */ int curses_ready = 0; /* curses initialized */ #ifdef USE_CURSES WINDOW *upper_w; /* curses upper window pointer */ WINDOW *mid_w; /* curses mid window pointer */ WINDOW *lower_w; /* curses lower window pointer */ #endif int rt_prio = RTPRIO_NOTUSED; /* realtime priority */ /* monitor via network */ int do_monitor = 0; int inhibit_monitor = 0; #ifdef I4B_EXTERNAL_MONITOR int monitorport = DEF_MONPORT; #else int monitorport = -1; #endif int accepted = 0; int isdntime = 0; /* flag, log time from exchange */ int extcallattr = 0; /* flag, display extended caller attributes */ char tinainitprog[MAXPATHLEN] = TINA_FILE_DEF; char rotatesuffix[MAXPATHLEN] = ""; time_t starttime = 0; char holidayfile[MAXPATHLEN] = HOLIDAY_FILE_DEF; /* holiday filename */ #else /* !MAIN */ int isdnfd; char mailto[MAXPATHLEN]; char mailer[MAXPATHLEN]; char *configfile; int config_error_flag; #ifdef DEBUG int do_debug; int debug_flags; int debug_noscreen; #endif int do_bell; int do_fork; int do_ttytype; char *ttype; int do_rdev; char *rdev; int do_print; int got_unitlen; time_t unit_length; cfg_entry_t cfg_entry_tab[CFG_ENTRY_MAX]; /* configuration table */ isdn_ctrl_state_t isdn_ctrl_tab[ISDN_CTRL_MAX]; /* controller states table */ int ncontroller; int nentries; int uselogfile; char logfile[MAXPATHLEN]; FILE *logfp; int logfacility; int nregex; struct rarr rarr[MAX_RE]; char ratesfile[MAXPATHLEN]; char *rate_error; int got_rate; struct rates *rates[NRATES][NDAYS]; int useacctfile; char acctfile[MAXPATHLEN]; FILE *acctfp; int acct_all; int aliasing; char aliasfile[MAXPATHLEN]; int do_fullscreen; int curses_ready; #ifdef USE_CURSES WINDOW *upper_w; WINDOW *mid_w; WINDOW *lower_w; #endif int rt_prio; int do_monitor; int inhibit_monitor; int monitorport; int accepted; int isdntime; int extcallattr; char tinainitprog[MAXPATHLEN]; char rotatesuffix[MAXPATHLEN]; time_t starttime; char holidayfile[MAXPATHLEN]; #endif /* MAIN */ char * bdrivername ( int drivertype ); void cfg_setval ( int keyword ); void check_and_kill ( cfg_entry_t *cep ); void check_pid ( void ); void close_allactive ( void ); void configure ( char *filename, int reread ); void daemonize ( void ); void dialresponse(cfg_entry_t *cep, int dstat); void display_acct ( cfg_entry_t *cep ); void display_bell ( void ); void display_ccharge ( cfg_entry_t *cep, int units ); void display_chans ( void ); void display_charge ( cfg_entry_t *cep ); void display_connect ( cfg_entry_t *cep ); void display_disconnect ( cfg_entry_t *cep ); void display_l12stat(int controller, int layer, int state); void display_tei(int controller, int tei); void display_updown ( cfg_entry_t *cep, int updown ); void do_exit ( int exitval ); void do_menu ( void ); int exec_answer ( cfg_entry_t *cep ); int exec_connect_prog ( cfg_entry_t *cep, const char *prog, int link_down ); pid_t exec_prog ( char *prog, char **arglist ); cfg_entry_t * find_by_device_for_dialout ( int drivertype, int driverunit ); cfg_entry_t *find_by_device_for_dialoutnumber(int drivertype, int driverunit, int cmdlen, char *cmd); cfg_entry_t * find_matching_entry_incoming ( msg_connect_ind_t *mp ); cfg_entry_t * find_active_entry_by_driver ( int drivertype, int driverunit ); void finish_log ( void ); char * getlogdatetime ( void ); int get_cdid ( void ); cfg_entry_t * get_cep_by_cc ( int ctrlr, int chan ); cfg_entry_t * get_cep_by_driver ( int drivertype, int driverunit ); cfg_entry_t * get_cep_by_cdid ( int cdid ); int get_current_rate ( cfg_entry_t *cep, int logit ); void handle_charge ( cfg_entry_t *cep ); void handle_recovery ( void ); void handle_scrprs(int cdid, int scr, int prs, char *caller); void if_up(cfg_entry_t *cep); void if_down(cfg_entry_t *cep); void init_controller ( void ); void init_controller_protocol ( void ); void init_log ( void ); void init_screen ( void ); void log ( int what, const char *fmt, ... ); int main ( int argc, char **argv ); void msg_accounting ( msg_accounting_ind_t *mp ); void msg_alert_ind ( msg_alert_ind_t *mp ); void msg_charging_ind ( msg_charging_ind_t *mp ); void msg_connect_active_ind ( msg_connect_active_ind_t *mp ); void msg_connect_ind ( msg_connect_ind_t *mp ); void msg_pdeact_ind(msg_pdeact_ind_t *md); void msg_negcomplete_ind(msg_negcomplete_ind_t *ind); void msg_ifstatechg_ind(msg_ifstatechg_ind_t *ind); void msg_drvrdisc_req(msg_drvrdisc_req_t *mp); void msg_dialout ( msg_dialout_ind_t *mp ); void msg_dialoutnumber(msg_dialoutnumber_ind_t *mp); void msg_disconnect_ind ( msg_disconnect_ind_t *mp ); void msg_idle_timeout_ind ( msg_idle_timeout_ind_t *mp ); void msg_l12stat_ind(msg_l12stat_ind_t *ml); void msg_teiasg_ind(msg_teiasg_ind_t *mt); void msg_proceeding_ind ( msg_proceeding_ind_t *mp ); void msg_packet_ind( msg_packet_ind_t *mp ); const char * name_of_controller(int ctrl_type, int card_type); void next_state ( cfg_entry_t *cep, int event ); char * print_i4b_cause( cause_t code ); char * printstate ( cfg_entry_t *cep ); int readrates ( char *filename ); int ret_channel_state(int controller, int channel); void reopenfiles ( int dummy ); void rereadconfig ( int dummy ); void select_first_dialno ( cfg_entry_t *cep ); void select_next_dialno ( cfg_entry_t *cep ); void select_this_dialno ( cfg_entry_t *cep ); int sendm_alert_req ( cfg_entry_t *cep ); int sendm_connect_req ( cfg_entry_t *cep ); int sendm_connect_resp ( cfg_entry_t *cep, int cdid, int response, cause_t cause ); int sendm_disconnect_req ( cfg_entry_t *cep, cause_t cause ); int set_channel_busy(int controller, int channel); int set_channel_idle(int controller, int channel); int setup_dialout(cfg_entry_t *cep); void sigchild_handler ( int sig ); void start_timer ( cfg_entry_t *cep, int seconds ); void stop_timer ( cfg_entry_t *cep ); void unitlen_chkupd( cfg_entry_t *cep ); void write_pid ( void ); void yyerror ( const char *msg ); void error_exit(int exitval, const char *fmt, ...); /* montior server module */ void monitor_init(); void monitor_exit(); void monitor_clear_rights(); void monitor_fixup_rights(); int monitor_start_rights(const char *clientspec); void monitor_add_rights(int rights); /* possible return codes from monitor_start_rights: */ #define I4BMAR_OK 0 /* rights added successfully */ #define I4BMAR_LENGTH 1 /* local socket name to long */ #define I4BMAR_DUP 2 /* entry already exists */ #define I4BMAR_CIDR 3 /* cidr netmask is invalid */ #define I4BMAR_NOIP 4 /* host/net could not be resolved */ int monitor_create_local_socket(); #ifndef I4B_NOTCPIP_MONITOR int monitor_create_remote_socket(int portno); #endif void monitor_prepselect(fd_set *selset, int *max_fd); void monitor_handle_input(fd_set *selset); void monitor_handle_connect(int sockfd, int is_local); void monitor_evnt_charge(cfg_entry_t *cep, int units, int estimated); void monitor_evnt_connect(cfg_entry_t *cep); void monitor_evnt_disconnect(cfg_entry_t *cep); void monitor_evnt_updown(cfg_entry_t *cep, int up); void monitor_evnt_log(int prio, const char * what, const char * msg); void monitor_evnt_l12stat(int controller, int layer, int state); void monitor_evnt_tei(int controller, int tei); void monitor_evnt_acct(cfg_entry_t *cep); /* controller.c */ void init_active_controller(void); int set_controller_state(int controller, int state); int get_controller_state(int controller); int decr_free_channels(int controller); int incr_free_channels(int controller); int get_free_channels(int controller); int set_channel_busy(int controller, int channel); int set_channel_idle(int controller, int channel); int ret_channel_state(int controller, int channel); /* alias.c */ void init_alias(char *filename); void free_aliases(void); char *get_alias(char *number); void upd_callstat_file(char *filename, int rotateflag); /* holiday.c */ void init_holidays(char *filename); void free_holidays(void); int isholiday(int d, int m, int y); #endif /* _ISDND_H_ */ diff --git a/usr.sbin/i4b/isdnd/isdnd.rc.5 b/usr.sbin/i4b/isdnd/isdnd.rc.5 index 2be90a4493e5..17fbec89cf0c 100644 --- a/usr.sbin/i4b/isdnd/isdnd.rc.5 +++ b/usr.sbin/i4b/isdnd/isdnd.rc.5 @@ -1,988 +1,1001 @@ .\" -.\" Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved. +.\" Copyright (c) 1997, 2001 Hellmuth Michaelis. 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. .\" .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. .\" -.\" $Id: isdnd.rc.5,v 1.51 2000/10/09 11:17:07 hm Exp $ -.\" .\" $FreeBSD$ .\" -.\" last edit-date: [Mon Oct 9 13:12:29 2000] +.\" last edit-date: [Mon May 21 11:20:26 2001] .\" -.Dd October 9, 2000 +.Dd May 21, 2001 .Dt ISDND.RC 5 .Os .Sh NAME .Nm isdnd.rc .Nd isdn4bsd ISDN connection management daemon config file format .Sh DESCRIPTION The file .Pa /etc/isdn/isdnd.rc contains (if not otherwise specified on the command line) the runtime configuration for the .Xr isdnd 8 ISDN connection management daemon which is part of the isdn4bsd package. .Pp The configuration file consists of keywords which start in column 1 followed by one or more spaces or tabs, an equal sign, one or more spaces or tabs and a keyword dependent parameter value. .Pp A line beginning with '#' is treated as a comment line. .Pp For keywords requiring the specification of a boolean value, the truth value can be either .Em yes or .Em on while the false value can be either .Em no or .Em off . .Pp The configuration file consists of one .Em system section, one or more optional .Em controller sections and one or more .Em entry sections. In the .Em system section parameters regarding the daemon operation or parameters not associated with a single remote connection can be set. In the .Em controller section parameters regarding a particular controller can be set. In the .Em entry section(s) parameters directly associated with a single remote connection can be set. .Pp The following keywords are recognized by .Nm isdnd : .Pp .Bl -tag -width system .It Li system This keyword starts the system configuration section. It must not have a parameter and may be used only once. The keyword is mandatory. The following keywords are valid in the system configuration section: .Bl -tag -width useacctfile .It Li acctall If this parameter is set to .Em on , accounting information is written even if the local site was not charged or no charging information is available or is not subscribed. (optional) .It Li acctfile Specifies the name of the accounting file which is used when the keyword .Em useacctfile (see below) is set to .Em on . See also system keyword .Em rotatesuffix . If this keyword is omitted the system default is used. (optional) .It Li aliasing If this parameter is set to .Em on , alias processing of telephone-number to name is enabled (see also the .Em aliasfile keyword below). The default is off. (optional) .It Li aliasfile Specifies the name of the telephone number-to-name alias database file shared with the .Xr isdntel 1 utility when alias processing is enabled via the .Em aliasing keyword. (optional) .It Li beepconnect In full-screen mode, if this parameter is set to .Em on , ring the bell when connecting or disconnecting a call. .It Li extcallattr If this parameter is set to .Em on , the extended caller attributes "screening indicator" and "presentation indicator" are written to the log-file. The default is off. (optional) .It Li holidayfile Specifies the name of the holiday file containing the dates of holidays. This file is used in conjunction with the .Em valid keyword to lookup the dates of holidays. (optional) .It Li isdntime If this parameter is set to .Em on , date/time information from the exchange (if provided) is written to the log-file. The default is off. (optional) .It Li mailer This keyword is used to specify the path/name of a mail program which which is able to use the "-s" flag to specify a subject on its command line. In case of a fatal error exit of .Nm this program is used to send mail to an administrator specified by the keyword .Em mailto . (optional) .It Li mailto This keyword is used to specify the email address of someone to notify in case of a fatal error exit of .Nm . (See also keyword .Em mailer ). (optional) .It Li monitor-allowed If this parameter is set to .Em on or .Em yes , monitoring via a local or remote machine is enabled. This parameter is optional and is set to .Em off by default. .It Li monitor-port sets the TCP port number for remote monitoring. This integer parameter is optional and is set to port 451 by default. .It Li monitor This keyword specifies a local socket name or a host or network for remote monitoring. The .Em monitor specification may either be: .Pp .Bl -tag -width Ds -compact .It Ar the name of a local (UNIX-domain) socket this MUST start with a "/", example: /var/run/isdn-monitor .It Ar a dotted-quad host specification example: 192.168.1.2 .It Ar a dotted-quad network address with netmask example: 192.168.1.0/24 .It Ar a resolvable host name example: localhost .It Ar a resolvable network name with netmask example: up-vision-net/24 .El .It Li monitor-access This keyword specifies the access rights for a previously used .Em monitor keyword. The supported access rights are: .Pp .Bl -tag -width Ds -compact .It Ar fullcmd .It Ar restrictedcmd .It Ar channelstate .It Ar logevents .It Ar callin .It Ar callout .El .It Li ratesfile Specifies the name of the ratesfile. If this keyword is omitted the system default is used. (optional) .It Li regexpr This keyword is used to specify regular expressions. It can be specified more than once up to a compile time dependent value (currently set to 5 by the MAX_RE definition in the source). .Pp All specified regular expressions are compared to the log strings at runtime and if a match is found, a program is run with the log text as a parameter (see also the keyword .Em regprog below). .Pp For an explanation how regular expressions are specified, please have a look at .Xr re_format 7 and .Xr regex 3 . The .Em extended regular expression syntax is supported here. .Pp Hint: it might be necessary to properly quote the expression to avoid improper interpretation by the configuration file parser. (optional) .It Li regprog This keyword is used to specify the name of a program which is run in case a corresponding regular expression is matched by a logging string. .Nm Isdnd expects to find the program below the path .Pa /etc/isdn which is prepended to the string specified as a parameter to this keyword. (optional) .It Li rotatesuffix Specifies a suffix for renaming the log- and the accounting-filename. In case rotatesuffix is used and a USR1 signal is sent to isdnd, the log-file and the accounting file is not only closed and reopened but the old log-file is also renamed to the former filename with the rotatesuffix string appended. If this keyword is omitted, the log-files are just closed and reopened; this is also the default behavior. (optional) .It Li rtprio Specifies the real-time priority .Nm isdnd runs at as an integer value in the range 0...31 with 0 being the highest priority. This keyword is optional; if not specified the process priority of .Nm isdnd is not touched in any way. ( See also .Xr rtprio 1 ). This keyword is only available if .Nm was compiled with -DUSE_RTPRIO. .It Li useacctfile If this parameter is set to .Em on charging (if available) and accounting information is written to the accounting file. (optional) .El .It Li controller This keyword starts the controller configuration section. It must not have a parameter and may be used once for every controller. The keyword is optional. The following keywords are valid in a controller configuration section: .Bl -tag -width useacctfile .It Li protocol This keyword is used to set the D-channel protocol for the S0-bus a controller is connected to. The following parameters are currently supported: .Pp .Bl -tag -width calledback -compact .It Ar dss1 The DSS1 or so-called "Euro-ISDN" D-channel protocol according to ITU Recommendations Q.921 and Q.931. .It Ar d64s An ISDN leased line with a single B-channel (called D64S in Germany). .El +.It Li firmware +This is keyword ist used like firmware=/path/to/file to download the +firmware to active controllers supported by the +.Em iavc +driver (AVM B1, T1). This keyword is supported for all controller types, +and causes I4B_CTRL_DOWNLOAD ioctl to be invoked with the specified file +as an argument. In systems equipped with both active and passive adapters, +and the passive cards being detected first, dummy 'controller' entries +are required for the passive cards to get the correct firmwares to +correct adapters. .El .It Li entry This keyword starts one configuration entry. It must not have a parameter. This keyword must be used at least once. The following keywords are valid in an entry section: .Bl -tag -width unitlengthsrc .It Li answerprog This keyword is used to specify the name of a program which is run in case an incoming telephone connection specified .Em answer in its configuration entry. The default name is .Em answer . .Nm Isdnd expects to find this program beneath the path .Pa /etc/isdn which is prepended to the string specified as a parameter to this keyword. (optional) .It Li alert is used to specify a time in seconds to wait before accepting a call. This keyword is only usable for incoming telephone calls (dialin-reaction = answer). It is used to have a chance to accept an incoming call on the phone before the answering machine starts to run. The minimum value for the alert parameter is 5 seconds and the maximum parameter allowed is 180 seconds. (optional) .It Li b1protocol The B channel layer 1 protocol used for this connection. The keyword is mandatory. The currently configurable values are: .Pp .Bl -tag -width Ds -compact .It Ar hdlc HDLC framing. .It Ar raw No framing at all (used for telephony). .El .It Li budget-calloutperiod is used to specify a time period in seconds. Within this period, the number of calls specified by .Em budget-calloutncalls are allowed to succeed, any further attempt to call out will be blocked for the rest of the time left in the time period. (optional) .It Li budget-calloutncalls The number of outgoing calls allowed within the time period specified by .Em budget-calloutperiod . (optional) .It Li budget-calloutsfile A path/filename to which the number of successfull callouts are written. The contents of the file is preserved when it exists during startup of isdnd. The format of this file is: start time, last update time, number of calls. (optional) .It Li budget-calloutsfile-rotate If set to .Em on rotate budget-calloutsfile every night when an attempt is made to update the file on a new day. The statistics for the previous day are witten to a file with the filename specified by budget-calloutsfile to which a hyphen and the new day's (!) day of month number is appended. (optional) .It Li budget-callbackperiod .It Li budget-callbackncalls .It Li budget-callbacksfile .It Li budget-calloutsfile-rotate See .Em budget-calloutperiod , .Em budget-calloutncalls , .Em budget-calloutsfile , and .Em budget-calloutsfile-rotate above. These are used to specify the budgets for calling back a remote site. .It Li callbackwait The time in seconds to wait between hanging up the call from a remote site and calling back the remote site. (optional) .It Li calledbackwait The time in seconds to wait for a remote site calling back the local site after a call from the local site to the remote site has been made. (optional) +.It Li clone +This causes the contents of the specified entry to be copied from the +existing named entry to the current one. +When using this feature at least a new entry specific 'name' and +'usrdeviceunit' value should be specified for the current entry. .It Li connectprog specifies a program run every time after a connection is established and address negotiation is complete (i.e.: the connection is usable). .Nm Isdnd expects to find the program below the path .Pa /etc/isdn which is prepended to the string specified as a parameter to this keyword. The programs specified by connect and disconnect will get the following command line arguments: -d (device) -f (flag) [ -a (addr) ] where .Em device is the name of device, e.g. "isp0", .Em flag will be "up" if connection just got up, or "down" if interface changed to down state and .Em addr the address that got assigned to the interface as a dotted-quad ip address (optional, only if it can be figured out by isdnd). (optional) .It Li dialin-reaction Used to specify what to do when an incoming connection request is received. The keyword is mandatory. The currently supported parameters are: .Pp .Bl -tag -width calledback -compact .It Ar accept Accept an incoming call. .It Ar reject Reject an incoming call. .It Ar ignore Ignore an incoming call. .It Ar answer Start telephone answering for an incoming voice call. .It Ar callback When a remote site calls, hang up and call back the remote site. .El .It Li dialout-type This keyword is used to configure what type of dialout mode is used. The keyword is mandatory. The currently supported parameters are: .Pp .Bl -tag -width Ds -compact .It Ar normal Normal behavior, call the remote site which is supposed to accept the call. .It Ar calledback Callback behavior, call the remote side which rejects the call and calls us back. .El .It Li dialrandincr When dialing or re-dialing and this parameter is set to .Em on , the dial retry time is added with a random value (currently 0...3 seconds) to minimize the chance of two sites dialing synchronously so each gets a busy each time it dials because the other side is also dialing. .It Li dialretries The number of dialing retries before giving up. Setting this to .Em -1 gives an unlimited number of retries! (optional) .It Li direction This keyword is used to configure if incoming and outgoing, incoming-only or outgoing only connections are possible. The keyword is optional, the default is .Em inout . .Pp The currently supported parameters are: .Pp .Bl -tag -width Ds -compact .It Ar inout Normal behavior, connection establishment is possible from remote and local. .It Ar in Only incoming connections are possible. .It Ar out Only outgoing connections are possible. .El .It Li disconnectprog specifies a program run every time after a connection was shut down. .Nm Isdnd expects to find the program below the path .Pa /etc/isdn which is prepended to the string specified as a parameter to this keyword. (optional) .It Li downtries is used to configure the number of unsuccessful tries (= retry cycles!) before the interface is disabled (for .Em downtime seconds). (see also the keyword .Em usedown further up). This keyword is optional. .It Li downtime is used to configure the time in seconds an interface is disabled after the configured number of .Em downtries . (see also the keyword .Em usedown further up). This keyword is optional and is set to 60 seconds by default. .It Li earlyhangup A (safety) time in seconds which specifies the time to hang up before an expected next charging unit will occur. (optional) .It Li idle-algorithm-outgoing The algorithm used to determine when to hang up an outgoing call when the line becomes idle. The current algorithms are: .Pp .Bl -tag -width calledback -compact .It Ar fix-unit-size idle algorithm which assumes fixed sized changing units during the whole call. .It Ar var-unit-size idle algorithm which assumes that the charging is time based after the first units time has expired. .El .It Li idletime-outgoing The time in seconds an outgoing connection must be idle before hanging up. An idle timeout of zero disables this functionality. (optional) .It Li idletime-incoming The time in seconds an incoming connection must be idle before hanging up. An idle timeout of zero disables this functionality. (optional) .It Li isdncontroller The ISDN controller number to be used for connections for this entry. (mandatory) .It Li isdnchannel The ISDN controller channel number to be used for connections for this entry. In case a channel is explicitly selected here, the SETUP message will request this channel but mark the request as .Em preferred (the indicated channel is preferred) instead of exclusive (only the indicated channel is acceptable). Thus the exchange is still free to select another than the requested channel! (mandatory) .It Li isdntxdel-incoming A delay value suitable for the .Xr timeout 9 kernel subroutine to delay the transmission of the first packet after a successful connection is made by this value for .Em incoming ISDN connections. The specification unit is 1/100 second. A zero (0) disables this feature and is the default value. This feature is implemented (and makes sense only) for the .Xr i4bipr 4 IP over raw HDLC ISDN driver. (optional) .It Li isdntxdel-outgoing A delay value suitable for the .Xr timeout 9 kernel subroutine to delay the transmission of the first packet after a successful connection is made by this value for .Em outgoing ISDN connections. The specification unit is 1/100 second. A zero (0) disables this feature and is the default value. This feature is implemented (and makes sense only) for the .Xr i4bipr 4 IP over raw HDLC ISDN driver. (optional) .It Li local-phone-dialout The local telephone number used when the local site dials out. When dialing out to a remote site, the number specified here is put into the .Em "Calling Party Number Information Element" . .Pp This keyword is mandatory for the .Em ipr user-land interfaces. .It Li local-phone-incoming The local telephone number used for verifying the destination of incoming calls. When a remote site dials in, this number is used to verify that it is the local site which the remote site wants to connect to. It is compared with the .Em "Called Party Number Information Element" got from the telephone exchange. .Pp This keyword is mandatory for the .Em ipr interfaces. .It Li name Defines a symbolic name for this configuration entry. Its purpose is to use this name in the full-screen display for easy identification of a link to a remote site and for accounting purposes. (mandatory) .It Li ppp-auth-paranoid If set to .Em no , the remote site is not required to prove its authentity for connections that are initiated by the local site. The default is .Em yes and requires the remote site to always authenticate. .Pp This keyword is only used if .Em ppp-send-auth has been set to pap or chap for an .Em isp PPP interface. (optional) .It Li ppp-auth-rechallenge Set to .Em no , if the other side does not support re-challenging for chap. The default is .Em yes , which causes verification of the remote site's authentity once in a while. .Pp This keyword is only used if .Em ppp-expect-auth has been set to chap for an .Em isp PPP interface. (optional) .It Li ppp-expect-auth The local site expects the authentity of the remote site to be proved by the specified method. The supported methods are: .Pp .Bl -tag -width Ds -compact .It Ar none Do not require the other side to authenticate. Typical uses are dial-out to an ISP (many ISPs do not authenticate themselves to clients) or offering anonymous dial-in at the local site. .It Ar chap The preferred authentication method, which does not require a password to be sent in the clear. .It Ar pap The unprotected authentication method, which allows anybody watching the wire to grab name and password. .El .Pp If .Em ppp-auth-paranoid is set to .Em no (the default is .Em yes ) outgoing connections will not require the remote site to authenticate itself. .Pp This keyword is only used for the .Em isp PPP interfaces. (optional) .It Li ppp-expect-name The name that has to be provided by the remote site to prove its authentity. .Pp This keyword is only used if .Em ppp-expect-auth has been set to pap or chap for an .Em isp PPP interface. (optional) .It Li ppp-expect-password The secret that has to be provided by the remote site to prove its authentity. .Pp This keyword is only used if .Em ppp-expect-auth has been set to pap or chap for an .Em isp PPP interface. (optional) .It Li ppp-send-auth The authentication method required by the remote site. The currently supported parameters are: .Pp .Bl -tag -width Ds -compact .It Ar none The remote site does not expect or support authentication. .It Ar chap The preferred authentication method, which does not require a password to be sent in the clear. .It Ar pap The unprotected authentication method, which allows anybody watching the wire to grab name and password. .El .Pp This keyword is only used for the .Em isp PPP interfaces. (optional) .It Li ppp-send-name The authentication name sent to the remote site. .Pp This keyword is only used if .Em ppp-send-auth has been set to pap or chap for an .Em isp PPP interface. (optional) .It Li ppp-send-password The secret used to prove the local site's authentity to the remote site. .Pp This keyword is only used if .Em ppp-send-auth has been set to pap or chap for an .Em isp PPP interface. (optional) .It Li ratetype The rate entry used from the rates file. (optional) .Pp For example, ratetype=0 selects lines beginning "ra0" in /etc/isdn/isdnd.rates; (typically ra0 lines are a set of tables for local call rates on different days of the week & times per day). .It Li recoverytime The time in seconds to wait between dial retries. (optional) .It Li remdial-handling is used to specify the dialout behavior in case more than one outgoing number is specified. The currently supported parameters are: .Pp .Bl -tag -width Ds -compact .It Ar first For every new (non-retry) call setup, start with the first number. .It Ar last For every new (non-retry) call setup, start with the last number with which a successful connection was made. .It Ar next For every new (non-retry) call setup, start with the next number which follows the last one used. .El .It Li remote-phone-dialout The remote telephone number used when the local site dials out. When dialing out to a remote site, the number specified here is put into the .Em "Called Party Number Information Element" . .Pp This keyword is mandatory for the .Em ipr interfaces. It may be specified more than once to try to dial to several numbers until one succeeds. .It Li remote-phone-incoming The remote telephone number used to verify an incoming call. When a remote site dials in, this number is used to verify that it is the correct remote site which is herewith authorized to connect into the local system. This parameter is compared against the .Em "Calling Party Number Information Element" got from the telephone exchange. .Pp This keyword is mandatory for the ipr interfaces. .Pp This keyword may have a wildcard parameter '*' to permit anyone dialing in. .It Li unitlength The length of a charging unit in seconds. This is used in conjunction with the idletime to decide when to hang up a connection. (optional) .It Li unitlengthsrc This keyword is used to specify from which source .Xr isdnd 8 takes the unitlength for short-hold mode. The currently configurable values are: .Pp .Bl -tag -width Ds -compact .It Ar none Then unitlength is not specified anywhere. .It Ar cmdl Use the unitlength specified on the command line. .It Ar conf Use the unitlength specified in the configuration file with the keyword .Em unitlength . .It Ar rate Use the unitlength from the ratesfile specified in the configuration file with the keyword .Em ratetype . .It Ar aocd Use a dynamically calculated unitlength in case AOCD is subscribed on the ISDN line. (AOCD is an acronym for ``Advice Of Charge During the call'' which is a service provided by the telecommunications (ie phone) provider, to indicate billable units). .El .It Li usrdevicename Specifies the user-land interface which is used for interfacing ISDN B channel data to the user-land. The keyword is mandatory. This keyword accepts the following parameters: .Pp .Bl -tag -width Ds -compact .It Ar ipr This parameter configures a raw HDLC IP over ISDN interface. .It Ar isp This parameter configures a synchronous PPP over ISDN interface. .It Ar rbch This specifies a Raw B CHannel access interface. .It Ar tel ISDN telephony. .It Ar ing configures a ISDN B-channel to NetGraph interface. .El .It Li usrdeviceunit Specifies the unit number for the device which is specified with usrdevicename. .It Li usedown is used to enable the use of the keywords .Em downtries and .Em downtime in the entries section(s). It is used in the .Nm isdnd daemon to dynamically enable and disable the IP interfaces to avoid excessive dialing activities in case of transient failures (such as busy lines). This parameter is optional and is set to .Em off by default. .It Li valid .Em Note : this feature is considered experimental! The parameter to this keyword is a string specifying a time range within which this entry is valid. The time specification consists of a list of weekdays and/or a holiday indicator ( see also the .Em holidayfile keyword in the system section ) separated by commas followed by an optional daytime range specification in the form hh:mm-hh:mm. The weekdays are specified as numbers from 0 to 6 and the number 7 for holidays: .Pp .Bl -tag -width Ds -compact .It Ar 0 Sunday .It Ar 1 Monday .It Ar 2 Tuesday .It Ar 3 Wednesday .It Ar 4 Thursday .It Ar 5 Friday .It Ar 6 Saturday .It Ar 7 a Holiday .El .Pp The following examples describe the "T-ISDN xxl" tariff of the german Telekom: .Bl -tag -width Ds -compact .It Ar 1,2,3,4,5,6,09:00-18:00 Monday through Saturday, daytime 9:00 to 18:00 .It Ar 1,2,3,4,5,6,18:00-9:00 Monday through Saturday, nighttime 18:00 to 9:00 .It Ar 0,7 Sunday and on holidays, all 24 hours .El .Pp The use of this keyword is optional. .El .El .Sh IDLETIME CALCULATION AND SHORT-HOLD MODE .Bl -tag -width "incoming calls .It Li incoming calls It is assumed that the calling side knows most about charging structures and such and as a consequence only the keyword .Em idletime-incoming has a function for incoming calls. .Pp For incoming calls the line is constantly monitored, and in case there was not traffic taking place for the time in seconds specified by .Em idletime-incoming the call is closed. .Pp Typically, .Em idletime-incoming is used as a last resort and is therefore set much higher than a charging unit time: typical values are one to five minutes. .It Li outgoing calls Outgoing call disconnect time can be setup in one of three ways: .Bl -tag -width "shorthold mode .It Li simple mode For simple mode, the .Em idle-algorithm-outgoing must be .Em fix-unit-size and the selected .Em unitlength must be 0 (zero) and .Em idletime-outgoing greater zero. .Pp The outgoing traffic is constantly monitored, and in case there was not traffic taking place for the time in seconds specified by .Em idletime-outgoing the call is closed. .Pp Typical values in simple mode are 10 to 30 seconds. .It Li shorthold mode for fixed unit charging For shorthold mode, the .Em idle-algorithm-outgoing must be .Em fix-unit-size and the selected .Em unitlength and .Em idletime-outgoing must be greater than 0 (zero); .Em earlyhangup must be >= 0 (zero). .Bd -literal |||| | | | | +------------------+-------------+--------------+ | | | | | |<-idle-time->|| |<--------------unitlength--------------------->| .Ed .Pp During the unchecked window which is (unitlength - (idle-time+earlyhangup)) in length, no idle check is done. After the unchecked window has ended, the line is checked for idle-time length if no traffic takes place. In case there was traffic detected in the check-window, the same procedure is restarted at the beginning of the next unit. In case no traffic was detected during the check-window, the line is closed at the end of the check window. .Pp Notice: .Em unitlength must (!) be greater than the sum of .Em idletime-outgoing and .Em earlyhangup ! .It Li shorthold mode for variable unit charging For shorthold mode, the .Em idle-algorithm-outgoing must be .Em var-unit-size and the selected .Em unitlength and .Em idletime-outgoing must be greater than 0 (zero); .Pp This shorthold mode is suitable when your calls are billed on the elapse time of the call plus a fixed connection charge. For example British Telecom bill this way. .Pp Each call is divided into two periods, the first is the .Em unchecked period and the second is the .Em checked . The .Em checked period starts 1 second before the first units time expires. .Pp During the .Em checked period if there is no traffic for .Em idle-time seconds the call is disconnected. .Pp .Bd -literal |<---unchecked------------------>|<------checked------> +------------------+-------------+ | |<-idle-time->| |<--------------unitlength------->| .Ed .Pp Experience shows that useful values for idle-time are from 15 to 30 seconds. .Pp If idle-time is too short an application that is not yet finished with the network will cause a new call to be placed. .Pp .El .El .Pp .Sh FILES .Bl -tag -width /etc/isdn/isdnd.rc -compact .It Pa /etc/isdn/isdnd.rc The default configuration file for the .Nm isdnd ISDN daemon. .El .Sh SEE ALSO .Xr regex 3 , .Xr re_format 7 , .Xr isdnd 8 , .Xr isdnmonitor 8 .Sh AUTHORS .An -nosplit The .Xr isdnd 8 daemon and this manual page were written by -.An Hellmuth Michaelis Aq hm@kts.org . +.An Hellmuth Michaelis Aq hm@freebsd.org . .Pp Additions to this manual page by .An Barry Scott Aq barry@scottb.demon.co.uk . diff --git a/usr.sbin/i4b/isdnd/monitor.c b/usr.sbin/i4b/isdnd/monitor.c index 2b730663c478..bd934d1bb9a7 100644 --- a/usr.sbin/i4b/isdnd/monitor.c +++ b/usr.sbin/i4b/isdnd/monitor.c @@ -1,1289 +1,1286 @@ /* * Copyright (c) 1998,1999 Martin Husemann. 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 author nor the names of any co-contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * 4. Altered versions must be plainly marked as such, and must not be * misrepresented as being the original software and/or documentation. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. * *--------------------------------------------------------------------------- * * i4b daemon - network monitor server module * ------------------------------------------ * * $Id: monitor.c,v 1.30 2000/10/09 12:53:29 hm Exp $ * * $FreeBSD$ * * last edit-date: [Mon Dec 13 21:47:44 1999] * *---------------------------------------------------------------------------*/ #include "isdnd.h" #ifndef I4B_EXTERNAL_MONITOR /* * dummy version of routines needed by config file parser * (config files should be valid with and without external montioring * support compiled into the daemon) */ void monitor_clear_rights() { } int monitor_start_rights(const char *clientspec) { return I4BMAR_OK; } void monitor_add_rights(int rights_mask) { } void monitor_fixup_rights() { } #else #include "monitor.h" #include #include #ifndef I4B_NOTCPIP_MONITOR #include #include #include #endif static TAILQ_HEAD(rights_q, monitor_rights) rights = TAILQ_HEAD_INITIALIZER(rights); static struct monitor_rights * local_rights = NULL; /* entry for local socket */ /* for each active monitor connection we have one of this: */ struct monitor_connection { TAILQ_ENTRY(monitor_connection) connections; int sock; /* socket for this connection */ int rights; /* active rights for this connection */ int events; /* bitmask of events client is interested in */ char source[FILENAME_MAX]; }; static TAILQ_HEAD(connections_tq, monitor_connection) connections = TAILQ_HEAD_INITIALIZER(connections); /* local prototypes */ static int cmp_rights(const struct monitor_rights *pa, const struct monitor_rights *pb); static int monitor_command(struct monitor_connection *con, int fd, int rights); static void cmd_dump_rights(int fd, int rights, u_int8_t *cmd, const char * source); static void cmd_dump_mcons(int fd, int rights, u_int8_t *cmd, const char * source); static void cmd_reread_cfg(int fd, int rights, u_int8_t *cmd, const char * source); static void cmd_hangup(int fd, int rights, u_int8_t *cmd, const char * source); static void monitor_broadcast(int mask, u_int8_t *pkt, size_t bytes); static int anybody(int mask); static void hangup_channel(int controller, int channel, const char *source); static ssize_t sock_read(int fd, void *buf, size_t nbytes); static ssize_t sock_write(int fd, void *buf, size_t nbytes); /* * Due to the way we structure config files, the rights for an external * monitor might be stated in multiple steps. First a call to * monitor_start_rights opens an entry. Further (optional) calls to * montior_add_rights assemble additional rights for this "current" * entry. When closing the sys-file section of the config file, the * "current" entry becomes invalid. */ static struct monitor_rights * cur_add_entry = NULL; /*--------------------------------------------------------------------------- * Initialize the monitor server module. This affects only active * connections, the access rights are not modified here! *---------------------------------------------------------------------------*/ void monitor_init(void) { struct monitor_connection * con; accepted = 0; while ((con = TAILQ_FIRST(&connections)) != NULL) { TAILQ_REMOVE(&connections, con, connections); free(con); } } /*--------------------------------------------------------------------------- * Prepare for exit *---------------------------------------------------------------------------*/ void monitor_exit(void) { struct monitor_connection *c; /* Close all open connections. */ while((c = TAILQ_FIRST(&connections)) != NULL) { close(c->sock); TAILQ_REMOVE(&connections, c, connections); free(c); } } /*--------------------------------------------------------------------------- * Initialize access rights. No active connections are affected! *---------------------------------------------------------------------------*/ void monitor_clear_rights(void) { struct monitor_rights *r; while ((r = TAILQ_FIRST(&rights)) != NULL) { TAILQ_REMOVE(&rights, r, list); free(r); } cur_add_entry = NULL; local_rights = NULL; } /*--------------------------------------------------------------------------- * Add an entry to the access lists. The clientspec either is * the name of the local socket or a host- or networkname or * numeric ip/host-bit-len spec. *---------------------------------------------------------------------------*/ int monitor_start_rights(const char *clientspec) { struct monitor_rights r; /* initialize the new rights entry */ memset(&r, 0, sizeof r); /* check clientspec */ if (*clientspec == '/') { struct sockaddr_un sa; /* this is a local socket spec, check if we already have one */ if (local_rights != NULL) return I4BMAR_DUP; /* does it fit in a local socket address? */ if (strlen(clientspec) > sizeof sa.sun_path) return I4BMAR_LENGTH; r.local = 1; strcpy(r.name, clientspec); #ifndef I4B_NOTCPIP_MONITOR } else { /* remote entry, parse host/net and cidr */ struct monitor_rights * rp; char hostname[FILENAME_MAX]; char *p; p = strchr(clientspec, '/'); if (!p) { struct hostent *host; u_int32_t hn; /* must be a host spec */ r.mask = ~0; host = gethostbyname(clientspec); if (!host) return I4BMAR_NOIP; memcpy(&hn, host->h_addr_list[0], sizeof hn); r.net = (u_int32_t)ntohl(hn); } else if(p[1]) { /* must be net/cidr spec */ int l; struct netent *net; u_int32_t s = ~0U; int num = strtol(p+1, NULL, 10); if (num < 0 || num > 32) return I4BMAR_CIDR; s >>= num; s ^= ~0U; l = p - clientspec; if (l >= sizeof hostname) return I4BMAR_LENGTH; strncpy(hostname, clientspec, l); hostname[l] = '\0'; net = getnetbyname(hostname); if (net == NULL) r.net = (u_int32_t)inet_network(hostname); else r.net = (u_int32_t)net->n_net; r.mask = s; r.net &= s; } else { return I4BMAR_CIDR; } /* check for duplicate entry */ for (rp = TAILQ_FIRST(&rights); rp != NULL; rp = TAILQ_NEXT(rp, list)) { if (rp->mask == r.mask && rp->net == r.net && rp->local == r.local) { return I4BMAR_DUP; } } #endif } r.rights = 0; /* entry ok, add it to the collection */ cur_add_entry = malloc(sizeof(r)); memcpy(cur_add_entry, &r, sizeof(r)); TAILQ_INSERT_TAIL(&rights, cur_add_entry, list); if(r.local) local_rights = cur_add_entry; DBGL(DL_RCCF, (log(LL_DBG, "system: monitor = %s", clientspec))); return I4BMAR_OK; } /*--------------------------------------------------------------------------- * Add rights to the currently constructed entry - if any. *---------------------------------------------------------------------------*/ void monitor_add_rights(int rights_mask) { if(cur_add_entry == NULL) return; /* noone under construction */ cur_add_entry->rights |= rights_mask; DBGL(DL_RCCF, (log(LL_DBG, "system: monitor-access = 0x%x", rights_mask))); } /*--------------------------------------------------------------------------- * All rights have been added now. Sort the to get most specific * host/net masks first, so we can travel the list and use the first * match for actual rights. *---------------------------------------------------------------------------*/ void monitor_fixup_rights(void) { struct monitor_rights * cur, * test, * next; /* no more rights may be added to the current entry */ cur_add_entry = NULL; /* sort the rights */ for (next = NULL, cur = TAILQ_FIRST(&rights); cur != NULL; cur = next) { next = TAILQ_NEXT(cur, list); for (test = TAILQ_FIRST(&rights); test != NULL && test != cur; test = TAILQ_NEXT(test, list)) { if (cmp_rights(cur, test) > 0) { /* move cur up the list and insert before test */ TAILQ_REMOVE(&rights, cur, list); if (test == TAILQ_FIRST(&rights)) TAILQ_INSERT_HEAD(&rights, cur, list); else TAILQ_INSERT_BEFORE(test, cur, list); break; } } } } /*--------------------------------------------------------------------------- * comparator for rights *---------------------------------------------------------------------------*/ static int cmp_rights(const struct monitor_rights *pa, const struct monitor_rights *pb) { u_int32_t mask; /* local sorts first */ if (pa->local) return -1; /* which is the less specific netmask? */ mask = pa->mask; if ((pb->mask & mask) == 0) mask = pb->mask; /* are the entries disjunct? */ if ((pa->net & mask) != (pb->net & mask)) { /* simply compare net part of address */ return ((pa->net & mask) < (pb->net & mask)) ? -1 : 1; } /* One entry is part of the others net. We already now "mask" is * the netmask of the less specific (i.e. greater) one */ return (pa->mask == mask) ? 1 : -1; } #ifndef I4B_NOTCPIP_MONITOR /*--------------------------------------------------------------------------- * Check if access rights for a remote socket are specified and * create this socket. Return -1 otherwise. *---------------------------------------------------------------------------*/ int monitor_create_remote_socket(int portno) { struct sockaddr_in sa; int val; int remotesockfd; remotesockfd = socket(AF_INET, SOCK_STREAM, 0); if(remotesockfd == -1) { log(LL_MER, "could not create remote monitor socket: %s", strerror(errno)); return(-1); } val = 1; if(setsockopt(remotesockfd, SOL_SOCKET, SO_REUSEADDR, &val, sizeof val)) { log(LL_MER, "could not setsockopt: %s", strerror(errno)); return(-1); } memset(&sa, 0, sizeof sa); sa.sin_len = sizeof sa; sa.sin_family = AF_INET; sa.sin_port = htons(portno); sa.sin_addr.s_addr = htonl(INADDR_ANY); if(bind(remotesockfd, (struct sockaddr *)&sa, sizeof sa) == -1) { log(LL_MER, "could not bind remote monitor socket to port %d: %s", portno, strerror(errno)); return(-1); } if(listen(remotesockfd, 0)) { log(LL_MER, "could not listen on monitor socket: %s", strerror(errno)); return(-1); } return(remotesockfd); } #endif /*--------------------------------------------------------------------------- * Check if access rights for a local socket are specified and * create this socket. Return -1 otherwise. *---------------------------------------------------------------------------*/ int monitor_create_local_socket(void) { int s; struct sockaddr_un sa; /* check for a local entry */ if (local_rights == NULL) return(-1); /* create and setup socket */ s = socket(AF_LOCAL, SOCK_STREAM, 0); if (s == -1) { log(LL_MER, "could not create local monitor socket, errno = %d", errno); return(-1); } unlink(local_rights->name); memset(&sa, 0, sizeof sa); sa.sun_len = sizeof sa; sa.sun_family = AF_LOCAL; strcpy(sa.sun_path, local_rights->name); if (bind(s, (struct sockaddr *)&sa, SUN_LEN(&sa))) { log(LL_MER, "could not bind local monitor socket [%s], errno = %d", local_rights->name, errno); return(-1); } chmod(local_rights->name, 0500); if (listen(s, 0)) { log(LL_MER, "could not listen on local monitor socket, errno = %d", errno); return(-1); } return(s); } /*--------------------------------------------------------------------------- * Prepare a fd_set for a select call. Add all our local * filedescriptors to the set, increment max_fd if appropriate. *---------------------------------------------------------------------------*/ void monitor_prepselect(fd_set *selset, int *max_fd) { struct monitor_connection * con; for (con = TAILQ_FIRST(&connections); con != NULL; con = TAILQ_NEXT(con, connections)) { int fd = con->sock; if (fd > *max_fd) *max_fd = fd; FD_SET(fd, selset); } } /*--------------------------------------------------------------------------- * Check if the result from a select call indicates something * to do for us. *---------------------------------------------------------------------------*/ void monitor_handle_input(fd_set *selset) { struct monitor_connection * con, * next; for (next = NULL, con = TAILQ_FIRST(&connections); con != NULL; con = next) { int fd = con->sock; next = TAILQ_NEXT(con, connections); if (FD_ISSET(fd, selset)) { /* handle command from this client */ if (monitor_command(con, fd, con->rights) != 0) { /* broken or closed connection */ char source[FILENAME_MAX]; strcpy(source, con->source); TAILQ_REMOVE(&connections, con, connections); free(con); log(LL_DMN, "monitor closed from %s", source ); } } } /* all connections gone? */ if (TAILQ_FIRST(&connections) == NULL) accepted = 0; } /*--------------------------------------------------------------------------- * Try new incoming connection on the given socket. * Setup client descriptor and send initial data. *---------------------------------------------------------------------------*/ void monitor_handle_connect(int sockfd, int is_local) { struct monitor_connection *con; struct monitor_rights *rp; #ifndef I4B_NOTCPIP_MONITOR struct sockaddr_in ia; u_int32_t ha = 0; #endif struct sockaddr_un ua; u_int8_t idata[I4B_MON_IDATA_SIZE]; int fd = -1, s, i, r_mask, t_events; char source[FILENAME_MAX]; /* accept the connection */ if(is_local) { s = sizeof ua; fd = accept(sockfd, (struct sockaddr *)&ua, &s); strcpy(source, "local"); #ifndef I4B_NOTCPIP_MONITOR } else { struct hostent *hp; s = sizeof ia; fd = accept(sockfd, (struct sockaddr *)&ia, &s); hp = gethostbyaddr((char *)&ia.sin_addr, 4, AF_INET); if(hp == NULL) snprintf(source, sizeof source, "%s (%s)", inet_ntoa(ia.sin_addr), inet_ntoa(ia.sin_addr)); else snprintf(source, sizeof source, "%s (%s)", hp->h_name, inet_ntoa(ia.sin_addr)); memcpy(&ha, &ia.sin_addr.s_addr, sizeof ha); ha = ntohl(ha); #endif } /* check the access rights of this connection */ r_mask = 0; for (rp = TAILQ_FIRST(&rights); rp != NULL; rp = TAILQ_NEXT(rp, list)) { if(rp->local) { if(is_local) { r_mask = rp->rights; break; } #ifndef I4B_NOTCPIP_MONITOR } else { if((ha & rp->mask) == rp->net) { r_mask = rp->rights; break; } #endif } } if(r_mask == 0) { /* no rights - go away */ log(LL_MER, "monitor access denied from %s", source); close(fd); return; } accepted = 1; con = malloc(sizeof(struct monitor_connection)); memset(con, 0, sizeof *con); TAILQ_INSERT_TAIL(&connections, con, connections); con->sock = fd; con->rights = r_mask; strcpy(con->source, source); log(LL_DMN, "monitor opened from %s rights 0x%x", source, r_mask); /* send initial data */ I4B_PREP_CMD(idata, I4B_MON_IDATA_CODE); I4B_PUT_2B(idata, I4B_MON_IDATA_VERSMAJOR, MPROT_VERSION); I4B_PUT_2B(idata, I4B_MON_IDATA_VERSMINOR, MPROT_REL); I4B_PUT_2B(idata, I4B_MON_IDATA_NUMCTRL, ncontroller); I4B_PUT_2B(idata, I4B_MON_IDATA_NUMENTR, nentries); I4B_PUT_4B(idata, I4B_MON_IDATA_CLACCESS, r_mask); if((sock_write(fd, idata, sizeof idata)) == -1) { log(LL_MER, "monitor_handle_connect: sock_write 1 error - %s", strerror(errno)); } for (i = 0; i < ncontroller; i++) { u_int8_t ictrl[I4B_MON_ICTRL_SIZE]; I4B_PREP_CMD(ictrl, I4B_MON_ICTRL_CODE); I4B_PUT_STR(ictrl, I4B_MON_ICTRL_NAME, name_of_controller(isdn_ctrl_tab[i].ctrl_type, isdn_ctrl_tab[i].card_type)); I4B_PUT_2B(ictrl, I4B_MON_ICTRL_BUSID, 0); I4B_PUT_4B(ictrl, I4B_MON_ICTRL_FLAGS, 0); I4B_PUT_4B(ictrl, I4B_MON_ICTRL_NCHAN, 2); if((sock_write(fd, ictrl, sizeof ictrl)) == -1) { log(LL_MER, "monitor_handle_connect: sock_write 2 error - %s", strerror(errno)); } } /* send device names from entries */ for(i=0; i < nentries; i++) /* walk thru all entries */ { u_int8_t ictrl[I4B_MON_IDEV_SIZE]; cfg_entry_t *p; char nbuf[64]; p = &cfg_entry_tab[i]; /* get ptr to enry */ snprintf(nbuf, sizeof(nbuf), "%s%d ", bdrivername(p->usrdevicename), p->usrdeviceunit); I4B_PREP_CMD(ictrl, I4B_MON_IDEV_CODE); /*XXX*/ I4B_PUT_2B(ictrl, I4B_MON_IDEV_STATE, 1); I4B_PUT_STR(ictrl, I4B_MON_IDEV_NAME, nbuf); if((sock_write(fd, ictrl, sizeof ictrl)) == -1) { log(LL_MER, "monitor_handle_connect: sock_write 3 error - %s", strerror(errno)); } } /*XXX*/ t_events = con->events; /*XXX*/ con->events = -1; /* current state of controller(s) */ for(i=0; i < ncontroller; i++) { monitor_evnt_tei(i, isdn_ctrl_tab[i].tei); monitor_evnt_l12stat(i, LAYER_ONE, isdn_ctrl_tab[i].l1stat); monitor_evnt_l12stat(i, LAYER_TWO, isdn_ctrl_tab[i].l2stat); } /* current state of entries */ for(i=0; i < nentries; i++) { cfg_entry_t *cep = &cfg_entry_tab[i]; if(cep->state == ST_CONNECTED) { monitor_evnt_connect(cep); monitor_evnt_acct(cep); monitor_evnt_charge(cep, cep->charge, 1); } } /*XXX*/ con->events = t_events; } /*--------------------------------------------------------------------------- * dump all monitor rights *---------------------------------------------------------------------------*/ static void cmd_dump_rights(int fd, int r_mask, u_int8_t *cmd, const char *source) { struct monitor_rights * r; int num_rights; u_int8_t drini[I4B_MON_DRINI_SIZE]; u_int8_t dr[I4B_MON_DR_SIZE]; for (num_rights = 0, r = TAILQ_FIRST(&rights); r != NULL; r = TAILQ_NEXT(r, list)) num_rights++; I4B_PREP_EVNT(drini, I4B_MON_DRINI_CODE); I4B_PUT_2B(drini, I4B_MON_DRINI_COUNT, num_rights); if((sock_write(fd, drini, sizeof drini)) == -1) { log(LL_MER, "cmd_dump_rights: sock_write 1 error - %s", strerror(errno)); } for (r = TAILQ_FIRST(&rights); r != NULL; r = TAILQ_NEXT(r, list)) { I4B_PREP_EVNT(dr, I4B_MON_DR_CODE); I4B_PUT_4B(dr, I4B_MON_DR_RIGHTS, r->rights); I4B_PUT_4B(dr, I4B_MON_DR_NET, r->net); I4B_PUT_4B(dr, I4B_MON_DR_MASK, r->mask); I4B_PUT_1B(dr, I4B_MON_DR_LOCAL, r->local); if((sock_write(fd, dr, sizeof dr)) == -1) { log(LL_MER, "cmd_dump_rights: sock_write 2 error - %s", strerror(errno)); } } } /*--------------------------------------------------------------------------- * rescan config file *---------------------------------------------------------------------------*/ static void cmd_reread_cfg(int fd, int rights, u_int8_t *cmd, const char * source) { rereadconfig(42); } /*--------------------------------------------------------------------------- * drop one connection *---------------------------------------------------------------------------*/ static void cmd_hangup(int fd, int rights, u_int8_t *cmd, const char * source) { int channel = I4B_GET_4B(cmd, I4B_MON_HANGUP_CHANNEL); int ctrl = I4B_GET_4B(cmd, I4B_MON_HANGUP_CTRL); hangup_channel(ctrl, channel, source); } /*--------------------------------------------------------------------------- * dump all active monitor connections *---------------------------------------------------------------------------*/ static void cmd_dump_mcons(int fd, int rights, u_int8_t *cmd, const char * source) { int num_connections; struct monitor_connection *con; u_int8_t dcini[I4B_MON_DCINI_SIZE]; for (num_connections = 0, con = TAILQ_FIRST(&connections); con != NULL; con = TAILQ_NEXT(con, connections)) num_connections++; I4B_PREP_EVNT(dcini, I4B_MON_DCINI_CODE); I4B_PUT_2B(dcini, I4B_MON_DCINI_COUNT, num_connections); if((sock_write(fd, dcini, sizeof dcini)) == -1) { log(LL_MER, "cmd_dump_mcons: sock_write 1 error - %s", strerror(errno)); } for (con = TAILQ_FIRST(&connections); con != NULL; con = TAILQ_NEXT(con, connections)) { #ifndef I4B_NOTCPIP_MONITOR int namelen; struct sockaddr_in name; #endif u_int8_t dc[I4B_MON_DC_SIZE]; I4B_PREP_EVNT(dc, I4B_MON_DC_CODE); I4B_PUT_4B(dc, I4B_MON_DC_RIGHTS, con->rights); #ifndef I4B_NOTCPIP_MONITOR namelen = sizeof name; if (getpeername(con->sock, (struct sockaddr*)&name, &namelen) == 0) memcpy(dc+I4B_MON_DC_WHO, &name.sin_addr, sizeof name.sin_addr); #endif if((sock_write(fd, dc, sizeof dc)) == -1) { log(LL_MER, "cmd_dump_mcons: sock_write 2 error - %s", strerror(errno)); } } } /*--------------------------------------------------------------------------- * Handle a command from the given socket. The client * has rights as specified in the rights parameter. * Return non-zero if connection is closed. *---------------------------------------------------------------------------*/ static int monitor_command(struct monitor_connection * con, int fd, int rights) { char cmd[I4B_MAX_MON_CLIENT_CMD]; u_int code; /* command dispatch table */ typedef void (*cmd_func_t)(int fd, int rights, u_int8_t *cmd, const char *source); static struct { cmd_func_t call; /* function to execute */ u_int rights; /* necessary rights */ } cmd_tab[] = { /* 0 */ { NULL, 0 }, /* 1 */ { cmd_dump_rights, I4B_CA_COMMAND_FULL }, /* 2 */ { cmd_dump_mcons, I4B_CA_COMMAND_FULL }, /* 3 */ { cmd_reread_cfg, I4B_CA_COMMAND_FULL }, /* 4 */ { cmd_hangup, I4B_CA_COMMAND_FULL }, }; #define NUMCMD (sizeof cmd_tab / sizeof cmd_tab[0]) u_long u; int bytes; /* Network transfer may deliver two or more packets concatenated. * Peek at the header and read only one event at a time... */ ioctl(fd, FIONREAD, &u); if (u < I4B_MON_CMD_HDR) { if (u == 0) { /* log(LL_MER, "monitor read 0 bytes"); */ /* socket closed by peer */ close(fd); return 1; } return 0; /* not enough data there yet */ } bytes = recv(fd, cmd, I4B_MON_CMD_HDR, MSG_PEEK); if (bytes < I4B_MON_CMD_HDR) { log(LL_MER, "monitor read only %d bytes", bytes); return 0; /* errh? something must be wrong... */ } bytes = I4B_GET_2B(cmd, I4B_MON_CMD_LEN); if (bytes >= sizeof cmd) { close(fd); log(LL_MER, "monitor: garbage on connection"); return 1; } /* now we know the size, it fits, so lets read it! */ if(sock_read(fd, cmd, bytes) <= 0) { log(LL_MER, "monitor: sock_read <= 0"); close(fd); return 1; } /* decode command */ code = I4B_GET_2B(cmd, I4B_MON_CMD); /* special case: may modify our connection descriptor, is * beyound all rights checks */ if (code == I4B_MON_CCMD_SETMASK) { /*XXX*/ /* u_int major = I4B_GET_2B(cmd, I4B_MON_ICLIENT_VERMAJOR); u_int minor = I4B_GET_2B(cmd, I4B_MON_ICLIENT_VERMINOR); */ int events = I4B_GET_4B(cmd, I4B_MON_ICLIENT_EVENTS); con->events = events & rights; return 0; } if (code < 0 || code >= NUMCMD) { log(LL_MER, "illegal command from client, code = %d\n", code); return 0; } if (cmd_tab[code].call == NULL) return 0; if ((cmd_tab[code].rights & rights) == cmd_tab[code].rights) cmd_tab[code].call(fd, rights, cmd, con->source); return 0; } /*--------------------------------------------------------------------------- * Check if somebody would receive an event with this mask. * We are lazy and try to avoid assembling unneccesary packets. * Return 0 if no one interested, nonzero otherwise. *---------------------------------------------------------------------------*/ static int anybody(int mask) { struct monitor_connection * con; for (con = TAILQ_FIRST(&connections); con != NULL; con = TAILQ_NEXT(con, connections)) { if ((con->events & mask) == mask) return 1; } return 0; } /*--------------------------------------------------------------------------- * exec hangup command *---------------------------------------------------------------------------*/ static void hangup_channel(int controller, int channel, const char *source) { cfg_entry_t * cep = NULL; + int i; if(controller < ncontroller) { if(isdn_ctrl_tab[controller].state != CTRL_UP) return; - if(isdn_ctrl_tab[controller].stateb1 != CHAN_IDLE) + for (i = 0; i < isdn_ctrl_tab[controller].nbch; i++) { - cep = get_cep_by_cc(controller, 0); - if (cep != NULL && cep->isdnchannelused == channel && - cep->isdncontrollerused == controller) - goto found; - } - if(isdn_ctrl_tab[controller].stateb2 != CHAN_IDLE) + if(isdn_ctrl_tab[controller].stateb[i] != CHAN_IDLE) { - cep = get_cep_by_cc(controller, 1); + cep = get_cep_by_cc(controller, i); if (cep != NULL && cep->isdnchannelused == channel && cep->isdncontrollerused == controller) goto found; + } } } /* not found */ return; found: log(LL_CHD, "%05d %s manual disconnect (remote from %s)", cep->cdid, cep->name, source); cep->hangup = 1; return; } /*--------------------------------------------------------------------------- * Send an event to every connection interested in this kind of * event *---------------------------------------------------------------------------*/ static void monitor_broadcast(int mask, u_int8_t *pkt, size_t bytes) { struct monitor_connection *con; for (con = TAILQ_FIRST(&connections); con != NULL; con = TAILQ_NEXT(con, connections)) { if ((con->events & mask) == mask) { int fd = con->sock; if((sock_write(fd, pkt, bytes)) == -1) { log(LL_MER, "monitor_broadcast: sock_write error - %s", strerror(errno)); } } } } /*--------------------------------------------------------------------------- * Post a logfile event *---------------------------------------------------------------------------*/ void monitor_evnt_log(int prio, const char * what, const char * msg) { u_int8_t evnt[I4B_MON_LOGEVNT_SIZE]; time_t now; if (!anybody(I4B_CA_EVNT_I4B)) return; time(&now); I4B_PREP_EVNT(evnt, I4B_MON_LOGEVNT_CODE); I4B_PUT_4B(evnt, I4B_MON_LOGEVNT_TSTAMP, (long)now); I4B_PUT_4B(evnt, I4B_MON_LOGEVNT_PRIO, prio); I4B_PUT_STR(evnt, I4B_MON_LOGEVNT_WHAT, what); I4B_PUT_STR(evnt, I4B_MON_LOGEVNT_MSG, msg); monitor_broadcast(I4B_CA_EVNT_I4B, evnt, sizeof evnt); } /*--------------------------------------------------------------------------- * Post a charging event on the connection described * by the given config entry. *---------------------------------------------------------------------------*/ void monitor_evnt_charge(cfg_entry_t *cep, int units, int estimate) { int mask; time_t now; u_int8_t evnt[I4B_MON_CHRG_SIZE]; mask = (cep->direction == DIR_IN) ? I4B_CA_EVNT_CALLIN : I4B_CA_EVNT_CALLOUT; if(!anybody(mask)) return; time(&now); I4B_PREP_EVNT(evnt, I4B_MON_CHRG_CODE); I4B_PUT_4B(evnt, I4B_MON_CHRG_TSTAMP, (long)now); I4B_PUT_4B(evnt, I4B_MON_CHRG_CTRL, cep->isdncontrollerused); I4B_PUT_4B(evnt, I4B_MON_CHRG_CHANNEL, cep->isdnchannelused); I4B_PUT_4B(evnt, I4B_MON_CHRG_UNITS, units); I4B_PUT_4B(evnt, I4B_MON_CHRG_ESTIMATED, estimate ? 1 : 0); monitor_broadcast(mask, evnt, sizeof evnt); } /*--------------------------------------------------------------------------- * Post a connection event *---------------------------------------------------------------------------*/ void monitor_evnt_connect(cfg_entry_t *cep) { u_int8_t evnt[I4B_MON_CONNECT_SIZE]; char devname[I4B_MAX_MON_STRING]; int mask; time_t now; mask = (cep->direction == DIR_IN) ? I4B_CA_EVNT_CALLIN : I4B_CA_EVNT_CALLOUT; if (!anybody(mask)) return; time(&now); snprintf(devname, sizeof devname, "%s%d", bdrivername(cep->usrdevicename), cep->usrdeviceunit); I4B_PREP_EVNT(evnt, I4B_MON_CONNECT_CODE); I4B_PUT_4B(evnt, I4B_MON_CONNECT_TSTAMP, (long)now); I4B_PUT_4B(evnt, I4B_MON_CONNECT_DIR, cep->direction == DIR_OUT ? 1 : 0); I4B_PUT_4B(evnt, I4B_MON_CONNECT_CTRL, cep->isdncontrollerused); I4B_PUT_4B(evnt, I4B_MON_CONNECT_CHANNEL, cep->isdnchannelused); I4B_PUT_STR(evnt, I4B_MON_CONNECT_CFGNAME, cep->name); I4B_PUT_STR(evnt, I4B_MON_CONNECT_DEVNAME, devname); if(cep->direction == DIR_OUT) { I4B_PUT_STR(evnt, I4B_MON_CONNECT_REMPHONE, cep->remote_phone_dialout); I4B_PUT_STR(evnt, I4B_MON_CONNECT_LOCPHONE, cep->local_phone_dialout); } else { I4B_PUT_STR(evnt, I4B_MON_CONNECT_REMPHONE, cep->real_phone_incoming); I4B_PUT_STR(evnt, I4B_MON_CONNECT_LOCPHONE, cep->local_phone_incoming); } monitor_broadcast(mask, evnt, sizeof evnt); } /*--------------------------------------------------------------------------- * Post a disconnect event *---------------------------------------------------------------------------*/ void monitor_evnt_disconnect(cfg_entry_t *cep) { u_int8_t evnt[I4B_MON_DISCONNECT_SIZE]; int mask; time_t now; mask = (cep->direction == DIR_IN) ? I4B_CA_EVNT_CALLIN : I4B_CA_EVNT_CALLOUT; if (!anybody(mask)) return; time(&now); I4B_PREP_EVNT(evnt, I4B_MON_DISCONNECT_CODE); I4B_PUT_4B(evnt, I4B_MON_DISCONNECT_TSTAMP, (long)now); I4B_PUT_4B(evnt, I4B_MON_DISCONNECT_CTRL, cep->isdncontrollerused); I4B_PUT_4B(evnt, I4B_MON_DISCONNECT_CHANNEL, cep->isdnchannelused); monitor_broadcast(mask, evnt, sizeof evnt); } /*--------------------------------------------------------------------------- * Post an up/down event *---------------------------------------------------------------------------*/ void monitor_evnt_updown(cfg_entry_t *cep, int up) { u_int8_t evnt[I4B_MON_UPDOWN_SIZE]; int mask; time_t now; mask = (cep->direction == DIR_IN) ? I4B_CA_EVNT_CALLIN : I4B_CA_EVNT_CALLOUT; if (!anybody(mask)) return; time(&now); I4B_PREP_EVNT(evnt, I4B_MON_UPDOWN_CODE); I4B_PUT_4B(evnt, I4B_MON_UPDOWN_TSTAMP, (long)now); I4B_PUT_4B(evnt, I4B_MON_UPDOWN_CTRL, cep->isdncontrollerused); I4B_PUT_4B(evnt, I4B_MON_UPDOWN_CHANNEL, cep->isdnchannelused); I4B_PUT_4B(evnt, I4B_MON_UPDOWN_ISUP, up); monitor_broadcast(mask, evnt, sizeof evnt); } /*--------------------------------------------------------------------------- * Post a Layer1/2 status change event *---------------------------------------------------------------------------*/ void monitor_evnt_l12stat(int controller, int layer, int state) { u_int8_t evnt[I4B_MON_L12STAT_SIZE]; time_t now; if(!anybody(I4B_CA_EVNT_I4B)) return; time(&now); I4B_PREP_EVNT(evnt, I4B_MON_L12STAT_CODE); I4B_PUT_4B(evnt, I4B_MON_L12STAT_TSTAMP, (long)now); I4B_PUT_4B(evnt, I4B_MON_L12STAT_CTRL, controller); I4B_PUT_4B(evnt, I4B_MON_L12STAT_LAYER, layer); I4B_PUT_4B(evnt, I4B_MON_L12STAT_STATE, state); monitor_broadcast(I4B_CA_EVNT_I4B, evnt, sizeof evnt); } /*--------------------------------------------------------------------------- * Post a TEI change event *---------------------------------------------------------------------------*/ void monitor_evnt_tei(int controller, int tei) { u_int8_t evnt[I4B_MON_TEI_SIZE]; time_t now; if(!anybody(I4B_CA_EVNT_I4B)) return; time(&now); I4B_PREP_EVNT(evnt, I4B_MON_TEI_CODE); I4B_PUT_4B(evnt, I4B_MON_TEI_TSTAMP, (long)now); I4B_PUT_4B(evnt, I4B_MON_TEI_CTRL, controller); I4B_PUT_4B(evnt, I4B_MON_TEI_TEI, tei); monitor_broadcast(I4B_CA_EVNT_I4B, evnt, sizeof evnt); } /*--------------------------------------------------------------------------- * Post an accounting event *---------------------------------------------------------------------------*/ void monitor_evnt_acct(cfg_entry_t *cep) { u_int8_t evnt[I4B_MON_ACCT_SIZE]; time_t now; if(!anybody(I4B_CA_EVNT_I4B)) return; time(&now); I4B_PREP_EVNT(evnt, I4B_MON_ACCT_CODE); I4B_PUT_4B(evnt, I4B_MON_ACCT_TSTAMP, (long)now); I4B_PUT_4B(evnt, I4B_MON_ACCT_CTRL, cep->isdncontrollerused); I4B_PUT_4B(evnt, I4B_MON_ACCT_CHAN, cep->isdnchannelused); I4B_PUT_4B(evnt, I4B_MON_ACCT_OBYTES, cep->outbytes); I4B_PUT_4B(evnt, I4B_MON_ACCT_OBPS, cep->outbps); I4B_PUT_4B(evnt, I4B_MON_ACCT_IBYTES, cep->inbytes); I4B_PUT_4B(evnt, I4B_MON_ACCT_IBPS, cep->inbps); monitor_broadcast(I4B_CA_EVNT_I4B, evnt, sizeof evnt); } /*--------------------------------------------------------------------------- * read from a socket *---------------------------------------------------------------------------*/ static ssize_t sock_read(int fd, void *buf, size_t nbytes) { size_t nleft; ssize_t nread; unsigned char *ptr; ptr = buf; nleft = nbytes; while(nleft > 0) { if((nread = read(fd, ptr, nleft)) < 0) { if(errno == EINTR) { nread = 0; } else { return(-1); } } else if(nread == 0) { break; /* EOF */ } nleft -= nread; ptr += nread; } return(nbytes - nleft); } /*--------------------------------------------------------------------------- * write to a socket *---------------------------------------------------------------------------*/ static ssize_t sock_write(int fd, void *buf, size_t nbytes) { size_t nleft; ssize_t nwritten; unsigned char *ptr; ptr = buf; nleft = nbytes; while(nleft > 0) { if((nwritten = write(fd, ptr, nleft)) <= 0) { if(errno == EINTR) { nwritten = 0; } else { return(-1); } } nleft -= nwritten; ptr += nwritten; } return(nbytes); } struct monitor_rights * monitor_next_rights(const struct monitor_rights *r) { if (r == NULL) return TAILQ_FIRST(&rights); else return TAILQ_NEXT(r, list); } #endif /* I4B_EXTERNAL_MONITOR */ diff --git a/usr.sbin/i4b/isdnd/rc_config.c b/usr.sbin/i4b/isdnd/rc_config.c index 26117438fef4..0b63a09009a9 100644 --- a/usr.sbin/i4b/isdnd/rc_config.c +++ b/usr.sbin/i4b/isdnd/rc_config.c @@ -1,1760 +1,1794 @@ /* * Copyright (c) 1997, 2001 Hellmuth Michaelis. 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. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. * *--------------------------------------------------------------------------- * * i4b daemon - config file processing * ----------------------------------- * * $FreeBSD$ * * last edit-date: [Wed Jan 10 14:46:58 2001] * *---------------------------------------------------------------------------*/ #include #include #include #include #include #include #include #ifdef __NetBSD__ #include #else #if __FreeBSD__ == 3 #include #include #endif #include #include #endif #include "isdnd.h" #include "y.tab.h" #include "monitor.h" extern int entrycount; extern int controllercount; extern int lineno; extern char *yytext; extern FILE *yyin; extern int yyparse(); static void set_config_defaults(void); static void check_config(void); static void print_config(void); static void parse_valid(int entrycount, char *dt); static int nregexpr = 0; static int nregprog = 0; /*---------------------------------------------------------------------------* * called from main to read and process config file *---------------------------------------------------------------------------*/ void configure(char *filename, int reread) { extern void reset_scanner(FILE *inputfile); set_config_defaults(); yyin = fopen(filename, "r"); if(reread) { reset_scanner(yyin); } if (yyin == NULL) { log(LL_ERR, "cannot fopen file [%s]", filename); exit(1); } yyparse(); monitor_fixup_rights(); check_config(); /* validation and consistency check */ fclose(yyin); if(do_print) { if(config_error_flag) { log(LL_ERR, "there were %d error(s) in the configuration file, terminating!", config_error_flag); exit(1); } print_config(); do_exit(0); } } /*---------------------------------------------------------------------------* * yacc error routine *---------------------------------------------------------------------------*/ void yyerror(const char *msg) { log(LL_ERR, "configuration error: %s at line %d, token \"%s\"", msg, lineno+1, yytext); config_error_flag++; } /*---------------------------------------------------------------------------* * fill all config entries with default values *---------------------------------------------------------------------------*/ static void set_config_defaults(void) { cfg_entry_t *cep = &cfg_entry_tab[0]; /* ptr to config entry */ int i; /* system section cleanup */ nregprog = nregexpr = 0; rt_prio = RTPRIO_NOTUSED; mailer[0] = '\0'; mailto[0] = '\0'; /* clean regular expression table */ for(i=0; i < MAX_RE; i++) { if(rarr[i].re_expr) free(rarr[i].re_expr); rarr[i].re_expr = NULL; if(rarr[i].re_prog) free(rarr[i].re_prog); rarr[i].re_prog = NULL; rarr[i].re_flg = 0; } strcpy(rotatesuffix, ""); /* * controller table cleanup, beware: has already * been setup in main, init_controller() ! */ for(i=0; i < ncontroller; i++) { isdn_ctrl_tab[i].protocol = PROTOCOL_DSS1; + isdn_ctrl_tab[i].firmware = NULL; } /* entry section cleanup */ for(i=0; i < CFG_ENTRY_MAX; i++, cep++) { bzero(cep, sizeof(cfg_entry_t)); /* ====== filled in at startup configuration, then static */ sprintf(cep->name, "ENTRY%d", i); cep->isdncontroller = INVALID; cep->isdnchannel = CHAN_ANY; cep->usrdevicename = INVALID; cep->usrdeviceunit = INVALID; cep->remote_numbers_handling = RNH_LAST; cep->dialin_reaction = REACT_IGNORE; cep->b1protocol = BPROT_NONE; cep->unitlength = UNITLENGTH_DEFAULT; cep->earlyhangup = EARLYHANGUP_DEFAULT; cep->ratetype = INVALID_RATE; cep->unitlengthsrc = ULSRC_NONE; cep->answerprog = ANSWERPROG_DEF; cep->callbackwait = CALLBACKWAIT_MIN; cep->calledbackwait = CALLEDBACKWAIT_MIN; cep->dialretries = DIALRETRIES_DEF; cep->recoverytime = RECOVERYTIME_MIN; cep->dialouttype = DIALOUT_NORMAL; cep->inout = DIR_INOUT; cep->ppp_expect_auth = AUTH_UNDEF; cep->ppp_send_auth = AUTH_UNDEF; cep->ppp_auth_flags = AUTH_RECHALLENGE | AUTH_REQUIRED; /* ======== filled in after start, then dynamic */ cep->cdid = CDID_UNUSED; cep->state = ST_IDLE; cep->aoc_valid = AOC_INVALID; } } /*---------------------------------------------------------------------------* * internaly set values for ommitted controler sectin *---------------------------------------------------------------------------*/ void cfg_set_controller_default() { controllercount = 0; DBGL(DL_RCCF, (log(LL_DBG, "[defaults, no controller section] controller %d: protocol = dss1", controllercount))); isdn_ctrl_tab[controllercount].protocol = PROTOCOL_DSS1; } #define PPP_PAP 0xc023 #define PPP_CHAP 0xc223 static void set_isppp_auth(int entry) { cfg_entry_t *cep = &cfg_entry_tab[entry]; /* ptr to config entry */ struct ifreq ifr; struct spppreq spr; int s; int doioctl = 0; if(cep->usrdevicename != BDRV_ISPPP) return; if(cep->ppp_expect_auth == AUTH_UNDEF && cep->ppp_send_auth == AUTH_UNDEF) return; if(cep->ppp_expect_auth == AUTH_NONE || cep->ppp_send_auth == AUTH_NONE) doioctl = 1; if ((cep->ppp_expect_auth == AUTH_CHAP || cep->ppp_expect_auth == AUTH_PAP) && cep->ppp_expect_name[0] != 0 && cep->ppp_expect_password[0] != 0) doioctl = 1; if ((cep->ppp_send_auth == AUTH_CHAP || cep->ppp_send_auth == AUTH_PAP) && cep->ppp_send_name[0] != 0 && cep->ppp_send_password[0] != 0) doioctl = 1; if(!doioctl) return; snprintf(ifr.ifr_name, sizeof(ifr.ifr_name), "isp%d", cep->usrdeviceunit); /* use a random AF to create the socket */ if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { log(LL_ERR, "ERROR opening control socket at line %d!", lineno); config_error_flag++; return; } spr.cmd = (int)SPPPIOGDEFS; ifr.ifr_data = (caddr_t)&spr; if (ioctl(s, SIOCGIFGENERIC, &ifr) == -1) { log(LL_ERR, "ERROR fetching active PPP authentication info for %s at line %d!", ifr.ifr_name, lineno); close(s); config_error_flag++; return; } if (cep->ppp_expect_auth != AUTH_UNDEF) { if(cep->ppp_expect_auth == AUTH_NONE) { spr.defs.hisauth.proto = 0; } else if ((cep->ppp_expect_auth == AUTH_CHAP || cep->ppp_expect_auth == AUTH_PAP) && cep->ppp_expect_name[0] != 0 && cep->ppp_expect_password[0] != 0) { spr.defs.hisauth.proto = cep->ppp_expect_auth == AUTH_PAP ? PPP_PAP : PPP_CHAP; strncpy(spr.defs.hisauth.name, cep->ppp_expect_name, AUTHNAMELEN); strncpy(spr.defs.hisauth.secret, cep->ppp_expect_password, AUTHKEYLEN); } } if (cep->ppp_send_auth != AUTH_UNDEF) { if(cep->ppp_send_auth == AUTH_NONE) { spr.defs.myauth.proto = 0; } else if ((cep->ppp_send_auth == AUTH_CHAP || cep->ppp_send_auth == AUTH_PAP) && cep->ppp_send_name[0] != 0 && cep->ppp_send_password[0] != 0) { spr.defs.myauth.proto = cep->ppp_send_auth == AUTH_PAP ? PPP_PAP : PPP_CHAP; strncpy(spr.defs.myauth.name, cep->ppp_send_name, AUTHNAMELEN); strncpy(spr.defs.myauth.secret, cep->ppp_send_password, AUTHKEYLEN); if(cep->ppp_auth_flags & AUTH_REQUIRED) spr.defs.hisauth.flags &= ~AUTHFLAG_NOCALLOUT; else spr.defs.hisauth.flags |= AUTHFLAG_NOCALLOUT; if(cep->ppp_auth_flags & AUTH_RECHALLENGE) spr.defs.hisauth.flags &= ~AUTHFLAG_NORECHALLENGE; else spr.defs.hisauth.flags |= AUTHFLAG_NORECHALLENGE; } } spr.cmd = (int)SPPPIOSDEFS; if (ioctl(s, SIOCSIFGENERIC, &ifr) == -1) { log(LL_ERR, "ERROR setting new PPP authentication parameters for %s at line %d!", ifr.ifr_name, lineno); config_error_flag++; } close(s); } /*---------------------------------------------------------------------------* * extract values from config and fill table *---------------------------------------------------------------------------*/ void cfg_setval(int keyword) { int i; switch(keyword) { case ACCTALL: acct_all = yylval.booln; DBGL(DL_RCCF, (log(LL_DBG, "system: acctall = %d", yylval.booln))); break; case ACCTFILE: strcpy(acctfile, yylval.str); DBGL(DL_RCCF, (log(LL_DBG, "system: acctfile = %s", yylval.str))); break; case ALERT: if(yylval.num < MINALERT) { yylval.num = MINALERT; DBGL(DL_RCCF, (log(LL_DBG, "entry %d: alert < %d, min = %d", entrycount, MINALERT, yylval.num))); } else if(yylval.num > MAXALERT) { yylval.num = MAXALERT; DBGL(DL_RCCF, (log(LL_DBG, "entry %d: alert > %d, min = %d", entrycount, MAXALERT, yylval.num))); } DBGL(DL_RCCF, (log(LL_DBG, "entry %d: alert = %d", entrycount, yylval.num))); cfg_entry_tab[entrycount].alert = yylval.num; break; case ALIASING: DBGL(DL_RCCF, (log(LL_DBG, "system: aliasing = %d", yylval.booln))); aliasing = yylval.booln; break; case ALIASFNAME: strcpy(aliasfile, yylval.str); DBGL(DL_RCCF, (log(LL_DBG, "system: aliasfile = %s", yylval.str))); break; case ANSWERPROG: if((cfg_entry_tab[entrycount].answerprog = malloc(strlen(yylval.str)+1)) == NULL) { log(LL_ERR, "entry %d: answerstring, malloc failed!", entrycount); do_exit(1); } strcpy(cfg_entry_tab[entrycount].answerprog, yylval.str); DBGL(DL_RCCF, (log(LL_DBG, "entry %d: answerprog = %s", entrycount, yylval.str))); break; case B1PROTOCOL: DBGL(DL_RCCF, (log(LL_DBG, "entry %d: b1protocol = %s", entrycount, yylval.str))); if(!(strcmp(yylval.str, "raw"))) cfg_entry_tab[entrycount].b1protocol = BPROT_NONE; else if(!(strcmp(yylval.str, "hdlc"))) cfg_entry_tab[entrycount].b1protocol = BPROT_RHDLC; else { log(LL_ERR, "ERROR parsing config file: unknown parameter for keyword \"b1protocol\" at line %d!", lineno); config_error_flag++; } break; case BEEPCONNECT: do_bell = yylval.booln; DBGL(DL_RCCF, (log(LL_DBG, "system: beepconnect = %d", yylval.booln))); break; case BUDGETCALLBACKPERIOD: DBGL(DL_RCCF, (log(LL_DBG, "entry %d: budget-callbackperiod = %d", entrycount, yylval.num))); cfg_entry_tab[entrycount].budget_callbackperiod = yylval.num; break; case BUDGETCALLBACKNCALLS: DBGL(DL_RCCF, (log(LL_DBG, "entry %d: budget-callbackncalls = %d", entrycount, yylval.num))); cfg_entry_tab[entrycount].budget_callbackncalls = yylval.num; break; case BUDGETCALLOUTPERIOD: DBGL(DL_RCCF, (log(LL_DBG, "entry %d: budget-calloutperiod = %d", entrycount, yylval.num))); cfg_entry_tab[entrycount].budget_calloutperiod = yylval.num; break; case BUDGETCALLOUTNCALLS: DBGL(DL_RCCF, (log(LL_DBG, "entry %d: budget-calloutncalls = %d", entrycount, yylval.num))); cfg_entry_tab[entrycount].budget_calloutncalls = yylval.num; break; case BUDGETCALLBACKSFILEROTATE: cfg_entry_tab[entrycount].budget_callbacksfile_rotate = yylval.booln; DBGL(DL_RCCF, (log(LL_DBG, "entry %d: budget-callbacksfile-rotate = %d", entrycount, yylval.booln))); break; case BUDGETCALLBACKSFILE: { FILE *fp; int s, l; int n; DBGL(DL_RCCF, (log(LL_DBG, "entry %d: budget-callbacksfile = %s", entrycount, yylval.str))); fp = fopen(yylval.str, "r"); if(fp != NULL) { if((fscanf(fp, "%d %d %d", (int *)&s, (int *)&l, &n)) != 3) { DBGL(DL_RCCF, (log(LL_DBG, "entry %d: initializing budget-callbacksfile %s", entrycount, yylval.str))); fclose(fp); fp = fopen(yylval.str, "w"); if(fp != NULL) fprintf(fp, "%d %d %d", (int)time(NULL), (int)time(NULL), 0); fclose(fp); } } else { DBGL(DL_RCCF, (log(LL_DBG, "entry %d: creating budget-callbacksfile %s", entrycount, yylval.str))); fp = fopen(yylval.str, "w"); if(fp != NULL) fprintf(fp, "%d %d %d", (int)time(NULL), (int)time(NULL), 0); fclose(fp); } fp = fopen(yylval.str, "r"); if(fp != NULL) { if((fscanf(fp, "%d %d %d", (int *)&s, (int *)&l, &n)) == 3) { if((cfg_entry_tab[entrycount].budget_callbacks_file = malloc(strlen(yylval.str)+1)) == NULL) { log(LL_ERR, "entry %d: budget-callbacksfile, malloc failed!", entrycount); do_exit(1); } strcpy(cfg_entry_tab[entrycount].budget_callbacks_file, yylval.str); DBGL(DL_RCCF, (log(LL_DBG, "entry %d: using callbacksfile %s", entrycount, yylval.str))); } fclose(fp); } } break; case BUDGETCALLOUTSFILEROTATE: cfg_entry_tab[entrycount].budget_calloutsfile_rotate = yylval.booln; DBGL(DL_RCCF, (log(LL_DBG, "entry %d: budget-calloutsfile-rotate = %d", entrycount, yylval.booln))); break; case BUDGETCALLOUTSFILE: { FILE *fp; int s, l; int n; DBGL(DL_RCCF, (log(LL_DBG, "entry %d: budget-calloutsfile = %s", entrycount, yylval.str))); fp = fopen(yylval.str, "r"); if(fp != NULL) { if((fscanf(fp, "%d %d %d", (int *)&s, (int *)&l, &n)) != 3) { DBGL(DL_RCCF, (log(LL_DBG, "entry %d: initializing budget-calloutsfile %s", entrycount, yylval.str))); fclose(fp); fp = fopen(yylval.str, "w"); if(fp != NULL) fprintf(fp, "%d %d %d", (int)time(NULL), (int)time(NULL), 0); fclose(fp); } } else { DBGL(DL_RCCF, (log(LL_DBG, "entry %d: creating budget-calloutsfile %s", entrycount, yylval.str))); fp = fopen(yylval.str, "w"); if(fp != NULL) fprintf(fp, "%d %d %d", (int)time(NULL), (int)time(NULL), 0); fclose(fp); } fp = fopen(yylval.str, "r"); if(fp != NULL) { if((fscanf(fp, "%d %d %d", (int *)&s, (int *)&l, &n)) == 3) { if((cfg_entry_tab[entrycount].budget_callouts_file = malloc(strlen(yylval.str)+1)) == NULL) { log(LL_ERR, "entry %d: budget-calloutsfile, malloc failed!", entrycount); do_exit(1); } strcpy(cfg_entry_tab[entrycount].budget_callouts_file, yylval.str); DBGL(DL_RCCF, (log(LL_DBG, "entry %d: using calloutsfile %s", entrycount, yylval.str))); } fclose(fp); } } break; case CALLBACKWAIT: if(yylval.num < CALLBACKWAIT_MIN) { yylval.num = CALLBACKWAIT_MIN; DBGL(DL_RCCF, (log(LL_DBG, "entry %d: callbackwait < %d, min = %d", entrycount, CALLBACKWAIT_MIN, yylval.num))); } DBGL(DL_RCCF, (log(LL_DBG, "entry %d: callbackwait = %d", entrycount, yylval.num))); cfg_entry_tab[entrycount].callbackwait = yylval.num; break; case CALLEDBACKWAIT: if(yylval.num < CALLEDBACKWAIT_MIN) { yylval.num = CALLEDBACKWAIT_MIN; DBGL(DL_RCCF, (log(LL_DBG, "entry %d: calledbackwait < %d, min = %d", entrycount, CALLEDBACKWAIT_MIN, yylval.num))); } DBGL(DL_RCCF, (log(LL_DBG, "entry %d: calledbackwait = %d", entrycount, yylval.num))); cfg_entry_tab[entrycount].calledbackwait = yylval.num; break; + case CLONE: + /* + * clone = + * Loads the entry from the named, existing one. + * Fields such as name and usrdeviceunit should + * always be specified after clone as they must be + * unique. + * + * NOTE: all malloc()'d fields must be dup()'d here, + * we can't have multiple references to same storage. + */ + for (i = 0; i < entrycount; i++) + if (!strcmp(cfg_entry_tab[i].name, yylval.str)) + break; + if (i == entrycount) { + log(LL_ERR, "entry %d: clone, unknown entry %s!", entrycount, yylval.str); + do_exit(1); + } + + DBGL(DL_RCCF, (log(LL_DBG, "entry %d: clone = %s", entrycount, yylval.str))); + + memcpy(&cfg_entry_tab[entrycount], &cfg_entry_tab[i], + sizeof(cfg_entry_tab[0])); + + if (cfg_entry_tab[entrycount].answerprog) + cfg_entry_tab[entrycount].answerprog = strdup(cfg_entry_tab[entrycount].answerprog); + if (cfg_entry_tab[entrycount].budget_callbacks_file) + cfg_entry_tab[entrycount].budget_callbacks_file = strdup(cfg_entry_tab[entrycount].budget_callbacks_file); + if (cfg_entry_tab[entrycount].budget_callouts_file) + cfg_entry_tab[entrycount].budget_callouts_file = strdup(cfg_entry_tab[entrycount].budget_callouts_file); + if (cfg_entry_tab[entrycount].connectprog) + cfg_entry_tab[entrycount].connectprog = strdup(cfg_entry_tab[entrycount].connectprog); + if (cfg_entry_tab[entrycount].disconnectprog) + cfg_entry_tab[entrycount].disconnectprog = strdup(cfg_entry_tab[entrycount].disconnectprog); + break; + case CONNECTPROG: if((cfg_entry_tab[entrycount].connectprog = malloc(strlen(yylval.str)+1)) == NULL) { log(LL_ERR, "entry %d: connectprog, malloc failed!", entrycount); do_exit(1); } strcpy(cfg_entry_tab[entrycount].connectprog, yylval.str); DBGL(DL_RCCF, (log(LL_DBG, "entry %d: connectprog = %s", entrycount, yylval.str))); break; case DIALOUTTYPE: DBGL(DL_RCCF, (log(LL_DBG, "entry %d: dialouttype = %s", entrycount, yylval.str))); if(!(strcmp(yylval.str, "normal"))) cfg_entry_tab[entrycount].dialouttype = DIALOUT_NORMAL; else if(!(strcmp(yylval.str, "calledback"))) cfg_entry_tab[entrycount].dialouttype = DIALOUT_CALLEDBACK; else { log(LL_ERR, "ERROR parsing config file: unknown parameter for keyword \"dialout-type\" at line %d!", lineno); config_error_flag++; } break; case DIALRETRIES: DBGL(DL_RCCF, (log(LL_DBG, "entry %d: dialretries = %d", entrycount, yylval.num))); cfg_entry_tab[entrycount].dialretries = yylval.num; break; case DIALRANDINCR: DBGL(DL_RCCF, (log(LL_DBG, "entry %d: dialrandincr = %d", entrycount, yylval.booln))); cfg_entry_tab[entrycount].dialrandincr = yylval.booln; break; case DIRECTION: DBGL(DL_RCCF, (log(LL_DBG, "entry %d: direction = %s", entrycount, yylval.str))); if(!(strcmp(yylval.str, "inout"))) cfg_entry_tab[entrycount].inout = DIR_INOUT; else if(!(strcmp(yylval.str, "in"))) cfg_entry_tab[entrycount].inout = DIR_INONLY; else if(!(strcmp(yylval.str, "out"))) cfg_entry_tab[entrycount].inout = DIR_OUTONLY; else { log(LL_ERR, "ERROR parsing config file: unknown parameter for keyword \"direction\" at line %d!", lineno); config_error_flag++; } break; case DISCONNECTPROG: if((cfg_entry_tab[entrycount].disconnectprog = malloc(strlen(yylval.str)+1)) == NULL) { log(LL_ERR, "entry %d: disconnectprog, malloc failed!", entrycount); do_exit(1); } strcpy(cfg_entry_tab[entrycount].disconnectprog, yylval.str); DBGL(DL_RCCF, (log(LL_DBG, "entry %d: disconnectprog = %s", entrycount, yylval.str))); break; case DOWNTRIES: if(yylval.num > DOWN_TRIES_MAX) yylval.num = DOWN_TRIES_MAX; else if(yylval.num < DOWN_TRIES_MIN) yylval.num = DOWN_TRIES_MIN; DBGL(DL_RCCF, (log(LL_DBG, "entry %d: downtries = %d", entrycount, yylval.num))); cfg_entry_tab[entrycount].downtries = yylval.num; break; case DOWNTIME: if(yylval.num > DOWN_TIME_MAX) yylval.num = DOWN_TIME_MAX; else if(yylval.num < DOWN_TIME_MIN) yylval.num = DOWN_TIME_MIN; DBGL(DL_RCCF, (log(LL_DBG, "entry %d: downtime = %d", entrycount, yylval.num))); cfg_entry_tab[entrycount].downtime = yylval.num; break; case EARLYHANGUP: DBGL(DL_RCCF, (log(LL_DBG, "entry %d: earlyhangup = %d", entrycount, yylval.num))); cfg_entry_tab[entrycount].earlyhangup = yylval.num; break; case EXTCALLATTR: DBGL(DL_RCCF, (log(LL_DBG, "system: extcallattr = %d", yylval.booln))); extcallattr = yylval.booln; break; + case FIRMWARE: + DBGL(DL_RCCF, (log(LL_DBG, "controller %d: firmware = %s", controllercount, yylval.str))); + isdn_ctrl_tab[controllercount].firmware = strdup(yylval.str); + break; + case HOLIDAYFILE: strcpy(holidayfile, yylval.str); DBGL(DL_RCCF, (log(LL_DBG, "system: holidayfile = %s", yylval.str))); break; case IDLE_ALG_OUT: DBGL(DL_RCCF, (log(LL_DBG, "entry %d: idle-algorithm-outgoing = %s", entrycount, yylval.str))); if(!(strcmp(yylval.str, "fix-unit-size"))) { cfg_entry_tab[entrycount].shorthold_algorithm = SHA_FIXU; } else if(!(strcmp(yylval.str, "var-unit-size"))) { cfg_entry_tab[entrycount].shorthold_algorithm = SHA_VARU; } else { log(LL_ERR, "ERROR parsing config file: unknown parameter for keyword \"idle-algorithm-outgoing\" at line %d!", lineno); config_error_flag++; } break; case IDLETIME_IN: DBGL(DL_RCCF, (log(LL_DBG, "entry %d: idle_time_in = %d", entrycount, yylval.num))); cfg_entry_tab[entrycount].idle_time_in = yylval.num; break; case IDLETIME_OUT: DBGL(DL_RCCF, (log(LL_DBG, "entry %d: idle_time_out = %d", entrycount, yylval.num))); cfg_entry_tab[entrycount].idle_time_out = yylval.num; break; case ISDNCONTROLLER: cfg_entry_tab[entrycount].isdncontroller = yylval.num; DBGL(DL_RCCF, (log(LL_DBG, "entry %d: isdncontroller = %d", entrycount, yylval.num))); break; case ISDNCHANNEL: - switch(yylval.num) + if (yylval.num == 0 || yylval.num == -1) { - case 0: - case -1: cfg_entry_tab[entrycount].isdnchannel = CHAN_ANY; DBGL(DL_RCCF, (log(LL_DBG, "entry %d: isdnchannel = any", entrycount))); - break; - case 1: - cfg_entry_tab[entrycount].isdnchannel = CHAN_B1; - DBGL(DL_RCCF, (log(LL_DBG, "entry %d: isdnchannel = one", entrycount))); - break; - case 2: - cfg_entry_tab[entrycount].isdnchannel = CHAN_B2; - DBGL(DL_RCCF, (log(LL_DBG, "entry %d: isdnchannel = two", entrycount))); - break; - default: + } + else if (yylval.num > MAX_BCHAN) + { log(LL_DBG, "entry %d: isdnchannel value out of range", entrycount); config_error_flag++; - break; + } + else + { + cfg_entry_tab[entrycount].isdnchannel = yylval.num-1; + DBGL(DL_RCCF, (log(LL_DBG, "entry %d: isdnchannel = B%d", entrycount, yylval.num))); } break; case ISDNTIME: DBGL(DL_RCCF, (log(LL_DBG, "system: isdntime = %d", yylval.booln))); isdntime = yylval.booln; break; case ISDNTXDELIN: cfg_entry_tab[entrycount].isdntxdelin = yylval.num; DBGL(DL_RCCF, (log(LL_DBG, "entry %d: isdntxdel-incoming = %d", entrycount, yylval.num))); break; case ISDNTXDELOUT: cfg_entry_tab[entrycount].isdntxdelout = yylval.num; DBGL(DL_RCCF, (log(LL_DBG, "entry %d: isdntxdel-outgoing = %d", entrycount, yylval.num))); break; case LOCAL_PHONE_DIALOUT: DBGL(DL_RCCF, (log(LL_DBG, "entry %d: local_phone_dialout = %s", entrycount, yylval.str))); strcpy(cfg_entry_tab[entrycount].local_phone_dialout, yylval.str); break; case LOCAL_PHONE_INCOMING: DBGL(DL_RCCF, (log(LL_DBG, "entry %d: local_phone_incoming = %s", entrycount, yylval.str))); strcpy(cfg_entry_tab[entrycount].local_phone_incoming, yylval.str); break; case MAILER: strcpy(mailer, yylval.str); DBGL(DL_RCCF, (log(LL_DBG, "system: mailer = %s", yylval.str))); break; case MAILTO: strcpy(mailto, yylval.str); DBGL(DL_RCCF, (log(LL_DBG, "system: mailto = %s", yylval.str))); break; case MONITORPORT: monitorport = yylval.num; DBGL(DL_RCCF, (log(LL_DBG, "system: monitorport = %d", yylval.num))); break; case MONITORSW: if (yylval.booln && inhibit_monitor) { do_monitor = 0; DBGL(DL_RCCF, (log(LL_DBG, "system: monitor-enable overriden by command line flag"))); } else { do_monitor = yylval.booln; DBGL(DL_RCCF, (log(LL_DBG, "system: monitor-enable = %d", yylval.booln))); } break; case NAME: DBGL(DL_RCCF, (log(LL_DBG, "entry %d: name = %s", entrycount, yylval.str))); strcpy(cfg_entry_tab[entrycount].name, yylval.str); break; case PPP_AUTH_RECHALLENGE: DBGL(DL_RCCF, (log(LL_DBG, "entry %d: ppp-auth-rechallenge = %d", entrycount, yylval.booln))); if(yylval.booln) cfg_entry_tab[entrycount].ppp_auth_flags |= AUTH_RECHALLENGE; else cfg_entry_tab[entrycount].ppp_auth_flags &= ~AUTH_RECHALLENGE; set_isppp_auth(entrycount); break; case PPP_AUTH_PARANOID: DBGL(DL_RCCF, (log(LL_DBG, "entry %d: ppp-auth-paranoid = %d", entrycount, yylval.booln))); if(yylval.booln) cfg_entry_tab[entrycount].ppp_auth_flags |= AUTH_REQUIRED; else cfg_entry_tab[entrycount].ppp_auth_flags &= ~AUTH_REQUIRED; set_isppp_auth(entrycount); break; case PPP_EXPECT_AUTH: DBGL(DL_RCCF, (log(LL_DBG, "entry %d: ppp-expect-auth = %s", entrycount, yylval.str))); if(!(strcmp(yylval.str, "none"))) cfg_entry_tab[entrycount].ppp_expect_auth = AUTH_NONE; else if(!(strcmp(yylval.str, "pap"))) cfg_entry_tab[entrycount].ppp_expect_auth = AUTH_PAP; else if(!(strcmp(yylval.str, "chap"))) cfg_entry_tab[entrycount].ppp_expect_auth = AUTH_CHAP; else { log(LL_ERR, "ERROR parsing config file: unknown parameter for keyword \"ppp-expect-auth\" at line %d!", lineno); config_error_flag++; break; } set_isppp_auth(entrycount); break; case PPP_EXPECT_NAME: DBGL(DL_RCCF, (log(LL_DBG, "entry %d: ppp-expect-name = %s", entrycount, yylval.str))); strncpy(cfg_entry_tab[entrycount].ppp_expect_name, yylval.str, sizeof(cfg_entry_tab[entrycount].ppp_expect_name) -1); set_isppp_auth(entrycount); break; case PPP_EXPECT_PASSWORD: DBGL(DL_RCCF, (log(LL_DBG, "entry %d: ppp-expect-password = %s", entrycount, yylval.str))); strncpy(cfg_entry_tab[entrycount].ppp_expect_password, yylval.str, sizeof(cfg_entry_tab[entrycount].ppp_expect_password) -1); set_isppp_auth(entrycount); break; case PPP_SEND_AUTH: DBGL(DL_RCCF, (log(LL_DBG, "entry %d: ppp-send-auth = %s", entrycount, yylval.str))); if(!(strcmp(yylval.str, "none"))) cfg_entry_tab[entrycount].ppp_send_auth = AUTH_NONE; else if(!(strcmp(yylval.str, "pap"))) cfg_entry_tab[entrycount].ppp_send_auth = AUTH_PAP; else if(!(strcmp(yylval.str, "chap"))) cfg_entry_tab[entrycount].ppp_send_auth = AUTH_CHAP; else { log(LL_ERR, "ERROR parsing config file: unknown parameter for keyword \"ppp-send-auth\" at line %d!", lineno); config_error_flag++; break; } set_isppp_auth(entrycount); break; case PPP_SEND_NAME: DBGL(DL_RCCF, (log(LL_DBG, "entry %d: ppp-send-name = %s", entrycount, yylval.str))); strncpy(cfg_entry_tab[entrycount].ppp_send_name, yylval.str, sizeof(cfg_entry_tab[entrycount].ppp_send_name) -1); set_isppp_auth(entrycount); break; case PPP_SEND_PASSWORD: DBGL(DL_RCCF, (log(LL_DBG, "entry %d: ppp-send-password = %s", entrycount, yylval.str))); strncpy(cfg_entry_tab[entrycount].ppp_send_password, yylval.str, sizeof(cfg_entry_tab[entrycount].ppp_send_password) -1); set_isppp_auth(entrycount); break; case PROTOCOL: DBGL(DL_RCCF, (log(LL_DBG, "controller %d: protocol = %s", controllercount, yylval.str))); if(!(strcmp(yylval.str, "dss1"))) isdn_ctrl_tab[controllercount].protocol = PROTOCOL_DSS1; else if(!(strcmp(yylval.str, "d64s"))) isdn_ctrl_tab[controllercount].protocol = PROTOCOL_D64S; else { log(LL_ERR, "ERROR parsing config file: unknown parameter for keyword \"protocol\" at line %d!", lineno); config_error_flag++; } break; case REACTION: DBGL(DL_RCCF, (log(LL_DBG, "entry %d: dialin_reaction = %s", entrycount, yylval.str))); if(!(strcmp(yylval.str, "accept"))) cfg_entry_tab[entrycount].dialin_reaction = REACT_ACCEPT; else if(!(strcmp(yylval.str, "reject"))) cfg_entry_tab[entrycount].dialin_reaction = REACT_REJECT; else if(!(strcmp(yylval.str, "ignore"))) cfg_entry_tab[entrycount].dialin_reaction = REACT_IGNORE; else if(!(strcmp(yylval.str, "answer"))) cfg_entry_tab[entrycount].dialin_reaction = REACT_ANSWER; else if(!(strcmp(yylval.str, "callback"))) cfg_entry_tab[entrycount].dialin_reaction = REACT_CALLBACK; else { log(LL_ERR, "ERROR parsing config file: unknown parameter for keyword \"dialin_reaction\" at line %d!", lineno); config_error_flag++; } break; case REMOTE_PHONE_DIALOUT: if(cfg_entry_tab[entrycount].remote_numbers_count >= MAXRNUMBERS) { log(LL_ERR, "ERROR parsing config file: too many remote numbers at line %d!", lineno); config_error_flag++; break; } DBGL(DL_RCCF, (log(LL_DBG, "entry %d: remote_phone_dialout #%d = %s", entrycount, cfg_entry_tab[entrycount].remote_numbers_count, yylval.str))); strcpy(cfg_entry_tab[entrycount].remote_numbers[cfg_entry_tab[entrycount].remote_numbers_count].number, yylval.str); cfg_entry_tab[entrycount].remote_numbers[cfg_entry_tab[entrycount].remote_numbers_count].flag = 0; cfg_entry_tab[entrycount].remote_numbers_count++; break; case REMOTE_NUMBERS_HANDLING: DBGL(DL_RCCF, (log(LL_DBG, "entry %d: remdial_handling = %s", entrycount, yylval.str))); if(!(strcmp(yylval.str, "next"))) cfg_entry_tab[entrycount].remote_numbers_handling = RNH_NEXT; else if(!(strcmp(yylval.str, "last"))) cfg_entry_tab[entrycount].remote_numbers_handling = RNH_LAST; else if(!(strcmp(yylval.str, "first"))) cfg_entry_tab[entrycount].remote_numbers_handling = RNH_FIRST; else { log(LL_ERR, "ERROR parsing config file: unknown parameter for keyword \"remdial_handling\" at line %d!", lineno); config_error_flag++; } break; case REMOTE_PHONE_INCOMING: { int n; n = cfg_entry_tab[entrycount].incoming_numbers_count; if (n >= MAX_INCOMING) { log(LL_ERR, "ERROR parsing config file: too many \"remote_phone_incoming\" entries at line %d!", lineno); config_error_flag++; break; } DBGL(DL_RCCF, (log(LL_DBG, "entry %d: remote_phone_incoming #%d = %s", entrycount, n, yylval.str))); strcpy(cfg_entry_tab[entrycount].remote_phone_incoming[n].number, yylval.str); cfg_entry_tab[entrycount].incoming_numbers_count++; } break; case RATESFILE: strcpy(ratesfile, yylval.str); DBGL(DL_RCCF, (log(LL_DBG, "system: ratesfile = %s", yylval.str))); break; case RATETYPE: DBGL(DL_RCCF, (log(LL_DBG, "entry %d: ratetype = %d", entrycount, yylval.num))); cfg_entry_tab[entrycount].ratetype = yylval.num; break; case RECOVERYTIME: if(yylval.num < RECOVERYTIME_MIN) { yylval.num = RECOVERYTIME_MIN; DBGL(DL_RCCF, (log(LL_DBG, "entry %d: recoverytime < %d, min = %d", entrycount, RECOVERYTIME_MIN, yylval.num))); } DBGL(DL_RCCF, (log(LL_DBG, "entry %d: recoverytime = %d", entrycount, yylval.num))); cfg_entry_tab[entrycount].recoverytime = yylval.num; break; case REGEXPR: if(nregexpr >= MAX_RE) { log(LL_ERR, "system: regexpr #%d >= MAX_RE", nregexpr); config_error_flag++; break; } if((i = regcomp(&(rarr[nregexpr].re), yylval.str, REG_EXTENDED|REG_NOSUB)) != 0) { char buf[256]; regerror(i, &(rarr[nregexpr].re), buf, sizeof(buf)); log(LL_ERR, "system: regcomp error for %s: [%s]", yylval.str, buf); config_error_flag++; break; } else { if((rarr[nregexpr].re_expr = malloc(strlen(yylval.str)+1)) == NULL) { log(LL_ERR, "system: regexpr malloc error error for %s", yylval.str); config_error_flag++; break; } strcpy(rarr[nregexpr].re_expr, yylval.str); DBGL(DL_RCCF, (log(LL_DBG, "system: regexpr %s stored into slot %d", yylval.str, nregexpr))); if(rarr[nregexpr].re_prog != NULL) rarr[nregexpr].re_flg = 1; nregexpr++; } break; case REGPROG: if(nregprog >= MAX_RE) { log(LL_ERR, "system: regprog #%d >= MAX_RE", nregprog); config_error_flag++; break; } if((rarr[nregprog].re_prog = malloc(strlen(yylval.str)+1)) == NULL) { log(LL_ERR, "system: regprog malloc error error for %s", yylval.str); config_error_flag++; break; } strcpy(rarr[nregprog].re_prog, yylval.str); DBGL(DL_RCCF, (log(LL_DBG, "system: regprog %s stored into slot %d", yylval.str, nregprog))); if(rarr[nregprog].re_expr != NULL) rarr[nregprog].re_flg = 1; nregprog++; break; case ROTATESUFFIX: strcpy(rotatesuffix, yylval.str); DBGL(DL_RCCF, (log(LL_DBG, "system: rotatesuffix = %s", yylval.str))); break; case RTPRIO: #ifdef USE_RTPRIO rt_prio = yylval.num; if(rt_prio < RTP_PRIO_MIN || rt_prio > RTP_PRIO_MAX) { config_error_flag++; log(LL_ERR, "system: error, rtprio (%d) out of range!", yylval.num); } else { DBGL(DL_RCCF, (log(LL_DBG, "system: rtprio = %d", yylval.num))); } #else rt_prio = RTPRIO_NOTUSED; #endif break; case TINAINITPROG: strcpy(tinainitprog, yylval.str); DBGL(DL_RCCF, (log(LL_DBG, "system: tinainitprog = %s", yylval.str))); break; case UNITLENGTH: DBGL(DL_RCCF, (log(LL_DBG, "entry %d: unitlength = %d", entrycount, yylval.num))); cfg_entry_tab[entrycount].unitlength = yylval.num; break; case UNITLENGTHSRC: DBGL(DL_RCCF, (log(LL_DBG, "entry %d: unitlengthsrc = %s", entrycount, yylval.str))); if(!(strcmp(yylval.str, "none"))) cfg_entry_tab[entrycount].unitlengthsrc = ULSRC_NONE; else if(!(strcmp(yylval.str, "cmdl"))) cfg_entry_tab[entrycount].unitlengthsrc = ULSRC_CMDL; else if(!(strcmp(yylval.str, "conf"))) cfg_entry_tab[entrycount].unitlengthsrc = ULSRC_CONF; else if(!(strcmp(yylval.str, "rate"))) cfg_entry_tab[entrycount].unitlengthsrc = ULSRC_RATE; else if(!(strcmp(yylval.str, "aocd"))) cfg_entry_tab[entrycount].unitlengthsrc = ULSRC_DYN; else { log(LL_ERR, "ERROR parsing config file: unknown parameter for keyword \"unitlengthsrc\" at line %d!", lineno); config_error_flag++; } break; case USRDEVICENAME: DBGL(DL_RCCF, (log(LL_DBG, "entry %d: usrdevicename = %s", entrycount, yylval.str))); if(!strcmp(yylval.str, "rbch")) cfg_entry_tab[entrycount].usrdevicename = BDRV_RBCH; else if(!strcmp(yylval.str, "tel")) cfg_entry_tab[entrycount].usrdevicename = BDRV_TEL; else if(!strcmp(yylval.str, "ipr")) cfg_entry_tab[entrycount].usrdevicename = BDRV_IPR; else if(!strcmp(yylval.str, "isp")) cfg_entry_tab[entrycount].usrdevicename = BDRV_ISPPP; #ifdef __bsdi__ else if(!strcmp(yylval.str, "ibc")) cfg_entry_tab[entrycount].usrdevicename = BDRV_IBC; #endif else if(!strcmp(yylval.str, "ing")) cfg_entry_tab[entrycount].usrdevicename = BDRV_ING; else { log(LL_ERR, "ERROR parsing config file: unknown parameter for keyword \"usrdevicename\" at line %d!", lineno); config_error_flag++; } break; case USRDEVICEUNIT: DBGL(DL_RCCF, (log(LL_DBG, "entry %d: usrdeviceunit = %d", entrycount, yylval.num))); cfg_entry_tab[entrycount].usrdeviceunit = yylval.num; break; case USEACCTFILE: useacctfile = yylval.booln; DBGL(DL_RCCF, (log(LL_DBG, "system: useacctfile = %d", yylval.booln))); break; case USEDOWN: DBGL(DL_RCCF, (log(LL_DBG, "entry %d: usedown = %d", entrycount, yylval.booln))); cfg_entry_tab[entrycount].usedown = yylval.booln; break; case VALID: DBGL(DL_RCCF, (log(LL_DBG, "entry %d: valid = %s", entrycount, yylval.str))); parse_valid(entrycount, yylval.str); break; default: log(LL_ERR, "ERROR parsing config file: unknown keyword at line %d!", lineno); config_error_flag++; break; } } /*---------------------------------------------------------------------------* * parse a date/time range *---------------------------------------------------------------------------*/ static void parse_valid(int entrycount, char *dt) { /* a valid string consists of some days of week separated by * commas, where 0=sunday, 1=monday .. 6=saturday and a special * value of 7 which is a holiday from the holiday file. * after the days comes an optional (!) time range in the form * aa:bb-cc:dd, this format is fixed to be parsable by sscanf. * Valid specifications looks like this: * 1,2,3,4,5,09:00-18:00 Monday-Friday 9-18h * 1,2,3,4,5,18:00-09:00 Monday-Friday 18-9h * 6 Saturday (whole day) * 0,7 Sunday and Holidays */ int day = 0; int fromhr = 0; int frommin = 0; int tohr = 0; int tomin = 0; int ret; for(;;) { if( ( ((*dt >= '0') && (*dt <= '9')) && (*(dt+1) == ':') ) || ( ((*dt >= '0') && (*dt <= '2')) && ((*(dt+1) >= '0') && (*(dt+1) <= '9')) && (*(dt+2) == ':') ) ) { /* dt points to time spec */ ret = sscanf(dt, "%d:%d-%d:%d", &fromhr, &frommin, &tohr, &tomin); if(ret !=4) { log(LL_ERR, "ERROR parsing config file: timespec [%s] error at line %d!", *dt, lineno); config_error_flag++; return; } if(fromhr < 0 || fromhr > 24 || tohr < 0 || tohr > 24 || frommin < 0 || frommin > 59 || tomin < 0 || tomin > 59) { log(LL_ERR, "ERROR parsing config file: invalid time [%s] at line %d!", *dt, lineno); config_error_flag++; return; } break; } else if ((*dt >= '0') && (*dt <= '7')) { /* dt points to day spec */ day |= 1 << (*dt - '0'); dt++; continue; } else if (*dt == ',') { /* dt points to delimiter */ dt++; continue; } else if (*dt == '\0') { /* dt points to end of string */ break; } else { /* dt points to illegal character */ log(LL_ERR, "ERROR parsing config file: illegal character [%c=0x%x] in date/time spec at line %d!", *dt, *dt, lineno); config_error_flag++; return; } } cfg_entry_tab[entrycount].day = day; cfg_entry_tab[entrycount].fromhr = fromhr; cfg_entry_tab[entrycount].frommin = frommin; cfg_entry_tab[entrycount].tohr = tohr; cfg_entry_tab[entrycount].tomin = tomin; } /*---------------------------------------------------------------------------* * configuration validation and consistency check *---------------------------------------------------------------------------*/ static void check_config(void) { cfg_entry_t *cep = &cfg_entry_tab[0]; /* ptr to config entry */ int i; int error = 0; /* regular expression table */ for(i=0; i < MAX_RE; i++) { if((rarr[i].re_expr != NULL) && (rarr[i].re_prog == NULL)) { log(LL_ERR, "check_config: regular expression %d without program!", i); error++; } if((rarr[i].re_prog != NULL) && (rarr[i].re_expr == NULL)) { log(LL_ERR, "check_config: regular expression program %d without expression!", i); error++; } } /* entry sections */ for(i=0; i <= entrycount; i++, cep++) { /* isdn controller number */ if((cep->isdncontroller < -1) || (cep->isdncontroller > (ncontroller-1))) { log(LL_ERR, "check_config: WARNING, isdncontroller out of range in entry %d!", i); } /* numbers used for dialout */ if((cep->inout != DIR_INONLY) && (cep->dialin_reaction != REACT_ANSWER)) { if(cep->remote_numbers_count == 0) { log(LL_ERR, "check_config: remote-phone-dialout not set in entry %d!", i); error++; } if(strlen(cep->local_phone_dialout) == 0) { log(LL_ERR, "check_config: local-phone-dialout not set in entry %d!", i); error++; } } /* numbers used for incoming calls */ if(cep->inout != DIR_OUTONLY) { if(strlen(cep->local_phone_incoming) == 0) { log(LL_ERR, "check_config: local-phone-incoming not set in entry %d!", i); error++; } if(cep->incoming_numbers_count == 0) { log(LL_ERR, "check_config: remote-phone-incoming not set in entry %d!", i); error++; } } if((cep->dialin_reaction == REACT_ANSWER) && (cep->b1protocol != BPROT_NONE)) { log(LL_ERR, "check_config: b1protocol not raw for telephony in entry %d!", i); error++; } if((cep->ppp_send_auth == AUTH_PAP) || (cep->ppp_send_auth == AUTH_CHAP)) { if(cep->ppp_send_name[0] == 0) { log(LL_ERR, "check_config: no remote authentification name in entry %d!", i); error++; } if(cep->ppp_send_password[0] == 0) { log(LL_ERR, "check_config: no remote authentification password in entry %d!", i); error++; } } if((cep->ppp_expect_auth == AUTH_PAP) || (cep->ppp_expect_auth == AUTH_CHAP)) { if(cep->ppp_expect_name[0] == 0) { log(LL_ERR, "check_config: no local authentification name in entry %d!", i); error++; } if(cep->ppp_expect_password[0] == 0) { log(LL_ERR, "check_config: no local authentification secret in entry %d!", i); error++; } } } if(error) { log(LL_ERR, "check_config: %d error(s) in configuration file, exit!", error); do_exit(1); } } /*---------------------------------------------------------------------------* * print the configuration *---------------------------------------------------------------------------*/ static void print_config(void) { #define PFILE stdout #ifdef I4B_EXTERNAL_MONITOR extern struct monitor_rights * monitor_next_rights(const struct monitor_rights *r); struct monitor_rights *m_rights; #endif cfg_entry_t *cep = &cfg_entry_tab[0]; /* ptr to config entry */ int i, j; time_t clock; char mytime[64]; time(&clock); strcpy(mytime, ctime(&clock)); mytime[strlen(mytime)-1] = '\0'; fprintf(PFILE, "#---------------------------------------------------------------------------\n"); fprintf(PFILE, "# system section (generated %s)\n", mytime); fprintf(PFILE, "#---------------------------------------------------------------------------\n"); fprintf(PFILE, "system\n"); fprintf(PFILE, "useacctfile = %s\n", useacctfile ? "on\t\t\t\t# update accounting information file" : "off\t\t\t\t# don't update accounting information file"); fprintf(PFILE, "acctall = %s\n", acct_all ? "on\t\t\t\t# put all events into accounting file" : "off\t\t\t\t# put only charged events into accounting file"); fprintf(PFILE, "acctfile = %s\t\t# accounting information file\n", acctfile); fprintf(PFILE, "ratesfile = %s\t\t# charging rates database file\n", ratesfile); #ifdef USE_RTPRIO if(rt_prio == RTPRIO_NOTUSED) fprintf(PFILE, "# rtprio is unused\n"); else fprintf(PFILE, "rtprio = %d\t\t\t\t# isdnd runs at realtime priority\n", rt_prio); #endif /* regular expression table */ for(i=0; i < MAX_RE; i++) { if(rarr[i].re_expr != NULL) { fprintf(PFILE, "regexpr = \"%s\"\t\t# scan logfile for this expression\n", rarr[i].re_expr); } if(rarr[i].re_prog != NULL) { fprintf(PFILE, "regprog = %s\t\t# program to run when expression is matched\n", rarr[i].re_prog); } } #ifdef I4B_EXTERNAL_MONITOR fprintf(PFILE, "monitor-allowed = %s\n", do_monitor ? "on\t\t\t\t# remote isdnd monitoring allowed" : "off\t\t\t\t# remote isdnd monitoring disabled"); fprintf(PFILE, "monitor-port = %d\t\t\t\t# TCP/IP port number used for remote monitoring\n", monitorport); m_rights = monitor_next_rights(NULL); if(m_rights != NULL) { char *s = "error\n"; char b[512]; for ( ; m_rights != NULL; m_rights = monitor_next_rights(m_rights)) { if(m_rights->local) { fprintf(PFILE, "monitor = \"%s\"\t\t# local socket name for monitoring\n", m_rights->name); } else { struct in_addr ia; ia.s_addr = ntohl(m_rights->net); switch(m_rights->mask) { case 0xffffffff: s = "32"; break; case 0xfffffffe: s = "31"; break; case 0xfffffffc: s = "30"; break; case 0xfffffff8: s = "29"; break; case 0xfffffff0: s = "28"; break; case 0xffffffe0: s = "27"; break; case 0xffffffc0: s = "26"; break; case 0xffffff80: s = "25"; break; case 0xffffff00: s = "24"; break; case 0xfffffe00: s = "23"; break; case 0xfffffc00: s = "22"; break; case 0xfffff800: s = "21"; break; case 0xfffff000: s = "20"; break; case 0xffffe000: s = "19"; break; case 0xffffc000: s = "18"; break; case 0xffff8000: s = "17"; break; case 0xffff0000: s = "16"; break; case 0xfffe0000: s = "15"; break; case 0xfffc0000: s = "14"; break; case 0xfff80000: s = "13"; break; case 0xfff00000: s = "12"; break; case 0xffe00000: s = "11"; break; case 0xffc00000: s = "10"; break; case 0xff800000: s = "9"; break; case 0xff000000: s = "8"; break; case 0xfe000000: s = "7"; break; case 0xfc000000: s = "6"; break; case 0xf8000000: s = "5"; break; case 0xf0000000: s = "4"; break; case 0xe0000000: s = "3"; break; case 0xc0000000: s = "2"; break; case 0x80000000: s = "1"; break; case 0x00000000: s = "0"; break; } fprintf(PFILE, "monitor = \"%s/%s\"\t\t# host (net/mask) allowed to connect for monitoring\n", inet_ntoa(ia), s); } b[0] = '\0'; if((m_rights->rights) & I4B_CA_COMMAND_FULL) strcat(b, "fullcmd,"); if((m_rights->rights) & I4B_CA_COMMAND_RESTRICTED) strcat(b, "restrictedcmd,"); if((m_rights->rights) & I4B_CA_EVNT_CHANSTATE) strcat(b, "channelstate,"); if((m_rights->rights) & I4B_CA_EVNT_CALLIN) strcat(b, "callin,"); if((m_rights->rights) & I4B_CA_EVNT_CALLOUT) strcat(b, "callout,"); if((m_rights->rights) & I4B_CA_EVNT_I4B) strcat(b, "logevents,"); if(b[strlen(b)-1] == ',') b[strlen(b)-1] = '\0'; fprintf(PFILE, "monitor-access = %s\t\t# monitor access rights\n", b); } } #endif /* entry sections */ for(i=0; i <= entrycount; i++, cep++) { fprintf(PFILE, "\n"); fprintf(PFILE, "#---------------------------------------------------------------------------\n"); fprintf(PFILE, "# entry section %d\n", i); fprintf(PFILE, "#---------------------------------------------------------------------------\n"); fprintf(PFILE, "entry\n"); fprintf(PFILE, "name = %s\t\t# name for this entry section\n", cep->name); fprintf(PFILE, "isdncontroller = %d\t\t# ISDN card number used for this entry\n", cep->isdncontroller); fprintf(PFILE, "isdnchannel = "); switch(cep->isdnchannel) { case CHAN_ANY: fprintf(PFILE, "-1\t\t# any ISDN B-channel may be used\n"); break; - case CHAN_B1: - fprintf(PFILE, "1\t\t# only ISDN B-channel 1 may be used\n"); - break; - case CHAN_B2: - fprintf(PFILE, "2\t\t# only ISDN B-channel 2 ay be used\n"); + default: + fprintf(PFILE, "%d\t\t# only ISDN B-channel %d may be used\n", cep->isdnchannel+1, cep->isdnchannel+1); break; } fprintf(PFILE, "usrdevicename = %s\t\t# name of userland ISDN B-channel device\n", bdrivername(cep->usrdevicename)); fprintf(PFILE, "usrdeviceunit = %d\t\t# unit number of userland ISDN B-channel device\n", cep->usrdeviceunit); fprintf(PFILE, "b1protocol = %s\n", cep->b1protocol ? "hdlc\t\t# B-channel layer 1 protocol is HDLC" : "raw\t\t# No B-channel layer 1 protocol used"); if(!(cep->usrdevicename == BDRV_TEL)) { fprintf(PFILE, "direction = "); switch(cep->inout) { case DIR_INONLY: fprintf(PFILE, "in\t\t# only incoming connections allowed\n"); break; case DIR_OUTONLY: fprintf(PFILE, "out\t\t# only outgoing connections allowed\n"); break; case DIR_INOUT: fprintf(PFILE, "inout\t\t# incoming and outgoing connections allowed\n"); break; } } if(!((cep->usrdevicename == BDRV_TEL) || (cep->inout == DIR_INONLY))) { if(cep->remote_numbers_count > 1) { for(j=0; jremote_numbers_count; j++) fprintf(PFILE, "remote-phone-dialout = %s\t\t# telephone number %d for dialing out to remote\n", cep->remote_numbers[j].number, j+1); fprintf(PFILE, "remdial-handling = "); switch(cep->remote_numbers_handling) { case RNH_NEXT: fprintf(PFILE, "next\t\t# use next number after last successfull for new dial\n"); break; case RNH_LAST: fprintf(PFILE, "last\t\t# use last successfull number for new dial\n"); break; case RNH_FIRST: fprintf(PFILE, "first\t\t# always start with first number for new dial\n"); break; } } else { fprintf(PFILE, "remote-phone-dialout = %s\t\t# telephone number for dialing out to remote\n", cep->remote_numbers[0].number); } fprintf(PFILE, "local-phone-dialout = %s\t\t# show this number to remote when dialling out\n", cep->local_phone_dialout); fprintf(PFILE, "dialout-type = %s\n", cep->dialouttype ? "calledback\t\t# i am called back by remote" : "normal\t\t# i am not called back by remote"); } if(!(cep->inout == DIR_OUTONLY)) { int n; fprintf(PFILE, "local-phone-incoming = %s\t\t# incoming calls must match this (mine) telephone number\n", cep->local_phone_incoming); for (n = 0; n < cep->incoming_numbers_count; n++) fprintf(PFILE, "remote-phone-incoming = %s\t\t# this is a valid remote number to call me\n", cep->remote_phone_incoming[n].number); fprintf(PFILE, "dialin-reaction = "); switch(cep->dialin_reaction) { case REACT_ACCEPT: fprintf(PFILE, "accept\t\t# i accept a call from remote and connect\n"); break; case REACT_REJECT: fprintf(PFILE, "reject\t\t# i reject the call from remote\n"); break; case REACT_IGNORE: fprintf(PFILE, "ignore\t\t# i ignore the call from remote\n"); break; case REACT_ANSWER: fprintf(PFILE, "answer\t\t# i will start telephone answering when remote calls in\n"); break; case REACT_CALLBACK: fprintf(PFILE, "callback\t\t# when remote calls in, i will hangup and call back\n"); break; } } if(cep->usrdevicename == BDRV_ISPPP) { char *s; switch(cep->ppp_expect_auth) { case AUTH_NONE: s = "none"; break; case AUTH_PAP: s = "pap"; break; case AUTH_CHAP: s = "chap"; break; default: s = NULL; break; } if(s != NULL) { fprintf(PFILE, "ppp-expect-auth = %s\t\t# the auth protocol we expect to receive on dial-in (none,pap,chap)\n", s); if(cep->ppp_expect_auth != AUTH_NONE) { fprintf(PFILE, "ppp-expect-name = %s\t\t# the user name allowed in\n", cep->ppp_expect_name); fprintf(PFILE, "ppp-expect-password = %s\t\t# the key expected from the other side\n", cep->ppp_expect_password); fprintf(PFILE, "ppp-auth-paranoid = %s\t\t# do we require remote to authenticate even if we dial out\n", cep->ppp_auth_flags & AUTH_REQUIRED ? "yes" : "no"); } } switch(cep->ppp_send_auth) { case AUTH_NONE: s = "none"; break; case AUTH_PAP: s = "pap"; break; case AUTH_CHAP: s = "chap"; break; default: s = NULL; break; } if(s != NULL) { fprintf(PFILE, "ppp-send-auth = %s\t\t# the auth protocol we use when dialing out (none,pap,chap)\n", s); if(cep->ppp_send_auth != AUTH_NONE) { fprintf(PFILE, "ppp-send-name = %s\t\t# our PPP account used for dial-out\n", cep->ppp_send_name); fprintf(PFILE, "ppp-send-password = %s\t\t# the key sent to the other side\n", cep->ppp_send_password); } } if(cep->ppp_send_auth == AUTH_CHAP || cep->ppp_expect_auth == AUTH_CHAP) { fprintf(PFILE, "ppp-auth-rechallenge = %s\t\t# rechallenge CHAP connections once in a while\n", cep->ppp_auth_flags & AUTH_RECHALLENGE ? "yes" : "no"); } } if(!((cep->inout == DIR_INONLY) || (cep->usrdevicename == BDRV_TEL))) { char *s; fprintf(PFILE, "idletime-outgoing = %d\t\t# outgoing call idle timeout\n", cep->idle_time_out); switch( cep->shorthold_algorithm ) { case SHA_FIXU: s = "fix-unit-size"; break; case SHA_VARU: s = "var-unit-size"; break; default: s = "error!!!"; break; } fprintf(PFILE, "idle-algorithm-outgoing = %s\t\t# outgoing call idle algorithm\n", s); } if(!(cep->inout == DIR_OUTONLY)) fprintf(PFILE, "idletime-incoming = %d\t\t# incoming call idle timeout\n", cep->idle_time_in); if(!(cep->usrdevicename == BDRV_TEL)) { fprintf(PFILE, "unitlengthsrc = "); switch(cep->unitlengthsrc) { case ULSRC_NONE: fprintf(PFILE, "none\t\t# no unit length specified, using default\n"); break; case ULSRC_CMDL: fprintf(PFILE, "cmdl\t\t# using unit length specified on commandline\n"); break; case ULSRC_CONF: fprintf(PFILE, "conf\t\t# using unitlength specified by unitlength-keyword\n"); fprintf(PFILE, "unitlength = %d\t\t# fixed unitlength\n", cep->unitlength); break; case ULSRC_RATE: fprintf(PFILE, "rate\t\t# using unitlength specified in rate database\n"); fprintf(PFILE, "ratetype = %d\t\t# type of rate from rate database\n", cep->ratetype); break; case ULSRC_DYN: fprintf(PFILE, "aocd\t\t# using dynamically calculated unitlength based on AOCD subscription\n"); fprintf(PFILE, "ratetype = %d\t\t# type of rate from rate database\n", cep->ratetype); break; } fprintf(PFILE, "earlyhangup = %d\t\t# early hangup safety time\n", cep->earlyhangup); } if(cep->usrdevicename == BDRV_TEL) { fprintf(PFILE, "answerprog = %s\t\t# program used to answer incoming telephone calls\n", cep->answerprog); fprintf(PFILE, "alert = %d\t\t# number of seconds to wait before accepting a call\n", cep->alert); } if(!(cep->usrdevicename == BDRV_TEL)) { if(cep->dialin_reaction == REACT_CALLBACK) fprintf(PFILE, "callbackwait = %d\t\t# i am waiting this time before calling back remote\n", cep->callbackwait); if(cep->dialouttype == DIALOUT_CALLEDBACK) fprintf(PFILE, "calledbackwait = %d\t\t# i am waiting this time for a call back from remote\n", cep->calledbackwait); if(!(cep->inout == DIR_INONLY)) { fprintf(PFILE, "dialretries = %d\t\t# number of dialing retries\n", cep->dialretries); fprintf(PFILE, "recoverytime = %d\t\t# time to wait between dialling retries\n", cep->recoverytime); fprintf(PFILE, "dialrandincr = %s\t\t# use random dialing time addon\n", cep->dialrandincr ? "on" : "off"); fprintf(PFILE, "usedown = %s\n", cep->usedown ? "on\t\t# ISDN device switched off on excessive dial failures" : "off\t\t# no device switchoff on excessive dial failures"); if(cep->usedown) { fprintf(PFILE, "downtries = %d\t\t# number of dialretries failures before switching off\n", cep->downtries); fprintf(PFILE, "downtime = %d\t\t# time device is switched off\n", cep->downtime); } } } } fprintf(PFILE, "\n"); } /* EOF */ diff --git a/usr.sbin/i4b/isdnd/rc_parse.y b/usr.sbin/i4b/isdnd/rc_parse.y index 428adc0f4cb0..2147325389f6 100644 --- a/usr.sbin/i4b/isdnd/rc_parse.y +++ b/usr.sbin/i4b/isdnd/rc_parse.y @@ -1,511 +1,519 @@ /* * Copyright (c) 1997 Joerg Wunsch. All rights reserved. * - * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved. + * Copyright (c) 1997, 2001 Hellmuth Michaelis. 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. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. * *--------------------------------------------------------------------------- * * i4b daemon - runtime configuration parser * ----------------------------------------- * - * $Id: rc_parse.y,v 1.30 2000/10/09 11:17:07 hm Exp $ - * * $FreeBSD$ * - * last edit-date: [Mon Oct 2 22:51:23 2000] + * last edit-date: [Mon May 21 11:22:21 2001] * *---------------------------------------------------------------------------*/ %{ /* #define YYDEBUG 1 */ #include #include #include #include "monitor.h" /* monitor access rights bit definitions */ #include "isdnd.h" #ifndef FALSE # define FALSE 0 #endif #ifndef TRUE # define TRUE 1 #endif extern void cfg_setval(int keyword); extern void cfg_set_controller_default(); extern void reset_scanner(FILE *infile); extern void yyerror(const char *msg); extern int yylex(); extern int lineno; extern char *yytext; extern int nentries; int saw_system = 0; int entrycount = -1; int controllercount = -1; %} %token ACCTALL %token ACCTFILE %token ALERT %token ALIASFNAME %token ALIASING %token ANSWERPROG %token B1PROTOCOL %token BEEPCONNECT %token BUDGETCALLOUTPERIOD %token BUDGETCALLOUTNCALLS %token BUDGETCALLOUTSFILE %token BUDGETCALLOUTSFILEROTATE %token BUDGETCALLBACKPERIOD %token BUDGETCALLBACKNCALLS %token BUDGETCALLBACKSFILE %token BUDGETCALLBACKSFILEROTATE %token CALLBACKWAIT %token CALLEDBACKWAIT %token CALLIN %token CALLOUT %token CHANNELSTATE +%token CLONE %token CONNECTPROG %token CONTROLLER %token DIALOUTTYPE %token DIALRANDINCR %token DIALRETRIES %token DIRECTION %token DISCONNECTPROG %token DOWNTIME %token DOWNTRIES %token EARLYHANGUP %token ENTRY %token EXTCALLATTR +%token FIRMWARE %token FULLCMD %token HOLIDAYFILE %token IDLETIME_IN %token IDLETIME_OUT %token IDLE_ALG_OUT %token ISDNCHANNEL %token ISDNCONTROLLER %token ISDNTIME %token ISDNTXDELIN %token ISDNTXDELOUT %token LOCAL_PHONE_DIALOUT %token LOCAL_PHONE_INCOMING %token LOGEVENTS %token MAILER %token MAILTO %token MONITOR %token MONITORACCESS %token MONITORPORT %token MONITORSW %token NAME %token NO %token OFF %token ON %token PPP_AUTH_RECHALLENGE %token PPP_AUTH_PARANOID %token PPP_EXPECT_AUTH %token PPP_EXPECT_NAME %token PPP_EXPECT_PASSWORD %token PPP_SEND_AUTH %token PPP_SEND_NAME %token PPP_SEND_PASSWORD %token PROTOCOL %token RATESFILE %token RATETYPE %token REACTION %token RECOVERYTIME %token REGEXPR %token REGPROG %token REMOTE_NUMBERS_HANDLING %token REMOTE_PHONE_DIALOUT %token REMOTE_PHONE_INCOMING %token RESTRICTEDCMD %token ROTATESUFFIX %token RTPRIO %token SYSTEM %token TINAINITPROG %token UNITLENGTH %token UNITLENGTHSRC %token USEACCTFILE %token USEDOWN %token USRDEVICENAME %token USRDEVICEUNIT %token VALID %token YES %token NUMBERSTR %token STRING %type boolean %type sysfilekeyword sysnumkeyword sysstrkeyword sysboolkeyword %type filekeyword numkeyword strkeyword boolkeyword monrights monright -%type cstrkeyword +%type cstrkeyword cfilekeyword %type filename %union { int booln; int num; char *str; } %% config: sections ; sections: possible_nullentries syssect optcontrollersects entrysects ; possible_nullentries: /* lambda */ | possible_nullentries error '\n' | possible_nullentries nullentry ; nullentry: '\n' ; entrysects: entrysect | entrysects entrysect ; optcontrollersects: controllersects | { cfg_set_controller_default(); } ; controllersects: controllersect | controllersects controllersect ; /* ============== */ /* system section */ /* ============== */ syssect: SYSTEM sysentries ; sysentries: sysentry { saw_system = 1; monitor_clear_rights(); } | sysentries sysentry ; sysentry: sysfileentry | sysboolentry | sysnumentry | sysstrentry | sysmonitorstart | sysmonitorrights | nullentry | error '\n' ; sysmonitorstart: MONITOR '=' STRING '\n' { char *err = NULL; switch (monitor_start_rights($3)) { case I4BMAR_OK: break; case I4BMAR_LENGTH: err = "local socket name too long: %s"; break; case I4BMAR_DUP: err = "duplicate entry: %s"; break; case I4BMAR_CIDR: err = "invalid CIDR specification: %s"; break; case I4BMAR_NOIP: err = "could not resolve host or net specification: %s"; break; } if (err) { char msg[1024]; snprintf(msg, sizeof msg, err, $3); yyerror(msg); } } ; sysmonitorrights: MONITORACCESS '=' monrights '\n' { monitor_add_rights($3); } ; monrights: monrights ',' monright { $$ = $1 | $3; } | monright { $$ = $1; } ; monright: FULLCMD { $$ = I4B_CA_COMMAND_FULL; } | RESTRICTEDCMD { $$ = I4B_CA_COMMAND_RESTRICTED; } | CHANNELSTATE { $$ = I4B_CA_EVNT_CHANSTATE; } | CALLIN { $$ = I4B_CA_EVNT_CALLIN; } | CALLOUT { $$ = I4B_CA_EVNT_CALLOUT; } | LOGEVENTS { $$ = I4B_CA_EVNT_I4B; } ; sysfileentry: sysfilekeyword '=' filename '\n' { cfg_setval($1); } ; sysboolentry: sysboolkeyword '=' boolean '\n' { yylval.booln = $3; cfg_setval($1); } ; sysnumentry: sysnumkeyword '=' NUMBERSTR '\n' { yylval.num = atoi($3); cfg_setval($1); } ; sysstrentry: sysstrkeyword '=' STRING '\n' { cfg_setval($1); } | sysstrkeyword '=' NUMBERSTR '\n' { cfg_setval($1); } ; filename: STRING { if ($1[0] != '/') { yyerror("filename doesn't start with a slash"); YYERROR; } $$ = $1; } ; boolean: NO { $$ = FALSE; } | OFF { $$ = FALSE; } | ON { $$ = TRUE; } | YES { $$ = TRUE; } ; sysfilekeyword: RATESFILE { $$ = RATESFILE; } | ACCTFILE { $$ = ACCTFILE; } | ALIASFNAME { $$ = ALIASFNAME; } | HOLIDAYFILE { $$ = HOLIDAYFILE; } | TINAINITPROG { $$ = TINAINITPROG; } ; sysboolkeyword: USEACCTFILE { $$ = USEACCTFILE; } | ALIASING { $$ = ALIASING; } | ACCTALL { $$ = ACCTALL; } | BEEPCONNECT { $$ = BEEPCONNECT; } | EXTCALLATTR { $$ = EXTCALLATTR; } | ISDNTIME { $$ = ISDNTIME; } | MONITORSW { $$ = MONITORSW; } ; sysnumkeyword: MONITORPORT { $$ = MONITORPORT; } | RTPRIO { $$ = RTPRIO; } ; sysstrkeyword: MAILER { $$ = MAILER; } | MAILTO { $$ = MAILTO; } | ROTATESUFFIX { $$ = ROTATESUFFIX; } | REGEXPR { $$ = REGEXPR; } | REGPROG { $$ = REGPROG; } ; /* ============= */ /* entry section */ /* ============= */ entrysect: ENTRY { entrycount++; nentries++; } entries ; entries: entry | entries entry ; entry: fileentry | strentry | numentry | boolentry | nullentry | error '\n' ; fileentry: filekeyword '=' filename '\n' { cfg_setval($1); } ; strentry: strkeyword '=' STRING '\n' { cfg_setval($1); } | strkeyword '=' NUMBERSTR '\n' { cfg_setval($1); } ; boolentry: boolkeyword '=' boolean '\n' { yylval.booln = $3; cfg_setval($1); } ; numentry: numkeyword '=' NUMBERSTR '\n' { yylval.num = atoi($3); cfg_setval($1); } ; filekeyword: BUDGETCALLBACKSFILE { $$ = BUDGETCALLBACKSFILE; } | BUDGETCALLOUTSFILE { $$ = BUDGETCALLOUTSFILE; } ; strkeyword: ANSWERPROG { $$ = ANSWERPROG; } | B1PROTOCOL { $$ = B1PROTOCOL; } | CONNECTPROG { $$ = CONNECTPROG; } | DIALOUTTYPE { $$ = DIALOUTTYPE; } | DIRECTION { $$ = DIRECTION; } | DISCONNECTPROG { $$ = DISCONNECTPROG; } | IDLE_ALG_OUT { $$ = IDLE_ALG_OUT; } | LOCAL_PHONE_INCOMING { $$ = LOCAL_PHONE_INCOMING; } | LOCAL_PHONE_DIALOUT { $$ = LOCAL_PHONE_DIALOUT; } | NAME { $$ = NAME; } | PPP_EXPECT_AUTH { $$ = PPP_EXPECT_AUTH; } | PPP_EXPECT_NAME { $$ = PPP_EXPECT_NAME; } | PPP_EXPECT_PASSWORD { $$ = PPP_EXPECT_PASSWORD; } | PPP_SEND_AUTH { $$ = PPP_SEND_AUTH; } | PPP_SEND_NAME { $$ = PPP_SEND_NAME; } | PPP_SEND_PASSWORD { $$ = PPP_SEND_PASSWORD; } | REACTION { $$ = REACTION; } | REMOTE_NUMBERS_HANDLING { $$ = REMOTE_NUMBERS_HANDLING; } | REMOTE_PHONE_INCOMING { $$ = REMOTE_PHONE_INCOMING; } | REMOTE_PHONE_DIALOUT { $$ = REMOTE_PHONE_DIALOUT; } | UNITLENGTHSRC { $$ = UNITLENGTHSRC; } | USRDEVICENAME { $$ = USRDEVICENAME; } | VALID { $$ = VALID; } + | CLONE { $$ = CLONE; } ; numkeyword: ALERT { $$ = ALERT; } | BUDGETCALLBACKPERIOD { $$ = BUDGETCALLBACKPERIOD; } | BUDGETCALLBACKNCALLS { $$ = BUDGETCALLBACKNCALLS; } | BUDGETCALLOUTPERIOD { $$ = BUDGETCALLOUTPERIOD; } | BUDGETCALLOUTNCALLS { $$ = BUDGETCALLOUTNCALLS; } | CALLBACKWAIT { $$ = CALLBACKWAIT; } | CALLEDBACKWAIT { $$ = CALLEDBACKWAIT; } | DIALRETRIES { $$ = DIALRETRIES; } | EARLYHANGUP { $$ = EARLYHANGUP; } | IDLETIME_IN { $$ = IDLETIME_IN; } | IDLETIME_OUT { $$ = IDLETIME_OUT; } | ISDNCONTROLLER { $$ = ISDNCONTROLLER; } | ISDNCHANNEL { $$ = ISDNCHANNEL; } | ISDNTXDELIN { $$ = ISDNTXDELIN; } | ISDNTXDELOUT { $$ = ISDNTXDELOUT; } | RATETYPE { $$ = RATETYPE; } | RECOVERYTIME { $$ = RECOVERYTIME; } | UNITLENGTH { $$ = UNITLENGTH; } | USRDEVICEUNIT { $$ = USRDEVICEUNIT; } | DOWNTIME { $$ = DOWNTIME; } | DOWNTRIES { $$ = DOWNTRIES; } ; boolkeyword: BUDGETCALLBACKSFILEROTATE { $$ = BUDGETCALLBACKSFILEROTATE; } | BUDGETCALLOUTSFILEROTATE { $$ = BUDGETCALLOUTSFILEROTATE; } | DIALRANDINCR { $$ = DIALRANDINCR; } | PPP_AUTH_RECHALLENGE { $$ = PPP_AUTH_RECHALLENGE; } | PPP_AUTH_PARANOID { $$ = PPP_AUTH_PARANOID; } | USEDOWN { $$ = USEDOWN; } ; /* ================== */ /* controller section */ /* ================== */ controllersect: CONTROLLER { controllercount++; } controllers ; controllers: controller | controllers controller ; controller: strcontroller | nullentry | error '\n' ; strcontroller: cstrkeyword '=' STRING '\n' { cfg_setval($1); } | cstrkeyword '=' NUMBERSTR '\n' { cfg_setval($1); } + | cfilekeyword '=' filename '\n' + { + cfg_setval($1); + } ; cstrkeyword: PROTOCOL { $$ = PROTOCOL; } ; +cfilekeyword: FIRMWARE { $$ = FIRMWARE; } + ; + %% diff --git a/usr.sbin/i4b/isdnd/rc_scan.l b/usr.sbin/i4b/isdnd/rc_scan.l index 92c5189d805c..c9bfce446787 100644 --- a/usr.sbin/i4b/isdnd/rc_scan.l +++ b/usr.sbin/i4b/isdnd/rc_scan.l @@ -1,199 +1,199 @@ /* * Copyright (c) 1997 Joerg Wunsch. All rights reserved. * - * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved. + * Copyright (c) 1997, 2001 Hellmuth Michaelis. 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. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. * *--------------------------------------------------------------------------- * * i4b daemon - runtime configuration lexical analyzer * --------------------------------------------------- * - * $Id: rc_scan.l,v 1.33 2000/10/09 11:17:07 hm Exp $ - * * $FreeBSD$ * - * last edit-date: [Wed Jan 10 10:37:11 2001] + * last edit-date: [Mon May 21 11:22:38 2001] * *---------------------------------------------------------------------------*/ %{ #include #include #include #include #include #include #include "y.tab.h" int lineno; %} %option noyywrap %option nounput %% #.*$ { /* * Drop comment. NB: this prevents a hash * sign from appearing inside a quoted string. */ } ["][^"]*["] { char *str; if ((str = malloc(yyleng - 1)) == 0) errx(EX_OSERR, "Out of virtual memory"); memcpy(str, yytext + 1, yyleng - 2); str[yyleng - 2] = 0; yylval.str = str; return STRING; } (-*[0-9]+)|\* { char *str; char *p = yytext; int i = 0; if ((str = malloc(128)) == 0) errx(EX_OSERR, "Out of virtual memory"); while(*p == '-' || isdigit(*p) || *p == '*') str[i++] = *p++; str[i] = '\0'; yylval.str = str; return NUMBERSTR; } acctall { return ACCTALL; } acctfile { return ACCTFILE; } alert { return ALERT; } aliasing { return ALIASING; } aliasfile { return ALIASFNAME; } answerprog { return ANSWERPROG; } b1protocol { return B1PROTOCOL; } beepconnect { return BEEPCONNECT; } budget-callbackperiod { return BUDGETCALLBACKPERIOD; } budget-callbackncalls { return BUDGETCALLBACKNCALLS; } budget-callbacksfile { return BUDGETCALLBACKSFILE; } budget-callbacksfile-rotate { return BUDGETCALLBACKSFILEROTATE; } budget-calloutperiod { return BUDGETCALLOUTPERIOD; } budget-calloutncalls { return BUDGETCALLOUTNCALLS; } budget-calloutsfile { return BUDGETCALLOUTSFILE; } budget-calloutsfile-rotate { return BUDGETCALLOUTSFILEROTATE; } callbackwait { return CALLBACKWAIT; } calledbackwait { return CALLEDBACKWAIT; } +clone { return CLONE; } connectprog { return CONNECTPROG; } controller { return CONTROLLER; } dialin-reaction { return REACTION; } dialout-type { return DIALOUTTYPE; } dialrandincr { return DIALRANDINCR; } dialretries { return DIALRETRIES; } direction { return DIRECTION; } disconnectprog { return DISCONNECTPROG; } downtries { return DOWNTRIES; } downtime { return DOWNTIME; } earlyhangup { return EARLYHANGUP; } entry { return ENTRY; } extcallattr { return EXTCALLATTR; } +firmware { return FIRMWARE; } holidayfile { return HOLIDAYFILE; } idletime-incoming { return IDLETIME_IN; } idletime-outgoing { return IDLETIME_OUT; } idle-algorithm-outgoing { return IDLE_ALG_OUT; } isdncontroller { return ISDNCONTROLLER; } isdnchannel { return ISDNCHANNEL; } isdntime { return ISDNTIME; } isdntxdel-incoming { return ISDNTXDELIN; } isdntxdel-outgoing { return ISDNTXDELOUT; } local-phone-dialout { return LOCAL_PHONE_DIALOUT; } local-phone-incoming { return LOCAL_PHONE_INCOMING; } mailer { return MAILER; } mailto { return MAILTO; } monitor-allowed { return MONITORSW; } monitor-port { return MONITORPORT; } monitor { return MONITOR; } monitor-access { return MONITORACCESS; } fullcmd { return FULLCMD; } restrictedcmd { return RESTRICTEDCMD; } channelstate { return CHANNELSTATE; } callin { return CALLIN; } callout { return CALLOUT; } logevents { return LOGEVENTS; } name { return NAME; } no { return NO; } off { return OFF; } on { return ON; } ppp-auth-rechallenge { return PPP_AUTH_RECHALLENGE; } ppp-auth-paranoid { return PPP_AUTH_PARANOID; } ppp-expect-auth { return PPP_EXPECT_AUTH; } ppp-expect-name { return PPP_EXPECT_NAME; } ppp-expect-password { return PPP_EXPECT_PASSWORD; } ppp-send-auth { return PPP_SEND_AUTH; } ppp-send-name { return PPP_SEND_NAME; } ppp-send-password { return PPP_SEND_PASSWORD; } protocol { return PROTOCOL; } ratesfile { return RATESFILE; } ratetype { return RATETYPE; } recoverytime { return RECOVERYTIME; } regexpr { return REGEXPR; } regprog { return REGPROG; } remdial-handling { return REMOTE_NUMBERS_HANDLING; } remote-phone-dialout { return REMOTE_PHONE_DIALOUT; } remote-phone-incoming { return REMOTE_PHONE_INCOMING; } rotatesuffix { return ROTATESUFFIX; } rtprio { return RTPRIO; } system { return SYSTEM; } tinainitprog { return TINAINITPROG; } unitlength { return UNITLENGTH; } unitlengthsrc { return UNITLENGTHSRC; } useacctfile { return USEACCTFILE; } usrdevicename { return USRDEVICENAME; } usrdeviceunit { return USRDEVICEUNIT; } usedown { return USEDOWN; } valid { return VALID; } yes { return YES; } \n { lineno++; return '\n'; } [A-Za-z/.][-A-Za-z0-9_/.]* { char *str; if ((str = strdup(yytext)) == 0) err(EX_OSERR, "Out of virtual memory"); yylval.str = str; return STRING; } [ \t] { /* drop white space */ } . { return yytext[0]; } %% void reset_scanner(FILE *infile) { yyrestart(infile); lineno = 1; } diff --git a/usr.sbin/i4b/isdnd/support.c b/usr.sbin/i4b/isdnd/support.c index b078b0d60756..f9585c3abaf9 100644 --- a/usr.sbin/i4b/isdnd/support.c +++ b/usr.sbin/i4b/isdnd/support.c @@ -1,1036 +1,1022 @@ /* * Copyright (c) 1997, 2001 Hellmuth Michaelis. 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. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. * *--------------------------------------------------------------------------- * * i4b daemon - misc support routines * ---------------------------------- * * $FreeBSD$ * * last edit-date: [Thu May 3 17:15:00 2001] * *---------------------------------------------------------------------------*/ #include "isdnd.h" static int isvalidtime(cfg_entry_t *cep); /*---------------------------------------------------------------------------* * find an active entry by driver type and driver unit *---------------------------------------------------------------------------*/ cfg_entry_t * find_active_entry_by_driver(int drivertype, int driverunit) { cfg_entry_t *cep = NULL; int i; for(i=0; i < nentries; i++) { cep = &cfg_entry_tab[i]; /* ptr to config entry */ if(!((cep->usrdevicename == drivertype) && (cep->usrdeviceunit == driverunit))) { continue; } /* check time interval */ if(isvalidtime(cep) == 0) { DBGL(DL_VALID, (log(LL_DBG, "find_active_entry_by_driver: entry %d, time not valid!", i))); continue; } /* found */ if(cep->cdid == CDID_UNUSED) { DBGL(DL_MSG, (log(LL_DBG, "find_active_entry_by_driver: entry %d [%s%d], cdid=CDID_UNUSED !", i, bdrivername(drivertype), driverunit))); return(NULL); } else if(cep->cdid == CDID_RESERVED) { DBGL(DL_MSG, (log(LL_DBG, "find_active_entry_by_driver: entry %d [%s%d], cdid=CDID_RESERVED!", i, bdrivername(drivertype), driverunit))); return(NULL); } return(cep); } return(NULL); } /*---------------------------------------------------------------------------* * find entry by drivertype and driverunit and setup for dialing out *---------------------------------------------------------------------------*/ cfg_entry_t * find_by_device_for_dialout(int drivertype, int driverunit) { cfg_entry_t *cep = NULL; int i; for(i=0; i < nentries; i++) { cep = &cfg_entry_tab[i]; /* ptr to config entry */ /* compare driver type and unit */ if(!((cep->usrdevicename == drivertype) && (cep->usrdeviceunit == driverunit))) { continue; } /* check time interval */ if(isvalidtime(cep) == 0) { DBGL(DL_MSG, (log(LL_DBG, "find_by_device_for_dialout: entry %d, time not valid!", i))); continue; } /* found, check if already reserved */ if(cep->cdid == CDID_RESERVED) { DBGL(DL_MSG, (log(LL_DBG, "find_by_device_for_dialout: entry %d, cdid reserved!", i))); return(NULL); } /* check if this entry is already in use ? */ if(cep->cdid != CDID_UNUSED) { DBGL(DL_MSG, (log(LL_DBG, "find_by_device_for_dialout: entry %d, cdid in use", i))); return(NULL); } if((setup_dialout(cep)) == GOOD) { /* found an entry to be used for calling out */ DBGL(DL_MSG, (log(LL_DBG, "find_by_device_for_dialout: found entry %d!", i))); return(cep); } else { DBGL(DL_MSG, (log(LL_DBG, "find_by_device_for_dialout: entry %d, setup_dialout() failed!", i))); return(NULL); } } DBGL(DL_MSG, (log(LL_DBG, "find_by_device_for_dialout: no entry found!"))); return(NULL); } /*---------------------------------------------------------------------------* * find entry by drivertype and driverunit and setup for dialing out *---------------------------------------------------------------------------*/ cfg_entry_t * find_by_device_for_dialoutnumber(int drivertype, int driverunit, int cmdlen, char *cmd) { cfg_entry_t *cep = NULL; int i, j; for(i=0; i < nentries; i++) { cep = &cfg_entry_tab[i]; /* ptr to config entry */ /* compare driver type and unit */ if(!((cep->usrdevicename == drivertype) && (cep->usrdeviceunit == driverunit))) { continue; } /* check time interval */ if(isvalidtime(cep) == 0) { DBGL(DL_MSG, (log(LL_DBG, "find_by_device_for_dialoutnumber: entry %d, time not valid!", i))); continue; } /* found, check if already reserved */ if(cep->cdid == CDID_RESERVED) { DBGL(DL_MSG, (log(LL_DBG, "find_by_device_for_dialoutnumber: entry %d, cdid reserved!", i))); return(NULL); } /* check if this entry is already in use ? */ if(cep->cdid != CDID_UNUSED) { DBGL(DL_MSG, (log(LL_DBG, "find_by_device_for_dialoutnumber: entry %d, cdid in use", i))); return(NULL); } /* check number and copy to cep->remote_numbers[] */ for(j = 0; j < cmdlen; j++) { if(!(isdigit(*(cmd+j)))) { DBGL(DL_MSG, (log(LL_DBG, "find_by_device_for_dialoutnumber: entry %d, dial string contains non-digit at pos %d", i, j))); return(NULL); } /* fill in number to dial */ cep->remote_numbers[0].number[j] = *(cmd+j); } cep->remote_numbers[0].number[j] = '\0'; cep->remote_numbers_count = 1; if((setup_dialout(cep)) == GOOD) { /* found an entry to be used for calling out */ DBGL(DL_MSG, (log(LL_DBG, "find_by_device_for_dialoutnumber: found entry %d!", i))); return(cep); } else { DBGL(DL_MSG, (log(LL_DBG, "find_by_device_for_dialoutnumber: entry %d, setup_dialout() failed!", i))); return(NULL); } } DBGL(DL_MSG, (log(LL_DBG, "find_by_device_for_dialoutnumber: no entry found!"))); return(NULL); } /*---------------------------------------------------------------------------* * find entry by drivertype and driverunit and setup for dialing out *---------------------------------------------------------------------------*/ int setup_dialout(cfg_entry_t *cep) { + int i; + /* check controller operational */ if((get_controller_state(cep->isdncontroller)) != CTRL_UP) { DBGL(DL_MSG, (log(LL_DBG, "setup_dialout: entry %s, controller is down", cep->name))); return(ERROR); } cep->isdncontrollerused = cep->isdncontroller; /* check channel available */ switch(cep->isdnchannel) { - case CHAN_B1: - case CHAN_B2: - if((ret_channel_state(cep->isdncontroller, cep->isdnchannel)) != CHAN_IDLE) + case CHAN_ANY: + for (i = 0; i < isdn_ctrl_tab[cep->isdncontroller].nbch; i++) { - DBGL(DL_MSG, (log(LL_DBG, "setup_dialout: entry %s, channel not free", cep->name))); - return(ERROR); - } - cep->isdnchannelused = cep->isdnchannel; + if(ret_channel_state(cep->isdncontroller, i) == CHAN_IDLE) break; + } - case CHAN_ANY: - if(((ret_channel_state(cep->isdncontroller, CHAN_B1)) != CHAN_IDLE) && - ((ret_channel_state(cep->isdncontroller, CHAN_B2)) != CHAN_IDLE)) + if (i == isdn_ctrl_tab[cep->isdncontroller].nbch) { DBGL(DL_MSG, (log(LL_DBG, "setup_dialout: entry %s, no channel free", cep->name))); return(ERROR); } cep->isdnchannelused = CHAN_ANY; break; default: - DBGL(DL_MSG, (log(LL_DBG, "setup_dialout: entry %s, channel undefined", cep->name))); + if((ret_channel_state(cep->isdncontroller, cep->isdnchannel)) != CHAN_IDLE) + { + DBGL(DL_MSG, (log(LL_DBG, "setup_dialout: entry %s, channel not free", cep->name))); return(ERROR); + } + cep->isdnchannelused = cep->isdnchannel; break; } DBGL(DL_MSG, (log(LL_DBG, "setup_dialout: entry %s ok!", cep->name))); /* preset disconnect cause */ SET_CAUSE_TYPE(cep->disc_cause, CAUSET_I4B); SET_CAUSE_VAL(cep->disc_cause, CAUSE_I4B_NORMAL); return(GOOD); } /*---------------------------------------------------------------------------* * find entry by drivertype and driverunit *---------------------------------------------------------------------------*/ cfg_entry_t * get_cep_by_driver(int drivertype, int driverunit) { cfg_entry_t *cep = NULL; int i; for(i=0; i < nentries; i++) { cep = &cfg_entry_tab[i]; /* ptr to config entry */ if(!((cep->usrdevicename == drivertype) && (cep->usrdeviceunit == driverunit))) { continue; } /* check time interval */ if(isvalidtime(cep) == 0) { DBGL(DL_MSG, (log(LL_DBG, "get_cep_by_driver: entry %d, time not valid!", i))); continue; } DBGL(DL_MSG, (log(LL_DBG, "get_cep_by_driver: found entry %d!", i))); return(cep); } return(NULL); } /*---------------------------------------------------------------------------* * find a matching entry for an incoming call * * - not found/no match: log output with LL_CHD and return NULL * - found/match: make entry in free cep, return address *---------------------------------------------------------------------------*/ cfg_entry_t * find_matching_entry_incoming(msg_connect_ind_t *mp) { cfg_entry_t *cep = NULL; int i; /* check for CW (call waiting) early */ if(mp->channel == CHAN_NO) { if(aliasing) { char *src_tela = "ERROR-src_tela"; char *dst_tela = "ERROR-dst_tela"; src_tela = get_alias(mp->src_telno); dst_tela = get_alias(mp->dst_telno); log(LL_CHD, "%05d CW from %s to %s (no channel free)", mp->header.cdid, src_tela, dst_tela); } else { log(LL_CHD, "%05d call waiting from %s to %s (no channel free)", mp->header.cdid, mp->src_telno, mp->dst_telno); } return(NULL); } for(i=0; i < nentries; i++) { int n; cep = &cfg_entry_tab[i]; /* ptr to config entry */ /* check my number */ if(strncmp(cep->local_phone_incoming, mp->dst_telno, strlen(cep->local_phone_incoming))) { DBGL(DL_MSG, (log(LL_DBG, "find_matching_entry_incoming: entry %d, myno %s != incomingno %s", i, cep->local_phone_incoming, mp->dst_telno))); continue; } /* check all allowed remote number's for this entry */ for (n = 0; n < cep->incoming_numbers_count; n++) { incoming_number_t *in = &cep->remote_phone_incoming[n]; if(in->number[0] == '*') break; if(strncmp(in->number, mp->src_telno, strlen(in->number))) { DBGL(DL_MSG, (log(LL_DBG, "find_matching_entry_incoming: entry %d, remno %s != incomingfromno %s", i, in->number, mp->src_telno))); } else break; } if (n >= cep->incoming_numbers_count) continue; /* check b protocol */ if(cep->b1protocol != mp->bprot) { DBGL(DL_MSG, (log(LL_DBG, "find_matching_entry_incoming: entry %d, bprot %d != incomingprot %d", i, cep->b1protocol, mp->bprot))); continue; } /* is this entry currently in use ? */ if(cep->cdid != CDID_UNUSED) { if(cep->cdid == CDID_RESERVED) { DBGL(DL_MSG, (log(LL_DBG, "find_matching_entry_incoming: entry %d, cdid is reserved", i))); } else if (cep->dialin_reaction == REACT_ACCEPT && cep->dialouttype == DIALOUT_CALLEDBACK) { /* * We might consider doing this even if this is * not a calledback config entry - BUT: there are * severe race conditions and timinig problems * ex. if both sides run I4B with no callback * delay - both may shutdown the outgoing call * and never be able to establish a connection. * In the called-back case this should not happen. */ DBGL(DL_MSG, (log(LL_DBG, "find_matching_entry_incoming: entry %d, incoming call for callback in progress (cdid %05d)", i, cep->cdid))); /* save the current call state, we're going to overwrite it with the * new incoming state below... */ cep->saved_call.cdid = cep->cdid; cep->saved_call.controller = cep->isdncontrollerused; cep->saved_call.channel = cep->isdnchannelused; } else { DBGL(DL_MSG, (log(LL_DBG, "find_matching_entry_incoming: entry %d, cdid in use", i))); continue; /* yes, next */ } } /* check controller value ok */ if(mp->controller > ncontroller) { log(LL_CHD, "%05d %s incoming call with invalid controller %d", mp->header.cdid, cep->name, mp->controller); return(NULL); } /* check controller marked up */ if((get_controller_state(mp->controller)) != CTRL_UP) { log(LL_CHD, "%05d %s incoming call, controller %d DOWN!", mp->header.cdid, cep->name, mp->controller); return(NULL); } /* * check controller he wants, check for any * controller or specific controller */ if( (mp->controller != -1) && (mp->controller != cep->isdncontroller) ) { log(LL_CHD, "%05d %s incoming call, controller %d != incoming %d", mp->header.cdid, cep->name, cep->isdncontroller, mp->controller); continue; } /* check channel he wants */ switch(mp->channel) { - case CHAN_B1: - case CHAN_B2: - if((ret_channel_state(mp->controller, mp->channel)) != CHAN_IDLE) + case CHAN_ANY: + for (i = 0; i < isdn_ctrl_tab[mp->controller].nbch; i++) { - log(LL_CHD, "%05d %s incoming call, channel %s not free!", - mp->header.cdid, cep->name, mp->channel == CHAN_B1 ? "B1" : "B2"); - return(NULL); - } + if(ret_channel_state(mp->controller, i) == CHAN_IDLE) break; + } - case CHAN_ANY: - if(((ret_channel_state(mp->controller, CHAN_B1)) != CHAN_IDLE) && - ((ret_channel_state(mp->controller, CHAN_B2)) != CHAN_IDLE)) + if (i == isdn_ctrl_tab[mp->controller].nbch) { log(LL_CHD, "%05d %s incoming call, no channel free!", mp->header.cdid, cep->name); return(NULL); } break; case CHAN_NO: log(LL_CHD, "%05d %s incoming call, call waiting (no channel available)!", mp->header.cdid, cep->name); return(NULL); break; default: - log(LL_CHD, "%05d %s incoming call, ERROR, channel undefined!", - mp->header.cdid, cep->name); + if((ret_channel_state(mp->controller, mp->channel)) != CHAN_IDLE) + { + log(LL_CHD, "%05d %s incoming call, channel B%d not free!", + mp->header.cdid, cep->name, mp->channel+1); return(NULL); + } break; } /* check time interval */ if(isvalidtime(cep) == 0) { DBGL(DL_MSG, (log(LL_DBG, "find_matching_entry_incoming: entry %d, time not valid!", i))); continue; } /* found a matching entry */ cep->cdid = mp->header.cdid; cep->isdncontrollerused = mp->controller; cep->isdnchannelused = mp->channel; /*XXX*/ cep->disc_cause = 0; /* cp number to real one used */ strcpy(cep->real_phone_incoming, mp->src_telno); /* copy display string */ strcpy(cep->display, mp->display); /* entry currently down ? */ if(cep->state == ST_DOWN) { msg_updown_ind_t mui; /* set interface up */ DBGL(DL_MSG, (log(LL_DBG, "find_matching_entry_incoming: entry %d, ", i))); mui.driver = cep->usrdevicename; mui.driver_unit = cep->usrdeviceunit; mui.updown = SOFT_ENA; if((ioctl(isdnfd, I4B_UPDOWN_IND, &mui)) < 0) { log(LL_ERR, "find_matching_entry_incoming: ioctl I4B_UPDOWN_IND failed: %s", strerror(errno)); error_exit(1, "find_matching_entry_incoming: ioctl I4B_UPDOWN_IND failed: %s", strerror(errno)); } cep->down_retry_count = 0; cep->state = ST_IDLE; } return(cep); } if(aliasing) { char *src_tela = "ERROR-src_tela"; char *dst_tela = "ERROR-dst_tela"; src_tela = get_alias(mp->src_telno); dst_tela = get_alias(mp->dst_telno); log(LL_CHD, "%05d Call from %s to %s", mp->header.cdid, src_tela, dst_tela); } else { log(LL_CHD, "%05d incoming call from %s to %s ctrl %d", mp->header.cdid, mp->src_telno, mp->dst_telno, mp->controller); } return(NULL); } /*---------------------------------------------------------------------------* * return address of ACTIVE config entry by controller and channel *---------------------------------------------------------------------------*/ cfg_entry_t * get_cep_by_cc(int ctrlr, int chan) { int i; - if((chan != CHAN_B1) && (chan != CHAN_B2)) + if((chan < 0) || (chan >= isdn_ctrl_tab[ctrlr].nbch)) return(NULL); for(i=0; i < nentries; i++) { if((cfg_entry_tab[i].cdid != CDID_UNUSED) && (cfg_entry_tab[i].cdid != CDID_RESERVED) && (cfg_entry_tab[i].isdnchannelused == chan) && (cfg_entry_tab[i].isdncontrollerused == ctrlr) && ((ret_channel_state(ctrlr, chan)) == CHAN_RUN)) { return(&cfg_entry_tab[i]); } } return(NULL); } /*---------------------------------------------------------------------------* * return address of config entry identified by cdid *---------------------------------------------------------------------------*/ cfg_entry_t * get_cep_by_cdid(int cdid) { int i; for(i=0; i < nentries; i++) { if(cfg_entry_tab[i].cdid == cdid || cfg_entry_tab[i].saved_call.cdid == cdid) return(&cfg_entry_tab[i]); } return(NULL); } /*---------------------------------------------------------------------------* * return b channel driver type name string *---------------------------------------------------------------------------*/ char * bdrivername(int drivertype) { static char *bdtab[] = { "rbch", "tel", "ipr", "isp", "ibc", "ing" }; if(drivertype >= BDRV_RBCH && drivertype <= BDRV_ING) return(bdtab[drivertype]); else return("unknown"); } /*---------------------------------------------------------------------------* * process AOCD charging messages *---------------------------------------------------------------------------*/ void handle_charge(cfg_entry_t *cep) { time_t now = time(NULL); if(cep->aoc_last == 0) /* no last timestamp yet ? */ { cep->aoc_last = now; /* add time stamp */ } else if(cep->aoc_now == 0) /* no current timestamp yet ? */ { cep->aoc_now = now; /* current timestamp */ } else { cep->aoc_last = cep->aoc_now; cep->aoc_now = now; cep->aoc_diff = cep->aoc_now - cep->aoc_last; cep->aoc_valid = AOC_VALID; } #ifdef USE_CURSES if(do_fullscreen) display_charge(cep); #endif #ifdef I4B_EXTERNAL_MONITOR if(do_monitor && accepted) monitor_evnt_charge(cep, cep->charge, 0); #endif if(cep->aoc_valid == AOC_VALID) { if(cep->aoc_diff != cep->unitlength) { DBGL(DL_MSG, (log(LL_DBG, "handle_charge: AOCD unit length updated %d -> %d secs", cep->unitlength, cep->aoc_diff))); cep->unitlength = cep->aoc_diff; unitlen_chkupd(cep); } else { #ifdef NOTDEF DBGL(DL_MSG, (log(LL_DBG, "handle_charge: AOCD unit length still %d secs", cep->unitlength))); #endif } } } /*---------------------------------------------------------------------------* * update kernel idle_time, earlyhup_time and unitlen_time *---------------------------------------------------------------------------*/ void unitlen_chkupd(cfg_entry_t *cep) { msg_timeout_upd_t tupd; tupd.cdid = cep->cdid; /* init the short hold data based on the shorthold algorithm type */ switch(cep->shorthold_algorithm) { case SHA_FIXU: tupd.shorthold_data.shorthold_algorithm = SHA_FIXU; tupd.shorthold_data.unitlen_time = cep->unitlength; tupd.shorthold_data.idle_time = cep->idle_time_out; tupd.shorthold_data.earlyhup_time = cep->earlyhangup; break; case SHA_VARU: tupd.shorthold_data.shorthold_algorithm = SHA_VARU; tupd.shorthold_data.unitlen_time = cep->unitlength; tupd.shorthold_data.idle_time = cep->idle_time_out; tupd.shorthold_data.earlyhup_time = 0; break; default: log(LL_ERR, "unitlen_chkupd bad shorthold_algorithm %d", cep->shorthold_algorithm ); return; break; } if((ioctl(isdnfd, I4B_TIMEOUT_UPD, &tupd)) < 0) { log(LL_ERR, "ioctl I4B_TIMEOUT_UPD failed: %s", strerror(errno)); error_exit(1, "ioctl I4B_TIMEOUT_UPD failed: %s", strerror(errno)); } } /*--------------------------------------------------------------------------* * this is intended to be called by do_exit and closes down all * active connections before the daemon exits or is reconfigured. *--------------------------------------------------------------------------*/ void close_allactive(void) { - int i, j; + int i, j, k; cfg_entry_t *cep = NULL; j = 0; for (i = 0; i < ncontroller; i++) { if((get_controller_state(i)) != CTRL_UP) continue; - if((ret_channel_state(i, CHAN_B1)) == CHAN_RUN) + for (k = 0; k < isdn_ctrl_tab[i].nbch; k++) { - if((cep = get_cep_by_cc(i, CHAN_B1)) != NULL) + if((ret_channel_state(i, k)) == CHAN_RUN) { -#ifdef USE_CURSES - if(do_fullscreen) - display_disconnect(cep); -#endif -#ifdef I4B_EXTERNAL_MONITOR - monitor_evnt_disconnect(cep); -#endif - next_state(cep, EV_DRQ); - j++; - } - } - - if((ret_channel_state(i, CHAN_B2)) == CHAN_RUN) - { - if((cep = get_cep_by_cc(i, CHAN_B2)) != NULL) + if((cep = get_cep_by_cc(i, k)) != NULL) { #ifdef USE_CURSES if(do_fullscreen) display_disconnect(cep); #endif #ifdef I4B_EXTERNAL_MONITOR monitor_evnt_disconnect(cep); #endif next_state(cep, EV_DRQ); j++; } + } } } if(j) { log(LL_DMN, "close_allactive: waiting for all connections terminated"); sleep(5); } } /*--------------------------------------------------------------------------* * set an interface up *--------------------------------------------------------------------------*/ void if_up(cfg_entry_t *cep) { msg_updown_ind_t mui; /* set interface up */ DBGL(DL_MSG, (log(LL_DBG, "if_up: taking %s%d up", bdrivername(cep->usrdevicename), cep->usrdeviceunit))); mui.driver = cep->usrdevicename; mui.driver_unit = cep->usrdeviceunit; mui.updown = SOFT_ENA; if((ioctl(isdnfd, I4B_UPDOWN_IND, &mui)) < 0) { log(LL_ERR, "if_up: ioctl I4B_UPDOWN_IND failed: %s", strerror(errno)); error_exit(1, "if_up: ioctl I4B_UPDOWN_IND failed: %s", strerror(errno)); } cep->down_retry_count = 0; #ifdef USE_CURSES if(do_fullscreen) display_updown(cep, 1); #endif #ifdef I4B_EXTERNAL_MONITOR monitor_evnt_updown(cep, 1); #endif } /*--------------------------------------------------------------------------* * set an interface down *--------------------------------------------------------------------------*/ void if_down(cfg_entry_t *cep) { msg_updown_ind_t mui; /* set interface up */ DBGL(DL_MSG, (log(LL_DBG, "if_down: taking %s%d down", bdrivername(cep->usrdevicename), cep->usrdeviceunit))); mui.driver = cep->usrdevicename; mui.driver_unit = cep->usrdeviceunit; mui.updown = SOFT_DIS; if((ioctl(isdnfd, I4B_UPDOWN_IND, &mui)) < 0) { log(LL_ERR, "if_down: ioctl I4B_UPDOWN_IND failed: %s", strerror(errno)); error_exit(1, "if_down: ioctl I4B_UPDOWN_IND failed: %s", strerror(errno)); } cep->went_down_time = time(NULL); cep->down_retry_count = 0; #ifdef USE_CURSES if(do_fullscreen) display_updown(cep, 0); #endif #ifdef I4B_EXTERNAL_MONITOR monitor_evnt_updown(cep, 0); #endif } /*--------------------------------------------------------------------------* * send a dial response to (an interface in) the kernel *--------------------------------------------------------------------------*/ void dialresponse(cfg_entry_t *cep, int dstat) { msg_dialout_resp_t mdr; static char *stattab[] = { "normal condition", "temporary failure", "permanent failure", "dialout not allowed" }; if(dstat < DSTAT_NONE || dstat > DSTAT_INONLY) { log(LL_ERR, "dialresponse: dstat out of range %d!", dstat); return; } mdr.driver = cep->usrdevicename; mdr.driver_unit = cep->usrdeviceunit; mdr.stat = dstat; mdr.cause = cep->disc_cause; if((ioctl(isdnfd, I4B_DIALOUT_RESP, &mdr)) < 0) { log(LL_ERR, "dialresponse: ioctl I4B_DIALOUT_RESP failed: %s", strerror(errno)); error_exit(1, "dialresponse: ioctl I4B_DIALOUT_RESP failed: %s", strerror(errno)); } DBGL(DL_DRVR, (log(LL_DBG, "dialresponse: sent [%s]", stattab[dstat]))); } /*--------------------------------------------------------------------------* * screening/presentation indicator *--------------------------------------------------------------------------*/ void handle_scrprs(int cdid, int scr, int prs, char *caller) { /* screening indicator */ if(scr < SCR_NONE || scr > SCR_NET) { log(LL_ERR, "msg_connect_ind: invalid screening indicator value %d!", scr); } else { static char *scrtab[] = { "no screening indicator", "sreening user provided, not screened", "screening user provided, verified & passed", "screening user provided, verified & failed", "screening network provided", }; if(extcallattr) { log(LL_CHD, "%05d %s %s", cdid, caller, scrtab[scr]); } else { DBGL(DL_MSG, (log(LL_DBG, "%s - %s", caller, scrtab[scr]))); } } /* presentation indicator */ if(prs < PRS_NONE || prs > PRS_RESERVED) { log(LL_ERR, "msg_connect_ind: invalid presentation indicator value %d!", prs); } else { static char *prstab[] = { "no presentation indicator", "presentation allowed", "presentation restricted", "number not available due to interworking", "reserved presentation value" }; if(extcallattr) { log(LL_CHD, "%05d %s %s", cdid, caller, prstab[prs]); } else { DBGL(DL_MSG, (log(LL_DBG, "%s - %s", caller, prstab[prs]))); } } } /*--------------------------------------------------------------------------* * check if the time is valid for an entry *--------------------------------------------------------------------------*/ static int isvalidtime(cfg_entry_t *cep) { time_t t; struct tm *tp; if(cep->day == 0) return(1); t = time(NULL); tp = localtime(&t); if(cep->day & HD) { if(isholiday(tp->tm_mday, (tp->tm_mon)+1, (tp->tm_year)+1900)) { DBGL(DL_VALID, (log(LL_DBG, "isvalidtime: holiday %d.%d.%d", tp->tm_mday, (tp->tm_mon)+1, (tp->tm_year)+1900))); goto dayok; } } if(cep->day & (1 << tp->tm_wday)) { DBGL(DL_VALID, (log(LL_DBG, "isvalidtime: day match"))); goto dayok; } return(0); dayok: if(cep->fromhr==0 && cep->frommin==0 && cep->tohr==0 && cep->tomin==0) { DBGL(DL_VALID, (log(LL_DBG, "isvalidtime: no time specified, match!"))); return(1); } if(cep->tohr < cep->fromhr) { /* before 00:00 */ if( (tp->tm_hour > cep->fromhr) || (tp->tm_hour == cep->fromhr && tp->tm_min > cep->frommin) ) { DBGL(DL_VALID, (log(LL_DBG, "isvalidtime: tfromhr, cep->frommin, cep->tohr, cep->tomin, tp->tm_hour, tp->tm_min))); return(1); } /* after 00:00 */ if( (tp->tm_hour < cep->tohr) || (tp->tm_hour == cep->tohr && tp->tm_min < cep->tomin) ) { DBGL(DL_VALID, (log(LL_DBG, "isvalidtime: tfromhr, cep->frommin, cep->tohr, cep->tomin, tp->tm_hour, tp->tm_min))); return(1); } } else if(cep->fromhr == cep->tohr) { if(tp->tm_min >= cep->frommin && tp->tm_min < cep->tomin) { DBGL(DL_VALID, (log(LL_DBG, "isvalidtime: f=t, spec=%02d:%02d-%02d:%02d, curr=%02d:%02d, match!", cep->fromhr, cep->frommin, cep->tohr, cep->tomin, tp->tm_hour, tp->tm_min))); return(1); } } else { if((tp->tm_hour > cep->fromhr && tp->tm_hour < cep->tohr) || (tp->tm_hour == cep->fromhr && tp->tm_min >= cep->frommin) || (tp->tm_hour == cep->tohr && tp->tm_min < cep->tomin) ) { DBGL(DL_VALID, (log(LL_DBG, "isvalidtime: t>f, spec=%02d:%02d-%02d:%02d, curr=%02d:%02d, match!", cep->fromhr, cep->frommin, cep->tohr, cep->tomin, tp->tm_hour, tp->tm_min))); return(1); } } DBGL(DL_VALID, (log(LL_DBG, "isvalidtime: spec=%02d:%02d-%02d:%02d, curr=%02d:%02d, no match!", cep->fromhr, cep->frommin, cep->tohr, cep->tomin, tp->tm_hour, tp->tm_min))); return(0); } /* EOF */ diff --git a/usr.sbin/i4b/isdndebug/main.c b/usr.sbin/i4b/isdndebug/main.c index 89a89101335d..0620b3b4b74f 100644 --- a/usr.sbin/i4b/isdndebug/main.c +++ b/usr.sbin/i4b/isdndebug/main.c @@ -1,636 +1,633 @@ /* - * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved. + * Copyright (c) 1997, 2001 Hellmuth Michaelis. 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. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. * *--------------------------------------------------------------------------- * * main.c - i4b set debug options * ------------------------------ * - * $Id: main.c,v 1.27 2000/07/24 12:22:08 hm Exp $ - * * $FreeBSD$ * - * last edit-date: [Thu Oct 26 08:50:30 2000] + * last edit-date: [Mon May 21 10:09:23 2001] * *---------------------------------------------------------------------------*/ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include char *bin_str(unsigned long val, int length); static void usage ( void ); void printl1(unsigned long val); void printl2(unsigned long val); void printl3(unsigned long val); void printl4(unsigned long val); static int isdnfd; #define I4BCTLDEVICE "/dev/i4bctl" int opt_get = 0; int opt_layer = -1; int opt_set = 0; int opt_setval; int opt_reset = 0; int opt_max = 0; int opt_err = 0; int opt_zero = 0; int opt_unit = 0; int opt_lapd = 0; int opt_rlapd = 0; int opt_chipstat = 0; /*---------------------------------------------------------------------------* * usage display and exit *---------------------------------------------------------------------------*/ static void usage(void) { fprintf(stderr, "\n"); fprintf(stderr, "isdndebug - i4b set debug level, version %d.%d.%d, compiled %s %s\n", VERSION, REL, STEP, __DATE__, __TIME__); fprintf(stderr, "usage: isdndebug -c -e -g -l -m -q -r -s -u -z -C -Q\n"); fprintf(stderr, " -c get chipset statistics\n"); fprintf(stderr, " -e set error only debugging output\n"); fprintf(stderr, " -g get current debugging values\n"); fprintf(stderr, " -l layer specify layer (1...4)\n"); fprintf(stderr, " -m set maximum debugging output\n"); fprintf(stderr, " -q get Q.921 statistics\n"); fprintf(stderr, " -r reset values(s) to compiled in default\n"); fprintf(stderr, " -s value set new debugging value for layer\n"); fprintf(stderr, " -u unit unit number for -c, -q, -C and -Q commands\n"); fprintf(stderr, " -z set zero (=no) debugging output\n"); fprintf(stderr, " -C reset chipset statistics\n"); fprintf(stderr, " -Q reset Q.921 statistics\n"); fprintf(stderr, "\n"); exit(1); } /*---------------------------------------------------------------------------* * program entry *---------------------------------------------------------------------------*/ int main(int argc, char **argv) { int c; ctl_debug_t cdbg; int ret; while ((c = getopt(argc, argv, "ceghl:mqrs:u:zCHQ")) != -1) { switch(c) { case 'c': opt_chipstat = 1; break; case 'e': opt_err = 1; break; case 'g': opt_get = 1; break; case 'q': opt_lapd = 1; break; case 'r': opt_reset = 1; break; case 'm': opt_max = 1; break; case 'l': opt_layer = atoi(optarg); if(opt_layer < 1 || opt_layer > 4) usage(); break; case 's': if((sscanf(optarg, "%i", &opt_setval)) != 1) usage(); opt_set = 1; break; case 'u': opt_unit = atoi(optarg); if(opt_unit < 0 || opt_unit > 9) usage(); break; case 'z': opt_zero = 1; break; case 'Q': opt_rlapd = 1; break; case '?': default: usage(); break; } } if(opt_get == 0 && opt_set == 0 && opt_reset == 0 && opt_max == 0 && opt_err == 0 && opt_zero == 0 && opt_lapd == 0 && opt_rlapd == 0 && opt_chipstat == 0) { usage(); } if((opt_get + opt_set + opt_reset + opt_max + opt_err + opt_zero + opt_lapd + opt_rlapd + opt_chipstat) > 1) { usage(); } if((isdnfd = open(I4BCTLDEVICE, O_RDWR)) < 0) { fprintf(stderr, "i4bctl: cannot open %s: %s\n", I4BCTLDEVICE, strerror(errno)); exit(1); } if(opt_chipstat) { struct chipstat cst; u_char *name; cst.driver_unit = opt_unit; cst.driver_bchannel = 0; if((ret = ioctl(isdnfd, I4B_CTL_GET_CHIPSTAT, &cst)) < 0) { fprintf(stderr, "ioctl I4B_CTL_GET_CHIPSTAT failed: %s", strerror(errno)); exit(1); } switch(cst.driver_type) { case L1DRVR_ISIC: name = "isic"; printf("\nisic-driver\nHSCX events: VFR RDO CRC RAB XDU RFO\n"); printf("unit %d chan %d: %6d %6d %6d %6d %6d %6d\n", cst.stats.hscxstat.unit, cst.stats.hscxstat.chan, cst.stats.hscxstat.vfr, cst.stats.hscxstat.rdo, cst.stats.hscxstat.crc, cst.stats.hscxstat.rab, cst.stats.hscxstat.xdu, cst.stats.hscxstat.rfo); cst.driver_unit = opt_unit; cst.driver_bchannel = 1; if((ret = ioctl(isdnfd, I4B_CTL_GET_CHIPSTAT, &cst)) < 0) { fprintf(stderr, "ioctl I4B_CTL_GET_CHIPSTAT failed: %s", strerror(errno)); exit(1); } printf("HSCX events: VFR RDO CRC RAB XDU RFO\n"); printf("unit %d chan %d: %6d %6d %6d %6d %6d %6d\n", cst.stats.hscxstat.unit, cst.stats.hscxstat.chan, cst.stats.hscxstat.vfr, cst.stats.hscxstat.rdo, cst.stats.hscxstat.crc, cst.stats.hscxstat.rab, cst.stats.hscxstat.xdu, cst.stats.hscxstat.rfo); break; case L1DRVR_IWIC: name = "iwic"; break; case L1DRVR_IFPI: name = "ifpi"; break; case L1DRVR_IHFC: name = "ihfc"; break; case L1DRVR_IFPNP: name = "ifpnp"; break; default: fprintf(stderr, "ioctl I4B_CTL_GET_CHIPSTAT, unknown driver %d\n",cst.driver_type); exit(1); break; } exit(0); } if(opt_lapd) { l2stat_t l2s; l2s.unit = opt_unit; if((ret = ioctl(isdnfd, I4B_CTL_GET_LAPDSTAT, &l2s)) < 0) { fprintf(stderr, "ioctl I4B_CTL_GET_LAPDSTAT failed: %s", strerror(errno)); exit(1); } printf("unit %d Q.921 statistics: receive transmit\n", opt_unit); printf("---------------------------------------------\n"); printf("# of I-frames %12lu %12lu\n", l2s.lapdstat.rx_i, l2s.lapdstat.tx_i); printf("# of RR-frames %12lu %12lu\n", l2s.lapdstat.rx_rr, l2s.lapdstat.tx_rr); printf("# of RNR-frames %12lu %12lu\n", l2s.lapdstat.rx_rnr, l2s.lapdstat.tx_rnr); printf("# of REJ-frames %12lu %12lu\n", l2s.lapdstat.rx_rej, l2s.lapdstat.tx_rej); printf("# of SABME-frames %12lu %12lu\n", l2s.lapdstat.rx_sabme, l2s.lapdstat.tx_sabme); printf("# of DM-frames %12lu %12lu\n", l2s.lapdstat.rx_dm, l2s.lapdstat.tx_dm); printf("# of DISC-frames %12lu %12lu\n", l2s.lapdstat.rx_disc, l2s.lapdstat.tx_disc); printf("# of UA-frames %12lu %12lu\n", l2s.lapdstat.rx_ua, l2s.lapdstat.tx_ua); printf("# of FRMR-frames %12lu %12lu\n", l2s.lapdstat.rx_frmr, l2s.lapdstat.tx_frmr); printf("# of TEI-frames %12lu %12lu\n", l2s.lapdstat.rx_tei, l2s.lapdstat.tx_tei); printf("# of UI-frames %12lu \n", l2s.lapdstat.rx_ui); printf("# of XID-frames %12lu \n", l2s.lapdstat.rx_xid); printf(" errors\n"); printf("---------------------------------------------\n"); printf("# of frames with incorrect length%12lu\n", l2s.lapdstat.err_rx_len); printf("# of frames with bad frame type %12lu\n", l2s.lapdstat.err_rx_badf); printf("# of bad S frames %12lu\n", l2s.lapdstat.err_rx_bads); printf("# of bad U frames %12lu\n", l2s.lapdstat.err_rx_badu); printf("# of bad UI frames %12lu\n", l2s.lapdstat.err_rx_badui); exit(0); } if(opt_rlapd) { int unit; unit = opt_unit; if((ret = ioctl(isdnfd, I4B_CTL_CLR_LAPDSTAT, &unit)) < 0) { fprintf(stderr, "ioctl I4B_CTL_CLR_LAPDSTAT failed: %s", strerror(errno)); exit(1); } printf("Q.921 statistics counters unit %d reset to zero!\n", unit); exit(0); } if((ret = ioctl(isdnfd, I4B_CTL_GET_DEBUG, &cdbg)) < 0) { fprintf(stderr, "ioctl I4B_CTL_GET_DEBUG failed: %s", strerror(errno)); exit(1); } if(opt_get) { switch(opt_layer) { case -1: printl1(cdbg.l1); printl2(cdbg.l2); printl3(cdbg.l3); printl4(cdbg.l4); break; case 1: printl1(cdbg.l1); break; case 2: printl2(cdbg.l2); break; case 3: printl3(cdbg.l3); break; case 4: printl4(cdbg.l4); break; } printf("\n"); return(0); } else if(opt_set) { switch(opt_layer) { case -1: usage(); break; case 1: cdbg.l1 = opt_setval; break; case 2: cdbg.l2 = opt_setval; break; case 3: cdbg.l3 = opt_setval; break; case 4: cdbg.l4 = opt_setval; break; } } else if(opt_reset) { switch(opt_layer) { case -1: cdbg.l1 = L1_DEBUG_DEFAULT; cdbg.l2 = L2_DEBUG_DEFAULT; cdbg.l3 = L3_DEBUG_DEFAULT; cdbg.l4 = L4_DEBUG_DEFAULT; break; case 1: cdbg.l1 = L1_DEBUG_DEFAULT; break; case 2: cdbg.l2 = L2_DEBUG_DEFAULT; break; case 3: cdbg.l3 = L3_DEBUG_DEFAULT; break; case 4: cdbg.l4 = L4_DEBUG_DEFAULT; break; } } else if(opt_max) { switch(opt_layer) { case -1: cdbg.l1 = L1_DEBUG_MAX; cdbg.l2 = L2_DEBUG_MAX; cdbg.l3 = L3_DEBUG_MAX; cdbg.l4 = L4_DEBUG_MAX; break; case 1: cdbg.l1 = L1_DEBUG_MAX; break; case 2: cdbg.l2 = L2_DEBUG_MAX; break; case 3: cdbg.l3 = L3_DEBUG_MAX; break; case 4: cdbg.l4 = L4_DEBUG_MAX; break; } } else if(opt_err) { switch(opt_layer) { case -1: cdbg.l1 = L1_DEBUG_ERR; cdbg.l2 = L2_DEBUG_ERR; cdbg.l3 = L3_DEBUG_ERR; cdbg.l4 = L4_DEBUG_ERR; break; case 1: cdbg.l1 = L1_DEBUG_ERR; break; case 2: cdbg.l2 = L2_DEBUG_ERR; break; case 3: cdbg.l3 = L3_DEBUG_ERR; break; case 4: cdbg.l4 = L4_DEBUG_ERR; break; } } else if(opt_zero) { switch(opt_layer) { case -1: cdbg.l1 = 0; cdbg.l2 = 0; cdbg.l3 = 0; cdbg.l4 = 0; break; case 1: cdbg.l1 = 0; break; case 2: cdbg.l2 = 0; break; case 3: cdbg.l3 = 0; break; case 4: cdbg.l4 = 0; break; } } else { exit(1); } if((ret = ioctl(isdnfd, I4B_CTL_SET_DEBUG, &cdbg)) < 0) { fprintf(stderr, "ioctl I4B_CTL_SET_DEBUG failed: %s", strerror(errno)); exit(1); } return(0); } /*---------------------------------------------------------------------------* * return ptr to string of 1's and 0's for value *---------------------------------------------------------------------------*/ char * bin_str(unsigned long val, int length) { static char buffer[80]; int i = 0; if (length > 32) length = 32; val = val << (32 - length); while (length--) { if (val & 0x80000000) buffer[i++] = '1'; else buffer[i++] = '0'; if ((length % 4) == 0 && length) buffer[i++] = '.'; val = val << 1; } return (buffer); } /*---------------------------------------------------------------------------* * print l1 info *---------------------------------------------------------------------------*/ void printl1(unsigned long val) { printf("\nLayer 1: %s = 0x%lX\n", bin_str(val, 32), val); printf(" | |||| |||| |||| ||||\n"), printf(" | |||| |||| |||| |||+- general error messages\n"); printf(" | |||| |||| |||| ||+-- PH primitives exchanged\n"); printf(" | |||| |||| |||| |+--- B channel actions\n"); printf(" | |||| |||| |||| +---- HSCX error messages\n"); printf(" | |||| |||| |||+------ HSCX IRQ messages\n"); printf(" | |||| |||| ||+------- ISAC error messages\n"); printf(" | |||| |||| |+-------- ISAC messages\n"); printf(" | |||| |||| +--------- ISAC setup messages\n"); printf(" | |||| |||+----------- FSM general messages\n"); printf(" | |||| ||+------------ FSM error messages\n"); printf(" | |||| |+------------- timer general messages\n"); printf(" | |||| +-------------- timer error messages\n"); printf(" | |||+---------------- HSCX data xfer errors msgs\n"); printf(" | ||+----------------- ISAC CICO messages\n"); printf(" | |+------------------ silent messages (soft-HDLC)\n"); printf(" | +------------------- error messages (soft-HDLC)\n"); printf(" +--------------------- HFC-S PCI debug messages\n"); printf(" ++++-++++-++++-+++---------------------- unassigned\n"); } /*---------------------------------------------------------------------------* * print l2 info *---------------------------------------------------------------------------*/ void printl2(unsigned long val) { printf("\nLayer 2: %s = 0x%lX\n", bin_str(val, 32), val); printf(" || |||| |||| ||||\n"), printf(" || |||| |||| |||+- general error messages\n"); printf(" || |||| |||| ||+-- DL primitives exchanged\n"); printf(" || |||| |||| |+--- U frame messages\n"); printf(" || |||| |||| +---- U frame error messages\n"); printf(" || |||| |||+------ S frame messages\n"); printf(" || |||| ||+------- S frame error messages\n"); printf(" || |||| |+-------- I frame messages\n"); printf(" || |||| +--------- I frame error messages\n"); printf(" || |||+----------- FSM general messages\n"); printf(" || ||+------------ FSM error messages\n"); printf(" || |+------------- timer general messages\n"); printf(" || +-------------- timer error messages\n"); printf(" |+---------------- TEI general messages\n"); printf(" +----------------- TEI error messages\n"); printf(" ++++-++++-++++-++++-++------------------ unassigned\n"); } /*---------------------------------------------------------------------------* * print l3 info *---------------------------------------------------------------------------*/ void printl3(unsigned long val) { printf("\nLayer 3: %s = 0x%lX\n", bin_str(val, 32), val); printf(" ||| |||| ||||\n"), printf(" ||| |||| |||+- general error messages\n"); printf(" ||| |||| ||+-- general messages\n"); printf(" ||| |||| |+--- FSM messages\n"); printf(" ||| |||| +---- FSM error messages\n"); printf(" ||| |||+------ timer messages\n"); printf(" ||| ||+------- timer error messages\n"); printf(" ||| |+-------- protocol messages\n"); printf(" ||| +--------- protocol error messages\n"); printf(" ||+----------- facility messages\n"); printf(" |+------------ facility error messages\n"); printf(" +------------- Q.931 messages exchanged\n"); printf(" ++++-++++-++++-++++-++++-+-------------- unassigned\n"); } /*---------------------------------------------------------------------------* * print l4 info *---------------------------------------------------------------------------*/ void printl4(unsigned long val) { printf("\nLayer 4: %s = 0x%lX\n", bin_str(val, 32), val); - printf(" |||| |||| ||||\n"), - printf(" |||| |||| |||+- general error messages\n"); - printf(" |||| |||| ||+-- general messages\n"); - printf(" |||| |||| |+--- B-ch timeout messages\n"); - printf(" |||| |||| +---- network driver dial state\n"); - printf(" |||| |||+------ ipr driver debug messages\n"); - printf(" |||| ||+------- rbch driver debug messages\n"); - printf(" |||| |+-------- isp driver debug messages\n"); - printf(" |||| +--------- tel driver debug messages\n"); - printf(" |||+----------- tina driver debug messages\n"); - printf(" ||+------------ tina driver messages\n"); - printf(" |+------------- tina driver error messages\n"); - printf(" +-------------- ing driver debug messages\n"); + printf(" ||| |||| ||||\n"), + printf(" ||| |||| |||+- general error messages\n"); + printf(" ||| |||| ||+-- general messages\n"); + printf(" ||| |||| |+--- B-ch timeout messages\n"); + printf(" ||| |||| +---- network driver dial state\n"); + printf(" ||| |||+------ ipr driver debug messages\n"); + printf(" ||| ||+------- rbch driver debug messages\n"); + printf(" ||| |+-------- isp driver debug messages\n"); + printf(" ||| +--------- tel driver debug messages\n"); + printf(" ||+----------- ing driver debug messages\n"); + printf(" |+------------ iavc driver debug messages\n"); + printf(" +------------- capi driver debug messages\n"); printf(" ++++-++++-++++-++++-++++---------------- unassigned\n"); } /* EOF */ diff --git a/usr.sbin/i4b/man/Makefile b/usr.sbin/i4b/man/Makefile index 2600080fcff0..f75cd6b27025 100644 --- a/usr.sbin/i4b/man/Makefile +++ b/usr.sbin/i4b/man/Makefile @@ -1,6 +1,7 @@ # $FreeBSD$ MAN = i4b.4 i4bctl.4 i4bipr.4 i4bq921.4 i4bq931.4 i4brbch.4 i4btel.4 \ - i4btrc.4 isic.4 i4bisppp.4 iwic.4 ifpi.4 ifpnp.4 ihfc.4 itjc.4 + i4btrc.4 isic.4 i4bisppp.4 iwic.4 ifpi.4 ifpnp.4 ihfc.4 itjc.4 \ + i4bcapi.4 iavc.4 .include diff --git a/usr.sbin/i4b/man/i4bcapi.4 b/usr.sbin/i4b/man/i4bcapi.4 new file mode 100644 index 000000000000..3539b03c55c5 --- /dev/null +++ b/usr.sbin/i4b/man/i4bcapi.4 @@ -0,0 +1,55 @@ +.\" +.\" Copyright (c) 2001 Hellmuth Michaelis. 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. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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$ +.\" +.\" last edit-date: [Fri May 25 09:38:45 2001] +.\" +.Dd May 21, 2001 +.Dt I4BCAPI 4 +.Os +.Sh NAME +.Nm i4bcapi +.Nd CAPI driver for the isdn4bsd kernel part +.Sh SYNOPSIS +.Cd device \&"i4bcapi\&" +.Sh DESCRIPTION +.Nm +is a CAPI driver for the +.Em isdn4bsd +package. It sits between layer 4 of isdn4bsd and a driver for an active +ISDN card; currently only the +.Xr iavc 4 +driver for the AVM B1 and T1 family of active cards is supported. +.Sh STANDARDS +CAPI 2.0 (http://www.capi.org/) +.Sh SEE ALSO +.Xr iavc 4 +.Sh AUTHORS +The +.Nm +device driver was written by +.An Juha-Matti Liukkonen (Cubical Solutions Ltd, Finnland) Aq jml@cubical.fi . +This manpage was written by +.An Hellmuth Michaelis Aq hm@freebsd.org . diff --git a/usr.sbin/i4b/man/iavc.4 b/usr.sbin/i4b/man/iavc.4 new file mode 100644 index 000000000000..7c68d1dd364d --- /dev/null +++ b/usr.sbin/i4b/man/iavc.4 @@ -0,0 +1,67 @@ +.\" +.\" Copyright (c) 2001 Hellmuth Michaelis. 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. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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$ +.\" +.\" last edit-date: [Fri May 25 09:45:35 2001] +.\" +.Dd May 22, 2001 +.Dt IAVC 4 +.Os +.Sh NAME +.Nm iavc +.Nd isdn4bsd AVM B1/T1 driver +.Sh SYNOPSIS +.Cd "device iavc" +.Pp +NOTE: +For the B1 ISA card +.Pp +.Dl hint.iavc.0.at="isa" +.Dl hint.iavc.0.port="0x150" +.Dl hint.iavc.0.irq="5" +.Pp +must be added to +.Pa /boot/device.hints +.Pp +.Sh DESCRIPTION +The +.Nm +driver is used to access the AVM family of active cards to the +.Xr i4bcapi 4 +driver and the +.Em isdn4bsd +package. Currently the AVM B1 PCI, the AVM B1 ISA and the AVM T1 PCI +cards are supported. +.Sh STANDARDS +CAPI 2.0 (http://www.capi.org/) +.Sh SEE ALSO +.Xr i4bcapi 4 +.Sh AUTHORS +The +.Nm +device driver was written by +.An Juha-Matti Liukkonen (Cubical Solutions Ltd, Finnland) Aq jml@cubical.fi . +This manpage was written by +.An Hellmuth Michaelis Aq hm@freebsd.org .