HP UX 11i v2 Networking Software manual 164

Page 164

Sample Programs

Connectionless Mode

/************************************************************************** main

**************************************************************************/

main() {

int

send_fd, recv_fd;

/*

file descriptors */

u_char

sdlsap[20];

/*

sending DLSAP */

u_char

rdlsap[20];

/*

receiving DLSAP */

int

sdlsap_len, rdlsap_len; /*

DLSAP lengths */

int

i, j, recv_len;

 

 

/*

PART 1 of program. Demonstrate connectionless data transfer with LLC SAP header.

*/

/*

First, we must open the DLPI device file, /dev/dlpi, and attach to a PPA. attach() will open /dev/dlpi, find the first PPA with the DL_HP_PPA_INFO primitive, and attach to that PPA. attach() returns the file descriptor for the stream. Here we do an attach for each file descriptor.

*/

send_fd = attach(); recv_fd = attach();

/*

Now we have to bind to a IEEESAP. We will ask for connectionless data link service with the DL_CLDLS service mode. Since we are connectionless, we will not have any incoming connections so we

set max_conind to 0. bind() will return our local DLSAP and its length in the last two arguments we pass to it.

*/

bind(send_fd, SEND_SAP, 0, DL_CLDLS, sdlsap, &sdlsap_len); bind(recv_fd, RECV_SAP, 0, DL_CLDLS, rdlsap, &rdlsap_len);

/* print the DLSAPs we got back from the binds */ print_dlsap(”sending DLSAP = ”, sdlsap, sdlsap_len); print_dlsap(”receiving DLSAP = ”, rdlsap, rdlsap_len);

/*

Time to send some data. We'll send 5 data packets in sequence. */

for(i = 0; i < 5; i++) {

/* send (i+1)*10 data bytes with the first byte = i */ data_area[0] = i;

/* Initialize data area */ for (j = 1; j < (i+1)*10; j++)

data_area[j] = ”a”; print_dlsap(”sending data to ”,rdlsap, rdlsap_len);

send_data(send_fd, rdlsap, rdlsap_len, (i + 1) * 10); /* receive the data packet */

recv_len = recv_data(recv_fd);

printf(”received %d bytes, first word = %d\n”, recv_len, data_area[0]);

}

164

Appendix A

Image 164
Contents Dlpi Programmer’s Guide EditionLegal Notices Page Page Contents Contents Contents Sample Programs Printing History Page Preface Appendix a Sample ProgramsPage Introduction to Dlpi Introduction to Dlpi HP Dlpi Features Device File Format Header FilesService Interface Data Link LayerDlpi Connection-mode Service Modes of CommunicationData Link Layer Physical Attachment Identification Connectionless-mode ServiceDlpi Addressing HP PPA Format Data Link User Identification HP’s Dlsap Address Format 802.3, Ethernet, Token Ring, FddiHP’s Dlsap Address Format for Fibre Channel Dlsap Promiscuous Mode Clarifications Dlpi Services Dlerrorack DlinforeqDlinfoack DlhpppareqDlresetreq DlresetindDlresetres DlresetconLocal Management Services Information Reporting ServiceDlhprawdatareq DlhprawdataindAttach Service Bind ServiceSnap BindingReserved IEEESAPS/Ethertypes Message Flow Binding a Stream to a Dlsap Message Flow Enabling a Specific Multicast Address on a Connection-mode Services Connection Establishment ServiceConnection Handoff 12 Message Flow Successful Connection Establishment13 Message Flow Token Retrieval 16 Message Flow Both Primitives are Destroyed by Provider Data Transfer Service 19 Message Flow Normal Data TransferConnection Release Service 20 Message Flow DLS User-Invoked Connection ReleaseReset Service 23 Message Flow DLS User-Invoked Connection Reset Connectionless-mode Services Connectionless Data TransferRaw-mode Services Error Reporting ServiceXID and Test Service Raw-mode Data Transfer31 Message Flow XID Service XID and Test Packet Handling32 Message Flow Test Service An Example33 Message Flow a Connection-Mode Example Dlpi Primitives Dlpi Primitives Local Management Primitives PPA Initialization/De-initializationDlhpppareq Dlhpppaack Dlhpppaack Dlinforeq MTUDlinfoack Dlcsmacd DltpbDltpr DlmetroDlchar DlctcaDlfddi DlotherDlunknown DlhprawdlsDlacldls DLSTYLE1 DLSTYLE2Dlbadppa DlaccessDlattachreq Dlsyserr DldetachreqDloutstate Dlbindreq Dlnotinit DlbadaddrDlinitfailed Dlbindack Dlunbindreq Dlsubsbindreq Dlpeerbind DlhierarchicalbindDlsubsbindack DltoomanyDlsubsunbindreq Dlenabmultireq Dldisabmultireq DlnotsupportedDlpromisconreq DlnotenabDlpromiscmulti DlpromiscphysDlpromiscsap Dlpromiscoffreq Dlokack Dlerrorack Dlphysaddrreq Dlfactphysaddr Dlcurrphysaddr Dlphysaddrack DlsetphysaddrreqDlphysaddrack DlphysaddrreqDlsetphysaddrreq Dlgetstatisticsreq DlgetstatisticsackDlbusy DlgetstatisticsreqDlhpmulticastlistreq DlgetstatisticsackDlhpmulticastlistack Dlhpmulticastlistack Connectionless-mode Service Primitives DlunitdatareqDlbaddata Dlunitdataind Dluderrorind Message is valid in state Dlidle Raw Mode Service Primitives DlhprawdatareqDlhprawdataind DlbadprimRaw Mode Service Primitives Dlhpinforeq Connection-mode Service PrimitivesConnection-Oriented Dlpi Extensions Dlhpinfoack DlhpinforeqDlhpinfoack Connection-mode Service Primitives Connection-mode Service Primitives Dlhpsetacktoreq DlhpsetacktoreqDlhpsetptoreq DlhpsetptoreqDlhpsetrejtoreq DlhpsetrejtoreqDlhpsetbusytoreq Dlhpsetsendacktoreq DlhpsetbusytoreqDlhpsetmaxretriesreq DlhpsetmaxretriesreqDlhpsetsendacktoreq Dlhpsetackthreshreq DLOUTCONPENDING, DlinconpendingDlhpsetlocalwinreq Dlhpsetremotewinreq Dlhpclearstatsreq DlhpsetremotewinreqDlhpsetlocalbusyreq DlhpsetlocalbusyreqDlhpclearstatsreq Dlhpclearlocalbusyreq DlhpclearlocalbusyreqDlconnectreq Dlbadqostype DlconnectindDlbadqosparam 112 Dlconnectres 114 Dlconnectcon DlbadtokenDlbadcorr Dlpending116 Dltokenreq DltokenackDldatareq Dldataind Dldisconnectreq120 Dldisconnectind Dlresetreq Dlresetind Dlresetres Dlresetcon 126 Primitives to Handle XID and Test Operations DltestreqDltestind DltestautoChapter 129 Dltestres Dltestcon Dlxidreq Dlxidind Dlxidauto134 Dlxidres DlpollfinalDlxidcon Chapter 137 Dlpi States User Reset Dluserreset Dlresetcon Prov Reset DlprovresetDlresetres Resetres Udqos Pend DludqosDLDISCON9 Pend PendingDlinconpending DLDISCON11Chapter 141 142 Sample Programs Connection Mode LongareasizeAppendix a 145 146 Appendix a 147 148 Appendix a 149 150 Appendix a 151 152 Appendix a 153 154 Appendix a 155 Connectionless Mode Snap SAPAppendix a 157 158 Appendix a 159 160 Appendix a 161 162 Appendix a 163 164 Appendix a 165 166 Raw Mode 168 Appendix a 169 170 Appendix a 171 Raw Mode 172 Glossary Connection establishment174 Glossary Index
Related manuals
Manual 94 pages 16.8 Kb Manual 74 pages 39 Kb Manual 236 pages 18.16 Kb Manual 12 pages 39.66 Kb Manual 28 pages 49.76 Kb