summaryrefslogtreecommitdiff
path: root/addons/auto_ip/nx_auto_ip.c
blob: 1a2d8fd3dffd306701cc42ab27e8a300284f57b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
/***************************************************************************
 * Copyright (c) 2024 Microsoft Corporation
 * Copyright (c) 2025-present Eclipse ThreadX Contributors
 *
 * This program and the accompanying materials are made available under the
 * terms of the MIT License which is available at
 * https://opensource.org/licenses/MIT.
 *
 * SPDX-License-Identifier: MIT
 **************************************************************************/


/**************************************************************************/
/**************************************************************************/
/**                                                                       */ 
/** NetX Component                                                        */ 
/**                                                                       */
/**   AutoIP (AutoIP)                                                     */ 
/**                                                                       */
/**************************************************************************/
/**************************************************************************/

#define NX_AUTO_IP_SOURCE_CODE


/* Force error checking to be disabled in this module */
#include "tx_port.h"

#ifndef NX_DISABLE_ERROR_CHECKING
#define NX_DISABLE_ERROR_CHECKING
#endif

#ifndef TX_SAFETY_CRITICAL
#ifndef TX_DISABLE_ERROR_CHECKING
#define TX_DISABLE_ERROR_CHECKING
#endif
#endif


/* Include necessary system files.  */

#include "nx_api.h"
#ifndef NX_DISABLE_IPV4
#include "nx_ip.h"
#include "nx_arp.h"
#include "tx_thread.h"
#include "tx_timer.h"
#include "nx_auto_ip.h" 

/* Keep the AutoIP instance for callback notify.  */
static NX_AUTO_IP    *_nx_auto_ip_ptr;

/**************************************************************************/ 
/*                                                                        */ 
/*  FUNCTION                                               RELEASE        */ 
/*                                                                        */ 
/*    _nxe_auto_ip_create                                 PORTABLE C      */ 
/*                                                           6.4.3        */
/*  AUTHOR                                                                */
/*                                                                        */
/*    Yuxin Zhou, Microsoft Corporation                                   */
/*                                                                        */
/*  DESCRIPTION                                                           */ 
/*                                                                        */ 
/*    This function checks for errors in the AutoIP create function       */ 
/*    call.                                                               */ 
/*                                                                        */ 
/*  INPUT                                                                 */ 
/*                                                                        */ 
/*    auto_ip_ptr                           Pointer to AutoIP instance    */ 
/*    name                                  Pointer to AutoIP name        */ 
/*    ip_ptr                                Pointer to IP instance        */ 
/*    stack_ptr                             Pointer to start of stack     */ 
/*    stack_size                            Size of stack in bytes        */ 
/*    priority                              Priority of AutoIP thread     */
/*                                                                        */ 
/*  OUTPUT                                                                */ 
/*                                                                        */ 
/*    status                                Completion status             */ 
/*                                                                        */ 
/*  CALLS                                                                 */ 
/*                                                                        */ 
/*    _nx_auto_ip_create                    AutoIP create function        */ 
/*                                                                        */ 
/*  CALLED BY                                                             */ 
/*                                                                        */ 
/*    Application Code                                                    */ 
/*                                                                        */ 
/**************************************************************************/
UINT  _nxe_auto_ip_create(NX_AUTO_IP *auto_ip_ptr, CHAR *name, NX_IP *ip_ptr, VOID *stack_ptr, ULONG stack_size, UINT priority)
{

UINT    status;


    /* Check for invalid input pointers.  */
    if ((ip_ptr == NX_NULL) || (ip_ptr -> nx_ip_id != NX_IP_ID) ||
        (auto_ip_ptr == NX_NULL) || (auto_ip_ptr -> nx_auto_ip_id == NX_AUTO_IP_ID))
        return(NX_PTR_ERROR);
    
    /* Check for appropriate caller.  */
    NX_INIT_AND_THREADS_CALLER_CHECKING
    
    /* Call actual AutoIP create routine.  */
    status =  _nx_auto_ip_create(auto_ip_ptr, name, ip_ptr, stack_ptr, stack_size, priority);

    /* Return status.  */
    return(status);
}


