Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The sixteen socket numbers 80BB through 80C2 and 86D0 through 86D7 (hexadecimal) are registered with Novell by Galacticomm for use in Worldgroup the Major BBS software. Novell assigns “well-known” socket numbers for released software out of the range 8000 to FFFF. Alternatively, socket numbers 4000 through 7FFF are available for dynamic or experimental usage. Socket numbers 0000 through 3FFF are reserved by Novell, and may be used in accordance with Novell’s instructions (e.g. such as for socket 0452, Service Advertising Protocol).

...

The following macro might be helpful for this (and is included in IPX.H):

Code Block
#define hilo(i) (((unsigned)(i)
>>8
>>8)¦((unsigned char)(i)
<<8
<<8))

This simply swaps the two bytes of a 16-bit int or unsigned variable.

...

Terminating when in session:

Code Block
btucmd(chan,"T");
wait for btusts(chan) == 36 (You should timeout this wait, in case a status 36 never comes for some reason)
bturst(chan); (optional)

Terminating otherwise:

bturst(chan);

...

IPX Virtual Circuits in Raw Packet Mode

Code Block
                      ___________                                                       /      /     0|  chksum   |  (set by IPX)
        |      |      |___________|
        |      |     2|  length   |  Total number of bytes, incl header
        |      |      |___________|  Range 30-576, WARNING: MSB FIRST!
        |      |     4|  trnspt   |  (set by IPX)
        |      |     5|  paktyp   |  Packet type, 4=IPX packets
        |      |     6|           |
        |      |      |  dstnet   |  Destination network, 4 binary                      |      |      |  bytes,   |  right-justified, and zero-
        |      |      |___________|  filled
        |      |    10|           |
        |      |      |           |
        |      |      |  dstnod   |  Destination node, 6 binary bytes,
        |      |      |           |  right-justified, and zero-filled
        |     30      |           |
        |   bytes     |___________|                                             |      |    16|  dstsoc   |
        Destination socket                                 |      |      |___________|  WARNING: MOST
        SIGNIFICANT BYTE FIRST!                      |      |    18|           |
        30     |      |  srcnet   |  Source network, 4 binary bytes,                    to     |      |           |  right-justified, and zero-filled           576    |      |___________|
        bytes  |    22|           |
        |      |      |           |
        |      |      |  srcnod   |  Source node, 6 binary bytes,
        |      |      |           |  right-justified, and zero-filled
        |      |      |           |
        |      |      |___________|
        |      |    28|  srcsoc   |  Source socket
        |      \      |___________|  WARNING: MOST SIGNIFICANT BYTE FIRST!
        |           30|           |
        |             |           |
        |             |           |
        |             |  datbuf   |  Data buffer, containing 0 to 546
        |             |           |  bytes
        |             |           |
        |             |           |
        |             |           |
        |             |           |
        |             |           |
        |             |           |
        |             |           |
        |             |           |
        |             |           |
        |             |           |
        |             |           |
        |             |           |
        |             |           |
        |             |           |
        \             |___________|
Figure 6-1: IPX Virtual Raw Packet Format

...

If after transmitting a raw packet, you “transmit” a single nul (as in btuxct(chan,1,"\0")) and then wait for btuoba() to indicate an empty buffer (when it returns output buffer size minus 1), the raw packet preceding the nul will have been completely transmitted, and the nul will be discarded.

Code Block
struct {
     struct ipx ipx;
     char data[NBYTES];
} ipxpkt;

/* Fill up ipxpkt somehow. */
btuxct(chan,sizeof(ipxpkt),&ipxpkt);
btuxct(chan,1,"\0");
while (btuoba(chan) < OSIZE-1) {
     btuscn();
}
bturst(chan);

This code is an excerpt only (btusiz(), btuitz(), btusdf(), btuend() calls are all essential but they are not shown above). And the while-loop should really have a timeout. And you would rarely call btuscn() only inside a loop like that. But this should give you an idea of what’s involved in this little trick to detect total completion of raw packet transmission.

...

For example, let’s say you wanted to transmit the alphabet on an IPX Virtual channel in raw-packet mode to socket 4007 hex on node 2 of network 1. Assume you are using local socket 5008 hex. Here is code that would do this:

Code Block
#define hilo(i) (((unsigned)(i)
>>8
>>8)|((unsigned char)(i)
<<8
<<8))

struct ipxhdr {                             /* an IPX header contains...   */
     int chksum;                                             /* checksum   */
     int length;           /* 30-576:  header PLUS rest of packet (hi-lo)  */
     char trnspt;                                       /* IPX sets to 0   */
     char paktyp;                                /* 0=unknown 4=IPX 5=SPX  */
     char *stnet[4];                                 /* destination network*/
     char dstnod[6];                                 /* destination node   */
     int dstsoc;                              /* destination socket (hi-lo)*/
     char srcnet[4];                                  /* source network    */
     char srcnod[6];                                        /* source node */
     int srcsoc;                                   /* source socket (hi-lo)*/
};

#define IPXMAX 546               /* max length of data field of IPX packet */

struct ipxpak {                                   /* an IPX packet contains*/
     struct ipxhdr hdr;                                      /* IPX header */
     char datbuf[IPXMAX];                           /* 0 to 546 data bytes */
}

struct ipxpak xmtpak;
char net[]={0,0,0,1};
char nod[]={0,0,0,0,0,2};
char alphabet[]="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int chan=0;
char *malloc();

main()
{
     btuitz(malloc(btusiz(1,256,2048)));
     btusdf(chan,1,6,0x5008,2);
     xmtpak.hdr.length=hilo(26);        /* xmtpak.hdr.length=0x1A00 */
     xmtpak.hdr.paktyp=4;
     movmem(net,xmtpak.hdr.dstnet,6);
     movmem(nod,xmtpak.hdr.dstnod,4);
     xmtpak.hdr.dstsoc=hilo(0x4007);    /* xmtpak.hdr.dstsoc=0x0740 */
     movmem(alphabet,xmtpak.datbuf,26);
     btuxct(chan,&xmtpak,sizeof(struct ipxhdr)+26);
     while(btuoba(chan) < 2047) {
          btuscn();
     }
     btuend();
}

Note: this program is shown as a coding example and is almost useless otherwise, especially in its limited versatility and in its failure to check for erroneous return codes.

...

Also we recommend that a terminal program locally process the ctrl+S pause of server output. This function cannot be handled by the server due to packetization: by the time the server would get a ctrl+S, it may have already shipped out several huge packets.

...

Previous: Major BBS v10: 17 Programming Examples  |  Contents  |  Next: Major BBS v10: 19 X.25 Programming