diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-10-21 13:42:24 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-10-21 13:42:24 +0000 |
commit | 9dfe12ae5b94d03c997ea2903022a5d2d5c5f266 (patch) | |
tree | bdfc70477b60f1220cb05dd233a4570dd9c6bb5c /gcc/ada/g-socket.ads | |
parent | 1c662558a1113238a624245a45382d3df90ccf13 (diff) | |
download | gcc-9dfe12ae5b94d03c997ea2903022a5d2d5c5f266.tar.gz |
2003-10-21 Arnaud Charlet <charlet@act-europe.fr>
* 3psoccon.ads, 3veacodu.adb, 3vexpect.adb, 3vsoccon.ads,
3vsocthi.adb, 3vsocthi.ads, 3vtrasym.adb, 3zsoccon.ads,
3zsocthi.adb, 3zsocthi.ads, 50system.ads, 51system.ads,
55system.ads, 56osinte.adb, 56osinte.ads, 56taprop.adb,
56taspri.ads, 56tpopsp.adb, 57system.ads, 58system.ads,
59system.ads, 5aml-tgt.adb, 5bml-tgt.adb, 5csystem.ads,
5dsystem.ads, 5fosinte.adb, 5gml-tgt.adb, 5hml-tgt.adb,
5isystem.ads, 5lparame.adb, 5msystem.ads, 5psystem.ads,
5sml-tgt.adb, 5sosprim.adb, 5stpopsp.adb, 5tsystem.ads,
5usystem.ads, 5vml-tgt.adb, 5vsymbol.adb, 5vtraent.adb,
5vtraent.ads, 5wml-tgt.adb, 5xparame.ads, 5xsystem.ads,
5xvxwork.ads, 5yparame.ads, 5ytiitho.adb, 5zinit.adb,
5zml-tgt.adb, 5zparame.ads, 5ztaspri.ads, 5ztfsetr.adb,
5zthrini.adb, 5ztiitho.adb, 5ztpopsp.adb, 7stfsetr.adb,
7straces.adb, 7strafor.adb, 7strafor.ads, 7stratas.adb,
a-excach.adb, a-exexda.adb, a-exexpr.adb, a-exextr.adb,
a-exstat.adb, a-strsup.adb, a-strsup.ads, a-stwisu.adb,
a-stwisu.ads, bld.adb, bld.ads, bld-io.adb,
bld-io.ads, clean.adb, clean.ads, ctrl_c.c,
erroutc.adb, erroutc.ads, errutil.adb, errutil.ads,
err_vars.ads, final.c, g-arrspl.adb, g-arrspl.ads,
g-boubuf.adb, g-boubuf.ads, g-boumai.ads, g-bubsor.adb,
g-bubsor.ads, g-comver.adb, g-comver.ads, g-ctrl_c.ads,
g-dynhta.adb, g-dynhta.ads, g-eacodu.adb, g-excact.adb,
g-excact.ads, g-heasor.adb, g-heasor.ads, g-memdum.adb,
g-memdum.ads, gnatclean.adb, gnatsym.adb, g-pehage.adb,
g-pehage.ads, g-perhas.ads, gpr2make.adb, gpr2make.ads,
gprcmd.adb, gprep.adb, gprep.ads, g-semaph.adb,
g-semaph.ads, g-string.adb, g-string.ads, g-strspl.ads,
g-wistsp.ads, i-vthrea.adb, i-vthrea.ads, i-vxwoio.adb,
i-vxwoio.ads, Makefile.generic, Makefile.prolog, Makefile.rtl,
prep.adb, prep.ads, prepcomp.adb, prepcomp.ads,
prj-err.adb, prj-err.ads, s-boarop.ads, s-carsi8.adb,
s-carsi8.ads, s-carun8.adb, s-carun8.ads, s-casi16.adb,
s-casi16.ads, s-casi32.adb, s-casi32.ads, s-casi64.adb,
s-casi64.ads, s-casuti.adb, s-casuti.ads, s-caun16.adb,
s-caun16.ads, s-caun32.adb, s-caun32.ads, s-caun64.adb,
s-caun64.ads, scng.adb, scng.ads, s-exnint.adb,
s-exnllf.adb, s-exnlli.adb, s-expint.adb, s-explli.adb,
s-geveop.adb, s-geveop.ads, s-hibaen.ads, s-htable.adb,
s-htable.ads, sinput-c.adb, sinput-c.ads, s-memcop.ads,
socket.c, s-purexc.ads, s-scaval.adb, s-stopoo.adb,
s-strcom.adb, s-strcom.ads, s-strxdr.adb, s-rident.ads,
s-thread.adb, s-thread.ads, s-tpae65.adb, s-tpae65.ads,
s-tporft.adb, s-traent.adb, s-traent.ads, styleg.adb,
styleg.ads, styleg-c.adb, styleg-c.ads, s-veboop.adb,
s-veboop.ads, s-vector.ads, symbols.adb, symbols.ads,
tb-alvms.c, tb-alvxw.c, tempdir.adb, tempdir.ads,
vms_conv.ads, vms_conv.adb, vms_data.ads,
vxaddr2line.adb: Files added. Merge with ACT tree.
* 4dintnam.ads, 4mintnam.ads, 4uintnam.ads, 52system.ads,
5dosinte.ads, 5etpopse.adb, 5mosinte.ads, 5qosinte.adb,
5qosinte.ads, 5qstache.adb, 5qtaprop.adb, 5qtaspri.ads,
5stpopse.adb, 5uintman.adb, 5uosinte.ads, adafinal.c,
g-enblsp.adb, io-aux.c, scn-nlit.adb, scn-slit.adb,
s-exnflt.ads, s-exngen.adb, s-exngen.ads, s-exnlfl.ads,
s-exnlin.ads, s-exnsfl.ads, s-exnsin.ads, s-exnssi.ads,
s-expflt.ads, s-expgen.adb, s-expgen.ads, s-explfl.ads,
s-explin.ads, s-expllf.ads, s-expsfl.ads, s-expsin.ads,
s-expssi.ads, style.adb: Files removed. Merge with ACT tree.
* 1ic.ads, 31soccon.ads, 31soliop.ads, 3asoccon.ads,
3bsoccon.ads, 3gsoccon.ads, 3hsoccon.ads, 3ssoccon.ads,
3ssoliop.ads, 3wsoccon.ads, 3wsocthi.adb, 3wsocthi.ads,
3wsoliop.ads, 41intnam.ads, 42intnam.ads, 4aintnam.ads,
4cintnam.ads, 4gintnam.ads, 4hexcpol.adb, 4hintnam.ads,
4lintnam.ads, 4nintnam.ads, 4ointnam.ads, 4onumaux.ads,
4pintnam.ads, 4sintnam.ads, 4vcaldel.adb, 4vcalend.adb,
4vintnam.ads, 4wexcpol.adb, 4wintnam.ads, 4zintnam.ads,
51osinte.adb, 51osinte.ads, 52osinte.adb, 52osinte.ads,
53osinte.ads, 54osinte.ads, 5aosinte.adb, 5aosinte.ads,
5asystem.ads, 5ataprop.adb, 5atasinf.ads, 5ataspri.ads,
5atpopsp.adb, 5avxwork.ads, 5bosinte.adb, 5bosinte.ads,
5bsystem.ads, 5cosinte.ads, 5esystem.ads, 5fintman.adb,
5fosinte.ads, 5fsystem.ads, 5ftaprop.adb, 5ftasinf.ads,
5ginterr.adb, 5gintman.adb, 5gmastop.adb, 5gosinte.ads,
5gproinf.ads, 5gsystem.ads, 5gtaprop.adb, 5gtasinf.ads,
5gtpgetc.adb, 5hosinte.adb, 5hosinte.ads, 5hsystem.ads,
5htaprop.adb, 5htaspri.ads, 5htraceb.adb, 5iosinte.adb,
5itaprop.adb, 5itaspri.ads, 5ksystem.ads, 5kvxwork.ads,
5lintman.adb, 5lml-tgt.adb, 5losinte.ads, 5lsystem.ads,
5mvxwork.ads, 5ninmaop.adb, 5nintman.adb, 5nosinte.ads,
5ntaprop.adb, 5ntaspri.ads, 5ointerr.adb, 5omastop.adb,
5oosinte.adb, 5oosinte.ads, 5oosprim.adb, 5oparame.adb,
5osystem.ads, 5otaprop.adb, 5otaspri.ads, 5posinte.ads,
5posprim.adb, 5pvxwork.ads, 5sintman.adb, 5sosinte.adb,
5sosinte.ads, 5ssystem.ads, 5staprop.adb, 5stasinf.ads,
5staspri.ads, 5svxwork.ads, 5tosinte.ads, 5vasthan.adb,
5vinmaop.adb, 5vinterr.adb, 5vintman.adb, 5vintman.ads,
5vmastop.adb, 5vosinte.adb, 5vosinte.ads, 5vosprim.adb,
5vsystem.ads, 5vtaprop.adb, 5vtaspri.ads, 5vtpopde.adb,
5vtpopde.ads, 5wgloloc.adb, 5wintman.adb, 5wmemory.adb,
5wosprim.adb, 5wsystem.ads, 5wtaprop.adb, 5wtaspri.ads,
5ysystem.ads, 5zinterr.adb, 5zintman.adb, 5zosinte.adb,
5zosinte.ads, 5zosprim.adb, 5zsystem.ads, 5ztaprop.adb,
6vcpp.adb, 6vcstrea.adb, 6vinterf.ads, 7sinmaop.adb,
7sintman.adb, 7sosinte.adb, 7sosprim.adb, 7staprop.adb,
7staspri.ads, 7stpopsp.adb, 7straceb.adb, 9drpc.adb,
a-caldel.adb, a-caldel.ads, a-charac.ads, a-colien.ads,
a-comlin.adb, adaint.c, adaint.h, ada-tree.def,
a-diocst.adb, a-diocst.ads, a-direio.adb, a-except.adb,
a-except.ads, a-excpol.adb, a-exctra.adb, a-exctra.ads,
a-filico.adb, a-interr.adb, a-intsig.adb, a-intsig.ads,
ali.adb, ali.ads, ali-util.adb, ali-util.ads,
a-ngcefu.adb, a-ngcoty.adb, a-ngelfu.adb, a-nudira.adb,
a-nudira.ads, a-nuflra.adb, a-nuflra.ads, a-reatim.adb,
a-reatim.ads, a-retide.ads, a-sequio.adb, a-siocst.adb,
a-siocst.ads, a-ssicst.adb, a-ssicst.ads, a-strbou.adb,
a-strbou.ads, a-strfix.adb, a-strmap.adb, a-strsea.ads,
a-strunb.adb, a-strunb.ads, a-ststio.adb, a-stunau.adb,
a-stunau.ads, a-stwibo.adb, a-stwibo.ads, a-stwifi.adb,
a-stwima.adb, a-stwiun.adb, a-stwiun.ads, a-tags.adb,
a-tags.ads, a-tasatt.adb, a-taside.adb, a-teioed.adb,
a-textio.adb, a-textio.ads, a-tienau.adb, a-tifiio.adb,
a-tiflau.adb, a-tiflio.adb, a-tigeau.adb, a-tigeau.ads,
a-tiinau.adb, a-timoau.adb, a-tiocst.adb, a-tiocst.ads,
atree.adb, atree.ads, a-witeio.adb, a-witeio.ads,
a-wtcstr.adb, a-wtcstr.ads, a-wtdeio.adb, a-wtedit.adb,
a-wtenau.adb, a-wtflau.adb, a-wtinau.adb, a-wtmoau.adb,
bcheck.adb, binde.adb, bindgen.adb, bindusg.adb,
checks.adb, checks.ads, cio.c, comperr.adb,
comperr.ads, csets.adb, cstand.adb, cstreams.c,
debug_a.adb, debug_a.ads, debug.adb, decl.c,
einfo.adb, einfo.ads, errout.adb, errout.ads,
eval_fat.adb, eval_fat.ads, exp_aggr.adb, expander.adb,
expander.ads, exp_attr.adb, exp_ch11.adb, exp_ch13.adb,
exp_ch2.adb, exp_ch3.adb, exp_ch3.ads, exp_ch4.adb,
exp_ch5.adb, exp_ch6.adb, exp_ch7.adb, exp_ch7.ads,
exp_ch8.adb, exp_ch9.adb, exp_code.adb, exp_dbug.adb,
exp_dbug.ads, exp_disp.adb, exp_dist.adb, expect.c,
exp_fixd.adb, exp_imgv.adb, exp_intr.adb, exp_pakd.adb,
exp_prag.adb, exp_strm.adb, exp_strm.ads, exp_tss.adb,
exp_tss.ads, exp_util.adb, exp_util.ads, exp_vfpt.adb,
fe.h, fmap.adb, fmap.ads, fname.adb,
fname.ads, fname-uf.adb, fname-uf.ads, freeze.adb,
freeze.ads, frontend.adb, g-awk.adb, g-awk.ads,
g-busora.adb, g-busora.ads, g-busorg.adb, g-busorg.ads,
g-casuti.adb, g-casuti.ads, g-catiio.adb, g-catiio.ads,
g-cgi.adb, g-cgi.ads, g-cgicoo.adb, g-cgicoo.ads,
g-cgideb.adb, g-cgideb.ads, g-comlin.adb, g-comlin.ads,
g-crc32.adb, g-crc32.ads, g-debpoo.adb, g-debpoo.ads,
g-debuti.adb, g-debuti.ads, g-diopit.adb, g-diopit.ads,
g-dirope.adb, g-dirope.ads, g-dyntab.adb, g-dyntab.ads,
g-except.ads, g-exctra.adb, g-exctra.ads, g-expect.adb,
g-expect.ads, g-hesora.adb, g-hesora.ads, g-hesorg.adb,
g-hesorg.ads, g-htable.adb, g-htable.ads, gigi.h,
g-io.adb, g-io.ads, g-io_aux.adb, g-io_aux.ads,
g-locfil.adb, g-locfil.ads, g-md5.adb, g-md5.ads,
gmem.c, gnat1drv.adb, gnatbind.adb, gnatchop.adb,
gnatcmd.adb, gnatfind.adb, gnatkr.adb, gnatlbr.adb,
gnatlink.adb, gnatls.adb, gnatmake.adb, gnatmem.adb,
gnatname.adb, gnatprep.adb, gnatprep.ads, gnatpsta.adb,
gnatxref.adb, g-os_lib.adb, g-os_lib.ads, g-regexp.adb,
g-regexp.ads, g-regist.adb, g-regist.ads, g-regpat.adb,
g-regpat.ads, g-soccon.ads, g-socket.adb, g-socket.ads,
g-socthi.adb, g-socthi.ads, g-soliop.ads, g-souinf.ads,
g-speche.adb, g-speche.ads, g-spipat.adb, g-spipat.ads,
g-spitbo.adb, g-spitbo.ads, g-sptabo.ads, g-sptain.ads,
g-sptavs.ads, g-table.adb, g-table.ads, g-tasloc.adb,
g-tasloc.ads, g-thread.adb, g-thread.ads, g-traceb.adb,
g-traceb.ads, g-trasym.adb, g-trasym.ads, hostparm.ads,
i-c.ads, i-cobol.adb, i-cpp.adb, i-cstrea.ads,
i-cstrin.adb, i-cstrin.ads, impunit.adb, init.c,
inline.adb, interfac.ads, i-pacdec.ads, itypes.adb,
itypes.ads, i-vxwork.ads, lang.opt, lang-specs.h,
layout.adb, lib.adb, lib.ads, lib-list.adb,
lib-load.adb, lib-load.ads, lib-sort.adb, lib-util.adb,
lib-writ.adb, lib-writ.ads, lib-xref.adb, lib-xref.ads,
link.c, live.adb, make.adb, make.ads,
Makefile.adalib, Makefile.in, Make-lang.in, makeusg.adb,
mdll.adb, mdll-fil.adb, mdll-fil.ads, mdll-utl.adb,
mdll-utl.ads, memroot.adb, memroot.ads, memtrack.adb,
misc.c, mkdir.c, mlib.adb, mlib.ads,
mlib-fil.adb, mlib-fil.ads, mlib-prj.adb, mlib-prj.ads,
mlib-tgt.adb, mlib-tgt.ads, mlib-utl.adb, mlib-utl.ads,
namet.adb, namet.ads, namet.h, nlists.ads,
nlists.h, nmake.adt, opt.adb, opt.ads,
osint.adb, osint.ads, osint-b.adb, osint-c.adb,
par.adb, par-ch10.adb, par-ch11.adb, par-ch2.adb,
par-ch3.adb, par-ch4.adb, par-ch5.adb, par-ch6.adb,
par-ch9.adb, par-endh.adb, par-labl.adb, par-load.adb,
par-prag.adb, par-sync.adb, par-tchk.adb, par-util.adb,
prj.adb, prj.ads, prj-attr.adb, prj-attr.ads,
prj-com.adb, prj-com.ads, prj-dect.adb, prj-dect.ads,
prj-env.adb, prj-env.ads, prj-ext.adb, prj-ext.ads,
prj-makr.adb, prj-makr.ads, prj-nmsc.adb, prj-nmsc.ads,
prj-pars.adb, prj-pars.ads, prj-part.adb, prj-part.ads,
prj-pp.adb, prj-pp.ads, prj-proc.adb, prj-proc.ads,
prj-strt.adb, prj-strt.ads, prj-tree.adb, prj-tree.ads,
prj-util.adb, prj-util.ads, raise.c, raise.h,
repinfo.adb, repinfo.h, restrict.adb, restrict.ads,
rident.ads, rtsfind.adb, rtsfind.ads, s-addima.ads,
s-arit64.adb, s-assert.adb, s-assert.ads, s-atacco.adb,
s-atacco.ads, s-auxdec.adb, s-auxdec.ads, s-bitops.adb,
scans.ads, scn.adb, scn.ads, s-crc32.adb,
s-crc32.ads, s-direio.adb, sem.adb, sem.ads,
sem_aggr.adb, sem_attr.adb, sem_attr.ads, sem_case.adb,
sem_case.ads, sem_cat.adb, sem_cat.ads, sem_ch10.adb,
sem_ch11.adb, sem_ch12.adb, sem_ch12.ads, sem_ch13.adb,
sem_ch13.ads, sem_ch3.adb, sem_ch3.ads, sem_ch4.adb,
sem_ch5.adb, sem_ch5.ads, sem_ch6.adb, sem_ch6.ads,
sem_ch7.adb, sem_ch7.ads, sem_ch8.adb, sem_ch8.ads,
sem_ch9.adb, sem_disp.adb, sem_disp.ads, sem_dist.adb,
sem_elab.adb, sem_eval.adb, sem_eval.ads, sem_intr.adb,
sem_maps.adb, sem_mech.adb, sem_prag.adb, sem_prag.ads,
sem_res.adb, sem_res.ads, sem_type.adb, sem_type.ads,
sem_util.adb, sem_util.ads, sem_warn.adb, s-errrep.adb,
s-errrep.ads, s-exctab.adb, s-exctab.ads, s-exnint.ads,
s-exnllf.ads, s-exnlli.ads, s-expint.ads, s-explli.ads,
s-expuns.ads, s-fatflt.ads, s-fatgen.adb, s-fatgen.ads,
s-fatlfl.ads, s-fatllf.ads, s-fatsfl.ads, s-fileio.adb,
s-fileio.ads, s-finimp.adb, s-finimp.ads, s-finroo.adb,
s-finroo.ads, sfn_scan.adb, s-gloloc.adb, s-gloloc.ads,
s-imgdec.adb, s-imgenu.adb, s-imgrea.adb, s-imgwch.adb,
sinfo.adb, sinfo.ads, s-inmaop.ads, sinput.adb,
sinput.ads, sinput-d.adb, sinput-l.adb, sinput-l.ads,
sinput-p.adb, sinput-p.ads, s-interr.adb, s-interr.ads,
s-intman.ads, s-maccod.ads, s-mastop.adb, s-mastop.ads,
s-memory.adb, s-memory.ads, snames.adb, snames.ads,
snames.h, s-osprim.ads, s-parame.ads, s-parint.ads,
s-pooloc.adb, s-pooloc.ads, s-poosiz.adb, sprint.adb,
s-proinf.ads, s-scaval.ads, s-secsta.adb, s-secsta.ads,
s-sequio.adb, s-shasto.adb, s-shasto.ads, s-soflin.ads,
s-stache.adb, s-stache.ads, s-stalib.adb, s-stalib.ads,
s-stoele.ads, s-stopoo.ads, s-stratt.adb, s-stratt.ads,
s-strops.adb, s-strops.ads, s-taasde.adb, s-taasde.ads,
s-tadeca.adb, s-tadeca.ads, s-tadert.adb, s-tadert.ads,
s-taenca.adb, s-taenca.ads, s-taprob.adb, s-taprob.ads,
s-taprop.ads, s-tarest.adb, s-tarest.ads, s-tasdeb.adb,
s-tasdeb.ads, s-tasinf.adb, s-tasinf.ads, s-tasini.adb,
s-tasini.ads, s-taskin.adb, s-taskin.ads, s-tasque.adb,
s-tasque.ads, s-tasren.adb, s-tasren.ads, s-tasres.ads,
s-tassta.adb, s-tassta.ads, s-tasuti.adb, s-tasuti.ads,
s-tataat.adb, s-tataat.ads, s-tpinop.adb, s-tpinop.ads,
s-tpoben.adb, s-tpoben.ads, s-tpobop.adb, s-tpobop.ads,
s-tposen.adb, s-tposen.ads, s-traceb.adb, s-traceb.ads,
stringt.adb, stringt.ads, stringt.h, style.ads,
stylesw.adb, stylesw.ads, s-unstyp.ads, s-vaflop.ads,
s-valrea.adb, s-valuti.adb, s-vercon.adb, s-vmexta.adb,
s-wchcnv.ads, s-wchcon.ads, s-widcha.adb, switch.adb,
switch.ads, switch-b.adb, switch-c.adb, switch-m.adb,
s-wwdcha.adb, s-wwdwch.adb, sysdep.c, system.ads,
table.adb, table.ads, targparm.adb, targparm.ads,
targtyps.c, tbuild.adb, tbuild.ads, tracebak.c,
trans.c, tree_io.adb, treepr.adb, treeprs.adt,
ttypes.ads, types.ads, types.h, uintp.adb,
uintp.ads, uintp.h, uname.adb, urealp.adb,
urealp.ads, urealp.h, usage.adb, utils2.c,
utils.c, validsw.adb, validsw.ads, widechar.adb,
xeinfo.adb, xnmake.adb, xref_lib.adb, xref_lib.ads,
xr_tabls.adb, xr_tabls.ads, xtreeprs.adb, xsnames.adb,
einfo.h, sinfo.h, treeprs.ads, nmake.ads, nmake.adb,
gnatvsn.ads: Merge with ACT tree.
* gnatvsn.adb: Rewritten in a simpler and more efficient way.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@72751 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/g-socket.ads')
-rw-r--r-- | gcc/ada/g-socket.ads | 559 |
1 files changed, 383 insertions, 176 deletions
diff --git a/gcc/ada/g-socket.ads b/gcc/ada/g-socket.ads index 213de119c02..57a83743f1e 100644 --- a/gcc/ada/g-socket.ads +++ b/gcc/ada/g-socket.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 2001-2002 Ada Core Technologies, Inc. -- +-- Copyright (C) 2001-2003 Ada Core Technologies, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -26,311 +26,343 @@ -- however invalidate any other reasons why the executable file might be -- -- covered by the GNU Public License. -- -- -- --- GNAT is maintained by Ada Core Technologies Inc (http://www.gnat.com). -- +-- GNAT was originally developed by the GNAT team at New York University. -- +-- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ --- This package provides an interface to the sockets communication facility --- provided on many operating systems. Currently this is implemented on all --- native GNAT ports except for VMS. It is not yet implemented on the Lynx --- cross-ports. +-- This package provides an interface to the sockets communication +-- facility provided on many operating systems. This is implemented +-- on the following platforms: --- Another restriction is that there is no multicast support under Windows --- or under any system on which the multicast support is not available or --- installed. +-- All native ports, except Interix, with restrictions as follows + +-- Multicast is available only on systems which provide support +-- for this feature, so it is not available if Multicast is not +-- supported, or not installed. In particular Multicast is not +-- available with the Windows version. + +-- The VMS implementation has implemented using the DECC RTL Socket +-- API, and is thus subject to limitations in the implementation of +-- this API. + +-- This package is not supported on the Interix port of GNAT. + +-- VxWorks cross ports fully implement this package. + +-- This package is not yet implemented on LynxOS. with Ada.Exceptions; with Ada.Streams; +with System; + package GNAT.Sockets is -- Sockets are designed to provide a consistent communication facility - -- between applications. This package provides an Ada-like intrerface - -- similar to that proposed as part of the BSD socket layer. This is a - -- system independent thick binding. + -- between applications. This package provides an Ada-like interface + -- similar to that proposed as part of the BSD socket layer. + + -- GNAT.Sockets has been designed with several ideas in mind. + + -- This is a system independent interface. Therefore, we try as + -- much as possible to mask system incompatibilities. Some + -- functionalities are not available because there are not fully + -- supported on some systems. + + -- This is a thick binding. For instance, a major effort has been + -- done to avoid using memory addresses or untyped ints. We + -- preferred to define streams and enumeration types. Errors are + -- not returned as returned values but as exceptions. + + -- This package provides a POSIX-compliant interface (between two + -- different implementations of the same routine, we adopt the one + -- closest to the POSIX specification). For instance, using + -- select(), the notification of an asynchronous connect failure + -- is delivered in the write socket set (POSIX) instead of the + -- exception socket set (NT). -- Here is a typical example of what you can do: -- with GNAT.Sockets; use GNAT.Sockets; - -- + -- with Ada.Text_IO; -- with Ada.Exceptions; use Ada.Exceptions; - -- + -- procedure PingPong is - -- + -- Group : constant String := "239.255.128.128"; - -- -- Multicast groupe: administratively scoped IP address - -- + -- -- Multicast group: administratively scoped IP address + -- task Pong is -- entry Start; -- entry Stop; -- end Pong; - -- + -- task body Pong is -- Address : Sock_Addr_Type; -- Server : Socket_Type; -- Socket : Socket_Type; -- Channel : Stream_Access; - -- + -- begin -- accept Start; -- -- -- Get an Internet address of a host (here the local host name). -- -- Note that a host can have several addresses. Here we get -- -- the first one which is supposed to be the official one. - -- + -- Address.Addr := Addresses (Get_Host_By_Name (Host_Name), 1); - -- + -- -- Get a socket address that is an Internet address and a port - -- - -- Address.Port := 5432; - -- + + -- Address.Port := 5876; + -- -- The first step is to create a socket. Once created, this -- -- socket must be associated to with an address. Usually only -- -- a server (Pong here) needs to bind an address explicitly. -- -- Most of the time clients can skip this step because the -- -- socket routines will bind an arbitrary address to an unbound -- -- socket. - -- + -- Create_Socket (Server); - -- - -- -- Allow reuse of local addresses. - -- + + -- -- Allow reuse of local addresses + -- Set_Socket_Option -- (Server, -- Socket_Level, -- (Reuse_Address, True)); - -- + -- Bind_Socket (Server, Address); - -- - -- -- A server marks a socket as willing to receive connect events. - -- + + -- -- A server marks a socket as willing to receive connect events + -- Listen_Socket (Server); - -- + -- -- Once a server calls Listen_Socket, incoming connects events -- -- can be accepted. The returned Socket is a new socket that -- -- represents the server side of the connection. Server remains -- -- available to receive further connections. - -- + -- Accept_Socket (Server, Socket, Address); - -- - -- -- Return a stream associated to the connected socket. - -- + + -- -- Return a stream associated to the connected socket + -- Channel := Stream (Socket); - -- + -- -- Force Pong to block - -- + -- delay 0.2; - -- - -- -- Receive and print message from client Ping. - -- + + -- -- Receive and print message from client Ping + -- declare -- Message : String := String'Input (Channel); - -- + -- begin -- Ada.Text_IO.Put_Line (Message); - -- - -- -- Send same message to server Pong. - -- + + -- -- Send same message back to client Ping + -- String'Output (Channel, Message); -- end; - -- + -- Close_Socket (Server); -- Close_Socket (Socket); - -- + -- -- Part of the multicast example - -- + -- -- Create a datagram socket to send connectionless, unreliable -- -- messages of a fixed maximum length. - -- + -- Create_Socket (Socket, Family_Inet, Socket_Datagram); - -- - -- -- Allow reuse of local addresses. - -- + + -- -- Allow reuse of local addresses + -- Set_Socket_Option -- (Socket, -- Socket_Level, -- (Reuse_Address, True)); - -- - -- -- Join a multicast group. - -- + + -- -- Join a multicast group + -- Set_Socket_Option -- (Socket, -- IP_Protocol_For_IP_Level, -- (Add_Membership, Inet_Addr (Group), Any_Inet_Addr)); - -- + -- -- Controls the live time of the datagram to avoid it being -- -- looped forever due to routing errors. Routers decrement -- -- the TTL of every datagram as it traverses from one network -- -- to another and when its value reaches 0 the packet is -- -- dropped. Default is 1. - -- + -- Set_Socket_Option -- (Socket, -- IP_Protocol_For_IP_Level, -- (Multicast_TTL, 1)); - -- - -- -- Want the data you send to be looped back to your host. - -- + + -- -- Want the data you send to be looped back to your host + -- Set_Socket_Option -- (Socket, -- IP_Protocol_For_IP_Level, -- (Multicast_Loop, True)); - -- - -- -- If this socket is intended to receive messages, bind it to a - -- -- given socket address. - -- + + -- -- If this socket is intended to receive messages, bind it + -- -- to a given socket address. + -- Address.Addr := Any_Inet_Addr; -- Address.Port := 55505; - -- + -- Bind_Socket (Socket, Address); - -- + -- -- If this socket is intended to send messages, provide the -- -- receiver socket address. - -- + -- Address.Addr := Inet_Addr (Group); -- Address.Port := 55506; - -- + -- Channel := Stream (Socket, Address); - -- - -- -- Receive and print message from client Ping. - -- + + -- -- Receive and print message from client Ping + -- declare -- Message : String := String'Input (Channel); - -- + -- begin - -- - -- -- Get the address of the sender. - -- + -- -- Get the address of the sender + -- Address := Get_Address (Channel); -- Ada.Text_IO.Put_Line (Message & " from " & Image (Address)); - -- - -- -- Send same message to server Pong. - -- + + -- -- Send same message back to client Ping + -- String'Output (Channel, Message); -- end; - -- + -- Close_Socket (Socket); - -- + -- accept Stop; - -- + -- exception when E : others => -- Ada.Text_IO.Put_Line -- (Exception_Name (E) & ": " & Exception_Message (E)); -- end Pong; - -- + -- task Ping is -- entry Start; -- entry Stop; -- end Ping; - -- + -- task body Ping is -- Address : Sock_Addr_Type; -- Socket : Socket_Type; -- Channel : Stream_Access; - -- + -- begin -- accept Start; - -- - -- -- See comments in Ping section for the first steps. - -- + + -- -- See comments in Ping section for the first steps + -- Address.Addr := Addresses (Get_Host_By_Name (Host_Name), 1); - -- Address.Port := 5432; + -- Address.Port := 5876; -- Create_Socket (Socket); - -- + -- Set_Socket_Option -- (Socket, -- Socket_Level, -- (Reuse_Address, True)); - -- + -- -- Force Pong to block - -- + -- delay 0.2; - -- + -- -- If the client's socket is not bound, Connect_Socket will -- -- bind to an unused address. The client uses Connect_Socket to -- -- create a logical connection between the client's socket and -- -- a server's socket returned by Accept_Socket. - -- + -- Connect_Socket (Socket, Address); - -- + -- Channel := Stream (Socket); - -- + -- -- Send message to server Pong. - -- + -- String'Output (Channel, "Hello world"); - -- + -- -- Force Ping to block - -- + -- delay 0.2; - -- - -- -- Receive and print message from server Pong. - -- + + -- -- Receive and print message from server Pong + -- Ada.Text_IO.Put_Line (String'Input (Channel)); -- Close_Socket (Socket); - -- - -- -- Part of multicast example. Code similar to Pong's one. - -- + + -- -- Part of multicast example. Code similar to Pong's one + -- Create_Socket (Socket, Family_Inet, Socket_Datagram); - -- + -- Set_Socket_Option -- (Socket, -- Socket_Level, -- (Reuse_Address, True)); - -- + -- Set_Socket_Option -- (Socket, -- IP_Protocol_For_IP_Level, -- (Add_Membership, Inet_Addr (Group), Any_Inet_Addr)); - -- + -- Set_Socket_Option -- (Socket, -- IP_Protocol_For_IP_Level, -- (Multicast_TTL, 1)); - -- + -- Set_Socket_Option -- (Socket, -- IP_Protocol_For_IP_Level, -- (Multicast_Loop, True)); - -- + -- Address.Addr := Any_Inet_Addr; -- Address.Port := 55506; - -- + -- Bind_Socket (Socket, Address); - -- + -- Address.Addr := Inet_Addr (Group); -- Address.Port := 55505; - -- + -- Channel := Stream (Socket, Address); - -- - -- -- Send message to server Pong. - -- + + -- -- Send message to server Pong + -- String'Output (Channel, "Hello world"); - -- - -- -- Receive and print message from server Pong. - -- + + -- -- Receive and print message from server Pong + -- declare -- Message : String := String'Input (Channel); - -- + -- begin -- Address := Get_Address (Channel); -- Ada.Text_IO.Put_Line (Message & " from " & Image (Address)); -- end; - -- + -- Close_Socket (Socket); - -- + -- accept Stop; - -- + -- exception when E : others => -- Ada.Text_IO.Put_Line -- (Exception_Name (E) & ": " & Exception_Message (E)); -- end Ping; - -- + -- begin -- -- Indicate whether the thread library provides process -- -- blocking IO. Basically, if you are not using FSU threads -- -- the default is ok. - -- + -- Initialize (Process_Blocking_IO => False); -- Ping.Start; -- Pong.Start; @@ -340,11 +372,18 @@ package GNAT.Sockets is -- end PingPong; procedure Initialize (Process_Blocking_IO : Boolean := False); - -- Initialize must be called before using any socket routines. If - -- the thread library provides process blocking IO - basically - -- with FSU threads - GNAT.Sockets should be initialized with a - -- value of True to simulate thread blocking IO. Further calls to - -- Initialize will be ignored. + -- Initialize must be called before using any other socket routines. + -- The Process_Blocking_IO parameter indicates whether the thread + -- library provides process-blocking or thread-blocking input/output + -- operations. In the former case (typically with FSU threads) + -- GNAT.Sockets should be initialized with a value of True to + -- provide task-blocking IO through an emulation mechanism. + -- Only the first call to Initialize is taken into account (further + -- calls will be ignored). Note that with the default value + -- of Process_Blocking_IO, this operation is a no-op on UNIX + -- platforms, but applications should make sure to call it + -- if portability is expected: some platforms (such as Windows) + -- require initialization before any other socket operations. procedure Finalize; -- After Finalize is called it is not possible to use any routines @@ -431,7 +470,7 @@ package GNAT.Sockets is -- Convert address image from numbers-and-dots notation into an -- inet address. - -- Host entries provide a complete information on a given host: + -- Host entries provide complete information on a given host: -- the official name, an array of alternative names or aliases and -- array of network addresses. @@ -473,11 +512,50 @@ package GNAT.Sockets is function Get_Host_By_Name (Name : String) return Host_Entry_Type; - -- Return host entry structure for the given host name + -- Return host entry structure for the given host name. Here name + -- is either a host name, or an IP address. function Host_Name return String; -- Return the name of the current host + -- Service entries provide complete information on a given + -- service: the official name, an array of alternative names or + -- aliases and the port number. + + type Service_Entry_Type (Aliases_Length : Natural) is private; + + function Official_Name (S : Service_Entry_Type) return String; + -- Return official name in service entry + + function Port_Number (S : Service_Entry_Type) return Port_Type; + -- Return port number in service entry + + function Protocol_Name (S : Service_Entry_Type) return String; + -- Return Protocol in service entry (usually UDP or TCP) + + function Aliases_Length (S : Service_Entry_Type) return Natural; + -- Return number of aliases in service entry + + function Aliases + (S : Service_Entry_Type; + N : Positive := 1) + return String; + -- Return N'th aliases in service entry. The first index is 1. + + function Get_Service_By_Name + (Name : String; + Protocol : String) + return Service_Entry_Type; + -- Return service entry structure for the given service name + + function Get_Service_By_Port + (Port : Port_Type; + Protocol : String) + return Service_Entry_Type; + -- Return service entry structure for the given service port number + + Service_Error : exception; + -- Errors are described by an enumeration type. There is only one -- exception Socket_Error in this package to deal with an error -- during a socket routine. Once raised, its message contains the @@ -486,32 +564,48 @@ package GNAT.Sockets is -- The name of the enumeration constant documents the error condition. type Error_Type is - (Permission_Denied, + (Success, + Permission_Denied, Address_Already_In_Use, Cannot_Assign_Requested_Address, Address_Family_Not_Supported_By_Protocol, Operation_Already_In_Progress, Bad_File_Descriptor, + Software_Caused_Connection_Abort, Connection_Refused, + Connection_Reset_By_Peer, + Destination_Address_Required, Bad_Address, + Host_Is_Down, + No_Route_To_Host, Operation_Now_In_Progress, Interrupted_System_Call, Invalid_Argument, Input_Output_Error, Transport_Endpoint_Already_Connected, + Too_Many_Symbolic_Links, + Too_Many_Open_Files, Message_Too_Long, + File_Name_Too_Long, + Network_Is_Down, + Network_Dropped_Connection_Because_Of_Reset, Network_Is_Unreachable, No_Buffer_Space_Available, Protocol_Not_Available, Transport_Endpoint_Not_Connected, + Socket_Operation_On_Non_Socket, Operation_Not_Supported, + Protocol_Family_Not_Supported, Protocol_Not_Supported, + Protocol_Wrong_Type_For_Socket, + Cannot_Send_After_Transport_Endpoint_Shutdown, Socket_Type_Not_Supported, Connection_Timed_Out, + Too_Many_References, Resource_Temporarily_Unavailable, Unknown_Host, Host_Name_Lookup_Failure, - No_Address_Associated_With_Name, + Non_Recoverable_Error, Unknown_Server_Error, Cannot_Resolve_Error); @@ -541,7 +635,7 @@ package GNAT.Sockets is No_Delay, -- Do not delay send to coalesce packets (TCP_NODELAY) Add_Membership, -- Join a multicast group Drop_Membership, -- Leave a multicast group - Multicast_TTL, -- Indicates the time-to-live of sent multicast packets + Multicast_TTL, -- Indicate the time-to-live of sent multicast packets Multicast_Loop); -- Sent multicast packets are looped to the local socket type Option_Type (Name : Option_Name := Keep_Alive) is record @@ -599,11 +693,53 @@ package GNAT.Sockets is end case; end record; + -- A request flag allows to specify the type of message + -- transmissions or receptions. A request flag can be a + -- combination of zero or more predefined request flags. + + type Request_Flag_Type is private; + + No_Request_Flag : constant Request_Flag_Type; + -- This flag corresponds to the normal execution of an operation. + + Process_Out_Of_Band_Data : constant Request_Flag_Type; + -- This flag requests that the receive or send function operates + -- on out-of-band data when the socket supports this notion (e.g. + -- Socket_Stream). + + Peek_At_Incoming_Data : constant Request_Flag_Type; + -- This flag causes the receive operation to return data from the + -- beginning of the receive queue without removing that data from + -- the queue. A subsequent receive call will return the same data. + + Wait_For_A_Full_Reception : constant Request_Flag_Type; + -- This flag requests that the operation block until the full + -- request is satisfied. However, the call may still return less + -- data than requested if a signal is caught, an error or + -- disconnect occurs, or the next data to be received is of a dif- + -- ferent type than that returned. + + Send_End_Of_Record : constant Request_Flag_Type; + -- This flag indicates that the entire message has been sent and + -- so this terminates the record. + + function "+" (L, R : Request_Flag_Type) return Request_Flag_Type; + -- Combine flag L with flag R + + type Stream_Element_Reference is access all Ada.Streams.Stream_Element; + + type Vector_Element is record + Base : Stream_Element_Reference; + Length : Ada.Streams.Stream_Element_Count; + end record; + + type Vector_Type is array (Integer range <>) of Vector_Element; + procedure Create_Socket (Socket : out Socket_Type; Family : Family_Type := Family_Inet; Mode : Mode_Type := Socket_Stream); - -- Create an endpoint for communication. Raise Socket_Error on error. + -- Create an endpoint for communication. Raises Socket_Error on error. procedure Accept_Socket (Server : Socket_Type; @@ -613,7 +749,7 @@ package GNAT.Sockets is -- connections, creates a new connected socket with mostly the -- same properties as Server, and allocates a new socket. The -- returned Address is filled in with the address of the - -- connection. Raise Socket_Error on error. + -- connection. Raises Socket_Error on error. procedure Bind_Socket (Socket : Socket_Type; @@ -628,30 +764,31 @@ package GNAT.Sockets is (Socket : Socket_Type; Server : in out Sock_Addr_Type); -- Make a connection to another socket which has the address of - -- Server. Raise Socket_Error on error. + -- Server. Raises Socket_Error on error. procedure Control_Socket (Socket : Socket_Type; Request : in out Request_Type); -- Obtain or set parameter values that control the socket. This -- control differs from the socket options in that they are not - -- specific to sockets but are avaiable for any device. + -- specific to sockets but are available for any device. function Get_Peer_Name (Socket : Socket_Type) return Sock_Addr_Type; -- Return the peer or remote socket address of a socket. Raise -- Socket_Error on error. function Get_Socket_Name (Socket : Socket_Type) return Sock_Addr_Type; - -- Return the local or current socket address of a socket. Raise - -- Socket_Error on error. + -- Return the local or current socket address of a socket. Return + -- No_Sock_Addr on error (for instance, socket closed or not + -- locally bound). function Get_Socket_Option (Socket : Socket_Type; Level : Level_Type := Socket_Level; Name : Option_Name) return Option_Type; - -- Get the options associated with a socket. Raise Socket_Error on - -- error. + -- Get the options associated with a socket. Raises Socket_Error + -- on error. procedure Listen_Socket (Socket : Socket_Type; @@ -664,26 +801,36 @@ package GNAT.Sockets is procedure Receive_Socket (Socket : Socket_Type; Item : out Ada.Streams.Stream_Element_Array; - Last : out Ada.Streams.Stream_Element_Offset); + Last : out Ada.Streams.Stream_Element_Offset; + Flags : Request_Flag_Type := No_Request_Flag); -- Receive message from Socket. Last is the index value such that -- Item (Last) is the last character assigned. Note that Last is -- set to Item'First - 1 when the socket has been closed by - -- peer. This is not an error and no exception is raised. Raise - -- Socket_Error on error. + -- peer. This is not an error and no exception is raised. Flags + -- allows to control the reception. Raise Socket_Error on error. procedure Receive_Socket (Socket : Socket_Type; Item : out Ada.Streams.Stream_Element_Array; Last : out Ada.Streams.Stream_Element_Offset; - From : out Sock_Addr_Type); + From : out Sock_Addr_Type; + Flags : Request_Flag_Type := No_Request_Flag); -- Receive message from Socket. If Socket is not -- connection-oriented, the source address From of the message is -- filled in. Last is the index value such that Item (Last) is the - -- last character assigned. Raise Socket_Error on error. + -- last character assigned. Flags allows to control the + -- reception. Raises Socket_Error on error. + + procedure Receive_Vector + (Socket : Socket_Type; + Vector : Vector_Type; + Count : out Ada.Streams.Stream_Element_Count); + -- Receive data from a socket and scatter it into the set of vector + -- elements Vector. Count is set to the count of received stream elements. function Resolve_Exception (Occurrence : Ada.Exceptions.Exception_Occurrence) - return Error_Type; + return Error_Type; -- When Socket_Error or Host_Error are raised, the exception -- message contains the error code between brackets and a string -- describing the error code. Resolve_Error extracts the error @@ -693,24 +840,36 @@ package GNAT.Sockets is procedure Send_Socket (Socket : Socket_Type; Item : Ada.Streams.Stream_Element_Array; - Last : out Ada.Streams.Stream_Element_Offset); + Last : out Ada.Streams.Stream_Element_Offset; + Flags : Request_Flag_Type := No_Request_Flag); -- Transmit a message to another socket. Note that Last is set to - -- Item'First when socket has been closed by peer. This is not an - -- error and no exception is raised. Raise Socket_Error on error; + -- Item'First-1 when socket has been closed by peer. This is not + -- considered an error and no exception is raised. Flags allows to + -- control the transmission. Raises Socket_Error on any other + -- error condition. procedure Send_Socket (Socket : Socket_Type; Item : Ada.Streams.Stream_Element_Array; Last : out Ada.Streams.Stream_Element_Offset; - To : Sock_Addr_Type); + To : Sock_Addr_Type; + Flags : Request_Flag_Type := No_Request_Flag); -- Transmit a message to another socket. The address is given by - -- To. Raise Socket_Error on error; + -- To. Flags allows to control the transmission. Raises + -- Socket_Error on error. + + procedure Send_Vector + (Socket : Socket_Type; + Vector : Vector_Type; + Count : out Ada.Streams.Stream_Element_Count); + -- Transmit data gathered from the set of vector elements Vector to a + -- socket. Count is set to the count of transmitted stream elements. procedure Set_Socket_Option (Socket : Socket_Type; Level : Level_Type := Socket_Level; Option : Option_Type); - -- Manipulate socket options. Raise Socket_Error on error. + -- Manipulate socket options. Raises Socket_Error on error. procedure Shutdown_Socket (Socket : Socket_Type; @@ -739,11 +898,11 @@ package GNAT.Sockets is function Get_Address (Stream : Stream_Access) - return Sock_Addr_Type; + return Sock_Addr_Type; -- Return the socket address from which the last message was -- received. - type Socket_Set_Type is private; + type Socket_Set_Type is limited private; -- This type allows to manipulate sets of sockets. It allows to -- wait for events on multiple endpoints at one time. This is an -- access type on a system dependent structure. To avoid memory @@ -753,14 +912,18 @@ package GNAT.Sockets is procedure Clear (Item : in out Socket_Set_Type; Socket : Socket_Type); -- Remove Socket from Item - procedure Set (Item : in out Socket_Set_Type; Socket : Socket_Type); - -- Insert Socket into Item + procedure Copy (Source : Socket_Set_Type; Target : in out Socket_Set_Type); + -- Copy Source into Target as Socket_Set_Type is limited private procedure Empty (Item : in out Socket_Set_Type); -- Remove all Sockets from Item and deallocate internal data + procedure Get (Item : in out Socket_Set_Type; Socket : out Socket_Type); + -- Extract a Socket from socket set Item. Socket is set to + -- No_Socket when the set is empty. + function Is_Empty - (Item : Socket_Set_Type) + (Item : Socket_Set_Type) return Boolean; -- Return True if Item is empty @@ -770,6 +933,9 @@ package GNAT.Sockets is return Boolean; -- Return True if Socket is present in Item + procedure Set (Item : in out Socket_Set_Type; Socket : Socket_Type); + -- Insert Socket into Item + -- C select() waits for a number of file descriptors to change -- status. Usually, three independent sets of descriptors are -- watched (read, write and exception). A timeout gives an upper @@ -790,11 +956,19 @@ package GNAT.Sockets is -- abort a select operation is typically to add a socket in one of -- the socket sets when the timeout is set to forever. - Forever : constant Duration; - type Selector_Type is limited private; type Selector_Access is access all Selector_Type; + -- Selector_Duration is a subtype of Standard.Duration because the + -- full range of Standard.Duration cannot be represented in the + -- equivalent C structure. Moreover, negative values are not + -- allowed to avoid system incompatibilities. + + Immediate : constant := 0.0; + Forever : constant := Duration (Integer'Last) * 1.0; + + subtype Selector_Duration is Duration range Immediate .. Forever; + procedure Create_Selector (Selector : out Selector_Type); -- Create a new selector @@ -808,7 +982,7 @@ package GNAT.Sockets is R_Socket_Set : in out Socket_Set_Type; W_Socket_Set : in out Socket_Set_Type; Status : out Selector_Status; - Timeout : Duration := Forever); + Timeout : Selector_Duration := Forever); -- Return when one Socket in R_Socket_Set has some data to be read -- or if one Socket in W_Socket_Set is ready to receive some -- data. In these cases Status is set to Completed and sockets @@ -818,7 +992,21 @@ package GNAT.Sockets is -- received while checking socket status. As this procedure -- returns when Timeout occurs, it is a design choice to keep this -- procedure process blocking. Note that a Timeout of 0.0 returns - -- immediatly. + -- immediately. Also note that two different objects must be passed + -- as R_Socket_Set and W_Socket_Set (even if they contain the same + -- set of Sockets), or some event will be lost. + + procedure Check_Selector + (Selector : in out Selector_Type; + R_Socket_Set : in out Socket_Set_Type; + W_Socket_Set : in out Socket_Set_Type; + E_Socket_Set : in out Socket_Set_Type; + Status : out Selector_Status; + Timeout : Selector_Duration := Forever); + -- This refined version of Check_Selector allows to watch for + -- exception events (that is notifications of out-of-band + -- transmission and reception). As above, all of R_Socket_Set, + -- W_Socket_Set and E_Socket_Set must be different objects. procedure Abort_Selector (Selector : Selector_Type); -- Send an abort signal to the selector. @@ -828,18 +1016,23 @@ private type Socket_Type is new Integer; No_Socket : constant Socket_Type := -1; - Forever : constant Duration := Duration'Last; - type Selector_Type is limited record R_Sig_Socket : Socket_Type; W_Sig_Socket : Socket_Type; - In_Progress : Boolean := False; end record; + + pragma Volatile (Selector_Type); + -- The two signalling sockets are used to abort a select -- operation. - type Socket_Set_Record; - type Socket_Set_Type is access all Socket_Set_Record; + subtype Socket_Set_Access is System.Address; + No_Socket_Set : constant Socket_Set_Access := System.Null_Address; + + type Socket_Set_Type is record + Last : Socket_Type := No_Socket; + Set : Socket_Set_Access := No_Socket_Set; + end record; subtype Inet_Addr_Comp_Type is Natural range 0 .. 255; -- Octet for Internet address @@ -867,25 +1060,39 @@ private No_Sock_Addr : constant Sock_Addr_Type := (Family_Inet, No_Inet_Addr, 0); - Max_Host_Name_Length : constant := 64; + Max_Name_Length : constant := 64; -- The constant MAXHOSTNAMELEN is usually set to 64 - subtype Host_Name_Index is Natural range 1 .. Max_Host_Name_Length; + subtype Name_Index is Natural range 1 .. Max_Name_Length; - type Host_Name_Type - (Length : Host_Name_Index := Max_Host_Name_Length) + type Name_Type + (Length : Name_Index := Max_Name_Length) is record Name : String (1 .. Length); end record; -- We need fixed strings to avoid access types in host entry type - type Host_Name_Array is array (Natural range <>) of Host_Name_Type; + type Name_Array is array (Natural range <>) of Name_Type; type Inet_Addr_Array is array (Natural range <>) of Inet_Addr_Type; type Host_Entry_Type (Aliases_Length, Addresses_Length : Natural) is record - Official : Host_Name_Type; - Aliases : Host_Name_Array (1 .. Aliases_Length); + Official : Name_Type; + Aliases : Name_Array (1 .. Aliases_Length); Addresses : Inet_Addr_Array (1 .. Addresses_Length); end record; + type Service_Entry_Type (Aliases_Length : Natural) is record + Official : Name_Type; + Aliases : Name_Array (1 .. Aliases_Length); + Port : Port_Type; + Protocol : Name_Type; + end record; + + type Request_Flag_Type is mod 2 ** 8; + No_Request_Flag : constant Request_Flag_Type := 0; + Process_Out_Of_Band_Data : constant Request_Flag_Type := 1; + Peek_At_Incoming_Data : constant Request_Flag_Type := 2; + Wait_For_A_Full_Reception : constant Request_Flag_Type := 4; + Send_End_Of_Record : constant Request_Flag_Type := 8; + end GNAT.Sockets; |