/**************************************************************************/ 
/*                                                                        */ 
/*  FUNCTION                                               RELEASE        */ 
/*                                                                        */ 
/*    _nx_auto_ip_create                                  PORTABLE C      */ 
/*                                                           6.4.3        */
/*  AUTHOR                                                                */
/*                                                                        */
/*    Yuxin Zhou, Microsoft Corporation                                   */
/*                                                                        */
/*  DESCRIPTION                                                           */ 
/*                                                                        */ 
/*    This function creates an AutoIP instance for the associated IP      */ 
/*    instance. There must be only one AutoIP instance per IP instance.   */ 
/*                                                                        */ 
/*  INPUT                                                                 */ 
/*                                                                        */ 
/*    auto_ip_ptr                           Pointer to AutoIP instance    */ 
/*    name                                  Pointer to AutoIP name        */ 
/*    ip_ptr                                Pointer to IP instance        */ 
/*    stack_ptr                             Pointer to start of stack     */ 
/*    stack_size                            Size of stack in bytes        */ 
/*    priority                              Priority of AutoIP thread     */
/*                                                                        */ 
/*  OUTPUT                                                                */ 
/*                                                                        */ 
/*    Completion Status                                                   */ 
/*                                                                        */ 
/*  CALLS                                                                 */ 
/*                                                                        */ 
/*    tx_thread_create                      Create AutoIP thread          */ 
/*    tx_event_flags_create                 Create event flags group      */ 
/*    tx_event_flags_delete                 Delete event flags group      */ 
/*                                                                        */ 
/*  CALLED BY                                                             */ 
/*                                                                        */ 
/*    Application                                                         */ 
/*                                                                        */ 
/**************************************************************************/
UINT  _nx_auto_ip_create(NX_AUTO_IP *auto_ip_ptr, CHAR *name, NX_IP *ip_ptr, VOID *stack_ptr, ULONG stack_size, UINT priority)
{

UINT  status;


    /* Initialize the AutoIP control block to zero.  */
    memset((void *) auto_ip_ptr, 0, sizeof(NX_AUTO_IP));

    /* Create the AutoIP event flags.  */
    status =  tx_event_flags_create(&(auto_ip_ptr -> nx_auto_ip_conflict_event), "NetX AutoIP Collision Event");

    /* Determine if successful.  */
    if (status)
    {

        /* No, return an error.  */
        return(NX_AUTO_IP_ERROR);
    }

    /* Create the AutoIP processing thread.  */
    status =  tx_thread_create(&(auto_ip_ptr -> nx_auto_ip_thread), "NetX AutoIP", _nx_auto_ip_thread_entry, (ULONG) auto_ip_ptr,
                        stack_ptr, stack_size, priority, priority, 1, TX_DONT_START);

    /* Determine if the thread creation was successful.  */
    if (status)
    {

        /* Delete the event flags.  */
        tx_event_flags_delete(&(auto_ip_ptr -> nx_auto_ip_conflict_event));

        /* No, return an error.  */
        return(NX_AUTO_IP_ERROR);
    }

    /* Save the IP pointer and interface fields.  */
    auto_ip_ptr -> nx_auto_ip_ip_ptr =  ip_ptr;

    /* Default the auto IP interface to the primary interface. */
    auto_ip_ptr -> nx_ip_interface_index = 0;

    /* Save the AutoIP name.  */
    auto_ip_ptr -> nx_auto_ip_name =  name;

    /* Update the AutoIP structure ID.  */
    auto_ip_ptr -> nx_auto_ip_id =  NX_AUTO_IP_ID;

    /* Keep the AutoIP instance for callback notify.  */
    _nx_auto_ip_ptr = auto_ip_ptr;

    /* Return a successful status.  */
    return(NX_SUCCESS);
}

/**************************************************************************/ 
/*                                                                        */ 
/*  FUNCTION                                               RELEASE        */ 
/*                                                                        */ 
/*    _nxe_auto_ip_set_interface                          PORTABLE C      */ 
/*                                                           6.4.3        */
/*  AUTHOR                                                                */
/*                                                                        */
/*    Yuxin Zhou, Microsoft Corporation                                   */
/*                                                                        */
/*  DESCRIPTION                                                           */ 
/*                                                                        */ 
/*    This function performs error checking services for the set interface*/
/*    index service.                                                      */ 
/*                                                                        */ 
/*  INPUT                                                                 */ 
/*                                                                        */ 
/*    auto_ip_ptr                           Pointer to AutoIP instance    */ 
/*    interface_index                       Index into IP interface table */ 
/*                                                                        */ 
/*  OUTPUT                                                                */ 
/*                                                                        */ 
/*    Completion Status                                                   */ 
/*                                                                        */ 
/*  CALLS                                                                 */ 
/*                                                                        */ 
/*    None                                                                */
/*                                                                        */ 
/*  CALLED BY                                                             */ 
/*                                                                        */ 
/*    Application                                                         */ 
/*                                                                        */ 
/**************************************************************************/
UINT  _nxe_auto_ip_set_interface(NX_AUTO_IP *auto_ip_ptr, UINT interface_index)
{

UINT status;


    /* Check for invalid input pointers.  */
    if ((auto_ip_ptr == NX_NULL) || (auto_ip_ptr -> nx_auto_ip_id != NX_AUTO_IP_ID))
        return(NX_PTR_ERROR);

    /* Check for appropriate caller.  */
    NX_INIT_AND_THREADS_CALLER_CHECKING

    status = _nx_auto_ip_set_interface(auto_ip_ptr, interface_index);

    /* Return completion status. */
    return(status);
}


/**************************************************************************/ 
/*                                                                        */ 
/*  FUNCTION                                               RELEASE        */ 
/*                                                                        */ 
/*    _nx_auto_ip_set_interface                           PORTABLE C      */ 
/*                                                           6.4.3        */
/*  AUTHOR                                                                */
/*                                                                        */
/*    Yuxin Zhou, Microsoft Corporation                                   */
/*                                                                        */
/*  DESCRIPTION                                                           */ 
/*                                                                        */ 
/*    This function sets the index for the interface on the local host    */
/*    needing auto IP to set the address. The default value is zero       */
/*    (primary interface).                                                */ 
/*                                                                        */ 
/*  INPUT                                                                 */ 
/*                                                                        */ 
/*    auto_ip_ptr                           Pointer to AutoIP instance    */ 
/*    interface_index                       Index into IP interface table */ 
/*                                                                        */ 
/*  OUTPUT                                                                */ 
/*                                                                        */ 
/*    Completion Status                                                   */ 
/*                                                                        */ 
/*  CALLS                                                                 */ 
/*                                                                        */ 
/*    None                                                                */
/*                                                                        */ 
/*  CALLED BY                                                             */ 
/*                                                                        */ 
/*    Application                                                         */ 
/*                                                                        */ 
/**************************************************************************/
UINT  _nx_auto_ip_set_interface(NX_AUTO_IP *auto_ip_ptr, UINT interface_index)
{

    /* Determine if a local IP address was successfully setup.  */
    if (interface_index >= NX_MAX_PHYSICAL_INTERFACES)
    {

        /* Bad interface index.  */
        return(NX_AUTO_IP_BAD_INTERFACE_INDEX);
    }
    

    /* Set the index to the specified value.  */
    auto_ip_ptr -> nx_ip_interface_index = interface_index;

    /* Return successful outcome.  */
    return(NX_SUCCESS);
}


