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
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>NeL: NLNET::CNamingClient class Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.3.6 -->
<div class="qindex"> <form class="search" action="search.php" method="get">
<a class="qindex" href="main.html">Main Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical List</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="namespacemembers.html">Namespace Members</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related Pages</a> | <span class="search"><u>S</u>earch for <input class="search" type="text" name="query" value="" size="20" accesskey="s"/></span></form></div>
<h1>NLNET::CNamingClient Class Reference</h1><code>#include <<a class="el" href="a06090.html">naming_client.h</a>></code>
<p>
<hr><a name="_details"></a><h2>Detailed Description</h2>
Client side of Naming Service. Allows to register/unregister services, and to lookup for a registered service.<p>
<dl compact><dt><b>Warning:</b></dt><dd>the Naming Service can be down, it will reconnect when up but if other services try to register during the NS is offline, it will cause bug</dd></dl>
<dl compact><dt><b>Author:</b></dt><dd>Olivier Cado <p>
Vianney Lecroart <p>
Nevrax France </dd></dl>
<dl compact><dt><b>Date:</b></dt><dd>2001 </dd></dl>
<p>
<p>
Definition at line <a class="el" href="a06090.html#l00058">58</a> of file <a class="el" href="a06090.html">naming_client.h</a>.<table border=0 cellpadding=0 cellspacing=0>
<tr><td></td></tr>
<tr><td colspan=2><br><h2>Static Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02980.html#NLNET_1_1CNamingCliente0">connect</a> (const <a class="el" href="a02665.html">CInetAddress</a> &<a class="el" href="a04223.html#a657">addr</a>, <a class="el" href="a02306.html#NLNET_1_1CCallbackServerw8">CCallbackNetBase::TRecordingState</a> rec, const std::vector< <a class="el" href="a02665.html">CInetAddress</a> > &addresses)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Connect to the naming service. <a href="#NLNET_1_1CNamingCliente0"></a><br><br></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02980.html#NLNET_1_1CNamingCliente1">connected</a> ()</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Return true if the connection to the Naming Service was done. <a href="#NLNET_1_1CNamingCliente1"></a><br><br></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02980.html#NLNET_1_1CNamingCliente2">disconnect</a> ()</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Close the connection to the naming service. <a href="#NLNET_1_1CNamingCliente2"></a><br><br></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02980.html#NLNET_1_1CNamingCliente3">displayRegisteredServices</a> (<a class="el" href="a02813.html">NLMISC::CLog</a> *log=<a class="el" href="a05378.html#a13">NLMISC::DebugLog</a>)</td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>const std::list< <a class="el" href="a02981.html">CServiceEntry</a> > & </td><td class="memItemRight" valign=bottom><a class="el" href="a02980.html#NLNET_1_1CNamingCliente4">getRegisteredServices</a> ()</td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>std::string </td><td class="memItemRight" valign=bottom><a class="el" href="a02980.html#NLNET_1_1CNamingCliente5">info</a> ()</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Returns information about the naming connection (connected or not, which naming service and so on). <a href="#NLNET_1_1CNamingCliente5"></a><br><br></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02980.html#NLNET_1_1CNamingCliente6">lookup</a> (<a class="el" href="a05379.html#a93">TServiceId</a> sid, <a class="el" href="a02665.html">CInetAddress</a> &<a class="el" href="a04223.html#a657">addr</a>)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Same as lookup(const string&, CInetAddress&, uint16&). <a href="#NLNET_1_1CNamingCliente6"></a><br><br></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02980.html#NLNET_1_1CNamingCliente7">lookup</a> (const std::string &name, <a class="el" href="a02665.html">CInetAddress</a> &<a class="el" href="a04223.html#a657">addr</a>)</td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02980.html#NLNET_1_1CNamingCliente8">lookupAll</a> (const std::string &name, std::vector< <a class="el" href="a02665.html">CInetAddress</a> > &addresses)</td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02980.html#NLNET_1_1CNamingCliente9">lookupAlternate</a> (const std::string &name, <a class="el" href="a02665.html">CInetAddress</a> &<a class="el" href="a04223.html#a657">addr</a>)</td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02980.html#NLNET_1_1CNamingCliente10">lookupAndConnect</a> (const std::string &name, <a class="el" href="a02305.html">CCallbackClient</a> &sock)</td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a9">uint16</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02980.html#NLNET_1_1CNamingCliente11">queryServicePort</a> ()</td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02980.html#NLNET_1_1CNamingCliente12">registerService</a> (const std::string &name, const std::vector< <a class="el" href="a02665.html">CInetAddress</a> > &<a class="el" href="a04223.html#a657">addr</a>, <a class="el" href="a05379.html#a93">TServiceId</a> &sid)</td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02980.html#NLNET_1_1CNamingCliente13">registerServiceWithSId</a> (const std::string &name, const std::vector< <a class="el" href="a02665.html">CInetAddress</a> > &<a class="el" href="a04223.html#a657">addr</a>, <a class="el" href="a05379.html#a93">TServiceId</a> sid)</td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02980.html#NLNET_1_1CNamingCliente14">resendRegisteration</a> (const std::string &name, const std::vector< <a class="el" href="a02665.html">CInetAddress</a> > &<a class="el" href="a04223.html#a657">addr</a>, <a class="el" href="a05379.html#a93">TServiceId</a> sid)</td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02980.html#NLNET_1_1CNamingCliente15">setRegistrationBroadcastCallback</a> (<a class="el" href="a05379.html#a94">TBroadcastCallback</a> cb)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">You can link a callback if you want to know when a new service is registered (NULL to disable callback). <a href="#NLNET_1_1CNamingCliente15"></a><br><br></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02980.html#NLNET_1_1CNamingCliente16">setUnregistrationBroadcastCallback</a> (<a class="el" href="a05379.html#a94">TBroadcastCallback</a> cb)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">You can link a callback if you want to know when a new service is unregistered (NULL to disable callback). <a href="#NLNET_1_1CNamingCliente16"></a><br><br></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02980.html#NLNET_1_1CNamingCliente17">unregisterAllServices</a> ()</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Unregister all services registered by this client. You don't have to. <a href="#NLNET_1_1CNamingCliente17"></a><br><br></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02980.html#NLNET_1_1CNamingCliente18">unregisterService</a> (<a class="el" href="a05379.html#a93">TServiceId</a> sid)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Unregister a service from the naming service, service identifier. <a href="#NLNET_1_1CNamingCliente18"></a><br><br></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02980.html#NLNET_1_1CNamingCliente19">update</a> ()</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Call it evenly. <a href="#NLNET_1_1CNamingCliente19"></a><br><br></td></tr>
<tr><td colspan=2><br><h2>Static Protected Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02980.html#NLNET_1_1CNamingClientf0">checkThreadId</a> ()</td></tr>
<tr><td colspan=2><br><h2>Static Protected Attributes</h2></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a15">uint</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02980.html#NLNET_1_1CNamingClientt0">_ThreadId</a> = 0xFFFFFFFF</td></tr>
<tr><td colspan=2><br><h2>Private Types</h2></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>typedef std::map< <a class="el" href="a05379.html#a93">TServiceId</a>,<br>
std::string > </td><td class="memItemRight" valign=bottom><a class="el" href="a02980.html#NLNET_1_1CNamingClienty0">TRegServices</a></td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Type of map of registered services. <a href="#NLNET_1_1CNamingClienty0"></a><br><br></td></tr>
<tr><td colspan=2><br><h2>Private Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top> </td><td class="memItemRight" valign=bottom><a class="el" href="a02980.html#NLNET_1_1CNamingClientd0">CNamingClient</a> ()</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Constructor. <a href="#NLNET_1_1CNamingClientd0"></a><br><br></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top> </td><td class="memItemRight" valign=bottom><a class="el" href="a02980.html#NLNET_1_1CNamingClientd1">~CNamingClient</a> ()</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Destructor. <a href="#NLNET_1_1CNamingClientd1"></a><br><br></td></tr>
<tr><td colspan=2><br><h2>Static Private Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02980.html#NLNET_1_1CNamingClienth0">doReceiveLookupAnswer</a> (const std::string &name, std::vector< <a class="el" href="a02665.html">CInetAddress</a> > &addrs)</td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02980.html#NLNET_1_1CNamingClienth1">find</a> (<a class="el" href="a05379.html#a93">TServiceId</a> sid, std::vector< <a class="el" href="a02665.html">CInetAddress</a> > &addrs)</td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02980.html#NLNET_1_1CNamingClienth2">find</a> (const std::string &name, std::vector< <a class="el" href="a02665.html">CInetAddress</a> > &addrs)</td></tr>
<tr><td colspan=2><br><h2>Static Private Attributes</h2></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a02305.html">CCallbackClient</a> * </td><td class="memItemRight" valign=bottom><a class="el" href="a02980.html#NLNET_1_1CNamingClientv0">_Connection</a> = NULL</td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a05379.html#a93">TServiceId</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02980.html#NLNET_1_1CNamingClientv1">_MySId</a> = 0</td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a02980.html#NLNET_1_1CNamingClienty0">TRegServices</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02980.html#NLNET_1_1CNamingClientv2">_RegisteredServices</a></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>std::list< <a class="el" href="a02981.html">CServiceEntry</a> > </td><td class="memItemRight" valign=bottom><a class="el" href="a02980.html#NLNET_1_1CNamingClientv3">RegisteredServices</a></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>NLMISC::CMutex </td><td class="memItemRight" valign=bottom><a class="el" href="a02980.html#NLNET_1_1CNamingClientv4">RegisteredServicesMutex</a></td></tr>
<tr><td colspan=2><br><h2>Friends</h2></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02980.html#NLNET_1_1CNamingClientn0">cbRegisterBroadcast</a> (<a class="el" href="a02918.html">CMessage</a> &msgin, <a class="el" href="a02303.html">TSockId</a> <a class="el" href="a04113.html#a70">from</a>, <a class="el" href="a02306.html">CCallbackNetBase</a> &netbase)</td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02980.html#NLNET_1_1CNamingClientn1">cbUnregisterBroadcast</a> (<a class="el" href="a02918.html">CMessage</a> &msgin, <a class="el" href="a02303.html">TSockId</a> <a class="el" href="a04113.html#a70">from</a>, <a class="el" href="a02306.html">CCallbackNetBase</a> &netbase)</td></tr>
</table>
<hr><h2>Member Typedef Documentation</h2>
<a class="anchor" name="NLNET_1_1CNamingClienty0" doxytag="NLNET::CNamingClient::TRegServices" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> typedef std::map<<a class="el" href="a05379.html#a93">TServiceId</a>, std::string> <a class="el" href="a02980.html#NLNET_1_1CNamingClienty0">NLNET::CNamingClient::TRegServices</a><code> [private]</code>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
Type of map of registered services.
<p>
<p>
Definition at line <a class="el" href="a06090.html#l00194">194</a> of file <a class="el" href="a06090.html">naming_client.h</a>. </td>
</tr>
</table>
<hr><h2>Constructor & Destructor Documentation</h2>
<a class="anchor" name="NLNET_1_1CNamingClientd0" doxytag="NLNET::CNamingClient::CNamingClient" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> NLNET::CNamingClient::CNamingClient </td>
<td class="md" valign="top">( </td>
<td class="mdname1" valign="top" nowrap> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap><code> [inline, private]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
Constructor.
<p>
<p>
Definition at line <a class="el" href="a06090.html#l00200">200</a> of file <a class="el" href="a06090.html">naming_client.h</a>.
<p>
<div class="fragment"><pre>00200 {}
</pre></div> </td>
</tr>
</table>
<a class="anchor" name="NLNET_1_1CNamingClientd1" doxytag="NLNET::CNamingClient::~CNamingClient" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> NLNET::CNamingClient::~<a class="el" href="a02980.html">CNamingClient</a> </td>
<td class="md" valign="top">( </td>
<td class="mdname1" valign="top" nowrap> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap><code> [inline, private]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
Destructor.
<p>
<p>
Definition at line <a class="el" href="a06090.html#l00203">203</a> of file <a class="el" href="a06090.html">naming_client.h</a>.
<p>
<div class="fragment"><pre>00203 {}
</pre></div> </td>
</tr>
</table>
<hr><h2>Member Function Documentation</h2>
<a class="anchor" name="NLNET_1_1CNamingClientf0" doxytag="NLNET::CNamingClient::checkThreadId" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> void NLNET::CNamingClient::checkThreadId </td>
<td class="md" valign="top">( </td>
<td class="mdname1" valign="top" nowrap> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap><code> [static, protected]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
<p>
Definition at line <a class="el" href="a06089.html#l00544">544</a> of file <a class="el" href="a06089.html">naming_client.cpp</a>.
<p>
References <a class="el" href="a05622.html#l00154">nlerror</a>.
<p>
Referenced by <a class="el" href="a06089.html#l00267">disconnect()</a>, <a class="el" href="a06089.html#l00411">queryServicePort()</a>, <a class="el" href="a06089.html#l00302">registerService()</a>, <a class="el" href="a06089.html#l00340">registerServiceWithSId()</a>, <a class="el" href="a06089.html#l00373">resendRegisteration()</a>, <a class="el" href="a06089.html#l00398">unregisterAllServices()</a>, <a class="el" href="a06089.html#l00385">unregisterService()</a>, and <a class="el" href="a06089.html#l00536">update()</a>.
<p>
<div class="fragment"><pre>00545 {
00546 <span class="keywordflow">if</span> (<a class="code" href="a05378.html#a257">getThreadId</a> () != <a class="code" href="a02980.html#NLNET_1_1CNamingClientt0">_ThreadId</a>)
00547 {
00548 <a class="code" href="a04199.html#a3">nlerror</a> (<span class="stringliteral">"You try to access to the CNamingClient with 2 differents thread (%d and %d)"</span>, _ThreadId, <a class="code" href="a05378.html#a257">getThreadId</a>());
00549 }
00550 }
</pre></div> </td>
</tr>
</table>
<a class="anchor" name="NLNET_1_1CNamingCliente0" doxytag="NLNET::CNamingClient::connect" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> void NLNET::CNamingClient::connect </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">const <a class="el" href="a02665.html">CInetAddress</a> & </td>
<td class="mdname" nowrap> <em>addr</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap><a class="el" href="a02306.html#NLNET_1_1CCallbackServerw8">CCallbackNetBase::TRecordingState</a> </td>
<td class="mdname" nowrap> <em>rec</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap>const std::vector< <a class="el" href="a02665.html">CInetAddress</a> > & </td>
<td class="mdname" nowrap> <em>addresses</em></td>
</tr>
<tr>
<td></td>
<td class="md">) </td>
<td class="md" colspan="2"><code> [static]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
Connect to the naming service.
<p>
<p>
Definition at line <a class="el" href="a06089.html#l00239">239</a> of file <a class="el" href="a06089.html">naming_client.cpp</a>.
<p>
References <a class="el" href="a05526.html#l00184">NLNET::CCallbackNetBase::addCallbackArray()</a>, <a class="el" href="a05646.html#l01127">addr</a>, <a class="el" href="a05524.html#l00286">NLNET::CCallbackClient::connect()</a>, <a class="el" href="a05525.html#l00069">NLNET::CCallbackClient::connected()</a>, <a class="el" href="a06089.html#l00230">NLNET::NamingClientCallbackArray</a>, and <a class="el" href="a05622.html#l00290">nlassert</a>.
<p>
<div class="fragment"><pre>00240 {
00241 <a class="code" href="a04199.html#a6">nlassert</a> (_Connection == NULL || _Connection != NULL && !<a class="code" href="a02980.html#NLNET_1_1CNamingClientv0">_Connection</a>->connected ());
00242 <a class="code" href="a02980.html#NLNET_1_1CNamingClientt0">_ThreadId</a> = <a class="code" href="a05378.html#a257">getThreadId</a> ();
00243
00244 <span class="keywordflow">if</span> (<a class="code" href="a02980.html#NLNET_1_1CNamingClientv0">_Connection</a> == NULL)
00245 {
00246 <a class="code" href="a02980.html#NLNET_1_1CNamingClientv0">_Connection</a> = <span class="keyword">new</span> CCallbackClient( rec, <span class="stringliteral">"naming_client.nmr"</span> );
00247 <a class="code" href="a02980.html#NLNET_1_1CNamingClientv0">_Connection</a>->addCallbackArray (NamingClientCallbackArray, <span class="keyword">sizeof</span> (NamingClientCallbackArray) / <span class="keyword">sizeof</span> (NamingClientCallbackArray[0]));
00248 }
00249
00250 <a class="code" href="a02980.html#NLNET_1_1CNamingClientv0">_Connection</a>->connect (addr);
00251
00252 <span class="comment">/* // send the available addresses</span>
00253 <span class="comment"> CMessage msgout (_Connection->getSIDA(), "RS");</span>
00254 <span class="comment"> msgout.serialCont (const_cast<vector<CInetAddress>&>(addresses));</span>
00255 <span class="comment"> _Connection->send (msgout);</span>
00256 <span class="comment"> </span>
00257 <span class="comment"> // wait the message that contains all already connected services</span>
00258 <span class="comment"> FirstRegisteredBroadcast = false;</span>
00259 <span class="comment"> while (!FirstRegisteredBroadcast && _Connection->connected ())</span>
00260 <span class="comment"> {</span>
00261 <span class="comment"> _Connection->update (-1);</span>
00262 <span class="comment"> nlSleep (1);</span>
00263 <span class="comment"> }</span>
00264 <span class="comment">*/</span>}
</pre></div> </td>
</tr>
</table>
<a class="anchor" name="NLNET_1_1CNamingCliente1" doxytag="NLNET::CNamingClient::connected" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> bool NLNET::CNamingClient::connected </td>
<td class="md" valign="top">( </td>
<td class="mdname1" valign="top" nowrap> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap><code> [inline, static]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
Return true if the connection to the Naming Service was done.
<p>
<p>
Definition at line <a class="el" href="a06090.html#l00079">79</a> of file <a class="el" href="a06090.html">naming_client.h</a>.
<p>
References <a class="el" href="a05525.html#l00069">NLNET::CCallbackClient::connected()</a>.
<p>
Referenced by <a class="el" href="a06089.html#l00285">info()</a>.
<p>
<div class="fragment"><pre>00079 { <span class="keywordflow">return</span> <a class="code" href="a02980.html#NLNET_1_1CNamingClientv0">_Connection</a> != NULL && <a class="code" href="a02980.html#NLNET_1_1CNamingClientv0">_Connection</a>->connected (); }
</pre></div> </td>
</tr>
</table>
<a class="anchor" name="NLNET_1_1CNamingCliente2" doxytag="NLNET::CNamingClient::disconnect" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> void NLNET::CNamingClient::disconnect </td>
<td class="md" valign="top">( </td>
<td class="mdname1" valign="top" nowrap> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap><code> [static]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
Close the connection to the naming service.
<p>
<p>
Definition at line <a class="el" href="a06089.html#l00267">267</a> of file <a class="el" href="a06089.html">naming_client.cpp</a>.
<p>
References <a class="el" href="a06089.html#l00544">checkThreadId()</a>, <a class="el" href="a05525.html#l00069">NLNET::CCallbackClient::connected()</a>, and <a class="el" href="a05524.html#l00354">NLNET::CCallbackClient::disconnect()</a>.
<p>
<div class="fragment"><pre>00268 {
00269 <a class="code" href="a02980.html#NLNET_1_1CNamingClientf0">checkThreadId</a> ();
00270
00271 <span class="keywordflow">if</span> (<a class="code" href="a02980.html#NLNET_1_1CNamingClientv0">_Connection</a> != NULL)
00272 {
00273 <span class="keywordflow">if</span> (<a class="code" href="a02980.html#NLNET_1_1CNamingClientv0">_Connection</a>->connected ())
00274 {
00275 <a class="code" href="a02980.html#NLNET_1_1CNamingClientv0">_Connection</a>->disconnect ();
00276 }
00277 <span class="keyword">delete</span> <a class="code" href="a02980.html#NLNET_1_1CNamingClientv0">_Connection</a>;
00278 <a class="code" href="a02980.html#NLNET_1_1CNamingClientv0">_Connection</a> = NULL;
00279 }
00280
00281 <span class="comment">// we don't call unregisterAllServices because when the naming service will see the disconnection,</span>
00282 <span class="comment">// it'll automatically unregister all services registered by this client.</span>
00283 }
</pre></div> </td>
</tr>
</table>
<a class="anchor" name="NLNET_1_1CNamingCliente3" doxytag="NLNET::CNamingClient::displayRegisteredServices" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> void NLNET::CNamingClient::displayRegisteredServices </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top"><a class="el" href="a02813.html">NLMISC::CLog</a> * </td>
<td class="mdname1" valign="top" nowrap> <em>log</em> = <a class="el" href="a05378.html#a13">NLMISC::DebugLog</a> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap><code> [inline, static]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
<p>
Definition at line <a class="el" href="a06090.html#l00172">172</a> of file <a class="el" href="a06090.html">naming_client.h</a>.
<p>
References <a class="el" href="a06089.html#l00063">RegisteredServices</a>, <a class="el" href="a02980.html#NLNET_1_1CNamingClientv4">RegisteredServicesMutex</a>, <a class="el" href="a05981.html#l00105">uint</a>, and <a class="el" href="a05981.html#l00098">uint16</a>.
<p>
<div class="fragment"><pre>00173 {
00174 <a class="code" href="a02980.html#NLNET_1_1CNamingClientv4">RegisteredServicesMutex</a>.enter ();
00175 log-><a class="code" href="a02813.html#NLNET_1_1CNetLoga7">displayNL</a> (<span class="stringliteral">"Display the %d registered services :"</span>, <a class="code" href="a02980.html#NLNET_1_1CNamingClientv3">RegisteredServices</a>.size());
00176 <span class="keywordflow">for</span> (std::list<CServiceEntry>::iterator it = <a class="code" href="a02980.html#NLNET_1_1CNamingClientv3">RegisteredServices</a>.begin(); it != <a class="code" href="a02980.html#NLNET_1_1CNamingClientv3">RegisteredServices</a>.end (); it++)
00177 {
00178 log-><a class="code" href="a02813.html#NLNET_1_1CNetLoga7">displayNL</a> (<span class="stringliteral">" > %s-%hu %d addr"</span>, (*it).Name.c_str(), (<a class="code" href="a04558.html#a9">uint16</a>)(*it).SId, (*it).Addr.size());
00179 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a15">uint</a> i = 0; i < (*it).Addr.size(); i++)
00180 log-><a class="code" href="a02813.html#NLNET_1_1CNetLoga7">displayNL</a> (<span class="stringliteral">" '%s'"</span>, (*it).Addr[i].asString().c_str());
00181 }
00182 log-><a class="code" href="a02813.html#NLNET_1_1CNetLoga7">displayNL</a> (<span class="stringliteral">"End of the list"</span>);
00183 <a class="code" href="a02980.html#NLNET_1_1CNamingClientv4">RegisteredServicesMutex</a>.leave ();
00184 }
</pre></div> </td>
</tr>
</table>
<a class="anchor" name="NLNET_1_1CNamingClienth0" doxytag="NLNET::CNamingClient::doReceiveLookupAnswer" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> void NLNET::CNamingClient::doReceiveLookupAnswer </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">const std::string & </td>
<td class="mdname" nowrap> <em>name</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap>std::vector< <a class="el" href="a02665.html">CInetAddress</a> > & </td>
<td class="mdname" nowrap> <em>addrs</em></td>
</tr>
<tr>
<td></td>
<td class="md">) </td>
<td class="md" colspan="2"><code> [static, private]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
</td>
</tr>
</table>
<a class="anchor" name="NLNET_1_1CNamingClienth1" doxytag="NLNET::CNamingClient::find" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> void NLNET::CNamingClient::find </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top"><a class="el" href="a05379.html#a93">TServiceId</a> </td>
<td class="mdname" nowrap> <em>sid</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap>std::vector< <a class="el" href="a02665.html">CInetAddress</a> > & </td>
<td class="mdname" nowrap> <em>addrs</em></td>
</tr>
<tr>
<td></td>
<td class="md">) </td>
<td class="md" colspan="2"><code> [inline, static, private]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
<p>
Definition at line <a class="el" href="a06090.html#l00220">220</a> of file <a class="el" href="a06090.html">naming_client.h</a>.
<p>
References <a class="el" href="a06089.html#l00063">RegisteredServices</a>, <a class="el" href="a02980.html#NLNET_1_1CNamingClientv4">RegisteredServicesMutex</a>, and <a class="el" href="a06090.html#l00042">NLNET::TServiceId</a>.
<p>
<div class="fragment"><pre>00221 {
00222 <a class="code" href="a02980.html#NLNET_1_1CNamingClientv4">RegisteredServicesMutex</a>.enter ();
00223 <span class="keywordflow">for</span> (std::list<CServiceEntry>::iterator it = <a class="code" href="a02980.html#NLNET_1_1CNamingClientv3">RegisteredServices</a>.begin(); it != <a class="code" href="a02980.html#NLNET_1_1CNamingClientv3">RegisteredServices</a>.end (); it++)
00224 <span class="keywordflow">if</span> (sid == (*it).SId)
00225 addrs.push_back ((*it).Addr[0]);
00226 <a class="code" href="a02980.html#NLNET_1_1CNamingClientv4">RegisteredServicesMutex</a>.leave ();
00227 }
</pre></div> </td>
</tr>
</table>
<a class="anchor" name="NLNET_1_1CNamingClienth2" doxytag="NLNET::CNamingClient::find" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> void NLNET::CNamingClient::find </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">const std::string & </td>
<td class="mdname" nowrap> <em>name</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap>std::vector< <a class="el" href="a02665.html">CInetAddress</a> > & </td>
<td class="mdname" nowrap> <em>addrs</em></td>
</tr>
<tr>
<td></td>
<td class="md">) </td>
<td class="md" colspan="2"><code> [inline, static, private]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
<p>
Definition at line <a class="el" href="a06090.html#l00211">211</a> of file <a class="el" href="a06090.html">naming_client.h</a>.
<p>
References <a class="el" href="a06089.html#l00063">RegisteredServices</a>, and <a class="el" href="a02980.html#NLNET_1_1CNamingClientv4">RegisteredServicesMutex</a>.
<p>
Referenced by <a class="el" href="a06089.html#l00432">lookup()</a>, <a class="el" href="a06089.html#l00494">lookupAll()</a>, and <a class="el" href="a06089.html#l00465">lookupAlternate()</a>.
<p>
<div class="fragment"><pre>00212 {
00213 <a class="code" href="a02980.html#NLNET_1_1CNamingClientv4">RegisteredServicesMutex</a>.enter ();
00214 <span class="keywordflow">for</span> (std::list<CServiceEntry>::iterator it = <a class="code" href="a02980.html#NLNET_1_1CNamingClientv3">RegisteredServices</a>.begin(); it != <a class="code" href="a02980.html#NLNET_1_1CNamingClientv3">RegisteredServices</a>.end (); it++)
00215 <span class="keywordflow">if</span> (name == (*it).Name)
00216 addrs.push_back ((*it).Addr[0]);
00217 <a class="code" href="a02980.html#NLNET_1_1CNamingClientv4">RegisteredServicesMutex</a>.leave ();
00218 }
</pre></div> </td>
</tr>
</table>
<a class="anchor" name="NLNET_1_1CNamingCliente4" doxytag="NLNET::CNamingClient::getRegisteredServices" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> const std::list<<a class="el" href="a02981.html">CServiceEntry</a>>& NLNET::CNamingClient::getRegisteredServices </td>
<td class="md" valign="top">( </td>
<td class="mdname1" valign="top" nowrap> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap><code> [inline, static]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
Returns all registered services.
<p>
Definition at line <a class="el" href="a06090.html#l00147">147</a> of file <a class="el" href="a06090.html">naming_client.h</a>.
<p>
References <a class="el" href="a06089.html#l00063">RegisteredServices</a>.
<p>
<div class="fragment"><pre>00147 { <span class="keywordflow">return</span> <a class="code" href="a02980.html#NLNET_1_1CNamingClientv3">RegisteredServices</a>; }
</pre></div> </td>
</tr>
</table>
<a class="anchor" name="NLNET_1_1CNamingCliente5" doxytag="NLNET::CNamingClient::info" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> string NLNET::CNamingClient::info </td>
<td class="md" valign="top">( </td>
<td class="mdname1" valign="top" nowrap> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap><code> [static]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
Returns information about the naming connection (connected or not, which naming service and so on).
<p>
<p>
Definition at line <a class="el" href="a06089.html#l00285">285</a> of file <a class="el" href="a06089.html">naming_client.cpp</a>.
<p>
References <a class="el" href="a05810.html#l00385">NLNET::CInetAddress::asString()</a>, <a class="el" href="a06090.html#l00079">connected()</a>, <a class="el" href="a05507.html#l00169">NLNET::CBufClient::remoteAddress()</a>, and <a class="el" href="a05646.html#l01119">res</a>.
<p>
<div class="fragment"><pre>00286 {
00287 string <a class="code" href="a04223.html#a643">res</a>;
00288
00289 <span class="keywordflow">if</span> (<a class="code" href="a02980.html#NLNET_1_1CNamingCliente1">connected</a> ())
00290 {
00291 <a class="code" href="a04223.html#a643">res</a> = <span class="stringliteral">"connected to "</span>;
00292 <a class="code" href="a04223.html#a643">res</a> += <a class="code" href="a02980.html#NLNET_1_1CNamingClientv0">_Connection</a>->remoteAddress().asString();
00293 }
00294 <span class="keywordflow">else</span>
00295 {
00296 <a class="code" href="a04223.html#a643">res</a> = <span class="stringliteral">"Not connected"</span>;
00297 }
00298
00299 <span class="keywordflow">return</span> <a class="code" href="a04223.html#a643">res</a>;
00300 }
</pre></div> </td>
</tr>
</table>
<a class="anchor" name="NLNET_1_1CNamingCliente6" doxytag="NLNET::CNamingClient::lookup" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> bool NLNET::CNamingClient::lookup </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top"><a class="el" href="a05379.html#a93">TServiceId</a> </td>
<td class="mdname" nowrap> <em>sid</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap><a class="el" href="a02665.html">CInetAddress</a> & </td>
<td class="mdname" nowrap> <em>addr</em></td>
</tr>
<tr>
<td></td>
<td class="md">) </td>
<td class="md" colspan="2"><code> [static]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
Same as lookup(const string&, CInetAddress&, uint16&).
<p>
<p>
Definition at line <a class="el" href="a06089.html#l00448">448</a> of file <a class="el" href="a06089.html">naming_client.cpp</a>.
<p>
References <a class="el" href="a05646.html#l01127">addr</a>, <a class="el" href="a05525.html#l00069">NLNET::CCallbackClient::connected()</a>, <a class="el" href="a06090.html#l00211">find()</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, and <a class="el" href="a06090.html#l00042">NLNET::TServiceId</a>.
<p>
<div class="fragment"><pre>00449 {
00450 <a class="code" href="a04199.html#a6">nlassert</a> (_Connection != NULL && <a class="code" href="a02980.html#NLNET_1_1CNamingClientv0">_Connection</a>->connected ());
00451
00452 vector<CInetAddress> addrs;
00453 <a class="code" href="a02980.html#NLNET_1_1CNamingClienth2">find</a> (sid, addrs);
00454
00455 <span class="keywordflow">if</span> (addrs.size()==0)
00456 <span class="keywordflow">return</span> <span class="keyword">false</span>;
00457
00458 <a class="code" href="a04199.html#a6">nlassert</a> (addrs.size()==1);
00459 <a class="code" href="a04223.html#a657">addr</a> = addrs[0];
00460
00461 <span class="keywordflow">return</span> <span class="keyword">true</span>;
00462 }
</pre></div> </td>
</tr>
</table>
<a class="anchor" name="NLNET_1_1CNamingCliente7" doxytag="NLNET::CNamingClient::lookup" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> bool NLNET::CNamingClient::lookup </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">const std::string & </td>
<td class="mdname" nowrap> <em>name</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap><a class="el" href="a02665.html">CInetAddress</a> & </td>
<td class="mdname" nowrap> <em>addr</em></td>
</tr>
<tr>
<td></td>
<td class="md">) </td>
<td class="md" colspan="2"><code> [static]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
Returns true and the address of the specified service if it is found, otherwise returns false <dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign=top><em>name</em> </td><td>[in] Short name of the service to find </td></tr>
<tr><td valign=top><em>addr</em> </td><td>[out] Address of the service </td></tr>
<tr><td valign=top><em>validitytime</em> </td><td>[out] After this number of seconds are elapsed, another lookup will be necessary before sending a message to the service </td></tr>
</table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd>true if all worked fine</dd></dl>
<p>
Definition at line <a class="el" href="a06089.html#l00432">432</a> of file <a class="el" href="a06089.html">naming_client.cpp</a>.
<p>
References <a class="el" href="a05646.html#l01127">addr</a>, <a class="el" href="a05525.html#l00069">NLNET::CCallbackClient::connected()</a>, <a class="el" href="a06090.html#l00211">find()</a>, and <a class="el" href="a05622.html#l00290">nlassert</a>.
<p>
<div class="fragment"><pre>00433 {
00434 <a class="code" href="a04199.html#a6">nlassert</a> (_Connection != NULL && <a class="code" href="a02980.html#NLNET_1_1CNamingClientv0">_Connection</a>->connected ());
00435
00436 vector<CInetAddress> addrs;
00437 <a class="code" href="a02980.html#NLNET_1_1CNamingClienth2">find</a> (name, addrs);
00438
00439 <span class="keywordflow">if</span> (addrs.size()==0)
00440 <span class="keywordflow">return</span> <span class="keyword">false</span>;
00441
00442 <a class="code" href="a04199.html#a6">nlassert</a> (addrs.size()==1);
00443 <a class="code" href="a04223.html#a657">addr</a> = addrs[0];
00444
00445 <span class="keywordflow">return</span> <span class="keyword">true</span>;
00446 }
</pre></div> </td>
</tr>
</table>
<a class="anchor" name="NLNET_1_1CNamingCliente8" doxytag="NLNET::CNamingClient::lookupAll" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> void NLNET::CNamingClient::lookupAll </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">const std::string & </td>
<td class="mdname" nowrap> <em>name</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap>std::vector< <a class="el" href="a02665.html">CInetAddress</a> > & </td>
<td class="mdname" nowrap> <em>addresses</em></td>
</tr>
<tr>
<td></td>
<td class="md">) </td>
<td class="md" colspan="2"><code> [static]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
Returns all services corresponding to the specified short name. Ex: lookupAll ("AS", addresses);
<p>
Definition at line <a class="el" href="a06089.html#l00494">494</a> of file <a class="el" href="a06089.html">naming_client.cpp</a>.
<p>
References <a class="el" href="a05525.html#l00069">NLNET::CCallbackClient::connected()</a>, <a class="el" href="a06090.html#l00211">find()</a>, and <a class="el" href="a05622.html#l00290">nlassert</a>.
<p>
<div class="fragment"><pre>00495 {
00496 <a class="code" href="a04199.html#a6">nlassert</a> (_Connection != NULL && <a class="code" href="a02980.html#NLNET_1_1CNamingClientv0">_Connection</a>->connected ());
00497
00498 <a class="code" href="a02980.html#NLNET_1_1CNamingClienth2">find</a> (name, addrs);
00499 }
</pre></div> </td>
</tr>
</table>
<a class="anchor" name="NLNET_1_1CNamingCliente9" doxytag="NLNET::CNamingClient::lookupAlternate" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> bool NLNET::CNamingClient::lookupAlternate </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">const std::string & </td>
<td class="mdname" nowrap> <em>name</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap><a class="el" href="a02665.html">CInetAddress</a> & </td>
<td class="mdname" nowrap> <em>addr</em></td>
</tr>
<tr>
<td></td>
<td class="md">) </td>
<td class="md" colspan="2"><code> [static]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
Tells the Naming Service the specified address does not respond for the specified service, and returns true and another address for the service if available, otherwise returns false <dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign=top><em>name</em> </td><td>[in] Short name of the service to find </td></tr>
<tr><td valign=top><em>addr</em> </td><td>[in/out] In: Address of the service that does not respond. Out: Alternative address </td></tr>
<tr><td valign=top><em>validitytime</em> </td><td>[out] After this number of seconds are elapsed, another lookup will be necessary before sending a message to the service </td></tr>
</table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd>true if all worked fine.</dd></dl>
<p>
Definition at line <a class="el" href="a06089.html#l00465">465</a> of file <a class="el" href="a06089.html">naming_client.cpp</a>.
<p>
References <a class="el" href="a05646.html#l01127">addr</a>, <a class="el" href="a05525.html#l00069">NLNET::CCallbackClient::connected()</a>, <a class="el" href="a06090.html#l00211">find()</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a06089.html#l00063">RegisteredServices</a>, and <a class="el" href="a02980.html#NLNET_1_1CNamingClientv4">RegisteredServicesMutex</a>.
<p>
<div class="fragment"><pre>00466 {
00467 <a class="code" href="a04199.html#a6">nlassert</a> (_Connection != NULL && <a class="code" href="a02980.html#NLNET_1_1CNamingClientv0">_Connection</a>->connected ());
00468
00469 <span class="comment">// remove it from his local list</span>
00470
00471 <a class="code" href="a02980.html#NLNET_1_1CNamingClientv4">RegisteredServicesMutex</a>.enter ();
00472 <span class="keywordflow">for</span> (std::list<CServiceEntry>::iterator it = <a class="code" href="a02980.html#NLNET_1_1CNamingClientv3">RegisteredServices</a>.begin(); it != <a class="code" href="a02980.html#NLNET_1_1CNamingClientv3">RegisteredServices</a>.end (); it++)
00473 {
00474 <span class="keywordflow">if</span> ((*it).Addr[0] == <a class="code" href="a04223.html#a657">addr</a>)
00475 {
00476 <a class="code" href="a02980.html#NLNET_1_1CNamingClientv3">RegisteredServices</a>.erase (it);
00477 <span class="keywordflow">break</span>;
00478 }
00479 }
00480 <a class="code" href="a02980.html#NLNET_1_1CNamingClientv4">RegisteredServicesMutex</a>.leave ();
00481
00482 vector<CInetAddress> addrs;
00483 <a class="code" href="a02980.html#NLNET_1_1CNamingClienth2">find</a> (name, addrs);
00484
00485 <span class="keywordflow">if</span> (addrs.size()==0)
00486 <span class="keywordflow">return</span> <span class="keyword">false</span>;
00487
00488 <a class="code" href="a04199.html#a6">nlassert</a> (addrs.size()==1);
00489 <a class="code" href="a04223.html#a657">addr</a> = addrs[0];
00490
00491 <span class="keywordflow">return</span> <span class="keyword">true</span>;
00492 }
</pre></div> </td>
</tr>
</table>
<a class="anchor" name="NLNET_1_1CNamingCliente10" doxytag="NLNET::CNamingClient::lookupAndConnect" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> bool NLNET::CNamingClient::lookupAndConnect </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">const std::string & </td>
<td class="mdname" nowrap> <em>name</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap><a class="el" href="a02305.html">CCallbackClient</a> & </td>
<td class="mdname" nowrap> <em>sock</em></td>
</tr>
<tr>
<td></td>
<td class="md">) </td>
<td class="md" colspan="2"><code> [static]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
Obtains a socket connected to a service providing the service <em>name</em>. In case of failure to connect, the method informs the Naming Service and tries to get another service. <dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign=top><em>name</em> </td><td>[in] Short name of the service to find and connected </td></tr>
<tr><td valign=top><em>sock</em> </td><td>[out] The connected socket. </td></tr>
<tr><td valign=top><em>validitytime</em> </td><td>[out] After this number of seconds are elapsed, another lookup will be necessary before sending a message to the service. </td></tr>
</table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd>false if the service was not found.</dd></dl>
<p>
Definition at line <a class="el" href="a06089.html#l00501">501</a> of file <a class="el" href="a06089.html">naming_client.cpp</a>.
<p>
References <a class="el" href="a05810.html#l00385">NLNET::CInetAddress::asString()</a>, <a class="el" href="a05524.html#l00286">NLNET::CCallbackClient::connect()</a>, <a class="el" href="a05525.html#l00069">NLNET::CCallbackClient::connected()</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, and <a class="el" href="a05622.html#l00101">nldebug</a>.
<p>
<div class="fragment"><pre>00502 {
00503 <a class="code" href="a04199.html#a6">nlassert</a> (_Connection != NULL && <a class="code" href="a02980.html#NLNET_1_1CNamingClientv0">_Connection</a>->connected ());
00504
00505 <span class="comment">// look up for service</span>
00506 <a class="code" href="a02665.html">CInetAddress</a> servaddr;
00507
00508 <span class="comment">// if service not found, return false</span>
00509 <span class="keywordflow">if</span> (!CNamingClient::lookup (name, servaddr))
00510 <span class="keywordflow">return</span> <span class="keyword">false</span>;
00511
00512 <span class="keywordflow">do</span>
00513 {
00514 <span class="keywordflow">try</span>
00515 {
00516 <span class="comment">// try to connect to the server</span>
00517 sock.connect (servaddr);
00518
00519 <span class="comment">// connection succeeded</span>
00520 <span class="keywordflow">return</span> <span class="keyword">true</span>;
00521 }
00522 <span class="keywordflow">catch</span> (ESocketConnectionFailed &e)
00523 {
00524 <a class="code" href="a04199.html#a0">nldebug</a>( <span class="stringliteral">"NC: Connection to %s failed: %s, tring another service if available"</span>, servaddr.<a class="code" href="a02665.html#NLNET_1_1CInetAddressa1">asString</a>().c_str(), e.what() );
00525
00526 <span class="comment">// try another server and if service is not found, return false</span>
00527 <span class="keywordflow">if</span> (!CNamingClient::lookupAlternate (name, servaddr))
00528 <span class="keywordflow">return</span> <span class="keyword">false</span>;
00529 }
00530 }
00531 <span class="keywordflow">while</span> (<span class="keyword">true</span>);
00532 }
</pre></div> </td>
</tr>
</table>
<a class="anchor" name="NLNET_1_1CNamingCliente11" doxytag="NLNET::CNamingClient::queryServicePort" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a9">uint16</a> NLNET::CNamingClient::queryServicePort </td>
<td class="md" valign="top">( </td>
<td class="mdname1" valign="top" nowrap> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap><code> [static]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
Requests the naming service to choose a port for the service <dl compact><dt><b>Returns:</b></dt><dd>An empty port number</dd></dl>
<p>
Definition at line <a class="el" href="a06089.html#l00411">411</a> of file <a class="el" href="a06089.html">naming_client.cpp</a>.
<p>
References <a class="el" href="a06089.html#l00544">checkThreadId()</a>, <a class="el" href="a05525.html#l00069">NLNET::CCallbackClient::connected()</a>, <a class="el" href="a05527.html#l00129">NLNET::CCallbackNetBase::getSIDA()</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a05622.html#l00111">nlinfo</a>, <a class="el" href="a05586.html#l00073">NLMISC::nlSleep()</a>, <a class="el" href="a06089.html#l00106">NLNET::QueryPort</a>, <a class="el" href="a06089.html#l00107">NLNET::QueryPortPort</a>, <a class="el" href="a05524.html#l00079">NLNET::CCallbackClient::send()</a>, <a class="el" href="a05981.html#l00098">uint16</a>, and <a class="el" href="a05524.html#l00162">NLNET::CCallbackClient::update()</a>.
<p>
<div class="fragment"><pre>00412 {
00413 <a class="code" href="a02980.html#NLNET_1_1CNamingClientf0">checkThreadId</a> ();
00414 <a class="code" href="a04199.html#a6">nlassert</a> (_Connection != NULL && <a class="code" href="a02980.html#NLNET_1_1CNamingClientv0">_Connection</a>->connected ());
00415
00416 <a class="code" href="a02918.html">CMessage</a> msgout (<a class="code" href="a02980.html#NLNET_1_1CNamingClientv0">_Connection</a>->getSIDA(), <span class="stringliteral">"QP"</span>);
00417 <a class="code" href="a02980.html#NLNET_1_1CNamingClientv0">_Connection</a>->send (msgout);
00418
00419 <span class="comment">// wait the answer of the naming service "QP"</span>
00420 <a class="code" href="a05379.html#a39">QueryPort</a> = <span class="keyword">false</span>;
00421 <span class="keywordflow">while</span> (!<a class="code" href="a05379.html#a39">QueryPort</a>)
00422 {
00423 <a class="code" href="a02980.html#NLNET_1_1CNamingClientv0">_Connection</a>->update (-1);
00424 <a class="code" href="a05378.html#a256">nlSleep</a> (1);
00425 }
00426
00427 <a class="code" href="a04199.html#a1">nlinfo</a> (<span class="stringliteral">"NC: Received the answer of the query port (%hu)"</span>, QueryPortPort);
00428
00429 <span class="keywordflow">return</span> <a class="code" href="a05379.html#a40">QueryPortPort</a>;
00430 }
</pre></div> </td>
</tr>
</table>
<a class="anchor" name="NLNET_1_1CNamingCliente12" doxytag="NLNET::CNamingClient::registerService" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> bool NLNET::CNamingClient::registerService </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">const std::string & </td>
<td class="mdname" nowrap> <em>name</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap>const std::vector< <a class="el" href="a02665.html">CInetAddress</a> > & </td>
<td class="mdname" nowrap> <em>addr</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap><a class="el" href="a05379.html#a93">TServiceId</a> & </td>
<td class="mdname" nowrap> <em>sid</em></td>
</tr>
<tr>
<td></td>
<td class="md">) </td>
<td class="md" colspan="2"><code> [static]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
Register a service within the naming service. Returns false if the registration failed.
<p>
Definition at line <a class="el" href="a06089.html#l00302">302</a> of file <a class="el" href="a06089.html">naming_client.cpp</a>.
<p>
References <a class="el" href="a06089.html#l00060">_MySId</a>, <a class="el" href="a06089.html#l00053">_RegisteredServices</a>, <a class="el" href="a05646.html#l01127">addr</a>, <a class="el" href="a06089.html#l00544">checkThreadId()</a>, <a class="el" href="a05525.html#l00069">NLNET::CCallbackClient::connected()</a>, <a class="el" href="a05527.html#l00129">NLNET::CCallbackNetBase::getSIDA()</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a05622.html#l00101">nldebug</a>, <a class="el" href="a05586.html#l00073">NLMISC::nlSleep()</a>, <a class="el" href="a05622.html#l00135">nlwarning</a>, <a class="el" href="a06089.html#l00083">NLNET::Reason</a>, <a class="el" href="a06089.html#l00080">NLNET::Registered</a>, <a class="el" href="a06089.html#l00082">NLNET::RegisteredSID</a>, <a class="el" href="a06089.html#l00081">NLNET::RegisteredSuccess</a>, <a class="el" href="a05524.html#l00079">NLNET::CCallbackClient::send()</a>, <a class="el" href="a05979.html#l00420">NLMISC::CMemStream::serial()</a>, <a class="el" href="a05979.html#l00423">NLMISC::CMemStream::serialCont()</a>, <a class="el" href="a06090.html#l00042">NLNET::TServiceId</a>, <a class="el" href="a05981.html#l00098">uint16</a>, and <a class="el" href="a05524.html#l00162">NLNET::CCallbackClient::update()</a>.
<p>
<div class="fragment"><pre>00303 {
00304 <a class="code" href="a02980.html#NLNET_1_1CNamingClientf0">checkThreadId</a> ();
00305 <a class="code" href="a04199.html#a6">nlassert</a> (_Connection != NULL && <a class="code" href="a02980.html#NLNET_1_1CNamingClientv0">_Connection</a>->connected ());
00306
00307 <a class="code" href="a02918.html">CMessage</a> msgout (<a class="code" href="a02980.html#NLNET_1_1CNamingClientv0">_Connection</a>->getSIDA(), <span class="stringliteral">"RG"</span>);
00308 msgout.<a class="code" href="a02271.html#NLNET_1_1CMessagea41">serial</a> (const_cast<std::string&>(name));
00309 msgout.<a class="code" href="a02271.html#NLNET_1_1CMessagea54">serialCont</a> (<span class="keyword">const_cast</span><vector<CInetAddress>&>(addr));
00310 sid = 0;
00311 msgout.<a class="code" href="a02271.html#NLNET_1_1CMessagea41">serial</a> (sid);
00312 <a class="code" href="a02980.html#NLNET_1_1CNamingClientv0">_Connection</a>->send (msgout);
00313
00314 <span class="comment">// wait the answer of the naming service "RG"</span>
00315 <a class="code" href="a05379.html#a35">Registered</a> = <span class="keyword">false</span>;
00316 <a class="code" href="a05379.html#a37">RegisteredSID</a> = &sid;
00317 <span class="keywordflow">while</span> (!<a class="code" href="a05379.html#a35">Registered</a>)
00318 {
00319 <a class="code" href="a02980.html#NLNET_1_1CNamingClientv0">_Connection</a>->update (-1);
00320 <a class="code" href="a05378.html#a256">nlSleep</a> (1);
00321 }
00322 <span class="keywordflow">if</span> (<a class="code" href="a05379.html#a36">RegisteredSuccess</a>)
00323 {
00324 <a class="code" href="a02980.html#NLNET_1_1CNamingClientv1">_MySId</a> = sid;
00325 <a class="code" href="a02980.html#NLNET_1_1CNamingClientv2">_RegisteredServices</a>.insert (make_pair (*RegisteredSID, name));
00326 <a class="code" href="a04199.html#a0">nldebug</a> (<span class="stringliteral">"NC: Registered service %s-%hu at %s"</span>, name.c_str(), (<a class="code" href="a04558.html#a9">uint16</a>)sid, <a class="code" href="a04223.html#a657">addr</a>[0].asString().c_str());
00327 }
00328 <span class="keywordflow">else</span>
00329 {
00330 <a class="code" href="a04199.html#a0">nldebug</a> (<span class="stringliteral">"NC: Naming service refused to register service %s at %s"</span>, name.c_str(), <a class="code" href="a04223.html#a657">addr</a>[0].asString().c_str());
00331 <a class="code" href="a04199.html#a2">nlwarning</a> (<span class="stringliteral">"NC: Startup denied: %s"</span>, <a class="code" href="a05379.html#a38">Reason</a>.c_str());
00332 <a class="code" href="a05379.html#a38">Reason</a>.clear();
00333 }
00334
00335 <a class="code" href="a05379.html#a37">RegisteredSID</a> = NULL;
00336
00337 <span class="keywordflow">return</span> <a class="code" href="a05379.html#a36">RegisteredSuccess</a>;
00338 }
</pre></div> </td>
</tr>
</table>
<a class="anchor" name="NLNET_1_1CNamingCliente13" doxytag="NLNET::CNamingClient::registerServiceWithSId" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> bool NLNET::CNamingClient::registerServiceWithSId </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">const std::string & </td>
<td class="mdname" nowrap> <em>name</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap>const std::vector< <a class="el" href="a02665.html">CInetAddress</a> > & </td>
<td class="mdname" nowrap> <em>addr</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap><a class="el" href="a05379.html#a93">TServiceId</a> </td>
<td class="mdname" nowrap> <em>sid</em></td>
</tr>
<tr>
<td></td>
<td class="md">) </td>
<td class="md" colspan="2"><code> [static]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
Register a service within the naming service, using a specified service identifier. Returns false if the service identifier is unavailable i.e. the registration failed.
<p>
Definition at line <a class="el" href="a06089.html#l00340">340</a> of file <a class="el" href="a06089.html">naming_client.cpp</a>.
<p>
References <a class="el" href="a06089.html#l00060">_MySId</a>, <a class="el" href="a06089.html#l00053">_RegisteredServices</a>, <a class="el" href="a05646.html#l01127">addr</a>, <a class="el" href="a06089.html#l00544">checkThreadId()</a>, <a class="el" href="a05525.html#l00069">NLNET::CCallbackClient::connected()</a>, <a class="el" href="a05527.html#l00129">NLNET::CCallbackNetBase::getSIDA()</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a05622.html#l00101">nldebug</a>, <a class="el" href="a05622.html#l00154">nlerror</a>, <a class="el" href="a05586.html#l00073">NLMISC::nlSleep()</a>, <a class="el" href="a06089.html#l00080">NLNET::Registered</a>, <a class="el" href="a06089.html#l00082">NLNET::RegisteredSID</a>, <a class="el" href="a06089.html#l00081">NLNET::RegisteredSuccess</a>, <a class="el" href="a05524.html#l00079">NLNET::CCallbackClient::send()</a>, <a class="el" href="a05979.html#l00420">NLMISC::CMemStream::serial()</a>, <a class="el" href="a05979.html#l00423">NLMISC::CMemStream::serialCont()</a>, <a class="el" href="a06090.html#l00042">NLNET::TServiceId</a>, <a class="el" href="a05981.html#l00098">uint16</a>, and <a class="el" href="a05524.html#l00162">NLNET::CCallbackClient::update()</a>.
<p>
<div class="fragment"><pre>00341 {
00342 <a class="code" href="a02980.html#NLNET_1_1CNamingClientf0">checkThreadId</a> ();
00343 <a class="code" href="a04199.html#a6">nlassert</a> (_Connection != NULL && <a class="code" href="a02980.html#NLNET_1_1CNamingClientv0">_Connection</a>->connected ());
00344
00345 <a class="code" href="a02918.html">CMessage</a> msgout (<a class="code" href="a02980.html#NLNET_1_1CNamingClientv0">_Connection</a>->getSIDA(), <span class="stringliteral">"RG"</span>);
00346 msgout.<a class="code" href="a02271.html#NLNET_1_1CMessagea41">serial</a> (const_cast<std::string&>(name));
00347 msgout.<a class="code" href="a02271.html#NLNET_1_1CMessagea54">serialCont</a> (<span class="keyword">const_cast</span><vector<CInetAddress>&>(addr));
00348 msgout.<a class="code" href="a02271.html#NLNET_1_1CMessagea41">serial</a> (sid);
00349 <a class="code" href="a02980.html#NLNET_1_1CNamingClientv0">_Connection</a>->send (msgout);
00350
00351 <span class="comment">// wait the answer of the naming service "RGI"</span>
00352 <a class="code" href="a05379.html#a35">Registered</a> = <span class="keyword">false</span>;
00353 <a class="code" href="a05379.html#a37">RegisteredSID</a> = &sid;
00354 <span class="keywordflow">while</span> (!<a class="code" href="a05379.html#a35">Registered</a>)
00355 {
00356 <a class="code" href="a02980.html#NLNET_1_1CNamingClientv0">_Connection</a>->update (-1);
00357 <a class="code" href="a05378.html#a256">nlSleep</a> (1);
00358 }
00359 <span class="keywordflow">if</span> (<a class="code" href="a05379.html#a36">RegisteredSuccess</a>)
00360 {
00361 <a class="code" href="a02980.html#NLNET_1_1CNamingClientv1">_MySId</a> = sid;
00362 <a class="code" href="a02980.html#NLNET_1_1CNamingClientv2">_RegisteredServices</a>.insert (make_pair (*RegisteredSID, name));
00363 <a class="code" href="a04199.html#a0">nldebug</a> (<span class="stringliteral">"NC: Registered service with sid %s-%hu at %s"</span>, name.c_str(), (<a class="code" href="a04558.html#a9">uint16</a>)*<a class="code" href="a05379.html#a37">RegisteredSID</a>, <a class="code" href="a04223.html#a657">addr</a>[0].asString().c_str());
00364 }
00365 <span class="keywordflow">else</span>
00366 {
00367 <a class="code" href="a04199.html#a3">nlerror</a> (<span class="stringliteral">"NC: Naming service refused to register service with sid %s at %s"</span>, name.c_str(), <a class="code" href="a04223.html#a657">addr</a>[0].asString().c_str());
00368 }
00369
00370 <span class="keywordflow">return</span> <a class="code" href="a05379.html#a36">RegisteredSuccess</a> == 1;
00371 }
</pre></div> </td>
</tr>
</table>
<a class="anchor" name="NLNET_1_1CNamingCliente14" doxytag="NLNET::CNamingClient::resendRegisteration" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> void NLNET::CNamingClient::resendRegisteration </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">const std::string & </td>
<td class="mdname" nowrap> <em>name</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap>const std::vector< <a class="el" href="a02665.html">CInetAddress</a> > & </td>
<td class="mdname" nowrap> <em>addr</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap><a class="el" href="a05379.html#a93">TServiceId</a> </td>
<td class="mdname" nowrap> <em>sid</em></td>
</tr>
<tr>
<td></td>
<td class="md">) </td>
<td class="md" colspan="2"><code> [static]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
If the NS is down and goes up, we have to send it again the registration. But in this case, the NS must not send a registration broadcast, so we have a special message
<p>
Definition at line <a class="el" href="a06089.html#l00373">373</a> of file <a class="el" href="a06089.html">naming_client.cpp</a>.
<p>
References <a class="el" href="a05646.html#l01127">addr</a>, <a class="el" href="a06089.html#l00544">checkThreadId()</a>, <a class="el" href="a05525.html#l00069">NLNET::CCallbackClient::connected()</a>, <a class="el" href="a05527.html#l00129">NLNET::CCallbackNetBase::getSIDA()</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a05524.html#l00079">NLNET::CCallbackClient::send()</a>, <a class="el" href="a05979.html#l00420">NLMISC::CMemStream::serial()</a>, <a class="el" href="a05979.html#l00423">NLMISC::CMemStream::serialCont()</a>, and <a class="el" href="a06090.html#l00042">NLNET::TServiceId</a>.
<p>
<div class="fragment"><pre>00374 {
00375 <a class="code" href="a02980.html#NLNET_1_1CNamingClientf0">checkThreadId</a> ();
00376 <a class="code" href="a04199.html#a6">nlassert</a> (_Connection != NULL && <a class="code" href="a02980.html#NLNET_1_1CNamingClientv0">_Connection</a>->connected ());
00377
00378 <a class="code" href="a02918.html">CMessage</a> msgout (<a class="code" href="a02980.html#NLNET_1_1CNamingClientv0">_Connection</a>->getSIDA(), <span class="stringliteral">"RRG"</span>);
00379 msgout.<a class="code" href="a02271.html#NLNET_1_1CMessagea41">serial</a> (const_cast<std::string&>(name));
00380 msgout.<a class="code" href="a02271.html#NLNET_1_1CMessagea54">serialCont</a> (<span class="keyword">const_cast</span><vector<CInetAddress>&>(addr));
00381 msgout.<a class="code" href="a02271.html#NLNET_1_1CMessagea41">serial</a> (sid);
00382 <a class="code" href="a02980.html#NLNET_1_1CNamingClientv0">_Connection</a>->send (msgout);
00383 }
</pre></div> </td>
</tr>
</table>
<a class="anchor" name="NLNET_1_1CNamingCliente15" doxytag="NLNET::CNamingClient::setRegistrationBroadcastCallback" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> void NLNET::CNamingClient::setRegistrationBroadcastCallback </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top"><a class="el" href="a05379.html#a94">TBroadcastCallback</a> </td>
<td class="mdname1" valign="top" nowrap> <em>cb</em> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap><code> [static]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
You can link a callback if you want to know when a new service is registered (NULL to disable callback).
<p>
<p>
Definition at line <a class="el" href="a06089.html#l00066">66</a> of file <a class="el" href="a06089.html">naming_client.cpp</a>.
<p>
References <a class="el" href="a06089.html#l00055">NLNET::_RegistrationBroadcastCallback</a>, and <a class="el" href="a06090.html#l00044">NLNET::TBroadcastCallback</a>.
<p>
<div class="fragment"><pre>00067 {
00068 <a class="code" href="a05379.html#a33">_RegistrationBroadcastCallback</a> = cb;
00069 }
</pre></div> </td>
</tr>
</table>
<a class="anchor" name="NLNET_1_1CNamingCliente16" doxytag="NLNET::CNamingClient::setUnregistrationBroadcastCallback" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> void NLNET::CNamingClient::setUnregistrationBroadcastCallback </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top"><a class="el" href="a05379.html#a94">TBroadcastCallback</a> </td>
<td class="mdname1" valign="top" nowrap> <em>cb</em> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap><code> [static]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
You can link a callback if you want to know when a new service is unregistered (NULL to disable callback).
<p>
<p>
Definition at line <a class="el" href="a06089.html#l00071">71</a> of file <a class="el" href="a06089.html">naming_client.cpp</a>.
<p>
References <a class="el" href="a06089.html#l00056">NLNET::_UnregistrationBroadcastCallback</a>, and <a class="el" href="a06090.html#l00044">NLNET::TBroadcastCallback</a>.
<p>
<div class="fragment"><pre>00072 {
00073 <a class="code" href="a05379.html#a34">_UnregistrationBroadcastCallback</a> = cb;
00074 }
</pre></div> </td>
</tr>
</table>
<a class="anchor" name="NLNET_1_1CNamingCliente17" doxytag="NLNET::CNamingClient::unregisterAllServices" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> void NLNET::CNamingClient::unregisterAllServices </td>
<td class="md" valign="top">( </td>
<td class="mdname1" valign="top" nowrap> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap><code> [static]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
Unregister all services registered by this client. You don't have to.
<p>
<p>
Definition at line <a class="el" href="a06089.html#l00398">398</a> of file <a class="el" href="a06089.html">naming_client.cpp</a>.
<p>
References <a class="el" href="a06089.html#l00053">_RegisteredServices</a>, <a class="el" href="a06089.html#l00544">checkThreadId()</a>, <a class="el" href="a05525.html#l00069">NLNET::CCallbackClient::connected()</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a06090.html#l00042">NLNET::TServiceId</a>, and <a class="el" href="a06089.html#l00385">unregisterService()</a>.
<p>
<div class="fragment"><pre>00399 {
00400 <a class="code" href="a02980.html#NLNET_1_1CNamingClientf0">checkThreadId</a> ();
00401 <a class="code" href="a04199.html#a6">nlassert</a> (_Connection != NULL && <a class="code" href="a02980.html#NLNET_1_1CNamingClientv0">_Connection</a>->connected ());
00402
00403 <span class="keywordflow">while</span> (!<a class="code" href="a02980.html#NLNET_1_1CNamingClientv2">_RegisteredServices</a>.empty())
00404 {
00405 TRegServices::iterator irs = <a class="code" href="a02980.html#NLNET_1_1CNamingClientv2">_RegisteredServices</a>.begin();
00406 <a class="code" href="a05379.html#a93">TServiceId</a> sid = (*irs).first;
00407 <a class="code" href="a02980.html#NLNET_1_1CNamingCliente18">unregisterService</a> (sid);
00408 }
00409 }
</pre></div> </td>
</tr>
</table>
<a class="anchor" name="NLNET_1_1CNamingCliente18" doxytag="NLNET::CNamingClient::unregisterService" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> void NLNET::CNamingClient::unregisterService </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top"><a class="el" href="a05379.html#a93">TServiceId</a> </td>
<td class="mdname1" valign="top" nowrap> <em>sid</em> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap><code> [static]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
Unregister a service from the naming service, service identifier.
<p>
<p>
Definition at line <a class="el" href="a06089.html#l00385">385</a> of file <a class="el" href="a06089.html">naming_client.cpp</a>.
<p>
References <a class="el" href="a06089.html#l00053">_RegisteredServices</a>, <a class="el" href="a06089.html#l00544">checkThreadId()</a>, <a class="el" href="a05525.html#l00069">NLNET::CCallbackClient::connected()</a>, <a class="el" href="a05527.html#l00129">NLNET::CCallbackNetBase::getSIDA()</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a05622.html#l00101">nldebug</a>, <a class="el" href="a05524.html#l00079">NLNET::CCallbackClient::send()</a>, <a class="el" href="a05979.html#l00420">NLMISC::CMemStream::serial()</a>, and <a class="el" href="a06090.html#l00042">NLNET::TServiceId</a>.
<p>
Referenced by <a class="el" href="a06089.html#l00398">unregisterAllServices()</a>.
<p>
<div class="fragment"><pre>00386 {
00387 <a class="code" href="a02980.html#NLNET_1_1CNamingClientf0">checkThreadId</a> ();
00388 <a class="code" href="a04199.html#a6">nlassert</a> (_Connection != NULL && <a class="code" href="a02980.html#NLNET_1_1CNamingClientv0">_Connection</a>->connected ());
00389
00390 <a class="code" href="a02918.html">CMessage</a> msgout (<a class="code" href="a02980.html#NLNET_1_1CNamingClientv0">_Connection</a>->getSIDA(), <span class="stringliteral">"UNI"</span>);
00391 msgout.<a class="code" href="a02271.html#NLNET_1_1CMessagea41">serial</a> (sid);
00392 <a class="code" href="a02980.html#NLNET_1_1CNamingClientv0">_Connection</a>->send (msgout);
00393
00394 <a class="code" href="a04199.html#a0">nldebug</a> (<span class="stringliteral">"NC: Unregistering service %s-%hu"</span>, _RegisteredServices[sid].c_str(), sid);
00395 <a class="code" href="a02980.html#NLNET_1_1CNamingClientv2">_RegisteredServices</a>.erase (sid);
00396 }
</pre></div> </td>
</tr>
</table>
<a class="anchor" name="NLNET_1_1CNamingCliente19" doxytag="NLNET::CNamingClient::update" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> void NLNET::CNamingClient::update </td>
<td class="md" valign="top">( </td>
<td class="mdname1" valign="top" nowrap> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap><code> [static]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
Call it evenly.
<p>
<p>
Definition at line <a class="el" href="a06089.html#l00536">536</a> of file <a class="el" href="a06089.html">naming_client.cpp</a>.
<p>
References <a class="el" href="a06089.html#l00544">checkThreadId()</a>, <a class="el" href="a05525.html#l00069">NLNET::CCallbackClient::connected()</a>, and <a class="el" href="a05524.html#l00162">NLNET::CCallbackClient::update()</a>.
<p>
<div class="fragment"><pre>00537 {
00538 <a class="code" href="a02980.html#NLNET_1_1CNamingClientf0">checkThreadId</a> ();
00539 <span class="comment">// get message for naming service (new registration for example)</span>
00540 <span class="keywordflow">if</span> (<a class="code" href="a02980.html#NLNET_1_1CNamingClientv0">_Connection</a> != NULL && <a class="code" href="a02980.html#NLNET_1_1CNamingClientv0">_Connection</a>->connected ())
00541 <a class="code" href="a02980.html#NLNET_1_1CNamingClientv0">_Connection</a>->update ();
00542 }
</pre></div> </td>
</tr>
</table>
<hr><h2>Friends And Related Function Documentation</h2>
<a class="anchor" name="NLNET_1_1CNamingClientn0" doxytag="NLNET::CNamingClient::cbRegisterBroadcast" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> void cbRegisterBroadcast </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top"><a class="el" href="a02918.html">CMessage</a> & </td>
<td class="mdname" nowrap> <em>msgin</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap><a class="el" href="a02303.html">TSockId</a> </td>
<td class="mdname" nowrap> <em>from</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap><a class="el" href="a02306.html">CCallbackNetBase</a> & </td>
<td class="mdname" nowrap> <em>netbase</em></td>
</tr>
<tr>
<td></td>
<td class="md">) </td>
<td class="md" colspan="2"><code> [friend]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
<p>
Definition at line <a class="el" href="a06089.html#l00119">119</a> of file <a class="el" href="a06089.html">naming_client.cpp</a>.
<p>
<div class="fragment"><pre>00120 {
00121 <a class="code" href="a05379.html#a93">TServiceId</a> <a class="code" href="a04223.html#a587">size</a>;
00122 string name;
00123 <a class="code" href="a05379.html#a93">TServiceId</a> sid;
00124 vector<CInetAddress> <a class="code" href="a04223.html#a657">addr</a>;
00125
00126 msgin.<a class="code" href="a02271.html#NLNET_1_1CMessagea41">serial</a> (size);
00127
00128 <span class="keywordflow">for</span> (<a class="code" href="a05379.html#a93">TServiceId</a> i = 0; i < <a class="code" href="a04223.html#a587">size</a>; i++)
00129 {
00130 msgin.<a class="code" href="a02271.html#NLNET_1_1CMessagea41">serial</a> (name);
00131 msgin.<a class="code" href="a02271.html#NLNET_1_1CMessagea41">serial</a> (sid);
00132 msgin.<a class="code" href="a02271.html#NLNET_1_1CMessagea54">serialCont</a> (addr);
00133
00134 <span class="comment">// add it in the list</span>
00135
00136 std::vector<CInetAddress> addrs;
00137 CNamingClient::find (sid, addrs);
00138
00139 <span class="keywordflow">if</span> (addrs.size() == 0)
00140 {
00141 CNamingClient::RegisteredServicesMutex.enter ();
00142 CNamingClient::RegisteredServices.push_back (CNamingClient::CServiceEntry (name, sid, addr));
00143 CNamingClient::RegisteredServicesMutex.leave ();
00144
00145 <a class="code" href="a04199.html#a1">nlinfo</a> (<span class="stringliteral">"NC: Registration Broadcast of the service %s-%hu '%s'"</span>, name.c_str(), (<a class="code" href="a04558.html#a9">uint16</a>)sid, <a class="code" href="a05379.html#a138">vectorCInetAddressToString</a>(addr).c_str());
00146
00147 <span class="keywordflow">if</span> (<a class="code" href="a05379.html#a33">_RegistrationBroadcastCallback</a> != NULL)
00148 <a class="code" href="a05379.html#a33">_RegistrationBroadcastCallback</a> (name, sid, addr);
00149 }
00150 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (addrs.size() == 1)
00151 {
00152 CNamingClient::RegisteredServicesMutex.enter ();
00153 <span class="keywordflow">for</span> (std::list<CNamingClient::CServiceEntry>::iterator it = CNamingClient::RegisteredServices.begin(); it != CNamingClient::RegisteredServices.end (); it++)
00154 {
00155 <span class="keywordflow">if</span> (sid == (*it).SId)
00156 {
00157 (*it).Name = name;
00158 (*it).Addr = <a class="code" href="a04223.html#a657">addr</a>;
00159 <span class="keywordflow">break</span>;
00160 }
00161 }
00162 CNamingClient::RegisteredServicesMutex.leave ();
00163 <a class="code" href="a04199.html#a1">nlinfo</a> (<span class="stringliteral">"NC: Registration Broadcast (update) of the service %s-%hu '%s'"</span>, name.c_str(), (<a class="code" href="a04558.html#a9">uint16</a>)sid, <a class="code" href="a04223.html#a657">addr</a>[0].asString().c_str());
00164 }
00165 <span class="keywordflow">else</span>
00166 {
00167 <a class="code" href="a04199.html#a12">nlstop</a>;
00168 }
00169 }
00170
00171 <span class="comment">// FirstRegisteredBroadcast = true;</span>
00172
00173 <span class="comment">//CNamingClient::displayRegisteredServices ();</span>
00174 }
</pre></div> </td>
</tr>
</table>
<a class="anchor" name="NLNET_1_1CNamingClientn1" doxytag="NLNET::CNamingClient::cbUnregisterBroadcast" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> void cbUnregisterBroadcast </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top"><a class="el" href="a02918.html">CMessage</a> & </td>
<td class="mdname" nowrap> <em>msgin</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap><a class="el" href="a02303.html">TSockId</a> </td>
<td class="mdname" nowrap> <em>from</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap><a class="el" href="a02306.html">CCallbackNetBase</a> & </td>
<td class="mdname" nowrap> <em>netbase</em></td>
</tr>
<tr>
<td></td>
<td class="md">) </td>
<td class="md" colspan="2"><code> [friend]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
<p>
Definition at line <a class="el" href="a06089.html#l00178">178</a> of file <a class="el" href="a06089.html">naming_client.cpp</a>.
<p>
<div class="fragment"><pre>00179 {
00180 string name;
00181 <a class="code" href="a05379.html#a93">TServiceId</a> sid;
00182 vector<CInetAddress> addrs;
00183
00184 msgin.<a class="code" href="a02271.html#NLNET_1_1CMessagea41">serial</a> (name);
00185 msgin.<a class="code" href="a02271.html#NLNET_1_1CMessagea41">serial</a> (sid);
00186
00187 <span class="comment">// remove it in the list, if the service is not found, ignore it</span>
00188
00189 CNamingClient::RegisteredServicesMutex.enter ();
00190 <span class="keywordflow">for</span> (std::list<CNamingClient::CServiceEntry>::iterator it = CNamingClient::RegisteredServices.begin(); it != CNamingClient::RegisteredServices.end (); it++)
00191 {
00192 <span class="keywordflow">if</span> ((*it).SId == sid)
00193 {
00194 <span class="comment">// check the structure</span>
00195 <a class="code" href="a04199.html#a8">nlassertex</a> ((*it).Name == name, (<span class="stringliteral">"%s %s"</span>,(*it).Name.c_str(), name.c_str()));
00196
00197 addrs = (*it).Addr;
00198
00199 CNamingClient::RegisteredServices.erase (it);
00200 <span class="keywordflow">break</span>;
00201 }
00202 }
00203 CNamingClient::RegisteredServicesMutex.leave ();
00204
00205 <a class="code" href="a04199.html#a1">nlinfo</a> (<span class="stringliteral">"NC: Unregistration Broadcast of the service %s-%hu"</span>, name.c_str(), (<a class="code" href="a04558.html#a9">uint16</a>)sid);
00206
00207 <span class="comment">// send the ACK to the NS</span>
00208
00209 <a class="code" href="a02918.html">CMessage</a> msgout (CNamingClient::_Connection->getSIDA(), <span class="stringliteral">"ACK_UNI"</span>);
00210 msgout.<a class="code" href="a02271.html#NLNET_1_1CMessagea41">serial</a> (sid);
00211 CNamingClient::_Connection->send (msgout);
00212
00213 <span class="comment">// oh my god, it s my sid! but i m alive, why this f*cking naming service want to kill me? ok, i leave it alone!</span>
00214 <span class="keywordflow">if</span>(CNamingClient::_MySId == sid)
00215 {
00216 <a class="code" href="a04199.html#a2">nlwarning</a> (<span class="stringliteral">"NC: Naming Service asked me to leave, I leave!"</span>);
00217 IService::getInstance()->exit();
00218 <span class="keywordflow">return</span>;
00219 }
00220
00221 <span class="keywordflow">if</span> (<a class="code" href="a05379.html#a34">_UnregistrationBroadcastCallback</a> != NULL)
00222 <a class="code" href="a05379.html#a34">_UnregistrationBroadcastCallback</a> (name, sid, addrs);
00223
00224 <span class="comment">//CNamingClient::displayRegisteredServices ();</span>
00225 }
</pre></div> </td>
</tr>
</table>
<hr><h2>Field Documentation</h2>
<a class="anchor" name="NLNET_1_1CNamingClientv0" doxytag="NLNET::CNamingClient::_Connection" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> <a class="el" href="a02305.html">CCallbackClient</a> * <a class="el" href="a02980.html#NLNET_1_1CNamingClientv0">NLNET::CNamingClient::_Connection</a> = NULL<code> [static, private]</code>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
<p>
Definition at line <a class="el" href="a06089.html#l00052">52</a> of file <a class="el" href="a06089.html">naming_client.cpp</a>. </td>
</tr>
</table>
<a class="anchor" name="NLNET_1_1CNamingClientv1" doxytag="NLNET::CNamingClient::_MySId" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> <a class="el" href="a05379.html#a93">TServiceId</a> <a class="el" href="a02980.html#NLNET_1_1CNamingClientv1">NLNET::CNamingClient::_MySId</a> = 0<code> [static, private]</code>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
<p>
Definition at line <a class="el" href="a06089.html#l00060">60</a> of file <a class="el" href="a06089.html">naming_client.cpp</a>.
<p>
Referenced by <a class="el" href="a06089.html#l00302">registerService()</a>, and <a class="el" href="a06089.html#l00340">registerServiceWithSId()</a>. </td>
</tr>
</table>
<a class="anchor" name="NLNET_1_1CNamingClientv2" doxytag="NLNET::CNamingClient::_RegisteredServices" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> <a class="el" href="a02980.html#NLNET_1_1CNamingClienty0">CNamingClient::TRegServices</a> <a class="el" href="a02980.html#NLNET_1_1CNamingClientv2">NLNET::CNamingClient::_RegisteredServices</a><code> [static, private]</code>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
<p>
Definition at line <a class="el" href="a06089.html#l00053">53</a> of file <a class="el" href="a06089.html">naming_client.cpp</a>.
<p>
Referenced by <a class="el" href="a06089.html#l00302">registerService()</a>, <a class="el" href="a06089.html#l00340">registerServiceWithSId()</a>, <a class="el" href="a06089.html#l00398">unregisterAllServices()</a>, and <a class="el" href="a06089.html#l00385">unregisterService()</a>. </td>
</tr>
</table>
<a class="anchor" name="NLNET_1_1CNamingClientt0" doxytag="NLNET::CNamingClient::_ThreadId" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a15">uint</a> <a class="el" href="a02980.html#NLNET_1_1CNamingClientt0">NLNET::CNamingClient::_ThreadId</a> = 0xFFFFFFFF<code> [static, protected]</code>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
<dl compact><dt><b><a class="el" href="todo.html#_todo000051">Todo:</a></b></dt><dd>ace: debug feature that we should remove one day before releasing the game</dd></dl>
<p>
Definition at line <a class="el" href="a06089.html#l00058">58</a> of file <a class="el" href="a06089.html">naming_client.cpp</a>. </td>
</tr>
</table>
<a class="anchor" name="NLNET_1_1CNamingClientv3" doxytag="NLNET::CNamingClient::RegisteredServices" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> std::list< <a class="el" href="a02981.html">CNamingClient::CServiceEntry</a> > <a class="el" href="a02980.html#NLNET_1_1CNamingClientv3">NLNET::CNamingClient::RegisteredServices</a><code> [static, private]</code>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
<p>
Definition at line <a class="el" href="a06089.html#l00063">63</a> of file <a class="el" href="a06089.html">naming_client.cpp</a>.
<p>
Referenced by <a class="el" href="a06090.html#l00172">displayRegisteredServices()</a>, <a class="el" href="a06090.html#l00211">find()</a>, <a class="el" href="a06090.html#l00147">getRegisteredServices()</a>, and <a class="el" href="a06089.html#l00465">lookupAlternate()</a>. </td>
</tr>
</table>
<a class="anchor" name="NLNET_1_1CNamingClientv4" doxytag="NLNET::CNamingClient::RegisteredServicesMutex" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> NLMISC::CMutex <a class="el" href="a02980.html#NLNET_1_1CNamingClientv4">NLNET::CNamingClient::RegisteredServicesMutex</a><code> [static, private]</code>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
<p>
Referenced by <a class="el" href="a06090.html#l00172">displayRegisteredServices()</a>, <a class="el" href="a06090.html#l00211">find()</a>, and <a class="el" href="a06089.html#l00465">lookupAlternate()</a>. </td>
</tr>
</table>
<hr>The documentation for this class was generated from the following files:<ul>
<li><a class="el" href="a06090.html">naming_client.h</a><li><a class="el" href="a06089.html">naming_client.cpp</a></ul>
<hr size="1"><address style="align: right;"><small>Generated on Tue Mar 16 14:00:38 2004 for NeL by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border=0 >
</a>1.3.6 </small></address>
</body>
</html>
|