-
Notifications
You must be signed in to change notification settings - Fork 4
/
netlib_doc.sdml
executable file
·1465 lines (1319 loc) · 63.9 KB
/
netlib_doc.sdml
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
<FRONT_MATTER>(NETLIB_DOC_1)
<TITLE_PAGE>
<TITLE>(NETLIB Programmer's Guide)
<ABSTRACT>(<REFERENCE>(RELMONTH))
<P>This manual contains information about NETLIB, a library
for TCP/IP network programming on VMS systems.
<ENDABSTRACT>
<REVISION_INFO>(This is an updated manual.)
<REVISION_INFO>(Operating System and Version:\OpenVMS VAX V6.2 or later)
<REVISION_INFO>(\OpenVMS Alpha V6.0 or later;)
<REVISION_INFO>(\OpenVMS Industry Standard 64 V8.2 or later)
<REVISION_INFO>(Software Version:\<REFERENCE>(VER))
<ENDTITLE_PAGE>(Endless Software Solutions<LINE>Perth, Western Australia)
<INCLUDE>(SRC_DIR:COPYRIGHT.SDML)
<CONTENTS_FILE>
<PREFACE>(\NETLIB_DOC_2)
<P>
There are several TCP/IP packages available for VMS systems today. Each
provides a VMS-style programming interface, using the $QIO system service,
and most also provide a <quote>(socket) programming library, based on
the communications model developed for BSD UNIX. Unfortunately, the
$QIO-based driver interface is generally difficult to use, while the
socket libraries are designed for ease of use only from the C programming
language. In addition, the libraries do not typically provide support
for VMS-style asynchronous programming.
<P>
NETLIB was originally developed to support MadGoat Software's Message
Exchange mail package, which needed to support many TCP/IP packages doing
VMS-style asynchronous programming. NETLIB provides a consistent, VMS-style
interface for TCP/IP-based network programs.
<head1>(Intended Audience\NETLIB_INST_3)
<p>This manual is intended for programmers writing applications that use
NETLIB.
<head1>(Document Structure\NETLIB_INST_4)
<p>This document consists of an introductory chapter, a section containing
routine descriptions, and an appendix describing the status codes returned
by NETLIB routines.
<head1>(Related Documents\NETLIB_INST_5)
<p>The <emphasis>(NETLIB Installation Guide) describes how to install NETLIB.
<endpreface>
<ENDFRONT_MATTER>
<CHAPTER>(Using NETLIB\NETLIB_DOC_3)
<P>
This chapter discusses the NETLIB programming interface.
<HEAD1>(Overview\NETLIB_DOC_4)
<P>NETLIB provides a single programming interface that can be used
with almost any TCP/IP package for VMS systems. While every package
provides a $QIO interface and most also provide a socket library,
the advantages to using NETLIB instead are:
<list>(unnumbered)
<le>NETLIB allows VMS-style asynchronous programming (using ASTs) without
having to use the $QIO interface directly.
<le>NETLIB provides a VMS common language environment style of
programming interface, making it easier to use from other languages
than a UNIX-type socket library written for C programmers.
<le>NETLIB provides some additional utility routines for domain name
lookups and line-oriented network traffic.
<endlist>
<head2>(NETLIB Services\NETLIB_DOC_5)
<P>NETLIB provides services for writing TCP/IP-based network programs,
both client and server. Servers can either be standalone, AST-driven
programs, or can be single-threaded server processes <quote>(forked)
by the <quote>(master server) provided with each TCP/IP package.
<p>
NETLIB services can be grouped into four basic areas:
<list>(unnumbered)
<le><emphasis>(Connection services\bold).
These routines provide the services necessary for performing TCP/IP
network I/O.
<le><emphasis>(Line-mode services\bold). These routines provide
a line-oriented network reads and writes, for line-oriented protocols
that run over TCP.
<le><emphasis>(DNS resolver services\bold). These routines provide
host name and address lookup services. A direct DNS query routine
is also provided.
<le><emphasis>(Utility routines\bold). These are routines for
doing byte-order conversions, IP address parsing and formatting,
and other miscellaneous services.
<endlist>
<HEAD1>(Header files\NETLIB_DOC_6)
<P>
NETLIB includes header files for both C and BLISS programming, called
NETLIBDEF.H and NETLIBDEF.R32, respectively. The header files reside
in the NETLIB_DIR: directory. These files define constants and structures
that are used by the NETLIB programming interface.
<HEAD1>(NETLIB Data Structures\NETLIB_DOC_7)
<P>
NETLIB uses several data structures in its programming interface. Some
of these data structures (INADDRDEF and SINDEF) are common to all BSD
socket-oriented programming libraries, one (MXRRDEF) is special to NETLIB.
The header files provided
with NETLIB defines these structures for BLISS and C programmers.
<HEAD2>(INADDRDEF Structure\NETLIB_DOC_8)
<p>The INADDRDEF structure is used for passing an IP address. The contents
is (currently) a longword, in network byte order (see <reference>(byte_ordering)
for more information). Its definition is (in C) is:
<interactive>
struct INADDRDEF {
unsigned long inaddr_l_addr;
}
<endinteractive>
<HEAD2>(SINDEF Structure\NETLIB_DOC_9)
<P>The SINDEF structure defines an IP <quote>(socket,) which is a combination
of an IP address and a TCP or UDP port number. Its definition is:
<interactive>
struct SINDEF {
unsigned short sin_w_family;
unsigned short sin_w_port;
struct INADDRDEF sin_x_addr;
unsigned char sin_x_mbz[8];
}
<endinteractive>
<cp>The <emphasis>(sin_w_family\bold) field should always be set to
NETLIB_K_AF_INET (value 2). The <emphasis>(sin_w_mbz\bold) field should
always be zeroed.
<cp>This is a specific form of the more general SOCKADDRDEF structure for
use with IP-based sockets. NETLIB currently only supports IP network
programming, so other types of addresses should not be used.
<HEAD2>(MXRRDEF Structure\NETLIB_DOC_10)
<P>The MXRRDEF structure is used to return MX resource record information
in a call to NETLIB_DNS_MX_LOOKUP:
<interactive>
struct MXRRDEF {
unsigned int mxrr_l_preference;
unsigned int mxrr_l_length;
char mxrr_t_name[128];
}
<endinteractive>
<p>This structure is NETLIB-specific.
<HEAD2>(NETLIB_DNS_HEADER Structure\NETLIB_DOC_11)
<p>A domain name server accepts queries and returns replies prefixed with
with a standard header. A definition of this header is provided in the
NETLIB_DNS_HEADER structure. Refer to the NETLIBDEF header file and
the appropriate DNS RFCs (such as RFC 1035) for more information about
this header. Only those programs which use the NETLIB_DNS_QUERY routine
will need this header definition.
<HEAD1>(Byte-Order Considerations\byte_ordering)
<P>
In NETLIB routines, addresses and port numbers are expected to be in
<quote>(network order;) that is, with the high-order byte first. This
is opposite the natural byte-order for VAX and AXP systems running VMS,
which places the low-order byte first. NETLIB provides routines that
can be used to reverse byte order for use in the calls which expect
it.
<HEAD1>(Synchronous vs. Asynchronous Operation\NETLIB_DOC_12)
<P>
Most NETLIB routines can be executed synchronously (where the routine
uses $QIOW) or asynchronously ($QIO is used instead of $QIOW). To have
a routine called asynchronously, specify a non-zero <emphasis>(astadr\bold) argument
(and, optionally, the <emphasis>(astprm\bold) argument, to have a parameter
passed to the AST routine).
<HEAD1>(I/O Status Block\NETLIB_DOC_13)
<P>
Most NETLIB routines include an optional parameter for a VMS-style I/O
status block (IOSB), which is used to return status information to the calling
program. The first word of the IOSB is the NETLIB status code for the
call; the second word, for read and write operations, is the number of
bytes transferred. The second longword of the IOSB is not used by NETLIB.
<HEAD1>(Linking NETLIB Programs\NETLIB_DOC_14)
<p>
To link your program with NETLIB, include the following line in a LINK
options file:
<interactive>
NETLIB_SHR/SHARE
<endinteractive>
<p>
Note that in older versions of NETLIB, you would like against NETLIB_SHRXFR.
However, that extra shareable image is no longer needed. The NETLIB_SHRXFR
logical name is still provided by NETLIB, though, for compatibility with
old build procedures.
<HEAD1>(Contacting the Author\NETLIB_DOC_15)
<p>There is no formal support for NETLIB. If you have Internet connectivity,
however, you may wish to subscribe to one or more of the following MadGoat
Software mailing lists:
<list>(simple)
<le><emphasis>([email protected]\bold)
<p>
Discussion of MadGoat Software products by users and MadGoat
developers. To subscribe, send a message to
<emphasis>([email protected])
with the word SUBSCRIBE in the first line of the body of the
message.
<le><emphasis>([email protected]\bold)
<p>
Announcements of new releases and new products from MadGoat.
To subscribe, send a message to
<emphasis>([email protected])
with the word SUBSCRIBE in the first line of the body of the
message.
<le><emphasis>([email protected]\bold)
<p>
Address for reporting bugs in MadGoat Software products. Please
include the name of the package and version in the subject header
of the message, so the report can be more easily directed to the
appropriate developer.
<endlist>
<part>(Routine Descriptions\rtnpart)
<part_page>
<title>(<reference>(rtnpart)\<reference>(rtnpart\text))
<abstract>
This part describes the each of the NETLIB routines.
<endabstract>
<endpart_page>(renumber)
<routine_section>(NETLIB Routines\RTN)
<set_template_heading>(rsdeflist\CONDITION VALUES RETURNED)
<comment>(----------------------------------------------------------------)
<routine>(NETLIB_ACCEPT\Accept an incoming connection\\NETLIB_DOC_16)
<overview>
NETLIB_ACCEPT waits for an incoming connection and accepts it, creating
a new socket for the new connection.
<endoverview>
<format>
<frtn>(NETLIB_ACCEPT)
<fargs>(socket ,newsocket [,remaddr] [,remaddr-size] [,remaddr-len] [,iosb] [,astadr] [,astprm])
<endformat>
<returns>(cond_value\longword (unsigned)\write only\by value)
<argdeflist>
<argitem>(socket\longword_unsigned\longword (unsigned)\read only\by reference)
<argdef>Socket that was established as a listener.
<argitem>(newsocket\longword_unsigned\longword (unsigned)\write only\by reference)
<argdef>Socket for the accepted connection (created and returned by this
routine).
<argitem>(remaddr\structure\longword (unsigned)\write only\by reference)
<argdef>Address of a socket_address structure into which the remote
address/port information for the new connection is written.
<argitem>(remaddr-size\longword_unsigned\longword (unsigned)\read only\by reference)
<argdef>Size of the <emphasis>(remaddr\bold) structure.
<argitem>(remaddr-len\longword_unsigned\longword (unsigned)\write only\by reference)
<argdef>Longword into which the actual returned lenght of the socket address
is written.
<argitem>(iosb\io_status_block\longword (unsigned)\write only\by reference)
<argdef>I/O status block to receive the status for this call.
<argitem>(astadr\procedure\longword (unsigned)\call\by reference)
<argdef>Address of an AST routine to be invoked on completion of this operation.
<argitem>(astprm\user_arg\longword (unsigned)\read only\by value)
<argdef>Parameter to be passed to the AST routine.
<endargdeflist>
<description>
This routine is used as part of a <quote>(passive) open sequence, typically
by servers that bind a socket to a specific port number, then establish
a listener to handle the incoming connections. This call is used to accept
an incoming connection, creating a new socket for the new connection. The
listener socket is not affected by this call, so you can call NETLIB_ACCEPT
again to wait for another incoming connection on the same port after one
accept completes.
<p>
If you want to know the address and port number of the remote end of
the accepted connection, you can either use the <emphasis>(remaddr\bold),
<emphasis>(remaddr-size\bold), and <emphasis>(remaddr-len\bold) arguments on this
call, or follow this call with a call to NETLIB_GETPEERNAME.
<enddescription>
<comment>(----------------------------------------------------------------)
<routine>(NETLIB_ADDRESS_TO_NAME\Get the host name for an IP address\\NETLIB_DOC_17)
<overview>
NETLIB_ADDRESS_TO_NAME performs an inverse host lookup, returning a name
associated with an IP address.
<endoverview>
<format>
<frtn>(NETLIB_ADDRESS_TO_NAME)
<fargs>(socket, [which], address, addrsize, hostname [,retlen] [,iosb] [,astadr] [,astprm])
<endformat>
<returns>(cond_value\longword (unsigned)\write only\by value)
<argdeflist>
<argitem>(socket\longword_unsigned\longword (unsigned)\read only\by reference)
<argdef>The socket about which you wish to obtain the option information.
<argitem>(which\longword_unsigned\longword (unsigned)\read only\by reference)
<argdef>A code indicating the type of lookup to be performed. Possible values
are NETLIB_K_LOOKUP_DNS (1), which requests that the name be looked up using
the Domain Name System, and NETLIB_K_LOOKUP_HOST_TABLE (2), which requests
that the name be looked up in the local host table. If omitted, the default
is NETLIB_K_LOOKUP_DNS. See the Description section for information on
package-specific restrictions with this parameter.
<argitem>(address\structure\longword (unsigned)\read only\by reference)
<argdef>An INADDRDEF structure containing the address to be looked up.
<argitem>(addrsize\longword_unsigned\longword (unsigned)\read only\by reference)
<argdef>The size of the address passed in the <emphasis>(address\bold) parameter.
<argitem>(hostname\char_string\character string\write only\by descriptor)
<argdef>A buffer into which the returned host name will be written.
<argitem>(retlen\word_unsigned\word (unsigned)\write only\by reference)
<argdef>The returned length of the host name, in bytes.
<argitem>(iosb\io_status_block\longword (unsigned)\write only\by reference)
<argdef>I/O status block to receive the status for this call.
<argitem>(astadr\procedure\longword (unsigned)\call\by reference)
<argdef>Address of an AST routine to be invoked on completion of this operation.
<argitem>(astprm\user_arg\longword (unsigned)\read only\by value)
<argdef>Parameter to be passed to the AST routine.
<endargdeflist>
<description>
This routine performs an address-to-name lookup on the specified IP address.
Each TCP/IP package implements this function slightly differently, so
there are some restrictions on the use of this routine.
<P>
The <emphasis>(which\bold) argument is ignored, since
these packages do not provide separate access to DNS and local host tables.
Host table lookup will occur first, followed by a DNS lookup.
<enddescription>
<comment>(----------------------------------------------------------------)
<routine>(NETLIB_ADDRTOSTR\Format an IP address to a string\\NETLIB_DOC_18)
<overview>
NETLIB_ADDRTOSTR is a utility routine for formatting an IP address
as a character string.
<endoverview>
<format>
<frtn>(NETLIB_ADDRTOSTR)
<fargs>(address, string [,retlen])
<endformat>
<returns>(cond_value\longword (unsigned)\write only\by value)
<argdeflist>
<argitem>(address\INADDRDEF structure\longword (unsigned)\read only\by reference)
<argdef>An INADDRDEF structure containing the address to be formatted.
<argitem>(string\char_string\character string\write only\by descriptor)
<argdef>The string to hold the formatted address.
<argitem>(retlen\word_unsigned\word (unsigned)\write only\by reference)
<argdef>The number of characters written to <emphasis>(string\bold).
<endargdeflist>
<description>
This is a utility routine which formats an IP address to a character
string, using the dotted-decimal format.
<enddescription>
<comment>(----------------------------------------------------------------)
<routine>(NETLIB_BIND\Bind a socket to an address/port\\NETLIB_DOC_19)
<overview>
NETLIB_BIND sets the address and/or port number for a socket.
<endoverview>
<format>
<frtn>(NETLIB_BIND)
<fargs>(socket, socket-address, sockaddr-len [,iosb] [,astadr] [,astprm])
<endformat>
<returns>(cond_value\longword (unsigned)\write only\by value)
<argdeflist>
<argitem>(socket\longword_unsigned\longword (unsigned)\read only\by reference)
<argdef>Socket to be bound.
<argitem>(socket-address\structure\longword (unsigned)\read only\by reference)
<argdef>Socket_address structure describing the addreses and port to which
the socket is to be bound.
<argitem>(sockaddr-len\longword_unsigned\longword (unsigned)\read only\by reference)
<argdef>Size of the socket address structure.
<argitem>(iosb\io_status_block\longword (unsigned)\write only\by reference)
<argdef>I/O status block to receive the status for this call.
<argitem>(astadr\procedure\longword (unsigned)\call\by reference)
<argdef>Address of an AST routine to be invoked on completion of this operation.
<argitem>(astprm\user_arg\longword (unsigned)\read only\by value)
<argdef>Parameter to be passed to the AST routine.
<endargdeflist>
<description>
This routine is used primarily by server programs to bind a socket to
a particular port, and is typically followed by a call to NETLIB_LISTEN
to open a passive connection on that port.
<P>If a program does not bind a socket to a particular local address/port
combination, the underlying TCP/IP software will automatically assign
an address and/or port.
<enddescription>
<comment>(----------------------------------------------------------------)
<routine>(NETLIB_CLOSE\Close down a socket\\NETLIB_DOC_20)
<overview>
NETLIB_CLOSE closes a socket.
<endoverview>
<format>
<frtn>(NETLIB_CLOSE)
<fargs>(socket)
<endformat>
<returns>(cond_value\longword (unsigned)\write only\by value)
<argdeflist>
<argitem>(socket\longword_unsigned\longword (unsigned)\read only\by reference)
<argdef>Socket to be closed.
<endargdeflist>
<description>
This routine deletes the specified socket, closing the associated network
communications channel, if one is open. Once closed, the socket can no longer
be used; you must open a new one with the NETLIB_SOCKET call.
<enddescription>
<comment>(----------------------------------------------------------------)
<routine>(NETLIB_CONNECT\Connect a socket to a remote address/port\\NETLIB_DOC_21)
<overview>
NETLIB_CONNECT connects a socket to a remote address/port.
<endoverview>
<format>
<frtn>(NETLIB_CONNECT)
<fargs>(socket, socket-address, sockaddr-len [,iosb] [,astadr] [,astprm])
<endformat>
<returns>(cond_value\longword (unsigned)\write only\by value)
<argdeflist>
<argitem>(socket\longword_unsigned\longword (unsigned)\read only\by reference)
<argdef>Socket to be connected.
<argitem>(socket-address\structure\longword (unsigned)\read only\by reference)
<argdef>Socket_address structure describing the addreses and port to which
the socket is to be connected.
<argitem>(sockaddr-len\longword_unsigned\longword (unsigned)\read only\by reference)
<argdef>Size of the socket address structure.
<argitem>(iosb\io_status_block\longword (unsigned)\write only\by reference)
<argdef>I/O status block to receive the status for this call.
<argitem>(astadr\procedure\longword (unsigned)\call\by reference)
<argdef>Address of an AST routine to be invoked on completion of this operation.
<argitem>(astprm\user_arg\longword (unsigned)\read only\by value)
<argdef>Parameter to be passed to the AST routine.
<endargdeflist>
<description>
This routine is used primarily with TCP-based programs to establish a
connection to a remote system. When used with UDP, this routine fixes
the address to which subsequent UDP datagrams will be sent.
<enddescription>
<comment>(----------------------------------------------------------------)
<routine>(NETLIB_CONNECT_BY_NAME\Establish a TCP connection to a host by name\\NETLIB_DOC_22)
<overview>
NETLIB_CONNECT_BY_NAME establishes a TCP connection to a host using the
host's name, rather than its IP address.
<endoverview>
<format>
<frtn>(NETLIB_CONNECT_BY_NAME)
<fargs>(socket, hostname, port [,iosb] [,astadr] [,astprm])
<endformat>
<returns>(cond_value\longword (unsigned)\write only\by value)
<argdeflist>
<argitem>(socket\longword_unsigned\longword (unsigned)\read only\by reference)
<argdef>A STREAM-type socket allocated with NETLIB_SOCKET.
<argitem>(hostname\char_string\character string\read only\by descriptor)
<argdef>A character string containing either a host name or an IP address
in dotted-decimal format.
<argitem>(port\word_unsigned\word (unsigned)\read only\by reference)
<argdef>The port number to connect to on the destination host. Unlike
the SIN_W_PORT field of a SINDEF (socket address) structure, this
number is specified in <emphasis>(host order), not network order.
NETLIB_CONNECT_BY_NAME will automatically convert the port number to
network order for you.
<argitem>(iosb\io_status_block\longword (unsigned)\write only\by reference)
<argdef>I/O status block to receive the status for this call.
<argitem>(astadr\procedure\longword (unsigned)\call\by reference)
<argdef>Address of an AST routine to be invoked on completion of this operation.
<argitem>(astprm\user_arg\longword (unsigned)\read only\by value)
<argdef>Parameter to be passed to the AST routine.
<endargdeflist>
<description>
This routine converts the specified name or dotted-decimal address to
an IP address and uses NETLIB_CONNECT to connect to the specified host and
port. If multiple addresses are returned by the host name lookup, each
address will be tried until a connection is established or all addresses
have been tried.
<enddescription>
<comment>(----------------------------------------------------------------)
<routine>(NETLIB_DNS_EXPANDNAME\Expand a name in a DNS response\\NETLIB_DOC_23)
<overview>
NETLIB_DNS_EXPANDNAME is a utility routine used for extracting a domain name
from a DNS response.
<endoverview>
<format>
<frtn>(NETLIB_DNS_EXPANDNAME)
<fargs>(bufstart, buflen, bufptr, name [,retlen] [,skipcount])
<endformat>
<returns>(cond_value\longword (unsigned)\write only\by value)
<argdeflist>
<argitem>(bufstart\pointer\longword (unsigned)\read only\by value)
<argdef>A pointer to the start of the DNS response buffer.
<argitem>(buflen\word_unsigned\word (unsigned)\read only\by reference)
<argdef>The size of the buffer, in bytes.
<argitem>(bufptr\pointer\longword (unsigned)\read only\by value)
<argdef>A pointer to the area of the buffer containing the domain name
to be expanded.
<argitem>(name\char_string\character string\write only\by descriptor)
<argdef>A descriptor for a character string buffer into which the
expanded name will be written.
<argitem>(retlen\word_unsigned\word (unsigned)\write only\by reference)
<argdef>The returned length of the expanded name, in bytes.
<argitem>(skipcount\word_unsigned\word (unsigned)\write only\by reference)
<argdef>The number of bytes in the buffer that were used for the domain
name.
<endargdeflist>
<description>
This is a utility routine used when parsing a response returned by
a call to NETLIB_DNS_QUERY. It expands a domain name stored in a DNS
response out to the typical, human-readable, dotted-domain format.
<p>
This routine is needed because of the way domain names are represented
in DNS responses. Refer to RFC 1035 for further information on the format
of DNS queries and responses.
<enddescription>
<comment>(----------------------------------------------------------------)
<routine>(NETLIB_DNS_MX_LOOKUP\Look up MX records for a domain name\\NETLIB_DOC_24)
<overview>
NETLIB_DNS_MX_LOOKUP looks up a host name, returning any MX records.
<endoverview>
<format>
<frtn>(NETLIB_DNS_MX_LOOKUP)
<fargs>(socket, hostname, mxrrlist, mxrrlist-size [,mxrrcount] [,iosb] [,astadr] [,astprm])
<endformat>
<returns>(cond_value\longword (unsigned)\write only\by value)
<argdeflist>
<argitem>(socket\longword_unsigned\longword (unsigned)\read only\by reference)
<argdef>Any socket allocated with NETLIB_SOCKET.
<argitem>(hostname\char_string\character string\read only\by descriptor)
<argdef>The host name to be looked up.
<argitem>(mxrrlist\array of structures\longword (unsigned)\write only\by reference)
<argdef>An array of MXRRDEF structures into which the MX records will be
written.
<argitem>(mxrrlist-size\longword_unsigned\longword (unsigned)\read only\by reference)
<argdef>The number of elements in the <emphasis>(mxrrlist\bold) array.
<argitem>(mxrrcount\longword_unsigned\longword (unsigned)\write only\by reference)
<argdef>The actual number of MX records written to <emphasis>(mxrrlist\bold).
<argitem>(iosb\io_status_block\longword (unsigned)\write only\by reference)
<argdef>I/O status block to receive the status for this call.
<argitem>(astadr\procedure\longword (unsigned)\call\by reference)
<argdef>Address of an AST routine to be invoked on completion of this operation.
<argitem>(astprm\user_arg\longword (unsigned)\read only\by value)
<argdef>Parameter to be passed to the AST routine.
<endargdeflist>
<description>
This routine performs a DNS lookup on the specified name, returning any
Mail Exchanger (MX) records for that name.
<p>
This routine is a front-end that uses NETLIB_DNS_QUERY to perform the DNS queries.
<enddescription>
<comment>(----------------------------------------------------------------)
<routine>(NETLIB_DNS_QUERY\Perform a DNS query\\NETLIB_DOC_25)
<overview>
NETLIB_DNS_QUERY formats a domain name service query and returns the
response from a DNS server.
<endoverview>
<format>
<frtn>(NETLIB_DNS_QUERY)
<fargs>(socket, name, [class], type, buffer, bufsize [,flags] [,iosb] [,astadr] [,astprm])
<endformat>
<returns>(cond_value\longword (unsigned)\write only\by value)
<argdeflist>
<argitem>(socket\longword_unsigned\longword (unsigned)\read only\by reference)
<argdef>A socket allocated with NETLIB_SOCKET. Any socket can be used.
<argitem>(name\char_string\character string\read only\by descriptor)
<argdef>The domain name to be looked up.
<argitem>(class\longword_unsigned\longword (unsigned)\read only\by reference)
<argdef>The class of the query. For Internet domain names, this should be
NETLIB_K_DNS_CLASS_IN, which is the default if this parameter is omitted.
<argitem>(type\longword_unsigned\longword (unsigned)\read only\by reference)
<argdef>The type of query. Valid type codes are specified by Internet RFCs
on the DNS, the codes provided by NETLIB are listed in <reference>(dns_types).
<table>(Domain Name Service query types\dns_types)
<table_setup>(3\25\5)
<table_heads>(Symbolic name\Value\Description)
<table_row>(NETLIB_K_DNS_TYPE_A\1\Address (A) records)
<table_row>(NETLIB_K_DNS_TYPE_NS\2\Name Server (NS) records)
<table_row>(NETLIB_K_DNS_TYPE_CNAME\5\Canonical Name (CNAME) records)
<table_row>(NETLIB_K_DNS_TYPE_SOA\6\Start-of-Authority (SOA) records)
<table_row>(NETLIB_K_DNS_TYPE_WKS\11\Well-known-server (WKS) records)
<table_row>(NETLIB_K_DNS_TYPE_PTR\12\Pointer (PTR) records)
<table_row>(NETLIB_K_DNS_TYPE_HINFO\13\Host information (HINFO) records)
<table_row>(NETLIB_K_DNS_TYPE_MX\15\Mail Exchanger (MX) records)
<table_row>(NETLIB_K_DNS_TYPE_TXT\16\Text (TXT) records)
<table_row>(NETLIB_K_DNS_QTYPE_ALL\255\Any available information)
<endtable>
<argitem>(buffer\varying_arg\longword (unsigned)\write only\by reference)
<argdef>A buffer into which the DNS response will be copied.
<argitem>(bufsize\word_unsigned\word (unsigned)\read only\by reference)
<argdef>The size of <emphasis>(buffer\bold), in bytes.
<argitem>(flags\longword_mask\longword (unsigned)\read only\by reference)
<argdef>A bitmask of flags specifying options for this query. Valid flags
are listed in <reference>(query_flags). If omitted, the default value
for this parameter is 1.
<table>(Flag values for NETLIB_DNS_QUERY\query_flags)
<table_setup>(3\25\5)
<table_heads>(Symbolic name\Value\Description)
<table_row>(NETLIB_M_DOMAIN_SEARCH\1\Perform a domain search on the default
domain.)
<table_row>(NETLIB_M_NO_RECURSION\2\Specify a non-recursive query.)
<endtable>
<argitem>(iosb\io_status_block\longword (unsigned)\write only\by reference)
<argdef>I/O status block to receive the status for this call.
<argitem>(astadr\procedure\longword (unsigned)\call\by reference)
<argdef>Address of an AST routine to be invoked on completion of this operation.
<argitem>(astprm\user_arg\longword (unsigned)\read only\by value)
<argdef>Parameter to be passed to the AST routine.
<endargdeflist>
<description>
This routine formats a DNS query and returns the response from the first
name server to provide an answer that indicates either that the query succeeded,
or that the name does not exist in the DNS. If the query fails due to an
I/O error, that error status is returned and/or stored in the IOSB status
word.
<P>
Even when this routine returns a success status, the caller should
verify that the return code in the header of the DNS reply is NETLIB_K_DNS_RC_SUCCESS,
indicating a successful lookup, before attempting to parse the rest
of the reply.
<p>
The TCPIP$BIND_<emphasis>(xxx) logical names are used to determine the
name server(s) to use for lookups. If no name servers can be found, SS$_UNSUPPORTED is
returned.
<enddescription>
<comment>(----------------------------------------------------------------)
<routine>(NETLIB_DNS_SKIPNAME\Skip a name in a DNS response\\NETLIB_DOC_26)
<overview>
NETLIB_DNS_SKIPNAME is a utility routine used for parsing DNS responses
which skips over a domain name.
<endoverview>
<format>
<frtn>(NETLIB_DNS_SKIPNAME)
<fargs>(bufptr, buflen)
<endformat>
<returns>(longword_signed\longword (signed)\write only\by value)
<argdeflist>
<argitem>(bufptr\pointer\longword (unsigned)\read only\by value)
<argdef>A pointer to the area of the DNS response buffer that begins
the name to be skipped.
<argitem>(buflen\word_unsigned\word (unsigned)\read only\by reference)
<argdef>A count of the number of bytes in the buffer, starting from
<emphasis>(bufptr\bold).
<endargdeflist>
<description>
This is a utility routine used when parsing a response returned by
a call to NETLIB_DNS_QUERY. It returns a count of the number of
bytes to skip allocated to the domain name positioned in the buffer
at location <emphasis>(bufptr\bold). If the operation fails, -1 is
returned to indicate an error.
<p>
This routine is needed because of the way domain names are represented
in DNS responses. Refer to RFC 1035 for further information on the format
of DNS queries and responses.
<enddescription>
<comment>(----------------------------------------------------------------)
<routine>(NETLIB_GETPEERNAME\Get remote socket address\\NETLIB_DOC_27)
<overview>
NETLIB_GETSOCKNAME returns the remote address and port information for
a connected socket.
<endoverview>
<format>
<frtn>(NETLIB_GETPEERNAME)
<fargs>(socket, socket-address, sockaddr-size, sockaddr-retlen
[,iosb] [,astadr] [,astprm])
<endformat>
<returns>(cond_value\longword (unsigned)\write only\by value)
<argdeflist>
<argitem>(socket\longword_unsigned\longword (unsigned)\read only\by reference)
<argdef>Socket for which the information is to be returned.
<argitem>(socket-address\structure\longword (unsigned)\write only\by reference)
<argdef>Socket_address structure which will hold the returned address/port
information.
<argitem>(sockaddr-size\longword_unsigned\longword (unsigned)\read only\by reference)
<argdef>Size of the socket address structure.
<argitem>(sockaddr-retlen\longword_unsigned\longword (unsigned)\write only\by reference)
<argdef>Returned actual length of the socket address.
<argitem>(iosb\io_status_block\longword (unsigned)\write only\by reference)
<argdef>I/O status block to receive the status for this call.
<argitem>(astadr\procedure\longword (unsigned)\call\by reference)
<argdef>Address of an AST routine to be invoked on completion of this operation.
<argitem>(astprm\user_arg\longword (unsigned)\read only\by value)
<argdef>Parameter to be passed to the AST routine.
<endargdeflist>
<description>
This routine is used to return the remote address and port information for a
socket that is connected to a remote system.
<enddescription>
<comment>(----------------------------------------------------------------)
<routine>(NETLIB_GETSOCKNAME\Get local socket address\\NETLIB_DOC_28)
<overview>
NETLIB_GETSOCKNAME returns the local address and port information for
a socket.
<endoverview>
<format>
<frtn>(NETLIB_GETSOCKNAME)
<fargs>(socket, socket-address, sockaddr-size, sockaddr-retlen
[,iosb] [,astadr] [,astprm])
<endformat>
<returns>(cond_value\longword (unsigned)\write only\by value)
<argdeflist>
<argitem>(socket\longword_unsigned\longword (unsigned)\read only\by reference)
<argdef>Socket for which the information is to be returned.
<argitem>(socket-address\structure\longword (unsigned)\write only\by reference)
<argdef>Socket_address structure which will hold the returned address/port
information.
<argitem>(sockaddr-size\longword_unsigned\longword (unsigned)\read only\by reference)
<argdef>Size of the socket address structure.
<argitem>(sockaddr-retlen\longword_unsigned\longword (unsigned)\write only\by reference)
<argdef>Returned actual length of the socket address.
<argitem>(iosb\io_status_block\longword (unsigned)\write only\by reference)
<argdef>I/O status block to receive the status for this call.
<argitem>(astadr\procedure\longword (unsigned)\call\by reference)
<argdef>Address of an AST routine to be invoked on completion of this operation.
<argitem>(astprm\user_arg\longword (unsigned)\read only\by value)
<argdef>Parameter to be passed to the AST routine.
<endargdeflist>
<description>
This routine is used to return the local address and port information for a
socket that has been bound or connected.
<enddescription>
<comment>(----------------------------------------------------------------)
<routine>(NETLIB_GETSOCKOPT\Get socket options\\NETLIB_DOC_29)
<overview>
NETLIB_GETSOCKOPT gets the current state of a socket option.
<endoverview>
<format>
<frtn>(NETLIB_GETSOCKOPT)
<fargs>(socket, level, option, value, valsize [,vallen] [,iosb] [,astadr] [,astprm])
<endformat>
<returns>(cond_value\longword (unsigned)\write only\by value)
<argdeflist>
<argitem>(socket\longword_unsigned\longword (unsigned)\read only\by reference)
<argdef>The socket about which you wish to obtain the option information.
<argitem>(level\longword_unsigned\longword (unsigned)\read only\by reference)
<argdef><quote>(Level) of the option being set. The only level globally
supported is NETLIB_K_LEVEL_SOCKET (value X'FFFF'). Some packages also
support protocol-level option settings.
<argitem>(option\longword_unsigned\longword (unsigned)\read only\by reference)
<argdef>Longword representing the option being set. Not all packages support
all options, but most support the ones listed in <reference>(option_table).
<P>Consult your TCP/IP documentation on other available options
and on option value ranges.
<argitem>(value\varying_arg\longword (unsigned)\write only\by reference)
<argdef>Value to set for the option. Values vary from option to option.
<argitem>(valsize\longword_unsigned\longword (unsigned)\read only\by reference)
<argdef>Size of the <emphasis>(value\bold) argument, in bytes.
<argitem>(vallen\longword_unsigned\longword (unsigned)\write only\by reference)
<argdef>Actual returned length of <emphasis>(value\bold), in bytes.
<argitem>(iosb\io_status_block\longword (unsigned)\write only\by reference)
<argdef>I/O status block to receive the status for this call.
<argitem>(astadr\procedure\longword (unsigned)\call\by reference)
<argdef>Address of an AST routine to be invoked on completion of this operation.
<argitem>(astprm\user_arg\longword (unsigned)\read only\by value)
<argdef>Parameter to be passed to the AST routine.
<endargdeflist>
<description>
This routine provides an interface to the <emphasis>(getsockopt\bold) service
provided by most TCP/IP packages (most are based on the BSD socket
communications model).
<enddescription>
<comment>(----------------------------------------------------------------)
<routine>(NETLIB_GET_HOSTNAME\Get local host's name\\NETLIB_DOC_29_AND_A_HALF)
<overview>
NETLIB_GET_HOSTNAME returns the Internet host name of the local host.
<endoverview>
<format>
<frtn>(NETLIB_GET_HOSTNAME)
<fargs>(namdsc [,retlen])
<endformat>
<returns>(cond_value\longword (unsigned)\write only\by value)
<argdeflist>
<argitem>(namdsc\char_string\character string\write only\by descriptor)
<argdef>Character string buffer that gets the returned host name.
<argitem>(retlen\word_unsigned\word (unsigned)\write only\by reference)
<argdef>The returned length of the host name.
<endargdeflist>
<description>
This routine returns the name of the local host by translating the
appropriate logical name defined for the TCP/IP package running on the
system.
<enddescription>
<comment>(----------------------------------------------------------------)
<routine>(NETLIB_HTON_LONG\Convert host-order longword to network order\\NETLIB_DOC_30)
<overview>
NETLIB_HTON_LONG is a utility routine for converting a longword in
the local host's byte order to a network-order longword.
<endoverview>
<format>
<frtn>(NETLIB_HTON_LONG)
<fargs>(value)
<endformat>
<returns>(longword_unsigned\longword (unsigned)\write only\by value)
<argdeflist>
<argitem>(value\longword_unsigned\longword (unsigned)\read only\by reference)
<argdef>The longword to be converted.
<endargdeflist>
<description>
This is a utility routine which reverses the byte order of a longword
to convert it from the native format for the local host (which is
<quote>(little-endian) for VAX and AXP systems running VMS) to network
order (which is <quote>(big-endian)). The returned value is the
network-order longword.
<enddescription>
<comment>(----------------------------------------------------------------)
<routine>(NETLIB_HTON_WORD\Convert host-order word to network order\\NETLIB_DOC_31)
<overview>
NETLIB_HTON_WORD is a utility routine for converting a word in
the local host's byte order to a network-order word.
<endoverview>
<format>
<frtn>(NETLIB_HTON_WORD)
<fargs>(value)
<endformat>
<returns>(word_unsigned\word (unsigned)\write only\by value)
<argdeflist>
<argitem>(value\word_unsigned\word (unsigned)\read only\by reference)
<argdef>The word to be converted.
<endargdeflist>
<description>
This is a utility routine which reverses the byte order of a word
to convert it from the native format for the local host (which is
<quote>(little-endian) for VAX and AXP systems running VMS) to network
order (which is <quote>(big-endian)). The return value is the
network-order word.
<enddescription>
<comment>(----------------------------------------------------------------)
<routine>(NETLIB_LISTEN\Listen for incoming connections\\NETLIB_DOC_32)
<overview>
NETLIB_LISTEN sets a socket up to listen for incoming connections.
<endoverview>
<format>
<frtn>(NETLIB_LISTEN)
<fargs>(socket [,backlog] [,iosb] [,astadr] [,astprm])
<endformat>
<returns>(cond_value\longword (unsigned)\write only\by value)
<argdeflist>
<argitem>(socket\longword_unsigned\longword (unsigned)\read only\by reference)
<argdef>Socket to be set up as a listener.
<argitem>(backlog\unsigned int\longword (unsigned)\read only\by reference)
<argdef>The number of backlogged connections to allow on this listener.
<argitem>(iosb\io_status_block\longword (unsigned)\write only\by reference)
<argdef>I/O status block to receive the status for this call.
<argitem>(astadr\procedure\longword (unsigned)\call\by reference)
<argdef>Address of an AST routine to be invoked on completion of this operation.
<argitem>(astprm\user_arg\longword (unsigned)\read only\by value)
<argdef>Parameter to be passed to the AST routine.
<endargdeflist>
<description>
This routine is used as part of a <quote>(passive) open sequence, typically
by servers that bind a socket to a specific port number, then establish
a listener to handle the incoming connections. This call is usually followed
by one or more invocations of NETLIB_ACCEPT to accept the incoming connections.
<enddescription>
<comment>(----------------------------------------------------------------)
<routine>(NETLIB_NAME_TO_ADDRESS\Get the IP address(es) for a host name\\NETLIB_DOC_33)
<overview>
NETLIB_NAME_TO_ADDRESS looks up a host name, returning its IP address(es).
<endoverview>
<format>
<frtn>(NETLIB_NAME_TO_ADDRESS)
<fargs>(socket, [which], hostname, addrlist, addrlist-size [,addrcount] [,iosb] [,astadr] [,astprm])
<endformat>
<returns>(cond_value\longword (unsigned)\write only\by value)
<argdeflist>
<argitem>(socket\longword_unsigned\longword (unsigned)\read only\by reference)
<argdef>The socket about which you wish to obtain the option information.
<argitem>(which\longword_unsigned\longword (unsigned)\read only\by reference)
<argdef>A code indicating the type of lookup to be performed. Possible values
are NETLIB_K_LOOKUP_DNS (1), which requests that the name be looked up using
the Domain Name System, and NETLIB_K_LOOKUP_HOST_TABLE (2), which requests
that the name be looked up in the local host table. If omitted, the default
is NETLIB_K_LOOKUP_DNS. See the Description section for information on
package-specific restrictions with this parameter.
<argitem>(hostname\char_string\character string\read only\by descriptor)
<argdef>The host name to be looked up.
<argitem>(addrlist\array of structures\longword (unsigned)\write only\by reference)
<argdef>An array of INADDRDEF structures into which the addresses will be
written.
<argitem>(addrlist-size\longword_unsigned\longword (unsigned)\read only\by reference)
<argdef>The number of elements in the <emphasis>(addrlist\bold) array.
<argitem>(addrcount\longword_unsigned\longword (unsigned)\write only\by reference)
<argdef>The actual number of addresses written to <emphasis>(addrlist\bold).
<argitem>(iosb\io_status_block\longword (unsigned)\write only\by reference)
<argdef>I/O status block to receive the status for this call.
<argitem>(astadr\procedure\longword (unsigned)\call\by reference)
<argdef>Address of an AST routine to be invoked on completion of this operation.
<argitem>(astprm\user_arg\longword (unsigned)\read only\by value)
<argdef>Parameter to be passed to the AST routine.
<endargdeflist>
<description>
This routine performs a name-to-address lookup on the specified host name.
Each TCP/IP package implements this function slightly differently, so
there are some restrictions on the use of this routine.
<P>
The <emphasis>(which\bold) argument is ignored, since
these packages do not provide separate access to DNS and local host tables.
Host table lookup will occur first, followed by a DNS lookup.
<enddescription>
<comment>(----------------------------------------------------------------)
<routine>(NETLIB_NTOH_LONG\Convert network-order longword to host order\\NETLIB_DOC_34)
<overview>
NETLIB_NTOH_LONG is a utility routine for converting a longword in
the network byte order to a host-order longword.
<endoverview>
<format>
<frtn>(NETLIB_NTOH_LONG)
<fargs>(value)
<endformat>
<returns>(longword_unsigned\longword (unsigned)\write only\by value)
<argdeflist>
<argitem>(value\longword_unsigned\longword (unsigned)\read only\by reference)
<argdef>The longword to be converted.
<endargdeflist>
<description>
This is a utility routine which reverses the byte order of a longword
to convert it from network order to host order. The return value is the
host-order longword.
<enddescription>
<comment>(----------------------------------------------------------------)
<routine>(NETLIB_NTOH_WORD\Convert network-order word to host order\\NETLIB_DOC_35)
<overview>
NETLIB_NTOH_WORD is a utility routine for converting a word in
the network byte order to a host-order word.
<endoverview>
<format>
<frtn>(NETLIB_NTOH_WORD)
<fargs>(value)
<endformat>
<returns>(word_unsigned\word (unsigned)\write only\by value)
<argdeflist>
<argitem>(value\word_unsigned\word (unsigned)\read only\by reference)
<argdef>The word to be converted.
<endargdeflist>
<description>
This is a utility routine which reverses the byte order of a word