/**************************************************************************/ 
/*                                                                        */ 
/*  FUNCTION                                               RELEASE        */ 
/*                                                                        */ 
/*    _nxe_auto_ip_get_address                            PORTABLE C      */ 
/*                                                           6.4.3        */
/*  AUTHOR                                                                */
/*                                                                        */
/*    Yuxin Zhou, Microsoft Corporation                                   */
/*                                                                        */
/*  DESCRIPTION                                                           */ 
/*                                                                        */ 
/*    This function checks for errors in the AutoIP get address function  */ 
/*    call.                                                               */ 
/*                                                                        */ 
/*  INPUT                                                                 */ 
/*                                                                        */ 
/*    auto_ip_ptr                           Pointer to AutoIP instance    */ 
/*    local_ip_address                      Destination for local IP addr */ 
/*                                                                        */ 
/*  OUTPUT                                                                */ 
/*                                                                        */ 
/*    status                                Completion status             */ 
/*                                                                        */ 
/*  CALLS                                                                 */ 
/*                                                                        */ 
/*    _nx_auto_ip_get_address               AutoIP get address function   */ 
/*                                                                        */ 
/*  CALLED BY                                                             */ 
/*                                                                        */ 
/*    Application Code                                                    */ 
/*                                                                        */ 
/**************************************************************************/
UINT  _nxe_auto_ip_get_address(NX_AUTO_IP *auto_ip_ptr, ULONG *local_ip_address)
{

UINT    status;

    /* Check for invalid input pointers.  */
    if ((auto_ip_ptr == NX_NULL) || (auto_ip_ptr -> nx_auto_ip_id != NX_AUTO_IP_ID) || (local_ip_address == NX_NULL))
        return(NX_PTR_ERROR);

    /* Call actual AutoIP get address routine.  */
    status =  _nx_auto_ip_get_address(auto_ip_ptr, local_ip_address);

    /* Return status.  */
    return(status);
}


/**************************************************************************/ 
/*                                                                        */ 
/*  FUNCTION                                               RELEASE        */ 
/*                                                                        */ 
/*    _nx_auto_ip_get_address                             PORTABLE C      */ 
/*                                                           6.4.3        */
/*  AUTHOR                                                                */
/*                                                                        */
/*    Yuxin Zhou, Microsoft Corporation                                   */
/*                                                                        */
/*  DESCRIPTION                                                           */ 
/*                                                                        */ 
/*    This function retrieves the local IP address resolved by the AutoIP */ 
/*    protocol. If there is no valid local IP address this routine        */ 
/*    returns an error and an IP address of all zeros.                    */ 
/*                                                                        */ 
/*  INPUT                                                                 */ 
/*                                                                        */ 
/*    auto_ip_ptr                           Pointer to AutoIP instance    */ 
/*    local_ip_address                      Destination for local IP addr */ 
/*                                                                        */ 
/*  OUTPUT                                                                */ 
/*                                                                        */ 
/*    Completion Status                                                   */ 
/*                                                                        */ 
/*  CALLS                                                                 */ 
/*                                                                        */ 
/*    None                                                                */
/*                                                                        */ 
/*  CALLED BY                                                             */ 
/*                                                                        */ 
/*    Application                                                         */ 
/*                                                                        */ 
/**************************************************************************/
UINT  _nx_auto_ip_get_address(NX_AUTO_IP *auto_ip_ptr, ULONG *local_ip_address)
{

ULONG   host_ip_address;
NX_IP   *ip_ptr;


    /* Set local variables for convenience. */
    ip_ptr = auto_ip_ptr -> nx_auto_ip_ip_ptr;
    host_ip_address = ip_ptr -> nx_ip_interface[auto_ip_ptr -> nx_ip_interface_index].nx_interface_ip_address;

    /* Determine if a local IP address was successfully setup.  */
    if (auto_ip_ptr -> nx_auto_ip_current_local_address == host_ip_address)
    {

        /* Yes, a local IP address is setup.  */
        *local_ip_address =  auto_ip_ptr -> nx_auto_ip_current_local_address;

        /* Return success!  */
        return(NX_SUCCESS);
    }
    else
    {

        /* No, a local IP address has not been setup.  Clear the return value.  */
        *local_ip_address =  0;

        /* Return an error.  */
        return(NX_AUTO_IP_NO_LOCAL);
    }
}


/**************************************************************************/ 
/*                                                                        */ 
/*  FUNCTION                                               RELEASE        */ 
/*                                                                        */ 
/*    _nxe_auto_ip_start                                  PORTABLE C      */ 
/*                                                           6.4.3        */
/*  AUTHOR                                                                */
/*                                                                        */
/*    Yuxin Zhou, Microsoft Corporation                                   */
/*                                                                        */
/*  DESCRIPTION                                                           */ 
/*                                                                        */ 
/*    This function checks for errors in the AutoIP start function        */ 
/*    call.                                                               */ 
/*                                                                        */ 
/*  INPUT                                                                 */ 
/*                                                                        */ 
/*    auto_ip_ptr                           Pointer to AutoIP instance    */ 
/*                                                                        */ 
/*  OUTPUT                                                                */ 
/*                                                                        */ 
/*    status                                Completion status             */ 
/*                                                                        */ 
/*  CALLS                                                                 */ 
/*                                                                        */ 
/*    _nx_auto_ip_start                     AutoIP start function         */ 
/*                                                                        */ 
/*  CALLED BY                                                             */ 
/*                                                                        */ 
/*    Application Code                                                    */ 
/*                                                                        */ 
/**************************************************************************/
UINT  _nxe_auto_ip_start(NX_AUTO_IP *auto_ip_ptr, ULONG starting_local_address)
{

UINT    status;


    /* Check for invalid input pointers.  */
    if ((auto_ip_ptr == NX_NULL) || (auto_ip_ptr -> nx_auto_ip_id != NX_AUTO_IP_ID))
        return(NX_PTR_ERROR);

    /* Check for appropriate caller.  */
    NX_INIT_AND_THREADS_CALLER_CHECKING

    /* Call actual AutoIP start routine.  */
    status =  _nx_auto_ip_start(auto_ip_ptr, starting_local_address);

    /* Return status.  */
    return(status);
}


