HP UX 11i v2 Networking Software manual 154

Page 154

Sample Programs

Connection Mode

connect_req(send_fd, rcdlsap, rcdlsap_len);

/*

The receiver control stream gets a CONNECT_IND. We need the correlation number to relate the CONNECT_IND to the CONNECT_RES we will send down later.

*/

correlation = connect_ind(recv_c_fd);

/*

We want to handle the actual data transfer over a dedicated receiver stream. Here, we attach and bind a second stream on the receivers sap with max_conind = 0.

*/

recv_d_fd = attach();

bind(recv_d_fd, RECV_SAP, 0, DL_CODLS, rddlsap, &rddlsap_len);

/*

To pass the connection from the control stream to the data stream, we need a token for the data stream. get_token returns this.

*/

token = get_token(recv_d_fd);

/*

Now we do a CONNECT_RES on the control stream. The correlation specifies the CONNECT_IND we are responding to, and the token, since it is non-zero, specifies the stream to which we want to hand off the connection.

*/

connect_res(recv_c_fd, correlation, token);

/* Get the CONNECT_CON back on the senders stream */ get_msg(send_fd); check_ctrl(DL_CONNECT_CON);

printf(”connection established\n”);

/*

We now have a connection established between the send_fd stream and the recv_d_fd stream. The recv_c_fd stream is in the IDLE state and is ready to process another CONNECT_IND. Since we won't be establishing any new connections, we'll call cleanup on the receiver control stream to unbind, detach, and close the file descriptor.

*/

cleanup(recv_c_fd);

/* Fill in data_area with some data to send. */ for(i = 0; i < 60; i++) {

data_area[i] = i;

}

/* Send 5 packets of data. */ for(i = 0; i < 5; i++) {

put_data(send_fd, (i + 1) * 10);

printf(”sent %d bytes of data\n”, (i + 1) * 10);

}

154

Appendix A

Image 154
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 Dlpi Addressing Connectionless-mode ServicePhysical Attachment Identification 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 Dlinfoack DlerrorackDlinforeq DlhpppareqDlresetres DlresetreqDlresetind DlresetconDlhprawdatareq Local Management ServicesInformation Reporting Service DlhprawdataindAttach Service Bind ServiceReserved IEEESAPS/Ethertypes BindingSnap 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 Dltpr DlcsmacdDltpb DlmetroDlfddi DlcharDlctca DlotherDlacldls DlhprawdlsDlunknown DLSTYLE1 DLSTYLE2Dlattachreq DlaccessDlbadppa Dloutstate DldetachreqDlsyserr Dlbindreq Dlinitfailed DlbadaddrDlnotinit Dlbindack Dlunbindreq Dlsubsbindreq Dlpeerbind DlhierarchicalbindDlsubsbindack DltoomanyDlsubsunbindreq Dlenabmultireq Dldisabmultireq DlnotsupportedDlpromisconreq DlnotenabDlpromiscsap DlpromiscphysDlpromiscmulti Dlpromiscoffreq Dlokack Dlerrorack Dlphysaddrreq Dlfactphysaddr Dlcurrphysaddr Dlphysaddrack DlphysaddrackDlsetphysaddrreq DlphysaddrreqDlsetphysaddrreq Dlbusy DlgetstatisticsreqDlgetstatisticsack 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 Connection-Oriented Dlpi Extensions Connection-mode Service PrimitivesDlhpinforeq Dlhpinfoack DlhpinforeqDlhpinfoack Connection-mode Service Primitives Connection-mode Service Primitives Dlhpsetacktoreq DlhpsetacktoreqDlhpsetptoreq DlhpsetptoreqDlhpsetbusytoreq DlhpsetrejtoreqDlhpsetrejtoreq Dlhpsetsendacktoreq DlhpsetbusytoreqDlhpsetsendacktoreq DlhpsetmaxretriesreqDlhpsetmaxretriesreq Dlhpsetackthreshreq DLOUTCONPENDING, DlinconpendingDlhpsetlocalwinreq Dlhpsetremotewinreq Dlhpclearstatsreq DlhpsetremotewinreqDlhpclearstatsreq DlhpsetlocalbusyreqDlhpsetlocalbusyreq Dlhpclearlocalbusyreq DlhpclearlocalbusyreqDlconnectreq Dlbadqosparam DlconnectindDlbadqostype 112 Dlconnectres 114 Dlbadcorr DlconnectconDlbadtoken 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 Dlresetres Resetres User Reset DluserresetDlresetcon Prov Reset Dlprovreset Udqos Pend DludqosDlinconpending DLDISCON9Pend Pending 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