2 THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
3 SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
4 END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
5 ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
6 IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
7 SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
8 FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
9 CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS
10 AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
11 COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
16 * Routines for IPX communications.
21 #define _BORLAND_DOS_REGS 1
41 typedef unsigned char BYTE;
42 typedef unsigned short WORD;
43 typedef unsigned long DWORD;
45 typedef struct local_address {
47 } __pack__ local_address;
49 typedef struct net_address {
51 local_address node_id;
53 } __pack__ net_address;
55 typedef struct ipx_header {
58 BYTE transport_control;
60 net_address destination;
62 } __pack__ ipx_header;
64 typedef struct ecb_header {
70 BYTE ipx_reserved[14];
72 local_address immediate_address;
74 WORD fragment_pointer[2];
76 } __pack__ ecb_header;
78 typedef struct packet_data {
80 byte data[IPX_MAX_DATA_SIZE];
81 } __pack__ packet_data;
83 typedef struct ipx_packet {
87 } __pack__ ipx_packet;
89 typedef struct user_address {
93 } __pack__ user_address;
96 int Ipx_num_users = 0;
97 user_address Ipx_users[MAX_USERS];
99 #define MAX_NETWORKS 64
100 int Ipx_num_networks = 0;
101 uint Ipx_networks[MAX_NETWORKS];
103 int ipx_packetnum = 0;
105 #define MAX_PACKETS 64
107 static packet_data packet_buffers[MAX_PACKETS];
108 static short packet_free_list[MAX_PACKETS];
109 static int num_packets = 0;
110 static int largest_packet_index = 0;
111 static short packet_size[MAX_PACKETS];
113 //added on 10/29/98 by Kevin Bently to add ipx stuff
114 WORD ipx_num_outgoing_packets = 8;
115 ipx_packet * outpackets;
116 //end this section addition - Kevin Bently
119 ubyte ipx_installed=0;
120 WORD ipx_vector_segment;
121 WORD ipx_vector_offset;
122 ubyte ipx_socket_life = 0; // 0=closed at prog termination, 0xff=closed when requested.
123 DWORD ipx_network = 0;
124 local_address ipx_my_node;
125 WORD ipx_num_packets=32; // 32 Ipx packets
126 ipx_packet * packets;
128 ushort ipx_packets_selector;
130 ecb_header * last_ecb=NULL;
133 void got_new_packet( ecb_header * ecb );
134 void ipx_listen_for_packet(ecb_header * ecb );
136 void free_packet( int id )
138 packet_buffers[id].packetnum = -1;
139 packet_free_list[ --num_packets ] = id;
140 if (largest_packet_index==id)
141 while ((--largest_packet_index>0) && (packet_buffers[largest_packet_index].packetnum == -1 ));
144 int ipx_get_packet_data( ubyte * data )
146 int i, n, best, best_id, size;
148 for (i=1; i<ipx_num_packets; i++ ) {
149 if ( !packets[i].ecb.in_use ) {
150 got_new_packet( &packets[i].ecb );
151 packets[i].ecb.in_use = 0;
152 ipx_listen_for_packet(&packets[i].ecb);
160 for (i=0; i<=largest_packet_index; i++ ) {
161 if ( packet_buffers[i].packetnum > -1 ) {
163 if ( best == -1 || (packet_buffers[i].packetnum<best) ) {
164 best = packet_buffers[i].packetnum;
170 //mprintf( (0, "Best id = %d, pn = %d, last_ecb = %x, len=%x, ne = %d\n", best_id, best, last_ecb, lastlen, neterrors ));
171 //mprintf( (1, "<%d> ", neterrors ));
173 if ( best_id < 0 ) return 0;
175 size = packet_size[best_id];
176 memcpy( data, packet_buffers[best_id].data, size );
177 free_packet(best_id);
183 unsigned int swap_short( unsigned int short )
184 #pragma aux swap_short parm [eax] = "xchg al,ah";
186 static inline unsigned int swap_short( unsigned int sshort ) {
188 asm("xchg %%ah,%%al" : "=a" (__retval) : "a" (sshort));
193 void got_new_packet( ecb_header * ecb )
197 unsigned short datasize;
201 p = (ipx_packet *)ecb;
203 if ( p->ecb.in_use ) { neterrors++; return; }
204 if ( p->ecb.completion_code ) { neterrors++; return; }
206 // Error( "Recieve error %d for completion code", p->ecb.completion_code );
208 if ( memcmp( &p->ipx.source.node_id, &ipx_my_node, 6 ) ) {
209 datasize=swap_short(p->ipx.length);
211 datasize -= sizeof(ipx_header);
212 // Find slot to put packet in...
213 if ( datasize > 0 && datasize <= sizeof(packet_data) ) {
214 if ( num_packets >= MAX_PACKETS ) {
215 //printf( 1, "IPX: Packet buffer overrun!!!\n" );
219 id = packet_free_list[ num_packets++ ];
220 if (id > largest_packet_index ) largest_packet_index = id;
221 packet_size[id] = datasize-sizeof(int);
222 packet_buffers[id].packetnum = p->pd.packetnum;
223 if ( packet_buffers[id].packetnum < 0 ) { neterrors++; return; }
224 memcpy( packet_buffers[id].data, p->pd.data, packet_size[id] );
231 //ipx_listen_for_packet(&p->ecb);
234 ubyte * ipx_get_my_local_address()
236 return ipx_my_node.address;
239 ubyte * ipx_get_my_server_address()
241 return (ubyte *)&ipx_network;
244 void ipx_listen_for_packet(ecb_header * ecb )
246 dpmi_real_regs rregs;
248 memset(&rregs,0,sizeof(dpmi_real_regs));
249 rregs.ebx = 4; // Listen For Packet function
250 rregs.esi = DPMI_real_offset(ecb);
251 rregs.es = DPMI_real_segment(ecb);
252 dpmi_real_int386x( 0x7A, &rregs );
255 void ipx_cancel_listen_for_packet(ecb_header * ecb )
257 dpmi_real_regs rregs;
258 memset(&rregs,0,sizeof(dpmi_real_regs));
259 rregs.ebx = 6; // IPX Cancel event
260 rregs.esi = DPMI_real_offset(ecb);
261 rregs.es = DPMI_real_segment(ecb);
262 dpmi_real_int386x( 0x7A, &rregs );
266 void ipx_send_packet(ecb_header * ecb )
268 dpmi_real_regs rregs;
269 memset(&rregs,0,sizeof(dpmi_real_regs));
270 rregs.ebx = 3; // Send Packet function
271 rregs.esi = DPMI_real_offset(ecb);
272 rregs.es = DPMI_real_segment(ecb);
273 dpmi_real_int386x( 0x7A, &rregs );
279 ubyte local_target[6];
280 } __pack__ net_xlat_info;
282 void ipx_get_local_target( ubyte * server, ubyte * node, ubyte * local_target )
284 net_xlat_info * info;
285 dpmi_real_regs rregs;
287 // Get dos memory for call...
288 info = (net_xlat_info *)dpmi_get_temp_low_buffer( sizeof(net_xlat_info) );
289 assert( info != NULL );
290 memcpy( info->network, server, 4 );
291 memcpy( info->node, node, 6 );
293 memset(&rregs,0,sizeof(dpmi_real_regs));
295 rregs.ebx = 2; // Get Local Target
296 rregs.es = DPMI_real_segment(info);
297 rregs.esi = DPMI_real_offset(info->network);
298 rregs.edi = DPMI_real_offset(info->local_target);
300 dpmi_real_int386x( 0x7A, &rregs );
302 // Save the local target...
303 memcpy( local_target, info->local_target, 6 );
308 dpmi_real_regs rregs;
309 if ( ipx_installed ) {
310 // When using VLM's instead of NETX, the sockets don't
311 // seem to automatically get closed, so we must explicitly
312 // close them at program termination.
314 memset(&rregs,0,sizeof(dpmi_real_regs));
315 rregs.edx = ipx_socket;
316 rregs.ebx = 1; // Close socket
317 dpmi_real_int386x( 0x7A, &rregs );
322 //---------------------------------------------------------------
323 // Initializes all IPX internals.
324 // If socket_number==0, then opens next available socket.
325 // Returns one of the constants defined in include/ipx.h
327 int ipx_init( int socket_number, int show_address )
329 dpmi_real_regs rregs;
330 ubyte *ipx_real_buffer;
337 // init packet buffers.
338 for (i=0; i<MAX_PACKETS; i++ ) {
339 packet_buffers[i].packetnum = -1;
340 packet_free_list[i] = i;
343 largest_packet_index = 0;
345 // Get the IPX vector
346 memset(&rregs,0,sizeof(dpmi_real_regs));
347 rregs.eax=0x00007a00;
348 dpmi_real_int386x( 0x2f, &rregs );
350 if ( (rregs.eax & 0xFF) != 0xFF ) {
351 return IPX_NOT_INSTALLED;
353 ipx_vector_offset = rregs.edi & 0xFFFF;
354 ipx_vector_segment = rregs.es;
355 //printf( "IPX entry point at %.4x:%.4x\n", ipx_vector_segment, ipx_vector_offset );
357 // Open a socket for IPX
359 memset(&rregs,0,sizeof(dpmi_real_regs));
360 swab( (char *)&socket_number,(char *)&ipx_socket, 2 );
361 rregs.edx = ipx_socket;
362 rregs.eax = ipx_socket_life;
363 rregs.ebx = 0; // Open socket
364 dpmi_real_int386x( 0x7A, &rregs );
366 ipx_socket = rregs.edx & 0xFFFF;
368 if ( rregs.eax & 0xFF ) {
369 //mprintf( (1, "IPX error opening channel %d\n", socket_number-IPX_DEFAULT_SOCKET ));
370 return IPX_SOCKET_TABLE_FULL;
375 // Find our internetwork address
376 ipx_real_buffer = dpmi_get_temp_low_buffer( 1024 ); // 1k block
377 if ( ipx_real_buffer == NULL ) {
378 //printf( "Error allocation realmode memory\n" );
379 return IPX_NO_LOW_DOS_MEM;
382 memset(&rregs,0,sizeof(dpmi_real_regs));
383 rregs.ebx = 9; // Get internetwork address
384 rregs.esi = DPMI_real_offset(ipx_real_buffer);
385 rregs.es = DPMI_real_segment(ipx_real_buffer);
386 dpmi_real_int386x( 0x7A, &rregs );
388 if ( rregs.eax & 0xFF ) {
389 //printf( "Error getting internetwork address!\n" );
390 return IPX_SOCKET_TABLE_FULL;
393 memcpy( &ipx_network, ipx_real_buffer, 4 );
394 memcpy( &ipx_my_node, &ipx_real_buffer[4], 6 );
396 Ipx_num_networks = 0;
397 memcpy( &Ipx_networks[Ipx_num_networks++], &ipx_network, 4 );
399 if ( show_address ) {
400 printf( "My IPX addresss is " );
401 printf( "%02X%02X%02X%02X/", ipx_real_buffer[0],ipx_real_buffer[1],ipx_real_buffer[2],ipx_real_buffer[3] );
402 printf( "%02X%02X%02X%02X%02X%02X\n", ipx_real_buffer[4],ipx_real_buffer[5],ipx_real_buffer[6],ipx_real_buffer[7],ipx_real_buffer[8],ipx_real_buffer[9] );
406 packets = dpmi_real_malloc( sizeof(ipx_packet)*ipx_num_packets, &ipx_packets_selector );
407 if ( packets == NULL ) {
408 //printf( "Couldn't allocate real memory for %d packets\n", ipx_num_packets );
409 return IPX_NO_LOW_DOS_MEM;
411 #if 0 /* adb: not needed, fails with cwsdpmi */
412 if (!dpmi_lock_region( packets, sizeof(ipx_packet)*ipx_num_packets )) {
413 //printf( "Couldn't lock real memory for %d packets\n", ipx_num_packets );
414 return IPX_NO_LOW_DOS_MEM;
417 memset( packets, 0, sizeof(ipx_packet)*ipx_num_packets );
419 for (i=1; i<ipx_num_packets; i++ ) {
420 packets[i].ecb.in_use = 0x1d;
421 //packets[i].ecb.in_use = 0;
422 packets[i].ecb.socket_id = ipx_socket;
423 packets[i].ecb.fragment_count = 1;
424 packets[i].ecb.fragment_pointer[0] = DPMI_real_offset(&packets[i].ipx);
425 packets[i].ecb.fragment_pointer[1] = DPMI_real_segment(&packets[i].ipx);
426 packets[i].ecb.fragment_size = sizeof(ipx_packet)-sizeof(ecb_header); //-sizeof(ecb_header);
428 ipx_listen_for_packet(&packets[i].ecb);
431 //added/replaced on 10/29/98 by Kevin Bently for new ipx stuff
432 //-killed- packets[0].ecb.socket_id = ipx_socket;
433 //-killed- packets[0].ecb.fragment_count = 1;
434 //-killed- packets[0].ecb.fragment_pointer[0] = DPMI_real_offset(&packets[0].ipx);
435 //-killed- packets[0].ecb.fragment_pointer[1] = DPMI_real_segment(&packets[0].ipx);
436 //-killed- packets[0].ipx.packet_type = 4; // IPX packet
437 //-killed- packets[0].ipx.destination.socket_id = ipx_socket;
438 //-killed-// memcpy( packets[0].ipx.destination.network_id, &ipx_network, 4 );
439 //-killed- memset( packets[0].ipx.destination.network_id, 0, 4 );
440 outpackets = dpmi_real_malloc( sizeof(ipx_packet)*ipx_num_packets, &ipx_packets_selector);
442 for(i=0;i<ipx_num_outgoing_packets;i++)
444 outpackets[i].ecb.socket_id = ipx_socket;
445 outpackets[i].ecb.fragment_count = 1;
446 outpackets[i].ecb.fragment_pointer[0] = DPMI_real_offset(&outpackets[i].ipx);
447 outpackets[i].ecb.fragment_pointer[1] = DPMI_real_segment(&outpackets[i].ipx);
448 outpackets[i].ipx.packet_type = 4; // IPX packet
449 outpackets[i].ipx.destination.socket_id = ipx_socket;
450 memset( outpackets[i].ipx.destination.network_id, 0, 4 );
454 //end this section replace - Kevin Bently
458 void ipx_send_packet_data( ubyte * data, int datasize, ubyte *network, ubyte *address, ubyte *immediate_address )
461 ipx_packet *sendpacket = NULL;
463 assert(ipx_installed);
465 if ( datasize >= IPX_MAX_DATA_SIZE ) {
466 printf( "Data too big\n" );
472 //added/replaced on 10/29/98 by Kevin Bently for new ipx stuff
473 //-killed- // Make sure no one is already sending something
474 //-killed- while( packets[0].ecb.in_use )
478 //-killed- if (packets[0].ecb.completion_code) {
479 //-killed- printf( "Send error %d for completion code\n", packets[0].ecb.completion_code );
480 //-killed- //killed on 10/25/98 by Victor Rachels to fix LAN crash
481 //-killed- //-killed- exit(1);
482 //-killed- //end this section kill - Victor
485 for(i=0;i<ipx_num_outgoing_packets;i++)
486 if(!outpackets[i].ecb.in_use)
487 sendpacket= &outpackets[i];
488 //end this section replacement - Kevin Bently
490 // Fill in destination address
491 if ( memcmp( network, &ipx_network, 4 ) )
492 memcpy( sendpacket->ipx.destination.network_id, network, 4 );
494 memset( sendpacket->ipx.destination.network_id, 0, 4 );
495 memcpy( sendpacket->ipx.destination.node_id.address, address, 6 );
496 memcpy( sendpacket->ecb.immediate_address.address, immediate_address, 6 );
497 sendpacket->pd.packetnum = ipx_packetnum++;
499 // Fill in data to send
500 sendpacket->ecb.fragment_size = sizeof(ipx_header) + sizeof(int) + datasize;
502 assert( datasize > 1 );
503 assert( sendpacket->ecb.fragment_size <= 576 );
505 memcpy( sendpacket->pd.data, data, datasize );
508 ipx_send_packet( &sendpacket->ecb );
512 void ipx_send_broadcast_packet_data( ubyte * data, int datasize )
515 ubyte broadcast[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
516 ubyte local_address[6];
518 // Set to all networks besides mine
519 for (i=0; i<Ipx_num_networks; i++ ) {
520 if ( memcmp( &Ipx_networks[i], &ipx_network, 4 ) ) {
521 ipx_get_local_target( (ubyte *)&Ipx_networks[i], broadcast, local_address );
522 ipx_send_packet_data( data, datasize, (ubyte *)&Ipx_networks[i], broadcast, local_address );
524 ipx_send_packet_data( data, datasize, (ubyte *)&Ipx_networks[i], broadcast, broadcast );
528 //OLDipx_send_packet_data( data, datasize, (ubyte *)&ipx_network, broadcast, broadcast );
530 // Send directly to all users not on my network or in the network list.
531 for (i=0; i<Ipx_num_users; i++ ) {
532 if ( memcmp( Ipx_users[i].network, &ipx_network, 4 ) ) {
533 for (j=0; j<Ipx_num_networks; j++ ) {
534 if (!memcmp( Ipx_users[i].network, &Ipx_networks[j], 4 ))
537 ipx_send_packet_data( data, datasize, Ipx_users[i].network, Ipx_users[i].node, Ipx_users[i].address );
544 // Sends a non-localized packet... needs 4 byte server, 6 byte address
545 void ipx_send_internetwork_packet_data( ubyte * data, int datasize, ubyte * server, ubyte *address )
547 ubyte local_address[6];
549 if ( (*(uint *)server) != 0 ) {
550 ipx_get_local_target( server, address, local_address );
551 ipx_send_packet_data( data, datasize, server, address, local_address );
553 // Old method, no server info.
554 ipx_send_packet_data( data, datasize, server, address, address );
558 int ipx_change_default_socket( ushort socket_number )
562 dpmi_real_regs rregs;
564 if ( !ipx_installed ) return -3;
567 memset(&rregs,0,sizeof(dpmi_real_regs));
568 swab( (char *)&socket_number,(char *)&new_ipx_socket, 2 );
569 rregs.edx = new_ipx_socket;
570 rregs.eax = ipx_socket_life;
571 rregs.ebx = 0; // Open socket
572 dpmi_real_int386x( 0x7A, &rregs );
574 new_ipx_socket = rregs.edx & 0xFFFF;
576 if ( rregs.eax & 0xFF ) {
577 //printf( (1, "IPX error opening channel %d\n", socket_number-IPX_DEFAULT_SOCKET ));
581 for (i=1; i<ipx_num_packets; i++ ) {
582 ipx_cancel_listen_for_packet(&packets[i].ecb);
585 // Close existing socket...
586 memset(&rregs,0,sizeof(dpmi_real_regs));
587 rregs.edx = ipx_socket;
588 rregs.ebx = 1; // Close socket
589 dpmi_real_int386x( 0x7A, &rregs );
591 ipx_socket = new_ipx_socket;
593 // Repost all listen requests on the new socket...
594 for (i=1; i<ipx_num_packets; i++ ) {
595 packets[i].ecb.in_use = 0;
596 packets[i].ecb.socket_id = ipx_socket;
597 ipx_listen_for_packet(&packets[i].ecb);
600 packets[0].ecb.socket_id = ipx_socket;
601 packets[0].ipx.destination.socket_id = ipx_socket;
604 // init packet buffers.
605 for (i=0; i<MAX_PACKETS; i++ ) {
606 packet_buffers[i].packetnum = -1;
607 packet_free_list[i] = i;
610 largest_packet_index = 0;
615 void ipx_read_user_file(char * filename)
619 char temp_line[132], *p1;
622 if (!filename) return;
626 fp = fopen( filename, "rt" );
629 printf( "Broadcast Users:\n" );
631 while (fgets(temp_line, 132, fp)) {
633 p1 = strchr(temp_line,'\n'); if (p1) *p1 = '\0';
634 p1 = strchr(temp_line,';'); if (p1) *p1 = '\0';
635 n = sscanf( temp_line, "%2x%2x%2x%2x/%2x%2x%2x%2x%2x%2x",(unsigned int *)&tmp.network[0],(unsigned int *) &tmp.network[1],(unsigned int *) &tmp.network[2],(unsigned int *) &tmp.network[3],(unsigned int *) &tmp.node[0],(unsigned int *) &tmp.node[1],(unsigned int *) &tmp.node[2],(unsigned int *)&tmp.node[3],(unsigned int *) &tmp.node[4],(unsigned int *) &tmp.node[5] );
636 // n = sscanf( temp_line, "%2x%2x%2x%2x/%2x%2x%2x%2x%2x%2x",&tmp.network[0], &tmp.network[1], &tmp.network[2], &tmp.network[3], &tmp.node[0], &tmp.node[1], &tmp.node[2],&tmp.node[3], &tmp.node[4], &tmp.node[5] );
637 if ( n != 10 ) continue;
638 if ( Ipx_num_users < MAX_USERS ) {
639 ubyte * ipx_real_buffer = (ubyte *)&tmp;
640 ipx_get_local_target( tmp.network, tmp.node, tmp.address );
641 Ipx_users[Ipx_num_users++] = tmp;
642 printf( "%02X%02X%02X%02X/", ipx_real_buffer[0],ipx_real_buffer[1],ipx_real_buffer[2],ipx_real_buffer[3] );
643 printf( "%02X%02X%02X%02X%02X%02X\n", ipx_real_buffer[4],ipx_real_buffer[5],ipx_real_buffer[6],ipx_real_buffer[7],ipx_real_buffer[8],ipx_real_buffer[9] );
645 printf( "Too many addresses in %s! (Limit of %d)\n", filename, MAX_USERS );
654 void ipx_read_network_file(char * filename)
658 char temp_line[132], *p1;
661 if (!filename) return;
663 fp = fopen( filename, "rt" );
666 printf( "Using Networks:\n" );
667 for (i=0; i<Ipx_num_networks; i++ ) {
668 ubyte * n1 = (ubyte *)&Ipx_networks[i];
669 printf("* %02x%02x%02x%02x\n", n1[0], n1[1], n1[2], n1[3] );
672 while (fgets(temp_line, 132, fp)) {
674 p1 = strchr(temp_line,'\n'); if (p1) *p1 = '\0';
675 p1 = strchr(temp_line,';'); if (p1) *p1 = '\0';
676 n = sscanf( temp_line, "%2x%2x%2x%2x",(unsigned int *) &tmp.network[0],(unsigned int *) &tmp.network[1],(unsigned int *) &tmp.network[2],(unsigned int *) &tmp.network[3] );
677 // n = sscanf( temp_line, "%2x%2x%2x%2x", &tmp.network[0], &tmp.network[1], &tmp.network[2], &tmp.network[3] );
678 if ( n != 4 ) continue;
679 if ( Ipx_num_networks < MAX_NETWORKS ) {
681 for (j=0; j<Ipx_num_networks; j++ )
682 if ( !memcmp( &Ipx_networks[j], tmp.network, 4 ) )
684 if ( j >= Ipx_num_networks ) {
685 memcpy( &Ipx_networks[Ipx_num_networks++], tmp.network, 4 );
686 printf(" %02x%02x%02x%02x\n", tmp.network[0], tmp.network[1], tmp.network[2], tmp.network[3] );
689 printf( "Too many networks in %s! (Limit of %d)\n", filename, MAX_NETWORKS );
698 //---typedef struct rip_entry {
704 //---typedef struct rip_packet {
705 //--- ushort operation; //1=request, 2=response
706 //--- rip_entry rip[50];
710 //---void ipx_find_all_servers()
713 //--- rip_packet * rp;
714 //--- assert(ipx_installed);
716 //--- ipx_change_default_socket( 0x0453 );
717 //--- // ipx_change_default_socket( 0x5304 );
719 //--- // Make sure no one is already sending something
720 //--- while( packets[0].ecb.in_use )
724 //--- if (packets[0].ecb.completion_code) {
725 //--- printf( "AAAA:Send error %d for completion code\n", packets[0].ecb.completion_code );
729 //--- rp = (rip_packet *)&packets[0].pd;
731 //--- // Fill in destination address
733 //--- char mzero1[] = {0,0,0,1};
734 //--- char mzero[] = {0,0,0,0,0,1};
735 //--- char immediate[6];
736 //--- //memcpy( packets[0].ipx.destination.network_id, &ipx_network, 4 );
737 //--- //memcpy( packets[0].ipx.destination.node_id.address, ipx_my_node.address, 6 );
739 //--- memcpy( packets[0].ipx.destination.network_id, mzero1, 4 );
740 //--- memcpy( packets[0].ipx.destination.node_id.address, mzero, 6 );
742 //--- memcpy( packets[0].ipx.destination.socket_id, &ipx_socket, 2 );
743 //--- memcpy( packets[0].ipx.source.network_id, &ipx_network, 4 );
744 //--- memcpy( packets[0].ipx.source.node_id.address, ipx_my_node.address, 6 );
745 //--- memcpy( packets[0].ipx.source.socket_id, &ipx_socket, 2 );
746 //--- //memcpy( packets[0].ecb.immediate_address.address, ipx_my_node.address, 6 );
747 //--- //mzero1[3] = 1;
748 //--- //memcpy( packets[0].ipx.destination.network_id, mzero1, 4 );
749 //--- //mzero[5] = 1;
750 //--- //memcpy( packets[0].ipx.destination.node_id.address, mzero, 6 );
751 //--- //ipx_get_local_target( mzero1, mzero, immediate );
752 //--- //memcpy( packets[0].ecb.immediate_address.address, mzero, 6 );
753 //--- //memcpy( packets[0].ecb.immediate_address.address, immediate, 6 );
754 //--- //mzero[5] = 0;
757 //--- packets[0].ipx.packet_type = 1; // RIP packet
759 //--- // Fill in data to send
760 //--- packets[0].ecb.fragment_size = sizeof(ipx_header) + sizeof(rip_packet);
761 //--- assert( packets[0].ecb.fragment_size <= 576 );
763 //--- rp->operation = 0; // Request
764 //--- for (i=0;i<50; i++) {
765 //--- rp->rip[i].network = 0xFFFFFFFF;
766 //--- rp->rip[i].nhops = 0;
767 //--- rp->rip[i].nticks = 0;
771 //--- ipx_send_packet( &packets[0].ecb );
773 //--- for (i=0;i<50; i++) {
774 //--- if ( rp->rip[i].network != 0xFFFFFFFF )
775 //--- printf( "Network = %8x, Hops=%d, Ticks=%d\n", rp->rip[i].network, rp->rip[i].nhops, rp->rip[i].nticks );