/**************************************************************************/ 
/*                                                                        */ 
/*  FUNCTION                                               RELEASE        */ 
/*                                                                        */ 
/*    _nx_auto_ip_start                                   PORTABLE C      */ 
/*                                                           6.4.3        */
/*  AUTHOR                                                                */
/*                                                                        */
/*    Yuxin Zhou, Microsoft Corporation                                   */
/*                                                                        */
/*  DESCRIPTION                                                           */ 
/*                                                                        */ 
/*    This function starts the AutoIP thread of a previously created      */ 
/*    AutoIP instance.                                                    */ 
/*                                                                        */ 
/*  INPUT                                                                 */ 
/*                                                                        */ 
/*    auto_ip_ptr                           Pointer to AutoIP instance    */ 
/*    starting_local_address                Starting local IP address,    */ 
/*                                              only IP addresses from    */ 
/*                                              169.254.1.0 through       */ 
/*                                              169.254.254.255 are valid,*/ 
/*                                              where a value of 0 implies*/ 
/*                                              a random generated value  */ 
/*                                                                        */ 
/*  OUTPUT                                                                */ 
/*                                                                        */ 
/*    Completion Status                                                   */ 
/*                                                                        */ 
/*  CALLS                                                                 */ 
/*                                                                        */ 
/*    tx_thread_resume                      Resume AutoIP thread          */ 
/*                                                                        */ 
/*  CALLED BY                                                             */ 
/*                                                                        */ 
/*    Application                                                         */ 
/*                                                                        */ 
/**************************************************************************/
UINT  _nx_auto_ip_start(NX_AUTO_IP *auto_ip_ptr, ULONG starting_local_address)
{


    /* First, start the local IP address to that supplied.  */
    auto_ip_ptr ->  nx_auto_ip_current_local_address =  starting_local_address;

    /* Set the restart flag.   */
    auto_ip_ptr -> nx_auto_ip_restart_flag =  NX_TRUE;

    /* Set the event flags to ensure AutoIP thread wakes up.  */
    tx_event_flags_set(&(auto_ip_ptr -> nx_auto_ip_conflict_event), 0x1, TX_OR);

    /* Resume the AutoIP thread.  */
    tx_thread_resume(&(auto_ip_ptr -> nx_auto_ip_thread));

    /* Return status.  */
    return(NX_SUCCESS);
}


/**************************************************************************/ 
/*                                                                        */ 
/*  FUNCTION                                               RELEASE        */ 
/*                                                                        */ 
/*    _nxe_auto_ip_stop                                   PORTABLE C      */ 
/*                                                           6.4.3        */
/*  AUTHOR                                                                */
/*                                                                        */
/*    Yuxin Zhou, Microsoft Corporation                                   */
/*                                                                        */
/*  DESCRIPTION                                                           */ 
/*                                                                        */ 
/*    This function checks for errors in the AutoIP stop function         */ 
/*    call.                                                               */ 
/*                                                                        */ 
/*  INPUT                                                                 */ 
/*                                                                        */ 
/*    auto_ip_ptr                           Pointer to AutoIP instance    */ 
/*                                                                        */ 
/*  OUTPUT                                                                */ 
/*                                                                        */ 
/*    status                                Completion status             */ 
/*                                                                        */ 
/*  CALLS                                                                 */ 
/*                                                                        */ 
/*    _nx_auto_ip_stop                      AutoIP stop function          */ 
/*                                                                        */ 
/*  CALLED BY                                                             */ 
/*                                                                        */ 
/*    Application Code                                                    */ 
/*                                                                        */ 
/**************************************************************************/
UINT  _nxe_auto_ip_stop(NX_AUTO_IP *auto_ip_ptr)
{

UINT    status;


    /* Check for invalid input pointers.  */
    if ((auto_ip_ptr == NX_NULL) || (auto_ip_ptr -> nx_auto_ip_id != NX_AUTO_IP_ID))
        return(NX_PTR_ERROR);

    /* Check for appropriate caller.  */
    NX_THREADS_ONLY_CALLER_CHECKING

    /* Call actual AutoIP stop routine.  */
    status =  _nx_auto_ip_stop(auto_ip_ptr);

    /* Return status.  */
    return(status);
}


