summaryrefslogtreecommitdiff
path: root/ecos/packages/net/httpd/current/src/monitor.c
blob: 88bba8d92b0724fd7673e7dc8238633b626cab07 (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
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
/* =================================================================
 *
 *      monitor.c
 *
 *      An HTTP system monitor 
 *
 * ================================================================= 
 * ####ECOSGPLCOPYRIGHTBEGIN####                                     
 * -------------------------------------------                       
 * This file is part of eCos, the Embedded Configurable Operating System.
 * Copyright (C) 2002, 2003 Free Software Foundation, Inc.           
 *
 * eCos is free software; you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free
 * Software Foundation; either version 2 or (at your option) any later
 * version.                                                          
 *
 * eCos is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 * for more details.                                                 
 *
 * You should have received a copy of the GNU General Public License 
 * along with eCos; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.     
 *
 * As a special exception, if other files instantiate templates or use
 * macros or inline functions from this file, or you compile this file
 * and link it with other works to produce a work based on this file,
 * this file does not by itself cause the resulting work to be covered by
 * the GNU General Public License. However the source code for this file
 * must still be made available in accordance with section (3) of the GNU
 * General Public License v2.                                        
 *
 * This exception does not invalidate any other reasons why a work based
 * on this file might be covered by the GNU General Public License.  
 * -------------------------------------------                       
 * ####ECOSGPLCOPYRIGHTEND####                                       
 * =================================================================
 * #####DESCRIPTIONBEGIN####
 * 
 *  Author(s):    nickg@calivar.com
 *  Contributors: nickg@calivar.com, andrew.lunn@ascom.ch
 *  Date:         2002-10-14
 *  Purpose:      
 *  Description:  
 *               
 * ####DESCRIPTIONEND####
 * 
 * =================================================================
 */

#include <pkgconf/system.h>
#include <pkgconf/isoinfra.h>
#include <pkgconf/net.h>
#include <pkgconf/httpd.h>
#include <pkgconf/kernel.h>

#include <cyg/infra/cyg_trac.h>        /* tracing macros */
#include <cyg/infra/cyg_ass.h>         /* assertion macros */

#include <cyg/httpd/httpd.h>

#include <cyg/kernel/kapi.h>
#ifdef CYGPKG_KERNEL_INSTRUMENT
#include <cyg/kernel/instrmnt.h>
#include <cyg/kernel/instrument_desc.h>
#endif

#include <unistd.h>
#include <ctype.h>

/* ================================================================= */
/* Include all the necessary network headers by hand. We need to do
 * this so that _KERNEL is correctly defined, or not, for specific
 * headers so we can use both the external API and get at internal
 * kernel structures.
 */

#define _KERNEL
#include <sys/param.h>
#undef _KERNEL
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <sys/errno.h>
#include <sys/time.h>
#include <netdb.h>
#define _KERNEL

#include <sys/sysctl.h>
#include <net/if.h>
#include <ifaddrs.h>
#include <netinet/in.h>
#include <netinet/ip.h>
#include <netinet/ip_icmp.h>
#include <net/route.h>
#include <net/if_dl.h>

#include <sys/protosw.h>
#include <netinet/in_pcb.h>
#include <netinet/udp.h>
#include <netinet/tcp.h>
#include <netinet/tcp_timer.h>
#include <netinet/ip_var.h>
#include <netinet/icmp_var.h>
#include <netinet/udp_var.h>
#include <netinet/tcp_var.h>
#ifdef CYGPKG_NET_INET6
#include <netinet/ip6.h>
#include <net/if_var.h>
#include <netinet6/ip6_var.h>
#include <netinet6/in6_var.h>
#include <netinet/icmp6.h>
#endif


#include <sys/mbuf.h>

#include <cyg/io/eth/eth_drv_stats.h>

/* ================================================================= */
/* Use this when a thread appears to have no name.
 */

#define NULL_THREAD_NAME "----------"

/* ================================================================= */
/* Draw navigation bar
 *
 * This draws a simple table containing links to the various monitor
 * pages at the current position in the HTML stream.
 */

static void draw_navbar( FILE *client )
{
    html_para_begin( client, "" );
    
    html_table_begin( client, "border cellpadding=\"4\"" );
    {
        html_table_row_begin(client, "" );
        {
            html_table_data_begin( client, "" );
            html_image( client, "/monitor/ecos.gif", "eCos logo", "" );
            html_table_data_begin( client, "" );
            html_url( client, "Threads", "/monitor/threads.html");
            html_table_data_begin( client, "" );
            html_url( client, "Interrupts", "/monitor/interrupts.html");
            html_table_data_begin( client, "" );
            html_url( client, "Memory", "/monitor/memory.html");
            html_table_data_begin( client, "" );
            html_url( client, "Network", "/monitor/network.html");
#ifdef CYGPKG_KERNEL_INSTRUMENT
            html_table_data_begin( client, "" );
            html_url( client, "Instrumentation", "/monitor/instrument.html");
#endif
        }
        html_table_row_end( client );
    }
    html_table_end( client );
}

/* ================================================================= */
/* Index page
 *
 * A simple introductory page matching "/monitor" and
 * "/monitor/index.html".
 */

static char monitor_index_blurb[] =
"<p>This is the eCos System Monitor. It presents a simple web monitor "
"and control interface for eCos systems.\n"
"<p>Use the navigation bar at the bottom of each page to explore."
;

static cyg_bool cyg_monitor_index( FILE * client, char *filename,
                                   char *formdata, void *arg )
{
    html_begin(client);

    html_head(client,"eCos System Monitor", "");    

    html_body_begin(client,"");
    {
        html_heading(client, 2, "eCos System Monitor" );

        fputs( monitor_index_blurb, client );
        
        draw_navbar(client);
    }
    html_body_end(client);

    html_end(client);
    
    return 1;
}

CYG_HTTPD_TABLE_ENTRY( cyg_monitor_entry,
                       "/monitor",
                       cyg_monitor_index,
                       NULL );

CYG_HTTPD_TABLE_ENTRY( cyg_monitor_index_entry,
                       "/monitor/index.html",
                       cyg_monitor_index,
                       NULL );

/* ================================================================= */
/* Thread Monitor
 *
 * Uses the kapi thread info API to enumerate all the current threads
 * and generate a table showing their state.
 */

static cyg_bool cyg_monitor_threads( FILE * client, char *filename,
                                     char *formdata, void *arg )
{
    
    html_begin(client);

/*    html_head(client,"Thread Monitor", "<meta http-equiv=\"refresh\" content=\"10\">"); */
    html_head(client,"eCos Thread Monitor", "");    

    html_body_begin(client,"");
    {
        html_heading(client, 2, "Thread Monitor" );

        html_table_begin( client, "border" );
        {
            cyg_handle_t thread = 0;
            cyg_uint16 id = 0;
        
            html_table_header( client, "Id", "" );
            html_table_header( client, "State", "" );
            html_table_header( client, "Set<br>Priority", "" );
            html_table_header( client, "Current<br>Priority", "" );
            html_table_header( client, "Name", "" );
            html_table_header( client, "Stack Base", "" );
            html_table_header( client, "Stack Size", "" );
#ifdef CYGFUN_KERNEL_THREADS_STACK_MEASUREMENT
            html_table_header( client, "Stack Used", "" );
#endif
            /* Loop over the threads, and generate a table row for
             * each.
             */
            while( cyg_thread_get_next( &thread, &id ) )
            {
                cyg_thread_info info;
                char *state_string;

                cyg_thread_get_info( thread, id, &info );
                
                if( info.name == NULL )
                    info.name = NULL_THREAD_NAME;

                /* Translate the state into a string.
                 */
                if( info.state == 0 )
                    state_string = "RUN";
                else if( info.state & 0x04 )
                    state_string = "SUSP";
                else switch( info.state & 0x1b )
                {
                case 0x01: state_string = "SLEEP"; break;
                case 0x02: state_string = "CNTSLEEP"; break;
                case 0x08: state_string = "CREATE"; break;
                case 0x10: state_string = "EXIT"; break;
                default: state_string = "????"; break;
                }

                /* Now generate the row.
                 */
                html_table_row_begin(client, "" );
                {
                    html_table_data_begin( client, "" );
                    fprintf( client, "<a href=\"/monitor/thread-%04x.html\">%04x</a>\n", id,id);
                    html_table_data_begin( client, "" );
                    fprintf( client, "%s", state_string);
                    html_table_data_begin( client, "" );
                    fprintf( client, "%d", info.set_pri);
                    html_table_data_begin( client, "" );
                    fprintf( client, "%d", info.cur_pri);
                    html_table_data_begin( client, "" );
                    fputs( info.name, client );
                    html_table_data_begin( client, "" );
                    fprintf( client, "%08x", info.stack_base );
                    html_table_data_begin( client, "" );
                    fprintf( client, "%d", info.stack_size );
#ifdef CYGFUN_KERNEL_THREADS_STACK_MEASUREMENT
                    html_table_data_begin( client, "" );
                    fprintf( client, "%d", info.stack_used );
#endif
                }
                html_table_row_end(client);
                
            }
        }
        html_table_end( client );

        draw_navbar(client);
    }
    html_body_end(client);

    html_end(client);
    
    return 1;
}

CYG_HTTPD_TABLE_ENTRY( cyg_monitor_show_threads,
                       "/monitor/threads.htm*",
                       cyg_monitor_threads,
                       NULL );

/* ================================================================= */
/* Thread edit page
 *
 * A page on which the thread's state may be edited. This tests forms
 * handling.
 */

static char thread_edit_blurb[] =
"<p>This table contains an entry for each property of the thread "
"that you can edit. The properties are:\n"
"<p><b>State:</b> Change thread's state. The <em>Suspend</em> button "
"will suspend the thread. The <em>Run</em> button will undo any previous "
"suspends. The <em>Release</em> button will release the thread out of "
"any sleep it is currently in.\n"
"<p><b>Priority:</b> Change the thread's priority.\n"
"<p>Once the new state has been selected, press the <em>Submit</em> "
"button to make the change, or <em>Reset</em> to clear it."
;

static cyg_bool cyg_monitor_thread_edit( FILE * client, char *filename,
                                         char *formdata, void *arg )
{
    /* If any form data has been supplied, then change the thread's
     * state accordingly.
     */
    if( formdata != NULL )
    {
        char *formlist[6];
        char *state;
        char *pri_string;
        char *id_string;
        cyg_handle_t thread = 0;
        cyg_uint16 id;

        /* Parse the data */
        cyg_formdata_parse( formdata, formlist, 6 );

        /* Get the thread id from the hidden control */
        id_string = cyg_formlist_find( formlist, "thread");

        sscanf( id_string, "%04hx", &id );

        thread = cyg_thread_find( id );

        /* If there is a pri field, change the priority */
        pri_string = cyg_formlist_find( formlist, "pri");

        if( pri_string != NULL )
        {
            cyg_priority_t pri;

            sscanf( pri_string, "%d", &pri );

            cyg_thread_set_priority( thread, pri );
        }

        /* If there is a state field, change the thread state */
        state = cyg_formlist_find( formlist, "state");

        if( state != NULL )
        {
            if( strcmp( state, "run" ) == 0 )
                cyg_thread_resume( thread );
            if( strcmp( state, "suspend" ) == 0 )
                cyg_thread_suspend( thread );
            if( strcmp( state, "release" ) == 0 )
                cyg_thread_release( thread );
        }
    }

    /* Now generate a page showing the current thread state, and
     * including form controls to change it.
     */
    
    html_begin(client);

    html_head(client,"eCos Thread Editor", "");

    html_body_begin(client,"");
    {
        cyg_uint16 id;
        cyg_thread_info info;
        cyg_handle_t thread = 0;
        char idbuf[16];
        
        sscanf( filename, "/monitor/thread-%04hx.html", &id );

        thread = cyg_thread_find( id );
        cyg_thread_get_info(thread, id, &info );
        
        html_heading(client, 2, "Thread State Editor" );

        html_para_begin( client, "" );
        
        fprintf( client, "Editing Thread %04x %s\n",id,
                 info.name?info.name:NULL_THREAD_NAME);

        fputs( thread_edit_blurb, client );
        
        html_form_begin( client, filename, "" );        
        {
            html_table_begin( client, "border" );
            {
                html_table_header( client, "Property", "" );
                html_table_header( client, "Value", "" );

                html_table_row_begin(client, "" );
                {
                    html_table_data_begin( client, "" );
                    fputs( "State", client );

                    html_table_data_begin( client, "" );

                    html_form_input_radio( client, "state", "run", (info.state&0x04)==0 );
                    fputs( "Run", client );
                    html_form_input_radio( client, "state", "suspend", (info.state&0x04)!=0 );
                    fputs( "Suspend", client );
                    html_form_input_radio( client, "state", "release", 0 );
                    fputs( "Release", client );
                }
                html_table_row_end( client );

                html_table_row_begin(client, "" );
                {
                    html_table_data_begin( client, "" );
                    fputs( "Priority", client );

                    html_table_data_begin( client, "" );
                    fprintf(client,"<input type=\"text\" name=\"pri\" size=\"10\" value=\"%d\">\n",
                            info.set_pri);                    
                }
                html_table_row_end( client );

            }
            html_table_end( client );

            /* Add submit and reset buttons */
            html_form_input(client, "submit", "submit", "Submit", "");                
            html_form_input(client, "reset", "reset", "Reset", "");

            /* Pass the thread ID through to our next incarnation */
            sprintf( idbuf, "%04x", id );
            html_form_input_hidden(client, "thread", idbuf );            

        }
        html_form_end( client );
        
        draw_navbar(client);
    }
    html_body_end(client);

    html_end(client);
    
    return 1;
}

CYG_HTTPD_TABLE_ENTRY( cyg_monitor_thread_edit_entry,
                       "/monitor/thread-*",
                       cyg_monitor_thread_edit,
                       NULL );

/* ================================================================= */
/* Interrupt monitor
 *
 * At present this just generates a table showing which interrupts
 * have an ISR attached.
 */

static cyg_bool cyg_monitor_interrupts( FILE * client, char *filename,
                                        char *formdata, void *arg )
{
    html_begin(client);

    html_head(client,"eCos Interrupt Monitor", "");

    html_body_begin(client,"");
    {
        html_heading(client, 2, "Interrupt Monitor" );

        html_table_begin( client, "border" );
        {
            int i;
            int maxint = CYGNUM_HAL_ISR_MAX;

#ifdef CYGPKG_HAL_I386
            maxint = CYGNUM_HAL_ISR_MIN+16;
#endif
            
            html_table_header( client, "ISR", "" );
            html_table_header( client, "State", "" );
            
            for( i = CYGNUM_HAL_ISR_MIN; i <= maxint ; i++ )
            {
                cyg_bool_t inuse;
                HAL_INTERRUPT_IN_USE( i, inuse );

                html_table_row_begin(client, "" );
                {
                    html_table_data_begin( client, "" );
                    fprintf( client, "%d", i);
                    html_table_data_begin( client, "" );
                    fprintf( client, "%s", inuse?"In Use":"Free");
                }
                html_table_row_end( client );
            }
        }
        html_table_end( client );

        draw_navbar(client);
    }
    html_body_end(client);

    html_end(client);
    
    return 1;
    
}

CYG_HTTPD_TABLE_ENTRY( cyg_monitor_interrupts_entry,
                       "/monitor/interrupts.htm*",
                       cyg_monitor_interrupts,
                       NULL );

/* ================================================================= */
/* Memory monitor
 *
 * Generates a table showing a 256 byte page of memory. Form controls
 * allow changes to the base address and display element size.
 */

static cyg_bool cyg_monitor_memory( FILE * client, char *filename,
                                    char *formdata, void *arg )
{
    char *formlist[10];
    cyg_uint32 base = 0;
    unsigned int datasize = 1;
    int size = 256;
    char *p;
    bool valid_base = true;

    
    cyg_formdata_parse( formdata, formlist, 10 );

    p = cyg_formlist_find( formlist, "base" );

    /* If the page is requested without a 'base' parameter, do not attempt
     * to access any memory locations to prevent illegal memory accesses
     * on targets where '0' is not a valid address.
     */
    if( p != NULL )
        sscanf( p, "%x", &base );
    else
        valid_base = false;

    p = cyg_formlist_find( formlist, "datasize" );

    if( p != NULL )
        sscanf( p, "%x", &datasize );

    if( cyg_formlist_find( formlist, "next" ) != NULL )
        base += size;

    if( cyg_formlist_find( formlist, "prev" ) != NULL )
        base -= size;
        
    html_begin(client);

    html_head(client,"eCos Memory Monitor", "");

    html_body_begin(client,"");
    {
        html_heading(client, 2, "Memory Monitor" );

        html_form_begin( client, "/monitor/memory.html", "" );
        {

            /* Text input control for base address
             */
            html_para_begin( client, "" );
            fprintf(client,
                    "Base Address: 0x<input type=\"text\" name=\"base\" size=\"10\" value=\"%x\">\n",
                    base);

            fprintf(client,
                    "WARNING: entering an illegal base address can crash the system.\n");

            /* A little menu for the element size
             */
            html_para_begin( client, "" );

            fputs( "Element Size: ", client );
            html_form_select_begin( client, "datasize", "" );
            html_form_option( client, "1", "bytes", datasize==1 );
            html_form_option( client, "2", "words", datasize==2 );
            html_form_option( client, "4", "dwords", datasize==4 );
            html_form_select_end( client );
                        
            html_para_begin( client, "" );

            /* Submit and reset buttons
             */
            html_form_input(client, "submit", "submit", "Submit", "");                
            html_form_input(client, "reset", "reset", "Reset", "");

            html_para_begin( client, "" );

            /* Previous page button */
            html_form_input(client, "submit", "prev", "Prev Page", "");

            /* Switch to monospaced font */
            cyg_html_tag_begin( client, "font", "face=\"monospace\"" );
            
            html_table_begin( client, "" );

            if (valid_base == true) {
                cyg_addrword_t loc;
                cyg_addrword_t oloc;
                
                for( oloc = loc = base; loc <= (base+size) ; loc++ )
                {
                    if( ( loc % 16 ) == 0 )
                    {
                        if( loc != base )
                        {
                            html_table_data_begin( client, "" );
                            for( ; oloc < loc; oloc++ )
                            {
                                char c = *(char *)oloc;
                                if( !isprint(c) )
                                    c = '.';
                                putc( c, client );
                            }
                            html_table_row_end( client );
                        }
                        if( loc == (base+size) )
                            break;
                        html_table_row_begin(client, "" );
                        html_table_data_begin( client, "" );
                        fprintf( client, "%08x:",loc);
                    }

                    html_table_data_begin( client, "" );

                    if( (loc % datasize) == 0 )
                    {
                        switch( datasize )
                        {
                        case 1: fprintf( client, "%02x", *(cyg_uint8  *)loc ); break;
                        case 2: fprintf( client, "%04x", *(cyg_uint16 *)loc ); break;
                        case 4: fprintf( client, "%08x", *(cyg_uint32 *)loc ); break;
                        }
                    }
                }
            }
            html_table_end( client );
            cyg_html_tag_end( client, "font" );
            
            html_form_input(client, "submit", "next", "Next Page", "");            
        }
        html_form_end( client );

        draw_navbar(client);
    }
    html_body_end(client);

    html_end(client);
    
    return 1;
    
}

CYG_HTTPD_TABLE_ENTRY( cyg_monitor_memory_entry,
                       "/monitor/memory.htm*",
                       cyg_monitor_memory,
                       NULL );

/* ================================================================= */
/* Network Monitor
 *
 * This function generates a page containing information about the
 * network interfaces and the protocols.
 */

static cyg_bool cyg_monitor_network( FILE * client, char *filename,
                                     char *formdata, void *arg )
{
    struct ifaddrs *iflist, *ifp;

    if(getifaddrs(&iflist)!=0)
        return 0;
    
    html_begin(client);

    html_head(client,"eCos Network Monitor", "");

    html_body_begin(client,"");
    {
        html_heading(client, 2, "Network Monitor" );

        html_heading(client, 3, "Interfaces" );        

        html_table_begin( client, "border" );
        {
            char addr[64];
            int i;
            ifp = iflist;

            html_table_header( client, "Interface", "" );
            html_table_header( client, "Status", "" );

            while( ifp != (struct ifaddrs *)NULL) 
            {
                if (ifp->ifa_addr->sa_family != AF_LINK) 
                {
                  
                  html_table_row_begin(client, "" );
                  {
                        html_table_data_begin( client, "" );
                        fprintf( client, "%s", ifp->ifa_name);

                        html_table_data_begin( client, "" );                        
                        html_table_begin( client, "" );
                        {
                            /* Get the interface's flags and display
                             * the interesting ones.
                             */
                            
                            html_table_row_begin(client, "" );
                            fprintf( client, "<td>Flags<td>\n" );
                            for( i = 0; i < 16; i++ )
                              {
                                switch( ifp->ifa_flags & (1<<i) )
                                  {
                                  default: break;
                                  case IFF_UP: fputs( " UP", client ); break;
                                  case IFF_BROADCAST: fputs( " BROADCAST", client ); break;
                                  case IFF_DEBUG: fputs( " DEBUG", client ); break;
                                  case IFF_LOOPBACK: fputs( " LOOPBACK", client ); break;
                                  case IFF_PROMISC: fputs( " PROMISCUOUS", client ); break;
                                  case IFF_RUNNING: fputs( " RUNNING", client ); break;
                                  case IFF_SIMPLEX: fputs( " SIMPLEX", client ); break;
                                  case IFF_MULTICAST: fputs( " MULTICAST", client ); break;
                                  }
                              }
                            html_table_row_end( client );                
                            
                            html_table_row_begin(client, "" );
                            getnameinfo(ifp->ifa_addr, sizeof(*ifp->ifa_addr),
                                        addr, sizeof(addr), NULL, 0, NI_NUMERICHOST);
                            fprintf( client, "<td>Address<td>%s\n", addr);
                            html_table_row_end( client );
                            
                            if (ifp->ifa_netmask) 
                            {
                              html_table_row_begin(client, "" );
                              getnameinfo(ifp->ifa_netmask, sizeof(*ifp->ifa_netmask),
                                          addr, sizeof(addr), NULL, 0, NI_NUMERICHOST);
                              fprintf( client, "<td>Mask<td>%s\n", addr); 
                              html_table_row_end( client );
                            }

                            if (ifp->ifa_broadaddr) 
                            {
                              html_table_row_begin(client, "" );
                              getnameinfo(ifp->ifa_broadaddr, sizeof(*ifp->ifa_broadaddr),
                                          addr, sizeof(addr), NULL, 0, NI_NUMERICHOST);
                              fprintf( client, "<td>Broadcast<td>%s\n", addr); 
                              html_table_row_end( client );
                            }
                        }
                        html_table_end( client );   
                    }
                    html_table_row_end( client );

                }
                ifp = ifp->ifa_next;
            }
        }
        html_table_end( client );

        /* Now the protocols. For each of the main protocols: IP,
         * ICMP, UDP, TCP print a table of useful information derived
         * from the in-kernel data structures. Note that this only
         * works for the BSD stacks.
         */
        
        html_para_begin( client, "" );
        html_heading(client, 3, "Protocols" );

        html_para_begin( client, "" );
        html_table_begin( client, "border");
        {
            html_table_header( client, "IPv4", "" );
#ifdef CYGPKG_NET_INET6
            html_table_header( client, "IPv6", "" );
#endif            
            html_table_header( client, "ICMPv4", "" );
#ifdef CYGPKG_NET_INET6
            html_table_header( client, "ICMPv6", "" );
#endif            
            html_table_header( client, "UDP", "" );
            html_table_header( client, "TCP", "" );

            html_table_row_begin(client, "" );
            {
                html_table_data_begin( client, "valign=\"top\"" );                        
                html_table_begin( client, "" );
                {

                    fprintf( client, "<tr><td><b>%s:</b><td></tr>\n", "Received" );
                    fprintf( client, "<tr><td>%s<td>%ld</tr>\n", "Total",
                             ipstat.ips_total );
                    fprintf( client, "<tr><td>%s<td>%ld</tr>\n", "Bad",
                             ipstat.ips_badsum+
                             ipstat.ips_tooshort+
                             ipstat.ips_toosmall+
                             ipstat.ips_badhlen+
                             ipstat.ips_badlen+
                             ipstat.ips_noproto+
                             ipstat.ips_toolong
                        );
                    fprintf( client, "<tr><td>%s<td>%ld</tr>\n", "Reassembled",
                             ipstat.ips_reassembled );
                    fprintf( client, "<tr><td>%s<td>%ld</tr>\n", "Delivered",
                             ipstat.ips_delivered );

                    fprintf( client, "<tr><td><b>%s:</b><td></tr>\n", "Sent" );                    
                    fprintf( client, "<tr><td>%s<td>%ld</tr>\n", "Total",
                             ipstat.ips_localout );
                    fprintf( client, "<tr><td>%s<td>%ld</tr>\n", "Raw",
                             ipstat.ips_rawout );
                    fprintf( client, "<tr><td>%s<td>%ld</tr>\n", "Fragmented",
                             ipstat.ips_fragmented );
                }
                html_table_end( client );
#ifdef CYGPKG_NET_INET6
                html_table_data_begin( client, "valign=\"top\"" );                        
                html_table_begin( client, "" );
                {

                    fprintf( client, "<tr><td><b>%s:</b><td></tr>\n", "Received" );
                    fprintf( client, "<tr><td>%s<td>%lld</tr>\n", "Total",
                             ip6stat.ip6s_total );
                    fprintf( client, "<tr><td>%s<td>%lld</tr>\n", "Bad",
                             ip6stat.ip6s_tooshort+
                             ip6stat.ip6s_toosmall
                        );
                    fprintf( client, "<tr><td>%s<td>%lld</tr>\n", "Reassembled",
                             ip6stat.ip6s_reassembled );
                    fprintf( client, "<tr><td>%s<td>%lld</tr>\n", "Delivered",
                             ip6stat.ip6s_delivered );

                    fprintf( client, "<tr><td><b>%s:</b><td></tr>\n", "Sent" );                    
                    fprintf( client, "<tr><td>%s<td>%lld</tr>\n", "Total",
                             ip6stat.ip6s_localout );
                    fprintf( client, "<tr><td>%s<td>%lld</tr>\n", "Raw",
                             ip6stat.ip6s_rawout );
                    fprintf( client, "<tr><td>%s<td>%lld</tr>\n", "Fragmented",
                             ip6stat.ip6s_fragmented );
                }
                html_table_end( client );
#endif
                html_table_data_begin( client, "valign=\"top\"" );                        
                html_table_begin( client, "" );
                {

                    fprintf( client, "<tr><td><b>%s:</b><td></tr>\n", "Received" );
                    fprintf( client, "<tr><td>%s<td>%ld</tr>\n", "ECHO",
                             icmpstat.icps_inhist[ICMP_ECHO] );
                    fprintf( client, "<tr><td>%s<td>%ld</tr>\n", "ECHO REPLY",
                             icmpstat.icps_inhist[ICMP_ECHOREPLY] );
                    fprintf( client, "<tr><td>%s<td>%ld</tr>\n", "UNREACH",
                             icmpstat.icps_inhist[ICMP_UNREACH] );
                    fprintf( client, "<tr><td>%s<td>%ld</tr>\n", "REDIRECT",
                             icmpstat.icps_inhist[ICMP_REDIRECT] );
                    fprintf( client, "<tr><td>%s<td>%ld</tr>\n", "Other",
                             icmpstat.icps_inhist[ICMP_SOURCEQUENCH]+
                             icmpstat.icps_inhist[ICMP_ROUTERADVERT]+
                             icmpstat.icps_inhist[ICMP_ROUTERSOLICIT]+
                             icmpstat.icps_inhist[ICMP_TIMXCEED]+
                             icmpstat.icps_inhist[ICMP_PARAMPROB]+
                             icmpstat.icps_inhist[ICMP_TSTAMP]+
                             icmpstat.icps_inhist[ICMP_TSTAMPREPLY]+
                             icmpstat.icps_inhist[ICMP_IREQ]+
                             icmpstat.icps_inhist[ICMP_IREQREPLY]+
                             icmpstat.icps_inhist[ICMP_MASKREQ]+
                             icmpstat.icps_inhist[ICMP_MASKREPLY]
                        );
                    fprintf( client, "<tr><td>%s<td>%ld</tr>\n", "Bad",
                             icmpstat.icps_badcode+
                             icmpstat.icps_tooshort+
                             icmpstat.icps_checksum+
                             icmpstat.icps_badlen+
                             icmpstat.icps_bmcastecho
                        );

                    fprintf( client, "<tr><td><b>%s:</b><td></tr>\n", "Sent" );                    
                    fprintf( client, "<tr><td>%s<td>%ld</tr>\n", "ECHO",
                             icmpstat.icps_outhist[ICMP_ECHO] );
                    fprintf( client, "<tr><td>%s<td>%ld</tr>\n", "ECHO REPLY",
                             icmpstat.icps_outhist[ICMP_ECHOREPLY] );
                    fprintf( client, "<tr><td>%s<td>%ld</tr>\n", "UNREACH",
                             icmpstat.icps_outhist[ICMP_UNREACH] );
                    fprintf( client, "<tr><td>%s<td>%ld</tr>\n", "REDIRECT",
                             icmpstat.icps_outhist[ICMP_REDIRECT] );
                    fprintf( client, "<tr><td>%s<td>%ld</tr>\n", "Other",
                             icmpstat.icps_inhist[ICMP_SOURCEQUENCH]+                             
                             icmpstat.icps_outhist[ICMP_ROUTERADVERT]+
                             icmpstat.icps_outhist[ICMP_ROUTERSOLICIT]+
                             icmpstat.icps_outhist[ICMP_TIMXCEED]+
                             icmpstat.icps_outhist[ICMP_PARAMPROB]+
                             icmpstat.icps_outhist[ICMP_TSTAMP]+
                             icmpstat.icps_outhist[ICMP_TSTAMPREPLY]+
                             icmpstat.icps_outhist[ICMP_IREQ]+
                             icmpstat.icps_outhist[ICMP_IREQREPLY]+
                             icmpstat.icps_outhist[ICMP_MASKREQ]+
                             icmpstat.icps_outhist[ICMP_MASKREPLY]
                        );
                }
                html_table_end( client );

#ifdef CYGPKG_NET_INET6
                html_table_data_begin( client, "valign=\"top\"" );                        
                html_table_begin( client, "" );
                {

                    fprintf( client, "<tr><td><b>%s:</b><td></tr>\n", "Received" );
                    fprintf( client, "<tr><td>%s<td>%lld</tr>\n", "ECHO",
                             icmp6stat.icp6s_inhist[ICMP_ECHO] );
                    fprintf( client, "<tr><td>%s<td>%lld</tr>\n", "ECHO REPLY",
                             icmp6stat.icp6s_inhist[ICMP_ECHOREPLY] );
                    fprintf( client, "<tr><td>%s<td>%lld</tr>\n", "UNREACH",
                             icmp6stat.icp6s_inhist[ICMP_UNREACH] );
                    fprintf( client, "<tr><td>%s<td>%lld</tr>\n", "REDIRECT",
                             icmp6stat.icp6s_inhist[ICMP_REDIRECT] );
                    fprintf( client, "<tr><td>%s<td>%lld</tr>\n", "Other",
                             icmp6stat.icp6s_inhist[ICMP_SOURCEQUENCH]+
                             icmp6stat.icp6s_inhist[ICMP_ROUTERADVERT]+
                             icmp6stat.icp6s_inhist[ICMP_ROUTERSOLICIT]+
                             icmp6stat.icp6s_inhist[ICMP_TIMXCEED]+
                             icmp6stat.icp6s_inhist[ICMP_PARAMPROB]+
                             icmp6stat.icp6s_inhist[ICMP_TSTAMP]+
                             icmp6stat.icp6s_inhist[ICMP_TSTAMPREPLY]+
                             icmp6stat.icp6s_inhist[ICMP_IREQ]+
                             icmp6stat.icp6s_inhist[ICMP_IREQREPLY]+
                             icmp6stat.icp6s_inhist[ICMP_MASKREQ]+
                             icmp6stat.icp6s_inhist[ICMP_MASKREPLY]
                        );
                    fprintf( client, "<tr><td>%s<td>%lld</tr>\n", "Bad",
                             icmp6stat.icp6s_badcode+
                             icmp6stat.icp6s_tooshort+
                             icmp6stat.icp6s_checksum+
                             icmp6stat.icp6s_badlen
                        );

                    fprintf( client, "<tr><td><b>%s:</b><td></tr>\n", "Sent" );                    
                    fprintf( client, "<tr><td>%s<td>%lld</tr>\n", "ECHO",
                             icmp6stat.icp6s_outhist[ICMP_ECHO] );
                    fprintf( client, "<tr><td>%s<td>%lld</tr>\n", "ECHO REPLY",
                             icmp6stat.icp6s_outhist[ICMP_ECHOREPLY] );
                    fprintf( client, "<tr><td>%s<td>%lld</tr>\n", "UNREACH",
                             icmp6stat.icp6s_outhist[ICMP_UNREACH] );
                    fprintf( client, "<tr><td>%s<td>%lld</tr>\n", "REDIRECT",
                             icmp6stat.icp6s_outhist[ICMP_REDIRECT] );
                    fprintf( client, "<tr><td>%s<td>%lld</tr>\n", "Other",
                             icmp6stat.icp6s_inhist[ICMP_SOURCEQUENCH]+                             
                             icmp6stat.icp6s_outhist[ICMP_ROUTERADVERT]+
                             icmp6stat.icp6s_outhist[ICMP_ROUTERSOLICIT]+
                             icmp6stat.icp6s_outhist[ICMP_TIMXCEED]+
                             icmp6stat.icp6s_outhist[ICMP_PARAMPROB]+
                             icmp6stat.icp6s_outhist[ICMP_TSTAMP]+
                             icmp6stat.icp6s_outhist[ICMP_TSTAMPREPLY]+
                             icmp6stat.icp6s_outhist[ICMP_IREQ]+
                             icmp6stat.icp6s_outhist[ICMP_IREQREPLY]+
                             icmp6stat.icp6s_outhist[ICMP_MASKREQ]+
                             icmp6stat.icp6s_outhist[ICMP_MASKREPLY]
                        );
                }
                html_table_end( client );
#endif
                html_table_data_begin( client, "valign=\"top\"" );                        
                html_table_begin( client, "" );
                {

                    fprintf( client, "<tr><td><b>%s:</b><td></tr>\n", "Received" );
                    fprintf( client, "<tr><td>%s<td>%ld</tr>\n", "Total",
                             udpstat.udps_ipackets );
                    fprintf( client, "<tr><td>%s<td>%ld</tr>\n", "Bad",
                             udpstat.udps_hdrops+
                             udpstat.udps_badsum+
                             udpstat.udps_badlen+
                             udpstat.udps_noport+
                             udpstat.udps_noportbcast+
                             udpstat.udps_fullsock
                        );
                    fprintf( client, "<tr><td><b>%s:</b><td></tr>\n", "Sent" );                    
                    fprintf( client, "<tr><td>%s<td>%ld</tr>\n", "Total",
                             udpstat.udps_opackets );
                }
                html_table_end( client );

                html_table_data_begin( client, "valign=\"top\"" );                        
                html_table_begin( client, "" );
                {

                    fprintf( client, "<tr><td><b>%s:</b><td></tr>\n", "Connections" );
                    fprintf( client, "<tr><td>%s<td>%ld</tr>\n", "Initiated",
                             tcpstat.tcps_connattempt );
                    fprintf( client, "<tr><td>%s<td>%ld</tr>\n", "Accepted",
                             tcpstat.tcps_accepts );
                    fprintf( client, "<tr><td>%s<td>%ld</tr>\n", "Established",
                             tcpstat.tcps_connects );
                    fprintf( client, "<tr><td>%s<td>%ld</tr>\n", "Closed",
                             tcpstat.tcps_closed );

                    fprintf( client, "<tr><td><b>%s:</b><td></tr>\n", "Received" );
                    fprintf( client, "<tr><td>%s<td>%ld</tr>\n", "Packets",
                             tcpstat.tcps_rcvtotal );
                    fprintf( client, "<tr><td>%s<td>%ld</tr>\n", "Data Packets",
                             tcpstat.tcps_rcvpack );
                    fprintf( client, "<tr><td>%s<td>%ld</tr>\n", "Bytes",
                             tcpstat.tcps_rcvbyte );
                    
                    fprintf( client, "<tr><td><b>%s:</b><td></tr>\n", "Sent" );
                    fprintf( client, "<tr><td>%s<td>%ld</tr>\n", "Packets",
                             tcpstat.tcps_sndtotal );
                    fprintf( client, "<tr><td>%s<td>%ld</tr>\n", "Data Packets",
                             tcpstat.tcps_sndpack );
                    fprintf( client, "<tr><td>%s<td>%ld</tr>\n", "Bytes",
                             tcpstat.tcps_sndbyte );

                    
                }
                html_table_end( client );
                
                
            }
            html_table_row_end( client );

        }
        html_table_end( client );

        html_para_begin( client, "" );
        html_heading(client, 3, "Mbufs" );

        html_table_begin( client, "border" );
        {
            html_table_header( client, "Summary", "" );
            html_table_header( client, "Types", "" );

            html_table_row_begin( client, "" );
            {
                html_table_data_begin( client, "valign=\"top\"" );                        
                html_table_begin( client, "" );
                {
                    fprintf( client, "<tr><td>%s<td>%ld</tr>\n", "Mbufs",
                             mbstat.m_mbufs );
                    fprintf( client, "<tr><td>%s<td>%ld</tr>\n", "Clusters",
                             mbstat.m_clusters );
                    fprintf( client, "<tr><td>%s<td>%ld</tr>\n", "Free Clusters",
                             mbstat.m_clfree );
                    fprintf( client, "<tr><td>%s<td>%ld</tr>\n", "Drops",
                             mbstat.m_drops );
                    fprintf( client, "<tr><td>%s<td>%ld</tr>\n", "Waits",
                             mbstat.m_wait );
                    fprintf( client, "<tr><td>%s<td>%ld</tr>\n", "Drains",
                             mbstat.m_drain );
#if defined(CYGPKG_NET_FREEBSD_STACK)
                    fprintf( client, "<tr><td>%s<td>%ld</tr>\n", "Copy Fails",
                             mbstat.m_mcfail );
                    fprintf( client, "<tr><td>%s<td>%ld</tr>\n", "Pullup Fails",
                             mbstat.m_mpfail );
#endif                    

                }
                html_table_end( client );

                html_table_data_begin( client, "valign=\"top\"" );                        
                html_table_begin( client, "" );
                {
                    u_long *mtypes;
#if defined(CYGPKG_NET_FREEBSD_STACK)
                    mtypes = mbtypes;
#else
                    mtypes = mbstat.m_mtypes;
#endif
                    
                    fprintf( client, "<tr><td>%s<td>%ld</tr>\n", "FREE",
                             mtypes[MT_FREE] );
                    fprintf( client, "<tr><td>%s<td>%ld</tr>\n", "DATA",
                             mtypes[MT_DATA] );
                    fprintf( client, "<tr><td>%s<td>%ld</tr>\n", "HEADER",
                             mtypes[MT_HEADER] );
#if !defined(CYGPKG_NET_FREEBSD_STACK)                    
                    fprintf( client, "<tr><td>%s<td>%ld</tr>\n", "SOCKET",
                             mtypes[MT_SOCKET] );
                    fprintf( client, "<tr><td>%s<td>%ld</tr>\n", "PCB",
                             mtypes[MT_PCB] );
                    fprintf( client, "<tr><td>%s<td>%ld</tr>\n", "RTABLE",
                             mtypes[MT_RTABLE] );
                    fprintf( client, "<tr><td>%s<td>%ld</tr>\n", "HTABLE",
                             mtypes[MT_HTABLE] );
                    fprintf( client, "<tr><td>%s<td>%ld</tr>\n", "ATABLE",
                             mtypes[MT_ATABLE] );
#endif
                    fprintf( client, "<tr><td>%s<td>%ld</tr>\n", "SONAME",
                             mtypes[MT_SONAME] );
#if !defined(CYGPKG_NET_FREEBSD_STACK)                                        
                    fprintf( client, "<tr><td>%s<td>%ld</tr>\n", "SOOPTS",
                             mtypes[MT_SOOPTS] );
#endif
                    fprintf( client, "<tr><td>%s<td>%ld</tr>\n", "FTABLE",
                             mtypes[MT_FTABLE] );

                    /* Ignore the rest for now... */
                    
                }
                html_table_end( client );
                
            }
            html_table_row_end( client );
            
        }
        html_table_end( client );
        
        
        draw_navbar(client);
    }
    html_body_end(client);

    html_end(client);
    
    freeifaddrs(iflist);
    return 1;
    
}

CYG_HTTPD_TABLE_ENTRY( cyg_monitor_network_entry,
                       "/monitor/network.htm*",
                       cyg_monitor_network,
                       NULL );

        
/* ================================================================= */
/* Instrumentation Monitor
 *
 * If the CYGPKG_KERNEL_INSTRUMENT option is set, we generate a table
 * showing the current instrumentation buffer. If the FLAGS option is
 * enabled we also print a table giving control of the flags.
 * 
 */

#ifdef CYGPKG_KERNEL_INSTRUMENT

/* Instrumentation record. */
struct Instrument_Record
{
    CYG_WORD16  type;                   // record type
    CYG_WORD16  thread;                 // current thread id
    CYG_WORD    timestamp;              // 32 bit timestamp
    CYG_WORD    arg1;                   // first arg
    CYG_WORD    arg2;                   // second arg
};
typedef struct Instrument_Record Instrument_Record;

/* Instrumentation variables, these live in the
 * instrumentation files in the kernel
 */
__externC Instrument_Record       *instrument_buffer_pointer;
__externC Instrument_Record       instrument_buffer[];
__externC cyg_uint32              instrument_buffer_size;

#if defined(CYGDBG_KERNEL_INSTRUMENT_FLAGS) && \
    defined(CYGDBG_KERNEL_INSTRUMENT_MSGS)

static cyg_uint32 instrument_flags[(CYG_INSTRUMENT_CLASS_MAX>>8)+1];

#endif

static char cyg_monitor_instrument_blurb1[] =
"<p>Use the checkboxes to enable the events to be recorded. Click "
"the <em>Submit</em> button to start recording. Click the <em>Clear</em> "
"button to clear all instrumentation and to stop recording."
;

static cyg_bool cyg_monitor_instrument( FILE * client, char *filename,
                                        char *formdata, void *arg )
{

#if defined(CYGDBG_KERNEL_INSTRUMENT_FLAGS) && \
    defined(CYGDBG_KERNEL_INSTRUMENT_MSGS)

    /* Disable all instrumentation while we generate the page.
     * Otherwise we could swamp the information we are really after.
     */
    
    cyg_scheduler_lock();
    {
        struct instrument_desc_s *id = instrument_desc;
        CYG_WORD cl = 0, ev = 0;

        for( ; id->msg != 0; id++ )
        {
            if( id->num > 0xff )
            {
                cl = id->num>>8;
                instrument_flags[cl] = 0;
            }
            else
            {
                ev = id->num;
                cyg_instrument_disable( cl<<8, ev );
            }
        }
    }
    cyg_scheduler_unlock();

#endif
    
    /* If we have some form data, deal with it.
     */
    if( formdata != NULL )
    {
        char *list[40];
        
        cyg_formdata_parse( formdata, list, sizeof(list)/sizeof(*list) );

#if defined(CYGDBG_KERNEL_INSTRUMENT_FLAGS) && \
    defined(CYGDBG_KERNEL_INSTRUMENT_MSGS)
        
        if( cyg_formlist_find( list, "clear" ) != NULL )
        {
            /* If the clear button is set, then disable all instrumentation flags.
             */
            int i;
            for( i = 0; i < sizeof(instrument_flags)/sizeof(*instrument_flags); i++ )
                instrument_flags[i] = 0;
        }
        else
        {
            /* Otherwise all the set checkboxes have been reported to
             * us in the form of class=event inputs.
             */
            char **p;
            for( p = list; *p != NULL; p++ )
            {
                int cl,ev;
                if( sscanf( *p, "%02x=%02x", &cl, &ev ) == 2 )
                    instrument_flags[cl] |= 1<<ev;
            }
        }
#endif
        
        /* If the cleartable button has been pressed, clear all the
         * table entries. 
         */
        if( cyg_formlist_find( list, "cleartable" ) != NULL )
        {
            cyg_scheduler_lock();
            {
                Instrument_Record *ibp = instrument_buffer_pointer;
                do
                {
                    ibp->type = 0;
                    ibp++;
                    if( ibp == &instrument_buffer[instrument_buffer_size] )
                        ibp = instrument_buffer;
                    
                } while( ibp != instrument_buffer_pointer );
                
            }
            cyg_scheduler_unlock();
        }
    }
    
    /* Now start generating the HTML page.
     */
    html_begin(client);

    html_head(client,"eCos Instrumentation Buffer", "");

    html_body_begin(client,"");
    {
        html_heading(client, 2, "Instrumentation Buffer" );

        html_form_begin( client, "/monitor/instrument.html", "" );
        
#if defined(CYGDBG_KERNEL_INSTRUMENT_FLAGS) && \
    defined(CYGDBG_KERNEL_INSTRUMENT_MSGS)
        
        /* If we have the flags enabled, generate a table showing all
         * the flag names with a checkbox against each.
         */

        fputs( cyg_monitor_instrument_blurb1, client );
        
        html_para_begin( client, "" );        
        /* Add submit,clear and reset buttons */
        html_form_input(client, "submit", "submit", "Submit", "");                
        html_form_input(client, "submit", "clear", "Clear", "");                
        html_form_input(client, "reset", "reset", "Reset", "");
        
        html_table_begin( client, "border width=100%" );
        {
            struct instrument_desc_s *id = instrument_desc;
            CYG_WORD cl = 0, ev = 0;
            int clc = 0;
            char class[5], event[5];

            html_table_row_begin( client, "" );

            for( ; id->msg != 0; id++ )
            {
                if( id->num > 0xff )
                {
                    cl = id->num;
                    sprintf( class, "%02x", cl>>8 );
                    clc = 0;
                    
                    if( id != instrument_desc )
                    {
                        html_table_end( client );
                        html_table_row_end( client );
                        html_table_row_begin( client, "" );
                    }
                        
                    html_table_data_begin( client, "valign=\"top\" width=100%" );
                    html_table_begin( client, "width=100%" );
                }
                else
                {
                    ev = id->num;
                    sprintf( event, "%02x", ev );

                    if( (clc%4) == 0 )
                    {
                        if( clc != 0 )
                            html_table_row_end( client );

                        html_table_row_begin( client, "" );
                    }
                    clc++;
                    html_table_data_begin( client, "width=25%" );
                    html_form_input_checkbox( client, class, event,
                                              instrument_flags[cl>>8] & (1<<ev) );
                    fputs( id->msg, client );
                }
            }            
            html_table_end( client );
            html_table_row_end( client );
        }
        html_table_end( client );

        /* Add submit,clear and reset buttons */
        html_form_input(client, "submit", "submit", "Submit", "");                
        html_form_input(client, "submit", "clear", "Clear", "");                
        html_form_input(client, "reset", "reset", "Reset", "");

#endif

        html_para_begin( client, "" );

        html_form_input(client, "submit", "cleartable", "Clear Table", "");

        
        /*
         */
        
        html_table_begin( client, "border" );
        {
            Instrument_Record *ibp = instrument_buffer_pointer;

            html_table_header( client, "TIME", "" );
            html_table_header( client, "THREAD", "" );
            html_table_header( client, "EVENT", "" );
            html_table_header( client, "ARG1", "" );
            html_table_header( client, "ARG2", "" );

            do
            {
                if( ibp->type != 0 )
                {
                    html_table_row_begin(client, "" );
                    {
                        cyg_handle_t thread = cyg_thread_find(ibp->thread);
                        cyg_thread_info info;
                    
                        html_table_data_begin( client, "" );
                        fprintf( client, "%08x",ibp->timestamp);
                        html_table_data_begin( client, "" );
                        if( thread != 0 &&
                            cyg_thread_get_info( thread, ibp->thread, &info ) &&
                            info.name != NULL )
                            fputs( info.name, client );
                        else fprintf( client, "[%04x]", ibp->thread);
                        html_table_data_begin( client, "" );
#if defined(CYGDBG_KERNEL_INSTRUMENT_MSGS)
                        fprintf( client, "%s", cyg_instrument_msg(ibp->type));
#else
                        fprintf( client, "%04x", ibp->type );
#endif
                        html_table_data_begin( client, "" );
                        fprintf( client, "%08x", ibp->arg1);
                        html_table_data_begin( client, "" );
                        fprintf( client, "%08x", ibp->arg2);
                    }
                    html_table_row_end( client );
                }
                ibp++;
                if( ibp == &instrument_buffer[instrument_buffer_size] )
                    ibp = instrument_buffer;
                
            } while( ibp != instrument_buffer_pointer );
        }
        html_table_end( client );

        html_para_begin( client, "" );

        html_form_input(client, "submit", "cleartable", "Clear Table", "");
        
        html_form_end( client );
        
        draw_navbar(client);
    }
    html_body_end(client);

    html_end(client);


#if defined(CYGDBG_KERNEL_INSTRUMENT_FLAGS) && \
    defined(CYGDBG_KERNEL_INSTRUMENT_MSGS)

    /*
     */

    cyg_scheduler_lock();
    {
        struct instrument_desc_s *id = instrument_desc;
        CYG_WORD cl = 0, ev = 0;

        for( ; id->msg != 0; id++ )
        {
            if( id->num > 0xff )
                cl = id->num>>8;
            else
            {
                ev = id->num;
                if( (instrument_flags[cl] & (1<<ev)) != 0 )
                    cyg_instrument_enable( cl<<8, ev );
            }
        }
    }
    cyg_scheduler_unlock();
#endif
    
    return true;
}

CYG_HTTPD_TABLE_ENTRY( cyg_monitor_instrument_entry,
                       "/monitor/instrument.htm*",
                       cyg_monitor_instrument,
                       NULL );

#endif

/* ================================================================= */
/* eCos Logo
 *
 * Define the logo as a byte array, and then define the data structure
 * and table entry to allow it to be fetched by the client.
 */

static cyg_uint8 ecos_logo_gif[] = {
    0x47, 0x49, 0x46, 0x38, 0x39, 0x61, 0x6f, 0x00, 0x23, 0x00, 0xf7, 0x00, 0x00, 0x00, 0x00, 0x00,
    0xff, 0xff, 0xff, 0xea, 0x19, 0x00, 0xcc, 0x00, 0x00, 0xfd, 0xfd, 0xfd, 0x83, 0x00, 0x00, 0xf6,
    0xf6, 0xf6, 0x2f, 0x2f, 0x2f, 0xef, 0xef, 0xef, 0x19, 0x00, 0x19, 0x45, 0x45, 0x45, 0xbb, 0xbb,
    0xbb, 0xe2, 0x3e, 0x3e, 0xe8, 0xbb, 0xd3, 0x3e, 0x3e, 0x3e, 0xfb, 0xfb, 0xfb, 0xbe, 0xbe, 0xbe,
    0xf1, 0xed, 0xed, 0xe5, 0x7b, 0x8e, 0xe5, 0x6b, 0x7b, 0xcc, 0xcc, 0xcc, 0x98, 0x95, 0x98, 0xc6,
    0xc3, 0xc6, 0x19, 0x19, 0x19, 0xf1, 0xf1, 0xf1, 0x98, 0x98, 0x98, 0xd6, 0xd3, 0xd6, 0x83, 0x83,
    0x83, 0xde, 0xde, 0xde, 0xe5, 0x25, 0x25, 0x73, 0x6f, 0x73, 0xea, 0xea, 0xea, 0xe5, 0x8e, 0xa2,
    0xe8, 0xe8, 0xe8, 0x7f, 0x7b, 0x7f, 0xe2, 0x56, 0x66, 0x8b, 0x8b, 0x8b, 0x19, 0x19, 0x00, 0xf8,
    0xf8, 0xf8, 0x73, 0x73, 0x73, 0xd3, 0xd1, 0xd1, 0x9c, 0x9c, 0x9c, 0x50, 0x50, 0x50, 0xef, 0xce,
    0xea, 0x92, 0x8e, 0x92, 0x6f, 0x6f, 0x6f, 0xe2, 0x2f, 0x2f, 0x61, 0x61, 0x61, 0xe5, 0xe5, 0xe5,
    0xe8, 0x9f, 0xb8, 0x37, 0x2f, 0x37, 0x66, 0x66, 0x66, 0xe2, 0x4b, 0x50, 0x56, 0x50, 0x56, 0xa9,
    0xa5, 0xa9, 0xce, 0xce, 0xce, 0x56, 0x50, 0x50, 0xd9, 0xd9, 0xd9, 0x77, 0x73, 0x77, 0x25, 0x25,
    0x2f, 0x6b, 0x6b, 0x6b, 0x9f, 0x9f, 0x9f, 0x87, 0x83, 0x87, 0x3e, 0x37, 0x37, 0xf4, 0xf4, 0xf4,
    0x25, 0x25, 0x25, 0xc1, 0xc1, 0xc1, 0x83, 0x7f, 0x83, 0xe5, 0xe2, 0xe2, 0x4b, 0x45, 0x4b, 0xd1,
    0xce, 0xd1, 0xaf, 0xac, 0xaf, 0xcc, 0xc9, 0xcc, 0x5b, 0x56, 0x5b, 0xdb, 0xd9, 0xdb, 0x66, 0x61,
    0x66, 0xe2, 0xe2, 0xe2, 0xb8, 0xb5, 0xb8, 0x2f, 0x25, 0x2f, 0xc3, 0xc1, 0xc3, 0xe0, 0xde, 0xe0,
    0xd3, 0xd3, 0xd3, 0xde, 0xdb, 0xde, 0xac, 0xac, 0xac, 0xce, 0xcc, 0xce, 0x77, 0x6f, 0x73, 0x4b,
    0x45, 0x45, 0xc9, 0xc6, 0xc9, 0x45, 0x3e, 0x45, 0x61, 0x5b, 0x61, 0xb5, 0xb2, 0xb5, 0x3e, 0x00,
    0x00, 0x8b, 0x87, 0x87, 0x95, 0x92, 0x95, 0xa2, 0x9f, 0xa2, 0xb8, 0xb8, 0xb8, 0x7b, 0x77, 0x7b,
    0x9c, 0x98, 0x9c, 0x50, 0x4b, 0x50, 0x6f, 0x6b, 0x6f, 0x6b, 0x66, 0x6b, 0xac, 0xa9, 0xac, 0x8e,
    0x8b, 0x8e, 0x8e, 0x00, 0x00, 0xdb, 0xdb, 0xdb, 0xed, 0xed, 0xed, 0x50, 0x4b, 0x4b, 0x3e, 0x37,
    0x3e, 0x95, 0x95, 0x95, 0xa5, 0xa2, 0xa5, 0x9f, 0x9c, 0x9f, 0xc1, 0xbe, 0xbe, 0x2f, 0x25, 0x25,
    0xd3, 0xd1, 0xd3, 0xf4, 0xf1, 0xf4, 0xc6, 0xc6, 0xc6, 0x8e, 0x8e, 0x8e, 0x25, 0x19, 0x19, 0x66,
    0x61, 0x61, 0xb2, 0xaf, 0xb2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00,
    0x00, 0x00, 0x6f, 0x00, 0x23, 0x00, 0x40, 0x08, 0xff, 0x00, 0x03, 0x08, 0x1c, 0x28, 0x10, 0x41,
    0x8a, 0x17, 0x0e, 0x1c, 0x00, 0x58, 0xc8, 0xb0, 0xa1, 0xc3, 0x87, 0x10, 0x21, 0x12, 0x14, 0x28,
    0xa0, 0xa2, 0xc5, 0x8b, 0x18, 0x33, 0x6a, 0xdc, 0xb8, 0x91, 0x01, 0x83, 0x11, 0x31, 0x26, 0x12,
    0x44, 0x10, 0x91, 0xe1, 0x09, 0x91, 0x28, 0x03, 0x4c, 0xb9, 0x50, 0x72, 0xa1, 0x0a, 0x04, 0x29,
    0x09, 0x72, 0x6c, 0x10, 0x73, 0xe2, 0x88, 0x8d, 0x2e, 0x0c, 0xd4, 0x0c, 0x70, 0x73, 0x63, 0x80,
    0x88, 0x10, 0x76, 0x0a, 0x6d, 0x18, 0x94, 0x60, 0x03, 0x8e, 0x1a, 0x27, 0x4a, 0x40, 0x5a, 0x51,
    0xa9, 0xc5, 0x0e, 0x3b, 0x0d, 0x30, 0x40, 0xca, 0x40, 0x45, 0xc9, 0x14, 0x42, 0x45, 0x72, 0x60,
    0xf9, 0xf0, 0x64, 0xd6, 0x00, 0x19, 0x3b, 0xe8, 0xfc, 0x3a, 0x70, 0xe9, 0x45, 0x10, 0x59, 0x0d,
    0x70, 0x9c, 0x30, 0xf1, 0x44, 0xcb, 0xb7, 0x70, 0x4b, 0x8a, 0x64, 0x4a, 0xb7, 0xae, 0x5d, 0x01,
    0x6c, 0x51, 0xbe, 0x88, 0xcb, 0xb7, 0xef, 0xc2, 0xb9, 0x77, 0x03, 0x0b, 0xbe, 0x98, 0x37, 0xc0,
    0x81, 0x88, 0x58, 0x09, 0xde, 0xe0, 0xea, 0xf0, 0xc5, 0x44, 0x0e, 0x0f, 0x13, 0x13, 0x34, 0x30,
    0x21, 0x23, 0xdb, 0x8c, 0x63, 0x07, 0x4a, 0xcd, 0x88, 0xd6, 0xa9, 0x45, 0x9a, 0x04, 0x69, 0x60,
    0xec, 0xc0, 0x94, 0x41, 0x44, 0xaf, 0x03, 0x53, 0xf8, 0xdd, 0xd1, 0x10, 0xf5, 0xc0, 0xa9, 0x76,
    0x41, 0x0f, 0x24, 0xcd, 0xb1, 0xf3, 0xc0, 0x9e, 0x1c, 0x25, 0x88, 0xac, 0xac, 0x91, 0x41, 0x00,
    0xc8, 0x6f, 0x77, 0x48, 0x9e, 0x78, 0xc3, 0xaa, 0xdf, 0x03, 0x27, 0xa6, 0x40, 0x28, 0x2a, 0x13,
    0xe9, 0x08, 0xd9, 0x93, 0x41, 0xd0, 0xe6, 0xd8, 0x41, 0x42, 0x83, 0x15, 0x02, 0x0d, 0x34, 0xe0,
    0x8d, 0x34, 0x73, 0x6a, 0xc6, 0x7e, 0xc3, 0x3b, 0xff, 0x04, 0x3c, 0xb8, 0x3c, 0x5d, 0xdb, 0x03,
    0xb7, 0xc2, 0x7d, 0x91, 0x02, 0xa6, 0xe2, 0x13, 0xe0, 0xf9, 0x22, 0x3f, 0xe1, 0x9a, 0x22, 0xd3,
    0x09, 0xd0, 0x03, 0x18, 0x00, 0x01, 0x9b, 0x2e, 0x48, 0xec, 0x01, 0x34, 0x10, 0xc3, 0x04, 0xd3,
    0x69, 0xa4, 0xd3, 0x5e, 0x11, 0x39, 0x46, 0x96, 0x40, 0x53, 0x44, 0xa4, 0x02, 0x59, 0x1a, 0xe5,
    0x97, 0x95, 0x68, 0x17, 0xd1, 0x80, 0x92, 0x77, 0xfd, 0x69, 0x34, 0x81, 0x83, 0x6d, 0x25, 0xe4,
    0xe1, 0x87, 0x0e, 0x3c, 0x48, 0x90, 0x6a, 0x0c, 0x89, 0x48, 0x10, 0x77, 0x74, 0x85, 0x44, 0x10,
    0x6e, 0x11, 0x4e, 0xd4, 0x9f, 0x84, 0x2b, 0x10, 0x68, 0x97, 0x69, 0x10, 0x31, 0x27, 0xd0, 0x72,
    0x38, 0xe6, 0xa8, 0x63, 0x8e, 0x44, 0x4d, 0x74, 0xd4, 0x5d, 0x13, 0xa1, 0xe8, 0x13, 0x41, 0x31,
    0x60, 0xe4, 0x02, 0x7a, 0x22, 0xa9, 0xd5, 0xd1, 0x61, 0x35, 0x4e, 0x84, 0x80, 0x42, 0x0e, 0x5d,
    0x70, 0x83, 0x48, 0xac, 0xf5, 0xe8, 0xa3, 0x46, 0x2e, 0xac, 0x30, 0x9a, 0x48, 0x45, 0x66, 0xc4,
    0x80, 0x77, 0x01, 0x74, 0x69, 0x91, 0x75, 0x05, 0x0a, 0x80, 0xa4, 0x59, 0x5e, 0x92, 0x54, 0x92,
    0x94, 0x5f, 0x3d, 0xf9, 0x16, 0x09, 0x59, 0x6d, 0x44, 0x03, 0x98, 0x31, 0xfd, 0x48, 0x58, 0x56,
    0x20, 0x20, 0x45, 0x90, 0x71, 0xe2, 0xf5, 0x39, 0xde, 0x44, 0xe6, 0x05, 0xea, 0xdf, 0x4e, 0x1c,
    0x90, 0xe0, 0x40, 0x95, 0x7e, 0xf2, 0x45, 0x9e, 0xa0, 0xe6, 0x75, 0xc0, 0x80, 0x04, 0x00, 0x0a,
    0x85, 0x00, 0x82, 0x89, 0x86, 0xb7, 0x28, 0xa3, 0x82, 0x4e, 0x40, 0x27, 0x41, 0x94, 0x56, 0x2a,
    0xde, 0xa5, 0x98, 0x32, 0x5a, 0x58, 0x6a, 0x7d, 0xed, 0x90, 0x10, 0x93, 0x9e, 0x02, 0x00, 0x2a,
    0x47, 0x2e, 0x78, 0x14, 0x2a, 0x53, 0xb6, 0x75, 0xff, 0x0a, 0x91, 0x03, 0x53, 0xc6, 0x84, 0x00,
    0x09, 0x7c, 0x5d, 0x70, 0x82, 0x7b, 0x29, 0x21, 0x25, 0xc1, 0xa6, 0x03, 0x35, 0x90, 0x61, 0x46,
    0x2e, 0x48, 0x18, 0xec, 0xb0, 0x16, 0xb1, 0x45, 0x62, 0x44, 0x70, 0x92, 0xb5, 0x58, 0x49, 0x0a,
    0x0a, 0xb5, 0x91, 0xb1, 0x31, 0xa1, 0x79, 0x11, 0xb5, 0x03, 0x69, 0xc9, 0x51, 0x0c, 0x50, 0x3e,
    0x74, 0x01, 0xaf, 0x05, 0x9d, 0x80, 0xaa, 0x0a, 0x36, 0x0a, 0x24, 0x2b, 0x00, 0xdf, 0xa2, 0xb4,
    0x82, 0x04, 0x13, 0x4c, 0x00, 0x02, 0x80, 0x96, 0xa1, 0xb4, 0x5d, 0xbb, 0x20, 0xd0, 0xa9, 0xe4,
    0x98, 0x3e, 0xd2, 0x46, 0x43, 0x03, 0x76, 0x76, 0x24, 0x17, 0x41, 0xea, 0x31, 0x3b, 0x11, 0x9f,
    0xe8, 0xa2, 0xe4, 0xc2, 0x46, 0x2c, 0x0a, 0x30, 0xc2, 0x44, 0x06, 0x1c, 0xac, 0x21, 0xc3, 0xd7,
    0x4e, 0x24, 0xe6, 0x8c, 0x02, 0x2f, 0xe8, 0x64, 0x43, 0xcd, 0x36, 0x67, 0xd7, 0x44, 0xda, 0x72,
    0x64, 0x21, 0x41, 0x68, 0xea, 0x96, 0xd2, 0x76, 0x74, 0xd1, 0xf8, 0x50, 0xb9, 0x16, 0xff, 0xc4,
    0x50, 0xb9, 0xfd, 0x32, 0xe5, 0x42, 0x90, 0x74, 0x5d, 0x69, 0xd1, 0xc2, 0x3b, 0x21, 0x6b, 0x91,
    0xc9, 0x0e, 0x65, 0x2c, 0x10, 0xaa, 0xe2, 0x4d, 0xc1, 0x71, 0x60, 0x32, 0xb3, 0xea, 0x59, 0x46,
    0x20, 0x6d, 0x6a, 0xb3, 0x00, 0x38, 0x37, 0xb4, 0x83, 0x48, 0xdd, 0x46, 0x09, 0x62, 0x42, 0x4a,
    0x8b, 0xd4, 0x31, 0xb1, 0x18, 0x89, 0x1c, 0x2c, 0x47, 0xbe, 0x01, 0x7a, 0xde, 0xd0, 0x18, 0x31,
    0xd0, 0x74, 0x43, 0x0e, 0xa0, 0x34, 0x85, 0x0a, 0x87, 0x39, 0x40, 0x02, 0xb8, 0x02, 0xe1, 0xea,
    0x50, 0xd8, 0x49, 0x4a, 0x00, 0x1b, 0x0d, 0x9d, 0x71, 0x96, 0xe4, 0x04, 0x53, 0x75, 0x00, 0x37,
    0x4a, 0x05, 0x42, 0xa5, 0x9f, 0xdb, 0x15, 0x8d, 0x61, 0x2a, 0xd0, 0xd1, 0x0c, 0x2c, 0x0b, 0x51,
    0xad, 0x6d, 0xf2, 0xec, 0xd0, 0x70, 0x35, 0x61, 0x69, 0x71, 0xcb, 0x7a, 0x0b, 0x65, 0x2d, 0x46,
    0x21, 0x11, 0x0c, 0x91, 0xce, 0x29, 0x41, 0x80, 0x68, 0x4b, 0x0e, 0xa0, 0xac, 0x35, 0x96, 0xd8,
    0x96, 0xd5, 0x51, 0xe7, 0x8f, 0x63, 0x44, 0x73, 0x00, 0x6e, 0xc5, 0xa5, 0x02, 0x09, 0xa8, 0x93,
    0xf0, 0xc2, 0xe5, 0x7e, 0xae, 0x1a, 0xd6, 0x08, 0x12, 0xc4, 0x2e, 0x01, 0x85, 0xaf, 0x66, 0x64,
    0x75, 0x41, 0x5f, 0xa7, 0xaa, 0xe8, 0xe6, 0xb5, 0x0b, 0x3a, 0x3a, 0x4a, 0x37, 0xe4, 0xae, 0xfb,
    0xbf, 0x1a, 0xf7, 0x3e, 0x18, 0x0d, 0x91, 0x0e, 0x14, 0x10, 0x00, 0x3b
};

CYG_HTTPD_DATA( cyg_monitor_ecos_logo_data,
                "image/gif",
                sizeof(ecos_logo_gif), ecos_logo_gif );

CYG_HTTPD_TABLE_ENTRY( cyg_monitor_ecos_logo,
                       "/monitor/ecos.gif",
                       cyg_httpd_send_data,
                       &cyg_monitor_ecos_logo_data );

/*------------------------------------------------------------------ */
/* end of monitor.c                                                  */