## TCPware V5.7 Programmer's Guide

- Introduction
- Multicasting
- Logicals
- Sample Programs

Chapter 2

UCX Compatibility Services

# Introduction

This chapter describes the UCX Compatibility Services.

The UCX Compatibility Services provide the following functions:

• BGDRIVER, the front-end QIO interface to TCPware that provides support for the HP TCP/IP Services for OpenVMS (formerly the VMS/ULTRIX Connection, or UCX) QIO functions.

• TCPware's master server supports BG devices (which are marked record-oriented). These extensions should allow UCX servers activated by the UCX master server to run under TCPware.

See the ADD SERVICE command in the NETCU Command Reference for details on setting services in TCPware.

• Support for the VMS 5.3 and later VAX C Run-Time Library (VAXCRTL) Socket Routines as described in the VAX C Run-Time Library Reference Manual available from HP.

• Support for OpenVMS Alpha and OpenVMS I64 DEC C Runtime Library (DECCRTL) Socket Routines.

For documentation on the HP TCP/IP Services for OpenVMS, see Bookreader help in the Telecommunications and Networking library, the HP TCP/IP Services for OpenVMS VAX collection, and the HP TCP/IP for OpenVMS Services for OpenVMS System Services and C Socket Programming book. This includes sections on writing Internet applications, using the OpenVMS System Services (including QIO calls) and DEC C Socket Routines (including a reference), and on-line programming examples.

Also see the HP TCP/IP Services for VMS Programming Manual from HP for details on the BGDRIVER $QIO interface.

Note! The UCX Compatibility Services are intended to be 100% compatible with HP's BGDRIVER.

If you discover that our BGDRIVER is not 100% compatible with the UCX BGDRIVER $QIO interface, please send us a sample program demonstrating the incompatibility.

The following files are included as part of the UCX QIO compatibility support in the directory TCPWARE_COMMON:[TCPWARE]:

BGDRIVER.EXE: | device driver that emulates the QIO functions.
UCX$INETDEF.H: | VAX C header file containing the UCX INET functions.
UCX$IPC.OLB: | transfer vectors used to resolve the socket routine references to the VAX C/DEC C Run-Time Library.
UCX$IPC_SHR.EXE: | Run-Time library used by VAXCRTL/DECCTRL to support the VAX C/DEC C Socket Routines.

If you have an application that was compiled and linked against UCX, you should be able to run that image on TCPware with no modifications (you do not need to re-link against TCPware).

Note! If you make changes to that application and want to compile and link against TCPware, follow the instructions under the Sample Programs section. The resulting image should run on TCPware or UCX systems.

# Multicasting

UCX Compatibility Services includes the following setsockopt and getsockopt options at the UCX$C_IPOPT level for multicasting support:

UCX$C_IP_ADD_MEMBERSHIP and UCX$C_IP_DROP_MEMBERSHIP | The setsockopt operation adds and drops a multicast membership. The following structure is specified: struct IPMREQDEF {unsigned long int IMR$L_MULTIADDR;/*Multicast group address*/unsigned long int IMR$L_INTERFACE;/*Local interface address*/} ; IMR$L_MULTIADDR contains the multicast internet address to be added or dropped andIMR$L_INTERFACE contains the local interface's internet address on which the multicast address is added or dropped. If IMR$L_INTERFACE is specified as INADDR_ANY (0), the default multicast interface is used.
UCX$C_IP_MULTICAST_IF | The setsockopt operation sets the interface for subsequent multicast datagrams. The longword option value specifies the local internet address of the interface to be used. A getsockopt operation of this option returns the currently set interface (or 0 if none was set).
UCX$C_IP_MULTICAST_LOOP | The setsockopt operation enables or disables the local loopback of multicast datagrams. By default, this option is enabled. Specify a byte value of 1 to enable, 0 to disable. A getsockopt operation of this option returns the current multicast loopback setting.
UCX$C_IP_MULTICAST_TTL | The setsockopt operation sets the time-to-live (TTL) value for multicast datagrams. By default, this value is 1. A getsockopt operation of this option returns the current multicast TTL.

# Logicals

TCPware defines the following logicals for UCX compatibility:

UCX$DEVICE | defined as BG:, which is the name of the UCX device drive.
UCX$INET_HOST | defined to be the host name, which is the same setting as TCPWARE_DOMAINNAME logical.
UCX$IPC_SHR | provides the linkage to the TCPware version of the UCX$IPC_SHR Run-Time library.

Note! The VAX C/DEC C Socket Routines getnetbyname and getnetbyaddr are supported and read the TCPWARE:NETWORKS. file.

IOCTL commands that set interface characteristics are not supported. Sensing of interfaces (SIOCGIFCONF, SIOCGIFADDR, SIOCGIFBRDADDR, SIOCGIFDSTADDR, SIOCGIFFLAGS, and SIOCGIFNETMASK) is supported.

# Sample Programs

The following sample programs using UNIX-like sockets are included in the TCPWARE_COMMON:[TCPWARE.EXAMPLES] directory:

BGDRIVER_TCP_CLIENT.C | BGDRIVER_UDP_CLIENT.C
BGDRIVER_TCP_SERVER.C | BGDRIVER_UDP_SERVER.C

The BGDRIVER_TCP_CLIENT.C and BGDRIVER_TCP_SERVER.C pair of programs provide a self-declared ECHO server that sequentially accepts client connections and echoes back the client messages. The BGDRIVER_UDP_CLIENT.C and BGDRIVER_UDP_SERVER.C pair of programs provide a self-declared DISCARD server that can receive (and discard) datagrams from multiple clients. These programs are functionally equivalent to the socket programs in Chapter 8, Socket Library.

To build any one of these applications using DEC C, enter:

$ CC/DECC/PREFIX=ALL/DEFINE=TCPWARE filename
$ LINK filename
Ctrl/Z

To build any one of these applications using VAX C, enter:

$ CC/VAXC/DEFINE=TCPWARE filename
$ LINK filename, TCPWARE:UCX$IPC/LIB, SYS$INPUT/OPTIONS-
_$ SYS$SHARE:VAXCRTL/SHARE
Ctrl/Z

You can build these programs on both TCPware and UCX systems. The /DEFINE=TCPWARE uses code to point to a TCPware include directory for building on a TCPware system.