/**************************************************************************/ 
/*                                                                        */ 
/*  FUNCTION                                               RELEASE        */ 
/*                                                                        */ 
/*    _nx_auto_ip_stop                                    PORTABLE C      */ 
/*                                                           6.4.3        */
/*  AUTHOR                                                                */
/*                                                                        */
/*    Yuxin Zhou, Microsoft Corporation                                   */
/*                                                                        */
/*  DESCRIPTION                                                           */ 
/*                                                                        */ 
/*    This function stops the AutoIP thread of a previously created and   */ 
/*    started AutoIP instance.                                            */ 
/*                                                                        */ 
/*  INPUT                                                                 */ 
/*                                                                        */ 
/*    auto_ip_ptr                           Pointer to AutoIP instance    */ 
/*                                                                        */ 
/*  OUTPUT                                                                */ 
/*                                                                        */ 
/*    Completion Status                                                   */ 
/*                                                                        */ 
/*  CALLS                                                                 */ 
/*                                                                        */ 
/*    tx_thread_suspend                     Suspend AutoIP thread         */ 
/*                                                                        */ 
/*  CALLED BY                                                             */ 
/*                                                                        */ 
/*    Application                                                         */ 
/*                                                                        */ 
/**************************************************************************/
UINT  _nx_auto_ip_stop(NX_AUTO_IP *auto_ip_ptr)
{

UINT        status;


    /* Suspend the AutoIP thread.  */
    status =  tx_thread_suspend(&(auto_ip_ptr -> nx_auto_ip_thread));

    /* Return status.  */
    return(status);
}


/**************************************************************************/ 
/*                                                                        */ 
/*  FUNCTION                                               RELEASE        */ 
/*                                                                        */ 
/*    _nxe_auto_ip_delete                                 PORTABLE C      */ 
/*                                                           6.4.3        */
/*  AUTHOR                                                                */
/*                                                                        */
/*    Yuxin Zhou, Microsoft Corporation                                   */
/*                                                                        */
/*  DESCRIPTION                                                           */ 
/*                                                                        */ 
/*    This function checks for errors in the AutoIP delete function       */ 
/*    call.                                                               */ 
/*                                                                        */ 
/*  INPUT                                                                 */ 
/*                                                                        */ 
/*    auto_ip_ptr                           Pointer to AutoIP instance    */ 
/*                                                                        */ 
/*  OUTPUT                                                                */ 
/*                                                                        */ 
/*    status                                Completion status             */ 
/*                                                                        */ 
/*  CALLS                                                                 */ 
/*                                                                        */ 
/*    _nx_auto_ip_delete                    AutoIP delete function        */ 
/*                                                                        */ 
/*  CALLED BY                                                             */ 
/*                                                                        */ 
/*    Application Code                                                    */ 
/*                                                                        */ 
/**************************************************************************/
UINT  _nxe_auto_ip_delete(NX_AUTO_IP *auto_ip_ptr)
{

UINT    status;


    /* Check for invalid input pointers.  */
    if ((auto_ip_ptr == NX_NULL) || (auto_ip_ptr -> nx_auto_ip_id != NX_AUTO_IP_ID))
        return(NX_PTR_ERROR);

    /* Check for appropriate caller.  */
    NX_THREADS_ONLY_CALLER_CHECKING

    /* Call actual AutoIP delete routine.  */
    status =  _nx_auto_ip_delete(auto_ip_ptr);

    /* Return status.  */
    return(status);
}


/**************************************************************************/ 
/*                                                                        */ 
/*  FUNCTION                                               RELEASE        */ 
/*                                                                        */ 
/*    _nx_auto_ip_delete                                  PORTABLE C      */ 
/*                                                           6.4.3        */
/*  AUTHOR                                                                */
/*                                                                        */
/*    Yuxin Zhou, Microsoft Corporation                                   */
/*                                                                        */
/*  DESCRIPTION                                                           */ 
/*                                                                        */ 
/*    This function deletes the previously created and stopped AutoIP     */ 
/*    AutoIP instance.                                                    */ 
/*                                                                        */ 
/*  INPUT                                                                 */ 
/*                                                                        */ 
/*    auto_ip_ptr                           Pointer to AutoIP instance    */ 
/*                                                                        */ 
/*  OUTPUT                                                                */ 
/*                                                                        */ 
/*    Completion Status                                                   */ 
/*                                                                        */ 
/*  CALLS                                                                 */ 
/*                                                                        */ 
/*    tx_event_flags_delete                 Delete event flags            */ 
/*    tx_thread_delete                      Delete AutoIP thread          */ 
/*    tx_thread_terminate                   Terminate AutoIP thread       */ 
/*                                                                        */ 
/*  CALLED BY                                                             */ 
/*                                                                        */ 
/*    Application                                                         */ 
/*                                                                        */ 
/**************************************************************************/
UINT  _nx_auto_ip_delete(NX_AUTO_IP *auto_ip_ptr)
{

NX_IP       *ip_ptr;


    /* First, set the ID to show it is invalid.  */
    auto_ip_ptr -> nx_auto_ip_id =  0;

    /* Pickup the IP pointer.  */
    ip_ptr =  auto_ip_ptr -> nx_auto_ip_ip_ptr;

    /* Get IP mutex so IP conflict notification can be setup.  */
    tx_mutex_get(&(ip_ptr -> nx_ip_protection), TX_WAIT_FOREVER);

    /* Clear the handler to avoid conflict notification callbacks.  */
    ip_ptr -> nx_ip_interface[auto_ip_ptr -> nx_ip_interface_index].nx_interface_ip_conflict_notify_handler =  NX_NULL;
    ip_ptr -> nx_ip_interface[auto_ip_ptr -> nx_ip_interface_index].nx_interface_ip_probe_address = 0;

    /* Release the IP internal mutex.  */
    tx_mutex_put(&(ip_ptr -> nx_ip_protection));

    /* Terminate the AutoIP thread.  */
    tx_thread_terminate(&(auto_ip_ptr -> nx_auto_ip_thread));

    /* Delete the AutoIP thread.  */
    tx_thread_delete(&(auto_ip_ptr -> nx_auto_ip_thread));

    /* Delete the AutoIP event flags.  */
    tx_event_flags_delete(&(auto_ip_ptr -> nx_auto_ip_conflict_event));

    /* Return success.  */
    return(NX_SUCCESS);
}


