summaryrefslogtreecommitdiff
path: root/support/dktools/dk4socka01.c
blob: 8a555d9027f6e9002c4773dda3ac8a8a7eb116e1 (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
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
/*
Copyright (C) 2015-2020, Dirk Krause
SPDX-License-Identifier: BSD-3-Clause
*/

/*
	WARNING: This file was generated by the dkct program (see
	http://dktools.sourceforge.net/ for details).
	Changes you make here will be lost if dkct is run again!
	You should modify the original source and run dkct on it.
	Original source: dk4socka01.ctr
*/

/**	@file dk4socka01.c The dk4socka01 module.
*/


#line 10 "dk4socka01.ctr"


#include "dk4conf.h"
#include "dk4sock.h"
#include "dk4socka.h"
#include "dk4mem.h"
#include "dk4maodd.h"
#include "dk4maodh.h"

#if DK4_HAVE_ERRNO_H
#ifndef ERRNO_H_INCLUDED
#include <errno.h>
#define	ERRNO_H_INCLUDED 1
#endif
#endif

#if DK4_HAVE_STRING_H
#ifndef STRING_H_INCLUDED
#include <string.h>
#define	STRING_H_INCLUDED 1
#endif
#endif




#line 35 "dk4socka01.ctr"



/**	Constant text keywords, not localized.
*/
static const dkChar * const	dk4socket_app_kwnl[] = {
/* 0 */
dkT("dk4sock.str"),

/* 1 */
dkT("\n\t"),

/* 2 */
dkT(": "),

/* 3 */
dkT("WSAStartup"),

/* 4 */
dkT("WSACleanup"),

/* 5 */
dkT("socket"),

/* 6 */
dkT("close"),

/* 7 */
dkT("closesocket"),

/* 8 */
dkT("bind"),

/* 9 */
dkT("listen"),

/* 10 */
dkT("accept"),

/* 11 */
dkT("connect"),

/* 12 */
dkT("setsockopt"),

/* 13 */
dkT("ioctlsocket"),

/* 14 */
dkT("fcntl"),

/* 15 */
dkT("select"),

/* 16 */
dkT("getsockopt"),

/* 17 */
dkT("getaddrinfo"),

/* 18 */
dkT("getnameinfo"),

/* 19 */
dkT("gethostbyname"),

/* 20 */
dkT("getservbyname"),

/* 21 */
dkT("GetAddrInfoW"),

/* 22 */
dkT("inet_ntop"),

/* 23 */
dkT("shutdown"),

/* 24 */
dkT("send/sendto"),

/* 25 */
dkT("recv/recvfrom"),

/* 26 */
dkT("inet_pton"),

NULL


#line 127 "dk4socka01.ctr"
};



/**	Constant text keywords, replaced by localized version if found.
*/
static const dkChar * const	dk4socket_app_kw_def[] = {
/* 0 */
dkT("Failed to initialize Winsock subsystem!"),

/* 1 */
dkT("Failed to shut down Winsock subsystem!"),

/* 2 */
dkT("Failed to create socket!"),

/* 3 */
dkT("Failed to close socket!"),

/* 4 */
dkT("Failed to bind local address!"),

/* 5 */
dkT("Failed to listen for incoming connection requests!"),

/* 6 */
dkT("Failed to accept incoming connection request!"),

/* 7 */
dkT("Failed to connect to remote address!"),

/* 8 */
dkT("Failed to modify ``reusable'' option for socket!"),

/* 9 */
dkT("Failed to modify ``non-blocking'' option for socket!"),

/* 10 */
dkT("Failed to retrieve remote address(es)!"),

/* 11 */
dkT("Failed to retrieve local address(es)!"),

/* 12 */
dkT("Failed to retrieve remote host address!"),

/* 13 */
dkT("Failed to retrieve port number for remote service!"),

/* 14 */
dkT("Failed to retrieve port number for local service!"),

/* 15 */
dkT("Failed to convert text to ASCII!"),

/* 16 */
dkT("\""),

/* 17 */
dkT("\"!"),

/* 18 */
dkT("Failed to obtain local address(es)!"),

/* 19 */
dkT("Port/service: "),

/* 20 */
dkT("Failed to obtain remote address(es)!"),

/* 21 */
dkT("Host: "),

/* 22 */
dkT("Port/service: "),

/* 23 */
dkT("Service/port not found: \""),

/* 24 */
dkT("\"!"),

/* 25 */
dkT("Failed to convert service/port to ASCII: \""),

/* 26 */
dkT("\"!"),

/* 27 */
dkT("No matching pair of local/remote addresses found!"),

/* 28 */
dkT("Illegal local port number!"),

/* 29 */
dkT("Illegal remote port number!"),

/* 30 */
dkT("Connection established."),

/* 31 */
dkT("Illegal address length in gethostbyname() result!"),

/* 32 */
dkT("Illegal address family in gethostbyname() result!"),

/* 33 */
dkT("Remote host not found: \""),

/* 34 */
dkT("\"!"),

/* 35 */
dkT("Non-ASCII characters in host name: \n\t\""),

/* 36 */
dkT("\"!"),

/* 37 */
dkT("errno="),

/* 38 */
dkT(" (0x"),

/* 39 */
dkT(")"),

/* 40 */
dkT("WSAGetLastError()="),

/* 41 */
dkT("Failed to create TCP connection!"),

/* 42 */
dkT("Local:  "),

/* 43 */
dkT("Remote: "),

/* 44 */
dkT("Timeout while attempting to connect."),

/* 45 */
dkT("Invalid arguments passed to function, probably a bug."),

/* 46 */
dkT("No matching local/remote address pair available!"),

/* 47 */
dkT("Network subsystem not yet ready."),

/* 48 */
dkT("Winsock version not supported!"),

/* 49 */
dkT("Blocking Winsock operation in progress!"),

/* 50 */
dkT("Process limit for Winsock reached!"),

/* 51 */
dkT("Invalid parameters passed to function!"),

/* 52 */
dkT("Winsock not initialized!"),

/* 53 */
dkT("Network subsystem has failed!"),

/* 54 */
dkT("Address family not supported!"),

/* 55 */
dkT("No more socket/file descriptors available"),

/* 56 */
dkT("No buffer space available!"),

/* 57 */
dkT("Protocol not supported!"),

/* 58 */
dkT("Wrong protocol type for socket!"),

/* 59 */
dkT("Service provider failed to initialize!"),

/* 60 */
dkT("Socket type not supported by address family!"),

/* 61 */
dkT("Unusable service provider version!"),

/* 62 */
dkT("Invalid/incomplete procedure table from service provider!"),

/* 63 */
dkT("Insufficient permissions!"),

/* 64 */
dkT("Address already in use!"),

/* 65 */
dkT("Address not available!"),

/* 66 */
dkT("File descriptor is not a socket!"),

/* 67 */
dkT("Host has no addresses in specified address family!"),

/* 68 */
dkT("Temporary problem on name server, try again later!"),

/* 69 */
dkT("Illegal flag combination!"),

/* 70 */
dkT("Name server failure!"),

/* 71 */
dkT("Address family not supported!"),

/* 72 */
dkT("Out of memory!"),

/* 73 */
dkT("No network address found for host!"),

/* 74 */
dkT("No such name or number!"),

/* 75 */
dkT("Service not available through specified socket type!"),

/* 76 */
dkT("Unsupported socket type or inconsistent arguments!"),

/* 77 */
dkT("System error, check errno!"),

/* 78 */
dkT("Argument buffer overflow!"),

/* 79 */
dkT("Resource temporarily locked, try again later!"),

/* 80 */
dkT("Attempt already in progress!"),

/* 81 */
dkT("Not a file descriptor!"),

/* 82 */
dkT("No-one listening on remote address!"),

/* 83 */
dkT("Connection reset by peer!"),

/* 84 */
dkT("Operation would result in deadlock!"),

/* 85 */
dkT("Destination address required!"),

/* 86 */
dkT("Timeout values too large!"),

/* 87 */
dkT("Operation is in progress."),

/* 88 */
dkT("Operation interrupted by signal!"),

/* 89 */
dkT("Socket is already connected!"),

/* 90 */
dkT("I/O error occured!"),

/* 91 */
dkT("Symbolic link loop detected!"),

/* 92 */
dkT("No more file descriptors available for process!"),

/* 93 */
dkT("Address or path name too long!"),

/* 94 */
dkT("Network unreachable!"),

/* 95 */
dkT("No more file descriptors available on system!"),

/* 96 */
dkT("File or path component does not exist or is empty!"),

/* 97 */
dkT("Failed to set a lock!"),

/* 98 */
dkT("Attempt to retrieve or modify unsupported option!"),

/* 99 */
dkT("Path component is not a directory!"),

/* 100 */
dkT("Provided buffer size is too small!"),

/* 101 */
dkT("Operation not supported by socket type or protocol!"),

/* 102 */
dkT("File system is mounted read-only!"),

/* 103 */
dkT("Timed out!"),

/* 104 */
dkT("Numeric overflow in file size/position calculation!"),

/* 105 */
dkT("Connection closed due to timeout or other failure!"),

/* 106 */
dkT("Host unreachable!"),

/* 107 */
dkT("Blocking Winsock operation interrupted by WSACancelBlockingCall()!"),

/* 108 */
dkT("Socket is in listening state!"),

/* 109 */
dkT("No local address bound yet!"),

/* 110 */
dkT("Socket is not in listening state!"),

/* 111 */
dkT("Invalid shutdown parameter"),

/* 112 */
dkT("Message size too large!"),

/* 113 */
dkT("Connection closed, failures in keep-alive tests!"),

/* 114 */
dkT("Not connected!"),

/* 115 */
dkT("Failed to initialize socket provider!"),

/* 116 */
dkT("Socket already shut down!"),

/* 117 */
dkT("Operation would block!"),

/* 118 */
dkT("Host not found (authorative answer)!"),

/* 119 */
dkT("Service provider returned invalid/incomplete procedure table!"),

/* 120 */
dkT("Invalid service provider version!"),

/* 121 */
dkT("Protocol error!"),

/* 122 */
dkT("Insufficient stream resources!"),

/* 123 */
dkT("Protocol family not supported!"),

/* 124 */
dkT("Connection to remote machine no longer active!"),

/* 125 */
dkT("Server exited before completing connection!"),

/* 126 */
dkT("Protocol family and type not found in network configuration!"),

/* 127 */
dkT("Stale NFS file handle!"),

/* 128 */
dkT("Failed to shut down socket!"),

/* 129 */
dkT("Failed to bind local address\n\t\""),

/* 130 */
dkT("\"!"),

/* 131 */
dkT("Failed to connect to remote address\n\t\""),

/* 132 */
dkT("\"!"),

/* 133 */
dkT("Send operation completed partially, only "),

/* 134 */
dkT(" of "),

/* 135 */
dkT(" bytes!"),

/* 136 */
dkT("Send operation completed partially!"),

/* 137 */
dkT("Send operation failed!"),

/* 138 */
dkT("Failed to receive data!"),

/* 139 */
dkT("Failed to create listener sockets!"),

/* 140 */
dkT("Listening: "),

/* 141 */
dkT("Failed to obtain allowed peer from string:\n\t\""),

/* 142 */
dkT("\"!"),

NULL


#line 642 "dk4socka01.ctr"
};


/**	Number of elements in the dk4socket_app_kw_def array.
*/
static const size_t	dk4socket_sz_kw_def =
sizeof(dk4socket_app_kw_def)/sizeof(DK4_PCDKCHAR);



size_t
dk4socket_log_num_texts(void)
{
  return (dk4socket_sz_kw_def);
}



const dkChar * const	*
dk4socket_log_texts(dk4_app_t *app)
{
  const dkChar * const	*back	= dk4socket_app_kw_def;

  if (NULL != app) {
    back = dk4app_string_table(app,dk4socket_app_kwnl[0],dk4socket_app_kw_def);
  }
  return back;
}



void
dk4socket_log_fctname_msg(
  const dkChar	**fctname,
  const dkChar	**msgtext,
  dk4_app_t	 *app,
  dk4_er_t	 *erp
)
{
  const dkChar * const	*msgtexts = dk4socket_app_kw_def;
  const dkChar		*mytext	  = NULL;
  if ((NULL != app) && (NULL != erp)) {
    msgtexts =
    dk4app_string_table(app, dk4socket_app_kwnl[0], dk4socket_app_kw_def);
    if (NULL != fctname) {
      switch (erp->ec) {
        case DK4_E_SOCKET_GETADDRINFO : {
#if DK4_CHAR_SIZE > 1
	  *fctname = dk4socket_app_kwnl[21];
#else
	  *fctname = dk4socket_app_kwnl[17];
#endif
	} break;
	case DK4_E_SOCKET_GETADDRLOC : {
#if DK4_CHAR_SIZE > 1
	  *fctname = dk4socket_app_kwnl[21];
#else
	  *fctname = dk4socket_app_kwnl[17];
#endif
	} break;
	case DK4_E_SOCKET_UP : {
	  *fctname = dk4socket_app_kwnl[3];
	} break;
	case DK4_E_SOCKET_DOWN : {
	  *fctname = dk4socket_app_kwnl[4];
	} break;
	case DK4_E_SOCKET_SOCKET : {
	  *fctname = dk4socket_app_kwnl[5];
	} break;
	case DK4_E_SOCKET_CLOSE : {
#if DK4_ON_WINDOWS
	  *fctname = dk4socket_app_kwnl[7];
#else
	  *fctname = dk4socket_app_kwnl[6];
#endif
	} break;
	case DK4_E_SOCKET_BIND : {
	  *fctname = dk4socket_app_kwnl[8];
	} break;
	case DK4_E_SOCKET_CONNECT : {
	  *fctname = dk4socket_app_kwnl[11];
	} break;
	case DK4_E_SOCKET_LISTEN : {
	  *fctname = dk4socket_app_kwnl[9];
	} break;
	case DK4_E_SOCKET_ACCEPT : {
	  *fctname = dk4socket_app_kwnl[10];
	} break;
	case DK4_E_SOCKET_SHUTDOWN : {
	  *fctname = dk4socket_app_kwnl[23];
	} break;
	case DK4_E_SOCKET_SEND : {
	  *fctname = dk4socket_app_kwnl[24];
	} break;
	case DK4_E_SOCKET_RECV : {
	  *fctname = dk4socket_app_kwnl[25];
	} break;
	case DK4_E_SOCKET_SELECT : {
	  *fctname = dk4socket_app_kwnl[15];
	} break;
	case DK4_E_SOCKET_SETSOCKOPT : {
	  *fctname = dk4socket_app_kwnl[12];
	} break;
	case DK4_E_SOCKET_GETSOCKOPT : {
	  *fctname = dk4socket_app_kwnl[16];
	} break;
	case DK4_E_SOCKET_IOCTLSOCKET : {
	  *fctname = dk4socket_app_kwnl[13];
	} break;
	case DK4_E_SOCKET_FCNTL : {
	  *fctname = dk4socket_app_kwnl[14];
	} break;
	case DK4_E_SOCKET_GETSERVBYNAME : {
	  *fctname = dk4socket_app_kwnl[20];
	} break;
	case DK4_E_SOCKET_GETHOSTBYNAME : {
	  *fctname = dk4socket_app_kwnl[19];
	} break;
	case DK4_E_SOCKET_INET_NTOP : {
	  *fctname = dk4socket_app_kwnl[22];
	} break;
	case DK4_E_SOCKET_INET_PTON : {
	  *fctname = dk4socket_app_kwnl[26];
	} break;
	default : {
	  *fctname = NULL;
	} break;
      }
    }
    if (NULL != msgtext) {
#if (DK4_CHAR_SIZE == 1) && (!DK4_ON_WINDOWS)
      switch (erp->ec) {
        case DK4_E_SOCKET_GETADDRINFO :
	case DK4_E_SOCKET_GETADDRLOC :
	{
#if DK4_HAVE_GETADDRINFO
	  mytext = gai_strerror((erp->dt).iDetails1);
#endif
	} break;
	case DK4_E_SOCKET_UP :
	case DK4_E_SOCKET_DOWN :
	case DK4_E_SOCKET_SOCKET :
	case DK4_E_SOCKET_CLOSE :
	case DK4_E_SOCKET_BIND :
	case DK4_E_SOCKET_CONNECT :
	case DK4_E_SOCKET_LISTEN :
	case DK4_E_SOCKET_ACCEPT :
	case DK4_E_SOCKET_SHUTDOWN :
	case DK4_E_SOCKET_SEND :
	case DK4_E_SOCKET_RECV :
	case DK4_E_SOCKET_SELECT :
	case DK4_E_SOCKET_SETSOCKOPT :
	case DK4_E_SOCKET_GETSOCKOPT :
	case DK4_E_SOCKET_IOCTLSOCKET :
	case DK4_E_SOCKET_FCNTL :
	case DK4_E_SOCKET_INET_NTOP :
	case DK4_E_SOCKET_INET_PTON :
	{
	  mytext = strerror((erp->dt).iDetails1);
	} break;
      }
#endif
      if (NULL == mytext) {
        

#line 806 "dk4socka01.ctr"
        switch (erp->ec) {
#if DK4_ON_WINDOWS
	  /* +++++ Windows +++++ */
          case DK4_E_SOCKET_GETADDRINFO :
	  case DK4_E_SOCKET_GETADDRLOC :
	  {
	    switch (erp->dt.iDetails1) {
	      case EAI_AGAIN : {
	        /* Temporary problem in name resolution */
		mytext = msgtexts[68];
	      } break;
	      case EAI_BADFLAGS : {
	        /* Incorrect flag combination */
		mytext = msgtexts[69];
	      } break;
	      case EAI_FAIL : {
	        /* Nonrecoverable failure in name resolution */
		mytext = msgtexts[70];
	      } break;
	      case EAI_FAMILY : {
	        /* Unsupported address family */
		mytext = msgtexts[71];
	      } break;
	      case EAI_MEMORY: {
	        /* Not enough memory available */
		mytext = msgtexts[72];
	      } break;
	      case EAI_NONAME : {
	        /* No address found for host */
		mytext = msgtexts[74];
	      } break;
	      case EAI_SERVICE : {
	        /* Service type not supported for specified socket type */
		mytext = msgtexts[75];
	      } break;
	      case EAI_SOCKTYPE : {
	        /* Socket type not supported */
		mytext = msgtexts[76];
	      } break;
	    }
	  } break;
	  case DK4_E_SOCKET_UP :
	  case DK4_E_SOCKET_DOWN :
	  case DK4_E_SOCKET_SOCKET :
	  case DK4_E_SOCKET_CLOSE :
	  case DK4_E_SOCKET_BIND :
	  case DK4_E_SOCKET_CONNECT :
	  case DK4_E_SOCKET_LISTEN :
	  case DK4_E_SOCKET_ACCEPT :
	  case DK4_E_SOCKET_SHUTDOWN :
	  case DK4_E_SOCKET_SEND :
	  case DK4_E_SOCKET_RECV :
	  case DK4_E_SOCKET_SELECT :
	  case DK4_E_SOCKET_SETSOCKOPT :
	  case DK4_E_SOCKET_GETSOCKOPT :
	  case DK4_E_SOCKET_IOCTLSOCKET :
	  case DK4_E_SOCKET_FCNTL :
	  case DK4_E_SOCKET_GETSERVBYNAME :
	  case DK4_E_SOCKET_GETHOSTBYNAME :
	  case DK4_E_SOCKET_INET_NTOP :
	  case DK4_E_SOCKET_INET_PTON :
	  {
	    switch (erp->dt.iDetails1) {
	      case ERROR_INVALID_PARAMETER : {
	        /* inet_ntop: Buffer not present or too small */
		mytext = msgtexts[100];
	      } break;
	      case WSAEACCES : {
	        /* bind: Insufficient permissions */
		/* connect, send, sendto */
	        mytext = msgtexts[63];
	      } break;
	      case WSAEADDRINUSE : {
	        /* bind: Address is already in use */
		/* connect, listen */
		mytext = msgtexts[64];
	      } break;
	      case WSAEADDRNOTAVAIL : {
	        /* bind: Address is not valid in context, not a local address*/
		/* connect: Invalid remote address */
		/* sendto */
		mytext = msgtexts[65];
	      } break;
	      case WSAEAFNOSUPPORT : {
	        /* socket: Addres family is not supported */
		/* connect, sendto, inet_ntop, inet_pton */
		mytext = msgtexts[54];
	      } break;
	      case WSAEALREADY : {
	        /* connect: Non-blocking connect already running for socket */
		mytext = msgtexts[80];
	      } break;
	      case WSAECONNABORTED : {
	        /* send: Timeout or other failure, close the socket */
		/* sendto, recv, shutdown */
		mytext = msgtexts[105];
	      } break;
	      case WSAECONNREFUSED : {
	        /* connect: Connect attempt forcefully rejected */
		mytext = msgtexts[82];
	      } break;
	      case WSAECONNRESET : {
	        /* accept: Connection request followed by termination request */
		/* send, sendto, recv, recvfrom, shutdown */
		mytext = msgtexts[83];
	      } break;
	      case WSAEDESTADDRREQ : {
	        /* sendto: Destination address required */
		mytext = msgtexts[85];
	      } break;
	      case WSAEFAULT : {
	        /* WSAStartup: Invalid data pointer */
		/* bind, connect, accept, select, ioctlsocket, gethostbyname */
		/* send, sendto, recv, recvfrom, inet_pton */
		mytext = msgtexts[51];
	      } break;
	      case WSAEHOSTUNREACH : {
	        /* connect: Host unreachable */
		/* send, sendto */
		mytext = msgtexts[106];
	      } break;
	      case WSAEINPROGRESS : {
	        /* WSAStartup: Blocking Winsock 1.1 operation in progress */
		/* WSACleanup, socket, bind, connect, listen, select */
		/* ioctlsocket, closesocket, gethostbyname, getservbyname */
		/* send, sendto, recv, recvfrom, shutdown */
		mytext = msgtexts[49];
	      } break;
	      case WSAEINTR : {
	        /* connect: Blocking call cancelled by WSACancelBlockingCall */
		/* accept, select, closesocket, gethostbyname, getservbyname */
		/* send, sendto, recv, recvfrom */
		mytext = msgtexts[107];
	      } break;
	      case WSAEINVAL : {
	        /* socket: Invalid argument supplied */
		/* bind, select, send, sendto, recv, recvfrom */
		/* connect: The socket is in listening state */
		/* listen: Socket not yet bound */
		/* accept: Not listening */
		/* shutdown: Invalid shutdown parameter */
		switch (erp->ec) {
		  case DK4_E_SOCKET_CONNECT : {
		    mytext = msgtexts[108];
		  } break;
		  case DK4_E_SOCKET_LISTEN : {
		    mytext = msgtexts[109];
		  } break;
		  case DK4_E_SOCKET_ACCEPT : {
		    mytext = msgtexts[110];
		  } break;
		  case DK4_E_SOCKET_SHUTDOWN : {
		    mytext = msgtexts[111];
		  } break;
		  default : {
		    mytext = msgtexts[51];
		  } break;
		}
	      } break;
	      case WSAEINVALIDPROCTABLE : {
	        /* socket: Service provider returned invalid procedure table */
		mytext = msgtexts[119];
	      } break;
	      case WSAEINVALIDPROVIDER : {
	        /* socket: Invalid provider version */
		mytext = msgtexts[120];
	      } break;
	      case WSAEISCONN : {
	        /* connect: Socket already connected */
		/* listen */
		/* recvfrom */
		mytext = msgtexts[89];
	      } break;
	      case WSAEMFILE : {
	        /* socket: No more file descriptors available */
		/* listen, accept */
		mytext = msgtexts[92];
	      } break;
	      case WSAEMSGSIZE : {
	        /* send: Message size too large */
		/* sendto, recv, recvfrom */
		mytext = msgtexts[112];
	      } break;
	      case WSAENETDOWN : {
	        /* WSACleanup: Network subsystem has failed */
		/* socket, bind, connect, listen, accept, select, ioctlsocket */
		/* closesocket, gethostbyname, getservbyname, send, sendto */
		/* recv, recvfrom, shutdown */
		mytext = msgtexts[53];
	      } break;
	      case WSAENETRESET : {
	        /* send: Connection closed while keep-alive tests */
		/* sendto, recv, recvfrom */
		mytext = msgtexts[113];
	      } break;
	      case WSAENETUNREACH : {
	        /* connect: Network unreachable */
		/* sendto */
		mytext = msgtexts[94];
	      } break;
	      case WSAENOBUFS : {
	        /* socket: No buffer space available */
		/* bind, connect, listen, accept, send, sendto */
		mytext = msgtexts[56];
	      } break;
	      case WSAENOTCONN : {
	        /* send: Not connected */
		/* recv, shutdown */
		mytext = msgtexts[114];
	      } break;
	      case WSAENOTSOCK : {
	        /* bind: file descriptor is not a socket */
		/* connect, listen, connect, select, ioctlsocket */
		/* closesocket, send, sendto, recv, recvfrom, shutdown */
		mytext = msgtexts[66];
	      } break;
	      case WSAEOPNOTSUPP : {
	        /* listen: Not supported by socket type */
		/* accept, send, sendto, recv, recvfrom */
		mytext = msgtexts[101];
	      } break;
	      case WSAEPROCLIM : {
	        /* WSAStartup: Limit of processes using Winsock is reached */
		mytext = msgtexts[50];
	      } break;
	      case WSAEPROTONOSUPPORT : {
	        /* socket: Unsupported protocol */
		mytext = msgtexts[57];
	      } break;
	      case WSAEPROTOTYPE : {
	        /* socket: Specified protocol invalid for socket */
		mytext = msgtexts[58];
	      } break;
	      case WSAEPROVIDERFAILEDINIT : {
	        /* socket: Failed to initialize socket provider */
		mytext = msgtexts[115];
	      } break;
	      case WSAESHUTDOWN : {
	        /* send: Socket was shut down */
		/* sendto, recv, recvfrom */
		mytext = msgtexts[116];
	      } break;
	      case WSAESOCKTNOSUPPORT : {
	        /* socket: Socket type not supported by address family */
		mytext = msgtexts[60];
	      } break;
	      case WSAETIMEDOUT : {
	        /* connect: Timeout */
		/* send, sendto, recv, recvfrom */
		mytext = msgtexts[103];
	      } break;
	      case WSAEWOULDBLOCK : {
	        /* connect: Connection not finished on non-blocking socket */
		/* accept: Non-blocking, not connection attempts are present */
		/* closesocket, send, sendto, recv, recvfrom */
		mytext = msgtexts[117];
	      } break;
	      case WSAHOST_NOT_FOUND : {
	        /* gethostbyname: Host not found (authorative answer) */
		/* getservbyname */
		mytext = msgtexts[118];
	      } break;
	      case WSANO_DATA : {
	        /* gethostbyname: Host name is valid, but no data found */
		/* getservbyname */
		mytext = msgtexts[73];
	      } break;
	      case WSANO_RECOVERY : {
	        /* gethostbyname: Unrecoverable error */
		/* getservbyname */
		mytext = msgtexts[70];
	      } break;
	      case WSANOTINITIALISED : {
	        /* WSACleanup: Winsock not initialized */
		/* socket, bind, connect, listen, accept, select, ioctlsocket */
		/* closesocket, gethostbyname, getservbyname, send, sendto */
		/* recv, recvfrom, shutdown */
		mytext = msgtexts[52];
	      } break;
	      case WSASYSNOTREADY : {
	        /* WSAStartup: Underlying subsystem not yet read */
		mytext = msgtexts[47];
	      } break;
	      case WSATRY_AGAIN : {
	        /* gethostbyname: Host not found (non-authorative, or server 
		failure */
		/* getservbyname */
		mytext = msgtexts[68];
	      } break;
	      case WSAVERNOTSUPPORTED : {
	        /* WSAStartup: The requested version is not supported */
		mytext = msgtexts[48];
	      } break;
	    }
	  } break;
	  /* ----- Windows ----- */
#else
	  /* +++++ non-Windows +++++ */

          case DK4_E_SOCKET_GETADDRINFO :
	  case DK4_E_SOCKET_GETADDRLOC :
	  {
	    switch (erp->dt.iDetails1) {
#ifdef EAI_ADDRFAMILY
	      case EAI_ADDRFAMILY : {
	        mytext = msgtexts[67];
	      } break;
#endif
#ifdef EAI_AGAIN
	      case EAI_AGAIN : {
	        mytext = msgtexts[68];
	      } break;
#endif
#ifdef EAI_BADFLAGS
	      case EAI_BADFLAGS : {
	        mytext = msgtexts[69];
	      } break;
#endif
#ifdef EAI_FAIL
	      case EAI_FAIL : {
	        mytext = msgtexts[70];
	      } break;
#endif
#ifdef EAI_FAMILY
	      case EAI_FAMILY : {
	        mytext = msgtexts[71];
	      } break;
#endif
#ifdef EAI_MEMORY
	      case EAI_MEMORY : {
	        mytext = msgtexts[72];
	      } break;
#endif
#ifdef EAI_NODATA
	      case EAI_NODATA : {
	        mytext = msgtexts[73];
	      } break;
#endif
#ifdef EAI_NONAME
	      case EAI_NONAME : {
	        mytext = msgtexts[74];
	      } break;
#endif
#ifdef EAI_OVERFLOW
	      case EAI_OVERFLOW : {
	        mytext = msgtexts[78];
	      } break;
#endif
#ifdef EAI_SERVICE
	      case EAI_SERVICE : {
	        mytext = msgtexts[75];
	      } break;
#endif
#ifdef EAI_SOCKTYPE
	      case EAI_SOCKTYPE : {
	        mytext = msgtexts[76];
	      } break;
#endif
#ifdef EAI_SYSTEM
	      case EAI_SYSTEM : {
	        mytext = msgtexts[77];
	      } break;
#endif
	    }
	  } break;
	  case DK4_E_SOCKET_GETHOSTBYNAME : {
	    switch (erp->dt.iDetails1) {
#ifdef HOST_NOT_FOUND
	      case HOST_NOT_FOUND : {
	        mytext = msgtexts[73];
	      } break;
#endif
#ifdef NO_ADDRESS
	      case NO_ADDRESS : {
	        mytext = msgtexts[73];
	      } break;
#endif
#if defined(NO_DATA) && ((!defined(NO_ADDRESS)) || (NO_DATA != NO_ADDRESS))
	      case NO_DATA : {
	        mytext = msgtexts[73];
	      } break;
#endif
#ifdef NO_RECOVERY
	      case NO_RECOVERY : {
	        mytext = msgtexts[70];
	      } break;
#endif
#ifdef TRY_AGAIN
	      case TRY_AGAIN : {
	        mytext = msgtexts[68];
	      } break;
#endif
	    }
	  } break;
	  case DK4_E_SOCKET_UP :
	  case DK4_E_SOCKET_DOWN :
	  case DK4_E_SOCKET_SOCKET :
	  case DK4_E_SOCKET_CLOSE :
	  case DK4_E_SOCKET_BIND :
	  case DK4_E_SOCKET_CONNECT :
	  case DK4_E_SOCKET_LISTEN :
	  case DK4_E_SOCKET_ACCEPT :
	  case DK4_E_SOCKET_SELECT :
	  case DK4_E_SOCKET_SETSOCKOPT :
	  case DK4_E_SOCKET_GETSOCKOPT :
	  case DK4_E_SOCKET_IOCTLSOCKET :
	  case DK4_E_SOCKET_FCNTL :
	  case DK4_E_SOCKET_INET_NTOP :
	  case DK4_E_SOCKET_INET_PTON :
	  {
	    switch (erp->dt.iDetails1) {
#ifdef EACCES
	      case EACCES : {
	        /* socket: Insufficient permissions */
		/* bind, connect, listen, send */
	        mytext = msgtexts[63];
	      } break;
#endif
#ifdef EADDRINUSE
	      case EADDRINUSE : {
	        /* bind: Address already in used */
		/* connect */
		/* listen */
	        mytext = msgtexts[64];
	      } break;
#endif
#ifdef EADDRNOTAVAIL
	      case EADDRNOTAVAIL : {
	        /* bind: nonexistent interface or address is not local */
		/* connect */
	        mytext = msgtexts[65];
	      } break;
#endif
#ifdef EAFNOSUPPORT
	      case EAFNOSUPPORT : {
	        /* socket: Address family not supported */
		/* bind: Mismatch address and address family */
		/* connect, sendto, inet_pton */
	        mytext = msgtexts[54];
	      } break;
#endif
#ifdef EAGAIN
	      case EAGAIN : {
	        /* accept: Socket non-blocking, no incoming requests */
		/* send, recv */
	        mytext = msgtexts[79];
	      } break;
#endif
#ifdef EALREADY
	      case EALREADY : {
	        /* connect: Already connected */
	        mytext = msgtexts[80];
	      } break;
#endif
#ifdef EBADF
	      case EBADF : {
	        /* close: Not a file descriptr */
		/* shutdown, bind, connect */
		/* listen, accept, send, recv */
	        mytext = msgtexts[81];
	      } break;
#endif
#ifdef ECONNABORTED
	      case ECONNABORTED : {
	        /* accept: Connection attempt aborted */
		mytext = msgtexts[105];
	      } break;
#endif
#ifdef ECONNREFUSED
	      case ECONNREFUSED : {
	        /* connect: No-one listening on remote address */
		/* recv */
	        mytext = msgtexts[82];
	      } break;
#endif
#ifdef ECONNRESET
	      case ECONNRESET : {
	        /* connect: Remote host denied connection */
		/* send, recv */
	        mytext = msgtexts[83];
	      } break;
#endif
#ifdef EDEADLK
	      case EDEADLK : {
	        mytext = msgtexts[84];
	      } break;
#endif
#ifdef EDESTADDRREQ
	      case EDESTADDRREQ : {
	        /* bind: Address is a NULL pointer */
		/* listen: Socket not yet bound */
		/* send */
	        mytext = msgtexts[85];
	      } break;
#endif
#ifdef EDOM
	      case EDOM : {
	        mytext = msgtexts[86];
	      } break;
#endif
#ifdef EFAULT
	      case EFAULT : {
	        /* bind: Pointer to outside usable address space */
		/* connect, accept, send, recv */
	        mytext = msgtexts[51];
	      } break;
#endif
#ifdef EHOSTUNREACH
	      case EHOSTUNREACH : {
	        /* connect: Remote host unreachable */
		/* send */
	        mytext = msgtexts[106];
	      } break;
#endif
#ifdef EINPROGRESS
	      case EINPROGRESS : {
	        /* connect: Socket is non-blocking, operation would block */
	        mytext = msgtexts[87];
	      } break;
#endif
#ifdef EINTR
	      case EINTR : {
	        /* close: Interrupted by signal */
		/* connect, accept, send, recv */
	        mytext = msgtexts[88];
	      } break;
#endif
#ifdef EINVAL
	      case EINVAL : {
	        /* socket: unknown protocol, illegal protocol family or flags */
		/* shutdown: Invalid argument */
		/* bind: Socket already bound */
		/* bind: wrong address length */
		/* bind: Socket already shut down */
		/* connect: Wrong address length or address family */
		/* listen: Socket already connected */
		/* listen: Socket already shut down */
		/* accept: Socket not listening, or illegal socket value */
		/* accept: Invalid flags */
		/* send: Invalid arguments , recv */
	        mytext = msgtexts[51];
	      } break;
#endif
#ifdef EISCONN
	      case EISCONN : {
	        /* bind: Socket already connected */
		/* connect, send */
	        mytext = msgtexts[89];
	      } break;
#endif
#ifdef EISDIR
	      case EISDIR : {
	        /* bind: Address is a NULL pointer */
	        mytext = msgtexts[85];
	      } break;
#endif
#ifdef EIO
	      case EIO : {
	        /* close: I/O error */
		/* connect, send */
	        mytext = msgtexts[90];
	      } break;
#endif
#ifdef ELOOP
	      case ELOOP : {
	        /* bind: Too many symbolic links or symlink loop */
		/* connect, send */
	        mytext = msgtexts[91];
	      } break;
#endif
#ifdef EMFILE
	      case EMFILE : {
	        /* socket: Process file table overflow */
		/* accept */
	        mytext = msgtexts[92];
	      } break;
#endif
#ifdef EMSGSIZE
	      case EMSGSIZE : {
	        /* send: Message size too large */
		mytext = msgtexts[112];
	      } break;
#endif
#ifdef ENAMETOOLONG
	      case ENAMETOOLONG : {
	        /* bind: Address is too long */
		/* connect, send */
	        mytext = msgtexts[93];
	      } break;
#endif
#ifdef ENETDOWN
	      case ENETDOWN : {
	        /* connect: Local network interface is down */
		/* send */
	        mytext = msgtexts[53];
	      } break;
#endif
#ifdef ENETUNREACH
	      case ENETUNREACH : {
	        /* connect: Network is unreachable */
		/* send */
	        mytext = msgtexts[94];
	      } break;
#endif
#ifdef ENFILE
	      case ENFILE : {
	        /* socket: System file table overflow */
		/* accept */
	        mytext = msgtexts[95];
	      } break;
#endif
#ifdef ENOBUFS
	      case ENOBUFS : {
	        /* socket: No memory for buffers */
		/* shutdown: Insufficient resources */
		/* connect, listen, accept, send */
	        mytext = msgtexts[56];
	      } break;
#endif
#ifdef ENODEV
	      case ENODEV : {
	        /* accept: Protocol family and type not in network config */
	        mytext = msgtexts[126];
	      } break;
#endif
#ifdef ENOENT
	      case ENOENT : {
	        /* bind: File does not exist */
		/* connect, send */
	        mytext = msgtexts[96];
	      } break;
#endif
#ifdef ENOLCK
	      case ENOLCK : {
	        mytext = msgtexts[97];
	      } break;
#endif
#ifdef ENOLINK
	      case ENOLINK : {
	        /* close: Connection to remote machine no longer active */
	        mytext = msgtexts[124];
	      } break;
#endif
#ifdef ENOMEM
	      case ENOMEM : {
	        /* socket: Not enough memory available */
		/* bind, accept, send, recv */
	        mytext = msgtexts[72];
	      } break;
#endif
#ifdef ENOPROTOOPT
	      case ENOPROTOOPT : {
	        mytext = msgtexts[98];
	      } break;
#endif
#ifdef ENOSR
	      case ENOSR : {
	        /* socket: Insufficient stream resources */
		/* bind, connect, accept, send, recv, shutdown */
	        mytext = msgtexts[122];
	      } break;
#endif
#ifdef ENOTCONN
	      case ENOTCONN : {
	        /* shutdown: Not connected */
		/* send, recv */
		mytext = msgtexts[114];
	      } break;
#endif
#ifdef ENOTDIR
	      case ENOTDIR : {
	        /* bind: Component or path prefix is not a directory */
		/* connect, send */
	        mytext = msgtexts[99];
	      } break;
#endif
#ifdef ENOTSOCK
	      case ENOTSOCK : {
	        /* shutdown: Not a socket */
		/* bind, connect, listen, accept, send, recv */
	        mytext = msgtexts[66];
	      } break;
#endif
#ifdef ENOSPC
	      case ENOSPC : {
	        /* inet_pton: Insufficient buffer size */
		/* close: Not enough space on device */
	        mytext = msgtexts[100];
	      } break;
#endif
#ifdef ENXIO
	      case ENXIO : {
	        /* connect: Server exited before completing connection */
	        mytext = msgtexts[125];
	      } break;
#endif
#ifdef EOPNOTSUPP
	      case EOPNOTSUPP : {
	        /* bind: Operation not supported by socket type */
		/* connect: Socket is listening */
		/* listen: Socket can not listen */
		/* accept: Not a stream socket */
		/* send: Illegal flags, recv  */
	        mytext = msgtexts[101];
	      } break;
#endif
#ifdef EPERM
	      case EPERM : {
	        /* connect: Insufficient permissions */
		/* accept: Firewall rules forbid connection */
	        mytext = msgtexts[63];
	      } break;
#endif
#ifdef EPFNOSUPPORT
	      case EPFNOSUPPORT : {
	        /* socket: Protocol family not supported */
	        mytext = msgtexts[123];
	      } break;
#endif
#ifdef EPIPE
	      case EPIPE : {
	        mytext = msgtexts[116];
	      } break;
#endif
#ifdef EPROTONOSUPPORT
	      case EPROTONOSUPPORT : {
	        /* socket: Protocol type not supported in this domain */
	        mytext = msgtexts[57];
	      } break;
#endif
#ifdef EPROTO
	      case EPROTO : {
	        /* accept: Protocol error */
		mytext = msgtexts[121];
	      } break;
#endif
#ifdef EPROTOTYPE
	      case EPROTOTYPE : {
	        /* socket: Socket type not supported by protocol */
		/* connect: Remote type is different address family as local */
	        mytext = msgtexts[58];
	      } break;
#endif
#ifdef EROFS
	      case EROFS : {
	        /* bind: File system is mounted read-only */
	        mytext = msgtexts[102];
	      } break;
#endif
#ifdef ESTALE
	      case ESTALE : {
	        /* recv: Stale NFS file handle */
	        mytext = msgtexts[127];
	      } break;
#endif
#ifdef ETIMEDOUT
	      case ETIMEDOUT : {
	        /* connect: Timed out */
		/* recv */
	        mytext = msgtexts[103];
	      } break;
#endif
#ifdef EOVERFLOW
	      case EOVERFLOW : {
	        mytext = msgtexts[104];
	      } break;
#endif
#if defined(EWOULDBLOCK) && ((!defined(EAGAIN)) || (EWOULDBLOCK != EAGAIN))
	      case EWOULDBLOCK : {
	        /* accept: Socket non-blocking, no incoming requests */
		/* send, recv */
		mytext = msgtexts[79];
	      } break;
#endif
	    }
	  } break;
	  /* ----- non-Windows ----- */
#endif
	}
      }
      *msgtext = mytext;
    }
  }
}



void
dk4socket_log_simple_1(
  dk4_app_t	*app,
  int		 ll,
  size_t	 imain,
  dk4_er_t	*erp
)
{
  dkChar		 b1[16*sizeof(dk4_um_t)];	/* decimal */
  dkChar		 b2[16*sizeof(dk4_um_t)];	/* hexadecimal */
  const dkChar		*fctn	= NULL;	/* Function name */
  const dkChar		*errt	= NULL;	/* Error text */
  const dkChar		*msgt[16];	/* Message components */
  const dkChar * const	*msga;		/* Localized texts array */
  size_t		 used	= 0;	/* Number of used components */
  int			 res	= 0;	/* Conversion result */

  if (0 != dk4app_log_do(app, ll)) {
    msga = dk4app_string_table(app,dk4socket_app_kwnl[0],dk4socket_app_kw_def);
    if (dk4socket_sz_kw_def > imain) {
      msgt[used++] = msga[imain];
      dk4socket_log_fctname_msg(&fctn, &errt, app, erp);
      if (NULL != fctn) {
        if (NULL != errt) {
	  msgt[used++] = dk4socket_app_kwnl[1];
	  msgt[used++] = fctn;
	  msgt[used++] = dk4socket_app_kwnl[2];
	  msgt[used++] = errt;
	} else {
	  res = dk4ma_write_decimal_signed(
	    b1, DK4_SIZEOF(b1,dkChar), (dk4_um_t)(erp->dt.iDetails1), 0, NULL
	  );
	  if (0 != res) {
	    res = dk4ma_write_hex_signed(
	      b2, DK4_SIZEOF(b2,dkChar), (dk4_im_t)(erp->dt.iDetails1), 8, NULL
	    );
	    if (0 != res) {
	      msgt[used++] = dk4socket_app_kwnl[1];
	      msgt[used++] = fctn;
	      msgt[used++] = dk4socket_app_kwnl[2];
#if DK4_ON_WINDOWS
	      msgt[used++] = msga[40];
#else
	      msgt[used++] = msga[37];
#endif
	      msgt[used++] = b1;
	      msgt[used++] = msga[38];
	      msgt[used++] = b2;
	      msgt[used++] = msga[39];
	    }
	  }
	}
      } else {
        if (NULL != errt) {
	  msgt[used++] = dk4socket_app_kwnl[1];
	  msgt[used++] = errt;
	} else {
	}
      }
      dk4app_log_msg(app, ll, msgt, used);
    }
  }
}



void
dk4socket_log_simple_3(
  dk4_app_t	*app,
  int		 ll,
  size_t	 i1,
  size_t	 i2,
  const	dkChar	*ctext,
  dk4_er_t	*erp
)
{
  dkChar		 b1[16*sizeof(dk4_um_t)];	/* decimal */
  dkChar		 b2[16*sizeof(dk4_um_t)];	/* hexadecimal */
  const dkChar		*fctn	= NULL;	/* Function name */
  const dkChar		*errt	= NULL;	/* Error text */
  const dkChar		*msgt[16];	/* Message components */
  const dkChar * const	*msga;		/* Localized texts array */
  size_t		 used	= 0;	/* Number of used components */
  int			 res	= 0;	/* Conversion result */

  if (0 != dk4app_log_do(app, ll)) {
    msga = dk4app_string_table(app,dk4socket_app_kwnl[0],dk4socket_app_kw_def);
    if ((dk4socket_sz_kw_def > i1) && (dk4socket_sz_kw_def > i2)) {
      msgt[used++] = msga[i1];
      if (NULL != ctext) { msgt[used++] = ctext; }
      msgt[used++] = msga[i2];
      dk4socket_log_fctname_msg(&fctn, &errt, app, erp);
      if (NULL != fctn) {
        if (NULL != errt) {
	  msgt[used++] = dk4socket_app_kwnl[1];
	  msgt[used++] = fctn;
	  msgt[used++] = dk4socket_app_kwnl[2];
	  msgt[used++] = errt;
	} else {
	  res = dk4ma_write_decimal_signed(
	    b1, DK4_SIZEOF(b1,dkChar), (dk4_um_t)(erp->dt.iDetails1), 0, NULL
	  );
	  if (0 != res) {
	    res = dk4ma_write_hex_signed(
	      b2, DK4_SIZEOF(b2,dkChar), (dk4_im_t)(erp->dt.iDetails1), 8, NULL
	    );
	    if (0 != res) {
	      msgt[used++] = dk4socket_app_kwnl[1];
	      msgt[used++] = fctn;
	      msgt[used++] = dk4socket_app_kwnl[2];
#if DK4_ON_WINDOWS
	      msgt[used++] = msga[40];
#else
	      msgt[used++] = msga[37];
#endif
	      msgt[used++] = b1;
	      msgt[used++] = msga[38];
	      msgt[used++] = b2;
	      msgt[used++] = msga[39];
	    }
	  }
	}
      } else {
        if (NULL != errt) {
	  msgt[used++] = dk4socket_app_kwnl[1];
	  msgt[used++] = errt;
	} else {
	}
      }
      dk4app_log_msg(app, ll, msgt, used);
    }
  }
}



void
dk4socket_log_simple_5(
  dk4_app_t	*app,
  int		 ll,
  size_t	 i1,
  size_t	 i2,
  size_t	 i3,
  const	dkChar	*ct1,
  const	dkChar	*ct2,
  dk4_er_t	*erp
)
{
  dkChar		 b1[16*sizeof(dk4_um_t)];	/* decimal */
  dkChar		 b2[16*sizeof(dk4_um_t)];	/* hexadecimal */
  const dkChar		*fctn	= NULL;	/* Function name */
  const dkChar		*errt	= NULL;	/* Error text */
  const dkChar		*msgt[16];	/* Message components */
  const dkChar * const	*msga;		/* Localized texts array */
  size_t		 used	= 0;	/* Number of used components */
  int			 res	= 0;	/* Conversion result */

  if (0 != dk4app_log_do(app, ll)) {
    msga = dk4app_string_table(app,dk4socket_app_kwnl[0],dk4socket_app_kw_def);
    if ((dk4socket_sz_kw_def > i1) && (dk4socket_sz_kw_def > i2)) {
      msgt[used++] = msga[i1];
      if (NULL != ct1) { msgt[used++] = ct1; }
      msgt[used++] = msga[i2];
      if (NULL != ct2) { msgt[used++] = ct2; }
      msgt[used++] = msga[i3];
      dk4socket_log_fctname_msg(&fctn, &errt, app, erp);
      if (NULL != fctn) {
        if (NULL != errt) {
	  msgt[used++] = dk4socket_app_kwnl[1];
	  msgt[used++] = fctn;
	  msgt[used++] = dk4socket_app_kwnl[2];
	  msgt[used++] = errt;
	} else {
	  res = dk4ma_write_decimal_signed(
	    b1, DK4_SIZEOF(b1,dkChar), (dk4_um_t)(erp->dt.iDetails1), 0, NULL
	  );
	  if (0 != res) {
	    res = dk4ma_write_hex_signed(
	      b2, DK4_SIZEOF(b2,dkChar), (dk4_im_t)(erp->dt.iDetails1), 8, NULL
	    );
	    if (0 != res) {
	      msgt[used++] = dk4socket_app_kwnl[1];
	      msgt[used++] = fctn;
	      msgt[used++] = dk4socket_app_kwnl[2];
#if DK4_ON_WINDOWS
	      msgt[used++] = msga[40];
#else
	      msgt[used++] = msga[37];
#endif
	      msgt[used++] = b1;
	      msgt[used++] = msga[38];
	      msgt[used++] = b2;
	      msgt[used++] = msga[39];
	    }
	  }
	}
      } else {
        if (NULL != errt) {
	  msgt[used++] = dk4socket_app_kwnl[1];
	  msgt[used++] = errt;
	} else {
	}
      }
      dk4app_log_msg(app, ll, msgt, used);
    }
  }
}