/**************************************************************************/ 
/*                                                                        */ 
/*  FUNCTION                                               RELEASE        */ 
/*                                                                        */ 
/*    _nx_auto_ip_thread_entry                            PORTABLE C      */ 
/*                                                           6.1.11       */
/*  AUTHOR                                                                */
/*                                                                        */
/*    Yuxin Zhou, Microsoft Corporation                                   */
/*                                                                        */
/*  DESCRIPTION                                                           */ 
/*                                                                        */ 
/*    This function is the entry point of the AutoIP thread. All AutoIP   */ 
/*    actions are coordinated by this thread.                             */ 
/*                                                                        */ 
/*  INPUT                                                                 */ 
/*                                                                        */ 
/*    auto_ip_ptr                           Pointer to AutoIP instance    */ 
/*                                                                        */ 
/*  OUTPUT                                                                */ 
/*                                                                        */ 
/*    None                                                                */ 
/*                                                                        */ 
/*  CALLS                                                                 */ 
/*                                                                        */ 
/*    _nx_auto_ip_arp_packet_send           Send AutoIP probe and         */ 
/*                                            announce ARP messages       */ 
/*    nx_ip_interface_address_set           Set interface address         */ 
/*    nx_ip_interface_status_check          Get interface status          */ 
/*    tx_event_flags_get                    Get event flags               */ 
/*    tx_mutex_get                          Get IP protection             */ 
/*    tx_mutex_put                          Put IP protection             */ 
/*    tx_thread_sleep                       Thread sleep                  */ 
/*                                                                        */ 
/*  CALLED BY                                                             */ 
/*                                                                        */ 
/*    ThreadX                                                             */ 
/*                                                                        */ 
/**************************************************************************/
VOID  _nx_auto_ip_thread_entry(ULONG auto_ip_ptr_info)  
{

NX_AUTO_IP      *auto_ip_ptr;
NX_IP           *ip_ptr;
UINT            i, status;
ULONG           addresses;
ULONG           conflict;
ULONG           temp;
ULONG           delay;
ULONG           hw_address_lsw;
ULONG           host_ip_address;


    /* Pickup the AutoIP pointer.  */
    auto_ip_ptr =  (NX_AUTO_IP *) auto_ip_ptr_info;

    /* Pickup the associated IP pointer.  */
    ip_ptr =  auto_ip_ptr -> nx_auto_ip_ip_ptr;   

    /* Wait for the IP instance to be initialized before proceeding. This will ensure the
       MAC address is valid before a random local IP address is generated.  */
    nx_ip_interface_status_check(ip_ptr, auto_ip_ptr -> nx_ip_interface_index, NX_IP_LINK_ENABLED, &temp, NX_WAIT_FOREVER);

    /* Set LSW of hardware address */
    hw_address_lsw = ip_ptr -> nx_ip_interface[auto_ip_ptr -> nx_ip_interface_index].nx_interface_physical_address_lsw;

    /* Setup the conflict flag to false.  */
    conflict =  NX_FALSE;

    /* Loop forever inside the AutoIP thread!  */
    while(1)
    {

        /* Probe for local IP address use!  */

        /* Update the local variable in case anything has changed. */
        host_ip_address =  ip_ptr -> nx_ip_interface[auto_ip_ptr -> nx_ip_interface_index].nx_interface_ip_address;

        /* Wait until the IP address is non-zero.  The only way this can be non-zero is
           if the application has changed it or it was resolved by the DHCP protocol.  */
        while (host_ip_address)
        {

            /* Sleep for the maximum probe period.  */
            tx_thread_sleep(NX_IP_PERIODIC_RATE * NX_AUTO_IP_PROBE_MAX);

            /* Get the IP address from the IP task and see if it has changed from non zero. */ 
            host_ip_address =  ip_ptr -> nx_ip_interface[auto_ip_ptr -> nx_ip_interface_index].nx_interface_ip_address;
        }

        /* Determine if the restart flag is set.  */
        if (auto_ip_ptr -> nx_auto_ip_restart_flag)
        {

            /* Clear the restart flag.  */
            auto_ip_ptr -> nx_auto_ip_restart_flag =  NX_FALSE;

            /* Reset the conflict count.  */
            auto_ip_ptr -> nx_auto_ip_conflict_count =  0;

            /* Clear the conflict flag, since we might have an new starting local IP address.  */
            conflict =  NX_FALSE;
        }

        /* Determine if a conflict condition is present.  This flag is set at various places
           below.  */
        if (conflict)
        {

            /* Yes, a conflict was detected.  */

            /* Increment the conflict count.  */
            auto_ip_ptr -> nx_auto_ip_conflict_count++;

            /* Determine if we have reached the maximum number of conflicts.  */
            if (auto_ip_ptr -> nx_auto_ip_conflict_count > NX_AUTO_IP_MAX_CONFLICTS)
            {

                /* Yes, we have had excessive conflicts... we must now add extra delay.  */
                tx_thread_sleep(NX_IP_PERIODIC_RATE * NX_AUTO_IP_RATE_LIMIT_INTERVAL);
            }

            /* Clear the the local IP address in order to generate another random one.  */
            auto_ip_ptr -> nx_auto_ip_current_local_address =  0;

            /* Clear the conflict flag.  */
            conflict =  NX_FALSE;
        }

        /* Determine if a starting local IP address needs to be derived.  */
        if (auto_ip_ptr -> nx_auto_ip_current_local_address == 0)
        {

            /* Yes, the starting local IP address must be derived.  */

            /* Get pseudo random value with LSW of MAC address.  */
            temp =  ((ULONG) NX_RAND()) + hw_address_lsw;

            /* Determine the address range of local IP addresses.  */
            addresses =  NX_AUTO_IP_END_ADDRESS - NX_AUTO_IP_START_ADDRESS;

            /* Make sure that the random number fits within this range.  */
            temp =  temp % addresses;

            /* Now create a starting local IP address.  */
            auto_ip_ptr -> nx_auto_ip_current_local_address =  NX_AUTO_IP_START_ADDRESS + temp;
        }

        /* Register with NetX for ARP conflict detection for this local IP address.  */

        /* Get IP mutex so ARP notification can be setup.  */
        tx_mutex_get(&(ip_ptr -> nx_ip_protection), TX_WAIT_FOREVER);

        /* Finally, setup the handler to indicate the we want collision notification.  */
        ip_ptr -> nx_ip_interface[auto_ip_ptr -> nx_ip_interface_index].nx_interface_ip_conflict_notify_handler = _nx_auto_ip_conflict;

        /* Clear any outstanding events.  */
        tx_event_flags_get(&(auto_ip_ptr -> nx_auto_ip_conflict_event), 0x1, TX_OR_CLEAR, &temp, TX_NO_WAIT);

        /* Release the IP internal mutex.  */
        tx_mutex_put(&(ip_ptr -> nx_ip_protection));

        /* Calculate the delay time.  */
        delay = (ULONG)NX_RAND() % (NX_IP_PERIODIC_RATE * NX_AUTO_IP_PROBE_WAIT);

        /* Sleep for a small period of time.  */
        tx_thread_sleep(delay);

        /* Loop to probe for the specified local IP address.  */
        for (i = 0; i < NX_AUTO_IP_PROBE_NUM; i++)
        {

            /* Increment the total probe count.  */
            auto_ip_ptr -> nx_auto_ip_probe_count++;

            /* Send the ARP probe.  */
            _nx_arp_probe_send(ip_ptr, auto_ip_ptr -> nx_ip_interface_index, auto_ip_ptr -> nx_auto_ip_current_local_address);

            /* Calculate the delay time.  */
            delay =  ((ULONG) NX_RAND()) % (NX_IP_PERIODIC_RATE * NX_AUTO_IP_PROBE_MAX);

            /* Determine if this is less than the minimum.  */
            if (delay < (NX_IP_PERIODIC_RATE * NX_AUTO_IP_PROBE_MIN))
            {

                /* Set the delay to the minimum.  */
                delay =  (NX_IP_PERIODIC_RATE * NX_AUTO_IP_PROBE_MIN);
            }

            /* Delay by waiting for conflict events before sending the next ARP probe. This event is
               set by the conflict callback function when an ARP entry is received that matches
               the registered address.  */
            status =  tx_event_flags_get(&(auto_ip_ptr -> nx_auto_ip_conflict_event), 0x1, TX_OR_CLEAR, &temp, delay);

            /* Determine if conflict was detected.  */
            if (status == NX_SUCCESS)
            {

                /* Yes, a conflict is present.  */ 

                /* Set the conflict flag and get out of the loop.  */
                conflict =  NX_TRUE;
                break;
            }

            /* Update the local variable in case anything has changed. */
            host_ip_address =  ip_ptr -> nx_ip_interface[auto_ip_ptr -> nx_ip_interface_index].nx_interface_ip_address;

            /* Check for a restart or an IP address change.  */
            if (host_ip_address || (auto_ip_ptr -> nx_auto_ip_restart_flag))
                break;
        }

        /* Determine if there was a conflict. If so, continue at the top of the loop.  */
        if (conflict)
        {

#ifdef NX_AUTO_IP_DEBUG
            printf("AutoIP %s, CONFLICT for: %lu,%lu,%lu,%lu\n", auto_ip_ptr -> nx_auto_ip_name, 
                                    (auto_ip_ptr -> nx_auto_ip_current_local_address >> 24),
                                    (auto_ip_ptr -> nx_auto_ip_current_local_address >> 16 & 0xFF),
                                    (auto_ip_ptr -> nx_auto_ip_current_local_address >> 8 & 0xFF),
                                    (auto_ip_ptr -> nx_auto_ip_current_local_address & 0xFF));
#endif
            continue;
        }

        /* Check for a restart or an IP address change.  */
        if (host_ip_address || (auto_ip_ptr -> nx_auto_ip_restart_flag))
            continue;

        /* At this point, the local IP address has been successfully probed via ARP messages without
           any collisions.  It is now time to go into an announce phase to indicate local IP address
           is ours!  */
        
#ifdef NX_AUTO_IP_DEBUG
        printf("AutoIP %s, RESOLVED for: %lu,%lu,%lu,%lu\n", auto_ip_ptr -> nx_auto_ip_name, 
                                (auto_ip_ptr -> nx_auto_ip_current_local_address >> 24),
                                (auto_ip_ptr -> nx_auto_ip_current_local_address >> 16 & 0xFF),
                                (auto_ip_ptr -> nx_auto_ip_current_local_address >> 8 & 0xFF),
                                (auto_ip_ptr -> nx_auto_ip_current_local_address & 0xFF));
#endif

        /* Set the NetX IP address.  */
        nx_ip_interface_address_set(ip_ptr, auto_ip_ptr -> nx_ip_interface_index, auto_ip_ptr -> nx_auto_ip_current_local_address, 0xFFFF0000);

        /* Delay before announcing: NX_AUTO_IP_ANNOUNCE_WAIT.  */
        tx_thread_sleep(NX_IP_PERIODIC_RATE * NX_AUTO_IP_ANNOUNCE_WAIT);

       /* It is now time to go into an announce phase to indicate local IP address is ours!  */
        for (i = 0; i < NX_AUTO_IP_ANNOUNCE_NUM; i++)
        {

            /* Increment the total announcement count.  */
            auto_ip_ptr -> nx_auto_ip_announce_count++;
                
            /* Send the ARP announcement.  */
            _nx_arp_announce_send(ip_ptr, auto_ip_ptr -> nx_ip_interface_index);

            /* Calculate the delay time.  */
            delay =  (NX_IP_PERIODIC_RATE * NX_AUTO_IP_ANNOUNCE_INTERVAL);

            /* Delay by waiting for conflict events before sending the next ARP announcement. This event is
               set by the conflict callback function when an ARP entry is received that matches
               the registered address.  */
            status =  tx_event_flags_get(&(auto_ip_ptr -> nx_auto_ip_conflict_event), 0x1, TX_OR_CLEAR, &temp, delay);

            /* Determine if conflict was detected.  */
            if (status == NX_SUCCESS)
            {

                /* Yes, a conflict is present.  */ 

                /* Set the conflict flag and get out of the loop.  */
                conflict =  NX_TRUE;
                break;
            }
        }

        /* Determine if there was a conflict. If so, continue at the top of the loop.  */
        if (conflict)
        {

#ifdef NX_AUTO_IP_DEBUG
            printf("AutoIP %s, CONFLICT for: %lu,%lu,%lu,%lu\n", auto_ip_ptr -> nx_auto_ip_name, 
                                    (auto_ip_ptr -> nx_auto_ip_current_local_address >> 24),
                                    (auto_ip_ptr -> nx_auto_ip_current_local_address >> 16 & 0xFF),
                                    (auto_ip_ptr -> nx_auto_ip_current_local_address >> 8 & 0xFF),
                                    (auto_ip_ptr -> nx_auto_ip_current_local_address & 0xFF));
#endif

            /* Conflict, clear the IP address.  */
            nx_ip_interface_address_set(ip_ptr, auto_ip_ptr -> nx_ip_interface_index, 0, 0);

            continue;
        }

        /* Now, wait infinitely for another conflict situation.  */
        tx_event_flags_get(&(auto_ip_ptr -> nx_auto_ip_conflict_event), 0x1, TX_OR_CLEAR, &temp, TX_WAIT_FOREVER);

        /* Update the local variable in case anything has changed. */
        host_ip_address =  ip_ptr -> nx_ip_interface[auto_ip_ptr -> nx_ip_interface_index].nx_interface_ip_address;

        /* Determine if a conflict is present.  */

        /* If we get here a late conflict is present.  */ 
        if (auto_ip_ptr -> nx_auto_ip_current_local_address == host_ip_address)
        {

            /* Increment the total defend count.  */
            auto_ip_ptr -> nx_auto_ip_defend_count++;

#ifdef NX_AUTO_IP_DEBUG
            printf("AutoIP %s, DEFEND for: %lu,%lu,%lu,%lu\n", auto_ip_ptr -> nx_auto_ip_name, 
                                    (auto_ip_ptr -> nx_auto_ip_current_local_address >> 24),
                                    (auto_ip_ptr -> nx_auto_ip_current_local_address >> 16 & 0xFF),
                                    (auto_ip_ptr -> nx_auto_ip_current_local_address >> 8 & 0xFF),
                                    (auto_ip_ptr -> nx_auto_ip_current_local_address & 0xFF));
#endif

            /* No defense currently, just clear the IP address once a late collision is detected
               and start over.  */
            nx_ip_interface_address_set(ip_ptr, auto_ip_ptr -> nx_ip_interface_index, 0, 0);

            /* Set the conflict flag.  */
            conflict =  NX_TRUE;
        }
    }
}


/**************************************************************************/ 
/*                                                                        */ 
/*  FUNCTION                                               RELEASE        */ 
/*                                                                        */ 
/*    _nx_auto_ip_conflict                                PORTABLE C      */ 
/*                                                           6.4.3        */
/*  AUTHOR                                                                */
/*                                                                        */
/*    Yuxin Zhou, Microsoft Corporation                                   */
/*                                                                        */
/*  DESCRIPTION                                                           */ 
/*                                                                        */ 
/*    This function notifies the AutoIP instance that a conflict was      */ 
/*    detected by the NetX ARP receive packet handling routine.           */ 
/*                                                                        */ 
/*  INPUT                                                                 */ 
/*                                                                        */ 
/*    ip_ptr                                IP instance pointer           */ 
/*    interface_index                       IP Interface Index            */
/*    ip_address                            IP Address to bind to         */ 
/*    physical_msw                          Physical address MSW          */ 
/*    physical_lsw                          Physical address LSW          */ 
/*                                                                        */ 
/*  OUTPUT                                                                */ 
/*                                                                        */ 
/*    None                                                                */ 
/*                                                                        */ 
/*  CALLS                                                                 */ 
/*                                                                        */ 
/*    tx_event_flags_set                    Set event flags               */ 
/*                                                                        */ 
/*  CALLED BY                                                             */ 
/*                                                                        */ 
/*    NetX                                                                */ 
/*                                                                        */ 
/**************************************************************************/
VOID  _nx_auto_ip_conflict(NX_IP *ip_ptr, UINT interface_index, ULONG ip_address, ULONG physical_msw, ULONG physical_lsw)
{

    NX_PARAMETER_NOT_USED(ip_ptr);
    NX_PARAMETER_NOT_USED(interface_index);
    NX_PARAMETER_NOT_USED(ip_address);
    NX_PARAMETER_NOT_USED(physical_msw);
    NX_PARAMETER_NOT_USED(physical_lsw);

    /* Set the event flags to indicate that a collision was detected by NetX ARP processing.  */
    tx_event_flags_set(&(_nx_auto_ip_ptr -> nx_auto_ip_conflict_event), 0x1, TX_OR);
}
#endif /* NX_DISABLE_IPV4 */