820a29950b
Attempt to clean up most but certainly not all the spelling mistakes that found home in OpenOffice through decades. We could probably blame the international nature of the code but it is somewhat shameful that this wasn't done before. (cherry picked from commit 28206a7cb43aff5adb10f8235ad1680c3941ee3e) Conflicts: include/osl/file.hxx include/osl/pipe_decl.hxx include/osl/socket.h include/osl/socket_decl.hxx include/sal/main.h include/svx/dbaexchange.hxx include/svx/dlgctrl.hxx include/svx/msdffdef.hxx include/svx/sdr/contact/objectcontactofpageview.hxx include/svx/svdpntv.hxx include/ucbhelper/content.hxx include/ucbhelper/interceptedinteraction.hxx include/ucbhelper/resultsethelper.hxx include/unotools/sharedunocomponent.hxx include/unotools/viewoptions.hxx include/vcl/pdfwriter.hxx include/xmloff/txtparae.hxx include/xmloff/uniref.hxx rhino/rhino1_7R3.patch rsc/inc/rscrsc.hxx sal/inc/osl/conditn.h sal/inc/osl/security.h sal/inc/osl/semaphor.h sal/inc/osl/semaphor.hxx sal/inc/rtl/string.hxx sal/inc/rtl/tres.h sal/inc/systools/win32/StrConvert.h sal/osl/os2/file_path_helper.h sal/osl/os2/file_path_helper.hxx sal/osl/os2/file_url.cxx sal/osl/os2/file_url.h sal/osl/os2/makefile.mk sal/osl/os2/pipe.cxx sal/osl/os2/process.c sal/osl/os2/profile.c sal/osl/os2/socket.c sal/osl/os2/system.h sal/osl/unx/asm/interlck_sparc.s sal/osl/unx/file_url.cxx sal/osl/unx/signal.c sal/osl/unx/system.h sal/osl/w32/MAKEFILE.MK sal/osl/w32/interlck.c sal/osl/w32/module.cxx sal/osl/w32/security.c sal/qa/buildall.pl sal/qa/osl/file/osl_File.cxx sal/qa/osl/module/osl_Module_Const.h sal/qa/osl/mutex/osl_Mutex.cxx sal/qa/osl/pipe/osl_Pipe.cxx sal/qa/osl/process/osl_Thread.cxx sal/qa/osl/socket/osl_StreamSocket.cxx sal/qa/osl/socket/sockethelper.cxx sal/qa/rtl_strings/rtl_OUString.cxx sal/rtl/source/unload.cxx sal/systools/win32/kill/kill.cxx sal/systools/win32/uwinapi/MoveFileExA.cpp sal/test/bootstrap.pl sal/typesconfig/typesconfig.c sal/workben/tgetpwnam.cxx sax/inc/sax/parser/saxparser.hxx sc/addin/datefunc/dfa.cl sc/addin/datefunc/dfa.src sc/addin/rot13/rot13.cl sc/addin/rot13/rot13.src sc/inc/attarray.hxx sc/inc/chgtrack.hxx sc/inc/column.hxx sc/inc/compressedarray.hxx sc/inc/document.hxx sc/inc/table.hxx sc/source/core/data/column.cxx sc/source/core/data/dptablecache.cxx sc/source/core/data/dptabres.cxx sc/source/core/data/dptabsrc.cxx sc/source/core/data/global.cxx sc/source/core/tool/chgtrack.cxx sc/source/core/tool/compiler.cxx sc/source/filter/excel/xestyle.cxx sc/source/filter/excel/xichart.cxx sc/source/filter/inc/fapihelper.hxx sc/source/filter/inc/xistyle.hxx sc/source/filter/xml/xmlsubti.cxx sc/source/ui/Accessibility/AccessibleCell.cxx sc/source/ui/Accessibility/AccessibleContextBase.cxx sc/source/ui/Accessibility/AccessibleDataPilotControl.cxx sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx sc/source/ui/Accessibility/AccessibleEditObject.cxx sc/source/ui/Accessibility/AccessiblePreviewCell.cxx sc/source/ui/app/inputwin.cxx sc/source/ui/docshell/docfunc.cxx sc/source/ui/drawfunc/fupoor.cxx sc/source/ui/miscdlgs/linkarea.cxx sc/source/ui/unoobj/chart2uno.cxx sc/source/ui/unoobj/nameuno.cxx sc/source/ui/vba/vbacharacters.hxx sc/source/ui/vba/vbarange.cxx sc/source/ui/vba/vbawindow.cxx scaddins/source/analysis/analysishelper.cxx scaddins/source/analysis/analysishelper.hxx scaddins/source/datefunc/datefunc.cxx scripting/examples/python/Capitalise.py scripting/source/pyprov/officehelper.py sd/source/filter/eppt/eppt.cxx sd/source/filter/eppt/epptso.cxx sd/source/ui/dlg/prltempl.cxx sd/source/ui/dlg/tpoption.cxx sd/source/ui/func/fuediglu.cxx sd/source/ui/func/fupoor.cxx sd/source/ui/func/fusel.cxx sd/source/ui/func/smarttag.cxx sd/source/ui/inc/OutlinerIteratorImpl.hxx sd/source/ui/inc/SlideViewShell.hxx sd/source/ui/inc/fuediglu.hxx sd/source/ui/inc/fusel.hxx sd/source/ui/slideshow/slideshowimpl.cxx sd/source/ui/slidesorter/cache/SlsQueueProcessorThread.hxx sd/source/ui/slidesorter/controller/SlsHideSlideFunction.cxx sd/source/ui/slidesorter/controller/SlsSelectionCommand.hxx sd/source/ui/slidesorter/inc/controller/SlsAnimationFunction.hxx sd/source/ui/slidesorter/view/SlsButtonBar.cxx sd/source/ui/view/Outliner.cxx sd/source/ui/view/drviewsh.cxx sd/source/ui/view/frmview.cxx sdext/source/presenter/PresenterFrameworkObserver.hxx sdext/source/presenter/PresenterSlideShowView.cxx setup_native/scripts/deregister_extensions setup_native/scripts/register_extensions setup_native/source/opensolaris/bundledextensions/README setup_native/source/opensolaris/bundledextensions/svc-ooo_bundled_extensions setup_native/source/win32/customactions/patch/swappatchfiles.cxx setup_native/source/win32/customactions/reg4msdoc/registrar.cxx setup_native/source/win32/customactions/reg4msdoc/userregistrar.cxx sfx2/inc/sfx2/sfxbasemodel.hxx sfx2/qa/complex/sfx2/DocumentProperties.java sfx2/source/appl/appopen.cxx sfx2/source/appl/appquit.cxx sfx2/source/appl/appserv.cxx sfx2/source/bastyp/sfxhtml.cxx sfx2/source/dialog/dockwin.cxx sfx2/source/doc/docfile.cxx sfx2/source/doc/docvor.cxx sfx2/source/doc/graphhelp.cxx sfx2/source/doc/objcont.cxx sfx2/source/doc/objserv.cxx sfx2/source/doc/objstor.cxx sfx2/source/doc/objuno.cxx sfx2/source/doc/objxtor.cxx sfx2/source/doc/printhelper.cxx sfx2/source/doc/sfxbasemodel.cxx sfx2/source/notify/eventsupplier.cxx sfx2/source/view/frmload.cxx sfx2/source/view/sfxbasecontroller.cxx shell/qa/zip/ziptest.cxx shell/source/backends/wininetbe/wininetbackend.cxx shell/source/win32/shlxthandler/util/utilities.cxx solenv/bin/build.pl solenv/bin/build_release.pl solenv/bin/cws.pl solenv/bin/download_external_dependencies.pl solenv/bin/make_download.pl solenv/bin/make_installer.pl solenv/bin/modules/Cws.pm solenv/bin/modules/ExtensionsLst.pm solenv/bin/modules/installer/control.pm solenv/bin/modules/installer/downloadsigner.pm solenv/bin/modules/installer/javainstaller.pm solenv/bin/modules/installer/packagepool.pm solenv/bin/modules/installer/patch/InstallationSet.pm solenv/bin/modules/installer/scriptitems.pm solenv/bin/modules/installer/windows/feature.pm solenv/bin/modules/installer/windows/msiglobal.pm solenv/bin/modules/installer/windows/sign.pm solenv/bin/modules/installer/worker.pm solenv/bin/modules/installer/xpdinstaller.pm solenv/bin/modules/osarch.pm solenv/bin/modules/packager/work.pm solenv/bin/modules/pre2par/parameter.pm solenv/bin/patch_tool.pl solenv/bin/transform_description.pl solenv/doc/gbuild/doxygen.cfg solenv/gbuild/LinkTarget.mk solenv/gbuild/gbuild.mk solenv/inc/os2gcci.mk solenv/inc/settings.mk solenv/inc/startup/Readme solenv/inc/target.mk solenv/inc/tg_compv.mk solenv/inc/tg_javav.mk solenv/inc/unitools.mk solenv/inc/unxbsdi.mk solenv/inc/unxbsdi2.mk solenv/inc/unxbsds.mk solenv/inc/unxfbsd.mk solenv/inc/unxlng.mk sot/source/sdstor/stg.cxx sot/source/sdstor/stgelem.cxx sot/source/sdstor/ucbstorage.cxx starmath/inc/toolbox.hxx starmath/source/mathmlexport.cxx starmath/source/node.cxx starmath/source/toolbox.cxx starmath/source/view.cxx stoc/source/bootstrap/bootstrap.xml stoc/source/corereflection/criface.cxx stoc/source/invocation/invocation.cxx stoc/source/security/access_controller.cxx stoc/source/servicemanager/servicemanager.cxx stoc/source/tdmanager/tdmgr.cxx stoc/test/javavm/testjavavm.cxx stoc/test/testconv.cxx stoc/test/testcorefl.cxx stoc/test/testintrosp.cxx svl/inc/svl/inettype.hxx svl/inc/svl/urihelper.hxx svl/qa/complex/ConfigItems/helper/HistoryOptTest.cxx svl/qa/complex/ConfigItems/helper/HistoryOptTest.hxx svl/source/config/itemholder2.hxx svl/source/items/itemset.cxx svl/source/numbers/zforlist.cxx svl/source/numbers/zformat.cxx svl/source/numbers/zforscan.cxx svtools/bmpmaker/bmp.cxx svtools/inc/svtools/helpagentwindow.hxx svtools/inc/svtools/menuoptions.hxx svtools/inc/svtools/miscopt.hxx svtools/inc/svtools/optionsdrawinglayer.hxx svtools/inc/svtools/stringtransfer.hxx svtools/inc/svtools/svlbitm.hxx svtools/inc/svtools/svtdata.hxx svtools/inc/svtools/valueset.hxx svtools/source/brwbox/editbrowsebox.cxx svtools/source/config/itemholder2.hxx svtools/source/contnr/contentenumeration.hxx svx/inc/svx/fmsrcimp.hxx svx/inc/svx/svdobj.hxx svx/inc/svx/xtable.hxx svx/source/accessibility/DGColorNameLookUp.cxx svx/source/accessibility/svxrectctaccessiblecontext.cxx svx/source/dialog/pfiledlg.cxx svx/source/fmcomp/fmgridcl.cxx svx/source/fmcomp/fmgridif.cxx svx/source/fmcomp/gridctrl.cxx svx/source/form/filtnav.cxx svx/source/form/fmPropBrw.cxx svx/source/form/fmshimp.cxx svx/source/form/fmsrcimp.cxx svx/source/gallery2/galtheme.cxx svx/source/inc/docrecovery.hxx svx/source/sdr/event/eventhandler.cxx svx/source/svdraw/svdedtv2.cxx svx/source/svdraw/svdedxv.cxx svx/source/svdraw/svdhdl.cxx svx/source/svdraw/svdobj.cxx svx/source/svdraw/svdograf.cxx svx/source/svdraw/svdoole2.cxx svx/source/svdraw/svdotxtr.cxx svx/source/svdraw/svdundo.cxx svx/source/svdraw/svdxcgv.cxx svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.cxx sw/inc/SwNumberTree.hxx sw/inc/ndnotxt.hxx sw/source/core/access/acccell.cxx sw/source/core/access/acccell.hxx sw/source/core/access/accframebase.cxx sw/source/core/access/accframebase.hxx sw/source/core/access/accmap.cxx sw/source/core/access/accpage.cxx sw/source/core/access/accpage.hxx sw/source/core/access/accpara.cxx sw/source/core/access/accpara.hxx sw/source/core/bastyp/swrect.cxx sw/source/core/crsr/findtxt.cxx sw/source/core/doc/docdde.cxx sw/source/core/doc/notxtfrm.cxx sw/source/core/docnode/section.cxx sw/source/core/draw/dcontact.cxx sw/source/core/edit/edlingu.cxx sw/source/core/inc/anchoredobjectposition.hxx sw/source/core/layout/paintfrm.cxx sw/source/core/layout/tabfrm.cxx sw/source/core/layout/trvlfrm.cxx sw/source/core/ole/ndole.cxx sw/source/core/text/atrstck.cxx sw/source/core/text/inftxt.cxx sw/source/core/text/itratr.cxx sw/source/core/text/itrform2.cxx sw/source/core/text/itrform2.hxx sw/source/core/text/porfld.cxx sw/source/core/text/txtfly.cxx sw/source/core/txtnode/thints.cxx sw/source/core/txtnode/txtedt.cxx sw/source/core/uibase/dochdl/swdtflvr.cxx sw/source/core/uibase/docvw/PostItMgr.cxx sw/source/core/uibase/docvw/SidebarWin.cxx sw/source/core/uibase/docvw/edtwin.cxx sw/source/core/uibase/envelp/labimg.cxx sw/source/core/uibase/uiview/pview.cxx sw/source/core/uibase/uno/unomailmerge.cxx sw/source/core/undo/unattr.cxx sw/source/core/undo/untbl.cxx sw/source/core/unocore/unochart.cxx sw/source/core/view/vdraw.cxx sw/source/core/view/vnew.cxx sw/source/filter/basflt/fltini.cxx sw/source/filter/html/wrthtml.cxx sw/source/filter/inc/wwstyles.hxx sw/source/filter/rtf/rtffly.cxx sw/source/filter/rtf/swparrtf.cxx sw/source/filter/ww8/docxattributeoutput.cxx sw/source/filter/ww8/dump/msvbasic.cxx sw/source/filter/ww8/dump/ww8scan.cxx sw/source/filter/ww8/dump/ww8scan.hxx sw/source/filter/ww8/dump/ww8struc.hxx sw/source/filter/ww8/wrtww8.cxx sw/source/filter/ww8/ww8graf.cxx sw/source/filter/ww8/ww8par.cxx sw/source/filter/ww8/ww8par2.cxx sw/source/filter/ww8/ww8par2.hxx sw/source/filter/ww8/ww8par3.cxx sw/source/filter/ww8/ww8par6.cxx sw/source/filter/ww8/ww8scan.cxx sw/source/filter/ww8/ww8scan.hxx sw/source/ui/dbui/dbinsdlg.cxx sw/source/ui/inc/tablemgr.hxx sw/source/ui/inc/uitool.hxx sw/source/ui/lingu/olmenu.cxx sw/source/ui/uiview/viewport.cxx sysui/desktop/productversion.mk sysui/desktop/slackware/makefile.mk testgraphical/source/CallExternals.pm testgraphical/source/fill_documents_loop.pl testgraphical/ui/java/ConvwatchGUIProject/src/IniFile.java toolkit/doc/layout/notes.txt toolkit/doc/layout/oldnotes.txt toolkit/source/awt/vclxtabcontrol.cxx toolkit/src2xml/source/srcparser.py toolkit/workben/layout/editor.cxx tools/inc/tools/simplerm.hxx tools/inc/tools/solar.h tools/source/communi/geninfo.cxx tools/source/fsys/dirent.cxx tools/source/fsys/filecopy.cxx tools/source/fsys/os2.cxx tools/source/inet/inetmime.cxx tools/source/rc/resmgr.cxx ucb/source/core/ucbcmds.cxx ucb/source/ucp/file/filglob.cxx ucb/source/ucp/odma/odma_content.cxx ucb/source/ucp/tdoc/ucptdoc.xml ucb/source/ucp/webdav/makefile.mk ucbhelper/inc/ucbhelper/simplecertificatevalidationrequest.hxx ucbhelper/source/client/content.cxx ucbhelper/source/client/interceptedinteraction.cxx udkapi/com/sun/star/beans/XPropertiesChangeListener.idl udkapi/com/sun/star/io/ObjectOutputStream.idl udkapi/com/sun/star/io/XMarkableStream.idl udkapi/com/sun/star/io/XTextOutputStream.idl udkapi/com/sun/star/reflection/CoreReflection.idl udkapi/com/sun/star/reflection/XTypeDescriptionEnumerationAccess.idl udkapi/com/sun/star/test/XSimpleTest.idl unodevtools/source/skeletonmaker/skeletoncommon.cxx unodevtools/source/skeletonmaker/skeletoncommon.hxx unotools/inc/unotools/cacheoptions.hxx unotools/inc/unotools/cmdoptions.hxx unotools/inc/unotools/dynamicmenuoptions.hxx unotools/inc/unotools/extendedsecurityoptions.hxx unotools/inc/unotools/fontoptions.hxx unotools/inc/unotools/historyoptions.hxx unotools/inc/unotools/idhelper.hxx unotools/inc/unotools/internaloptions.hxx unotools/inc/unotools/localisationoptions.hxx unotools/inc/unotools/moduleoptions.hxx unotools/inc/unotools/printwarningoptions.hxx unotools/inc/unotools/securityoptions.hxx unotools/inc/unotools/startoptions.hxx unotools/inc/unotools/workingsetoptions.hxx unotools/source/config/cmdoptions.cxx unotools/source/config/compatibility.cxx unotools/source/config/configitem.cxx unotools/source/config/configmgr.cxx unotools/source/config/dynamicmenuoptions.cxx unotools/source/config/fontcfg.cxx unotools/source/config/itemholder1.hxx unotools/source/config/moduleoptions.cxx unotools/source/config/pathoptions.cxx unotools/source/config/viewoptions.cxx unotools/source/misc/sharedunocomponent.cxx uui/source/fltdlg.cxx uui/source/iahndl-filter.cxx vbahelper/inc/vbahelper/collectionbase.hxx vbahelper/source/msforms/vbacontrol.cxx vbahelper/source/vbahelper/collectionbase.cxx vcl/aqua/source/gdi/atsfonts.cxx vcl/inc/aqua/salmathutils.hxx vcl/inc/graphite_cache.hxx vcl/inc/jobset.h vcl/inc/os2/salgdi.h vcl/inc/osx/saldata.hxx vcl/inc/salgdi.hxx vcl/inc/salwtype.hxx vcl/inc/unx/wmadaptor.hxx vcl/inc/vcl/print.hxx vcl/inc/vcl/strhelper.hxx vcl/os2/source/app/salinst.cxx vcl/os2/source/app/saltimer.cxx vcl/os2/source/gdi/salgdi2.cxx vcl/osx/salframeview.mm vcl/osx/salprn.cxx vcl/qa/cppunit/dndtest.cxx vcl/source/app/dbggui.cxx vcl/source/control/ilstbox.cxx vcl/source/gdi/cvtsvm.cxx vcl/source/gdi/gdimtf.cxx vcl/source/gdi/outdev4.cxx vcl/source/gdi/outdev6.cxx vcl/source/gdi/pdfwriter_impl.cxx vcl/source/gdi/pdfwriter_impl2.cxx vcl/source/gdi/print.cxx vcl/source/gdi/print2.cxx vcl/source/glyphs/gcach_layout.cxx vcl/source/glyphs/glyphcache.cxx vcl/source/glyphs/graphite_layout.cxx vcl/source/window/printdlg.cxx vcl/source/window/tabdlg.cxx vcl/source/window/window.cxx vcl/source/window/winproc.cxx vcl/unx/generic/app/saldisp.cxx vcl/unx/generic/dtrans/X11_selection.hxx vcl/unx/gtk/app/gtkdata.cxx vcl/win/source/gdi/salgdi2.cxx vcl/win/source/gdi/salgdi3.cxx vcl/win/source/window/salframe.cxx vos/inc/vos/pipe.hxx vos/inc/vos/process.hxx vos/inc/vos/signal.hxx vos/inc/vos/socket.hxx vos/inc/vos/thread.hxx vos/source/pipe.cxx vos/source/socket.cxx wizards/com/sun/star/wizards/agenda/AgendaTemplate.java wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.java wizards/com/sun/star/wizards/agenda/TopicsControl.java wizards/com/sun/star/wizards/web/FTPDialog.java wizards/com/sun/star/wizards/web/ImageListDialog.java wizards/com/sun/star/wizards/web/Process.java wizards/com/sun/star/wizards/web/ProcessStatusRenderer.java wizards/com/sun/star/wizards/web/TOCPreview.java wizards/com/sun/star/wizards/web/WWD_Startup.java wizards/com/sun/star/wizards/web/data/TypeDetection.java wizards/com/sun/star/wizards/web/export/ImpressHTMLExporter.java writerfilter/inc/doctok/WW8Document.hxx writerfilter/source/dmapper/DomainMapper.cxx writerfilter/source/dmapper/NumberingManager.cxx writerfilter/source/dmapper/PropertyMap.cxx writerfilter/source/dmapper/StyleSheetTable.cxx writerfilter/source/doctok/WW8StructBase.hxx writerfilter/source/doctok/resources.xmi writerfilter/source/ooxml/README.efforts xmerge/source/activesync/XMergeFilter.cpp xmerge/source/minicalc/java/org/openoffice/xmerge/converter/xml/sxc/minicalc/SxcDocumentDeserializerImpl.java xmerge/source/palmtests/qa/comparator/pdbcomparison.java xmerge/source/palmtests/qa/test_spec/convertor_test_spec.html xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/DefinedName.java xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/Workbook.java xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/Worksheet.java xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/formula/SymbolLookup.java xmerge/source/pocketword/java/org/openoffice/xmerge/converter/xml/sxw/pocketword/DocumentDescriptor.java xmerge/workben/jstyle.pl xmlhelp/source/cxxhelp/provider/databases.hxx xmlhelp/source/cxxhelp/provider/provider.cxx xmlhelp/source/treeview/tvread.cxx xmloff/inc/txtfldi.hxx xmloff/inc/xmloff/xmlmultiimagehelper.hxx xmloff/inc/xmloff/xmluconv.hxx xmloff/source/core/xmlexp.cxx xmloff/source/draw/shapeexport2.cxx xmloff/source/draw/shapeexport3.cxx xmloff/source/meta/xmlversion.cxx xmloff/source/style/impastp4.cxx xmloff/source/style/xmlaustp.cxx xmloff/source/text/XMLSectionExport.cxx xmloff/source/text/txtflde.cxx xmloff/source/text/txtimp.cxx xmloff/source/text/txtparae.cxx xmloff/source/text/txtparai.cxx xmloff/source/text/txtvfldi.cxx xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx Change-Id: Ie072e7c3a60c5dae16a67ac36d1f372c5065c99c
722 lines
30 KiB
C++
722 lines
30 KiB
C++
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
/*
|
|
* This file is part of the LibreOffice project.
|
|
*
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
*
|
|
* This file incorporates work covered by the following license notice:
|
|
*
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
* with this work for additional information regarding copyright
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
* except in compliance with the License. You may obtain a copy of
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
*/
|
|
|
|
#ifndef INCLUDED_OSL_SOCKET_DECL_HXX
|
|
#define INCLUDED_OSL_SOCKET_DECL_HXX
|
|
|
|
#include <osl/socket.h>
|
|
#include <rtl/ustring.hxx>
|
|
#include <rtl/byteseq.hxx>
|
|
|
|
namespace osl
|
|
{
|
|
enum __osl_socket_NoCopy { SAL_NO_COPY };
|
|
|
|
/** The class should be understood as a reference to a socket address handle ( struct sockaddr ).
|
|
|
|
The handle is mutable.
|
|
*/
|
|
class SocketAddr
|
|
{
|
|
protected:
|
|
oslSocketAddr m_handle;
|
|
public:
|
|
|
|
/** Creates socket address of unknown type.
|
|
*/
|
|
inline SocketAddr();
|
|
|
|
/** Copy constructor.
|
|
*/
|
|
inline SocketAddr(const SocketAddr& Addr);
|
|
|
|
/** The SocketAddr takes over the responsibility of the handle ( which means,
|
|
that the handle gets destructed by the destructor of this reference)
|
|
@param Addr a handle
|
|
@param nocopy use SAL_NO_COPY
|
|
*/
|
|
inline SocketAddr(const oslSocketAddr Addr, __osl_socket_NoCopy nocopy );
|
|
|
|
/** Copyconstructs the oslSocketAddr handle.
|
|
*/
|
|
inline SocketAddr(oslSocketAddr Addr);
|
|
|
|
/** tcpip-specif constructor.
|
|
@param strAddrOrHostName strAddrOrHostName hostname or dotted ip-number of the network
|
|
interface, the socket shall be created on.
|
|
@param nPort tcp-ip port number
|
|
*/
|
|
inline SocketAddr( const ::rtl::OUString& strAddrOrHostName, sal_Int32 nPort );
|
|
|
|
/** destroys underlying oslSocketAddress
|
|
*/
|
|
inline ~SocketAddr();
|
|
|
|
/** checks, if the SocketAddr was created successful.
|
|
@return <code>true</code> if there is a valid underlying handle,
|
|
otherwise false.
|
|
*/
|
|
inline bool is() const;
|
|
|
|
/** Converts the address to a (human readable) domain-name.
|
|
|
|
@param pResult 0, if you are not interested in errors,
|
|
otherwise *pResult contains an error code on failure
|
|
or osl_Socket_Ok on success
|
|
@return the hostname of this SocketAddr or an empty string on failure.
|
|
@see osl_getHostnameOfSocketAddr()
|
|
*/
|
|
inline ::rtl::OUString SAL_CALL getHostname( oslSocketResult *pResult = 0 ) const;
|
|
|
|
/** Sets the ipaddress or hostname of the SocketAddress
|
|
*/
|
|
inline bool SAL_CALL setHostname( const ::rtl::OUString &sDottedIpOrHostname );
|
|
|
|
/** Returns the port number of the address.
|
|
@return the port in host-byte order or or OSL_INVALID_PORT on errors.
|
|
*/
|
|
inline sal_Int32 SAL_CALL getPort() const;
|
|
|
|
/** Sets the port number of the address.
|
|
@return true if successfule.
|
|
*/
|
|
inline bool SAL_CALL setPort( sal_Int32 nPort );
|
|
|
|
/** Sets the address of the underlying socket address struct in network byte order.
|
|
@return true on success, false signales falure.
|
|
*/
|
|
inline bool SAL_CALL setAddr( const ::rtl::ByteSequence & address );
|
|
|
|
/** Returns the address of the underlying socket in network byte order
|
|
*/
|
|
inline ::rtl::ByteSequence SAL_CALL getAddr( oslSocketResult *pResult = 0 ) const;
|
|
|
|
/** assign the handle to this reference. The previous handle is released.
|
|
*/
|
|
inline SocketAddr & SAL_CALL operator= (oslSocketAddr Addr);
|
|
|
|
/**
|
|
*/
|
|
inline SocketAddr & SAL_CALL operator= (const SocketAddr& Addr);
|
|
|
|
/** Assigns the socket addr without copyconstructing it.
|
|
@param Addr the socket address.
|
|
@param nocopy use SAL_NO_COPY
|
|
*/
|
|
inline SocketAddr & SAL_CALL assign( oslSocketAddr Addr, __osl_socket_NoCopy nocopy );
|
|
|
|
/** Returns true if the underlying handle is identical to the Addr handle.
|
|
*/
|
|
inline bool SAL_CALL operator== (oslSocketAddr Addr) const;
|
|
|
|
/** Returns true if the underlying handle is identical to the Addr handle.
|
|
*/
|
|
inline bool SAL_CALL operator== (const SocketAddr & Addr) const;
|
|
|
|
/** Returns the underlying SocketAddr handle without copyconstructing it.
|
|
*/
|
|
inline oslSocketAddr SAL_CALL getHandle() const;
|
|
|
|
/** Get the hostname for the local interface.
|
|
@param pResult after the call *pResult contains osl_Socket_Ok on success or
|
|
an error on failure.
|
|
@return the hostname
|
|
*/
|
|
static inline ::rtl::OUString SAL_CALL getLocalHostname( oslSocketResult *pResult = 0);
|
|
|
|
/** Tries to find an address for a host.
|
|
@see osl_resolveHostname()
|
|
@return A new created socket-address or 0 if the name could not be found.
|
|
*/
|
|
static inline void SAL_CALL resolveHostname(
|
|
const ::rtl::OUString & strHostName , SocketAddr & Addr );
|
|
|
|
/**
|
|
Tries to find the port associated with the given service/protocol-
|
|
pair (e.g. "ftp"/"tcp").
|
|
@return the port number in host-byte order or <code>OSL_INVALID_PORT</code>
|
|
if no service/protocol pair could be found.
|
|
*/
|
|
static inline sal_Int32 SAL_CALL getServicePort(
|
|
const ::rtl::OUString& strServiceName,
|
|
const ::rtl::OUString & strProtocolName= ::rtl::OUString("tcp") );
|
|
};
|
|
|
|
|
|
class Socket
|
|
{
|
|
protected:
|
|
oslSocket m_handle;
|
|
protected:
|
|
/** Creates a socket. Note it's protected.
|
|
@param Type
|
|
@param Family
|
|
@param Protocol
|
|
*/
|
|
inline Socket(oslSocketType Type,
|
|
oslAddrFamily Family = osl_Socket_FamilyInet,
|
|
oslProtocol Protocol = osl_Socket_ProtocolIp);
|
|
public:
|
|
inline Socket( );
|
|
|
|
inline Socket( const Socket & socket );
|
|
|
|
inline Socket( oslSocket socketHandle );
|
|
|
|
/** The instance takes over the handle's ownership without acquiring the
|
|
handle, but releases it within the dtor.
|
|
@param socketHandle the handle
|
|
@param noacquire use SAL_NO_ACQUIRE
|
|
*/
|
|
inline Socket( oslSocket socketHandle, __sal_NoAcquire noacquire );
|
|
|
|
/** Destructor. Releases the underlying handle
|
|
*/
|
|
inline ~Socket();
|
|
|
|
/** Assignment operator. If socket was already created, the old one will
|
|
be discarded.
|
|
*/
|
|
inline Socket& SAL_CALL operator= ( oslSocket socketHandle);
|
|
|
|
/** Assignment operator. If socket was already created, the old one will
|
|
be discarded.
|
|
*/
|
|
inline Socket& SAL_CALL operator= (const Socket& sock);
|
|
|
|
/**
|
|
@return <code>true</code>, when the underlying handle of both
|
|
Socket instances are identical, <code>false</code> otherwise.
|
|
*/
|
|
inline bool SAL_CALL operator==( const Socket& rSocket ) const ;
|
|
|
|
/**
|
|
@return <code>true</code>, when the underlying handle of both
|
|
Socket instances are identical, <code>false</code> otherwise.
|
|
*/
|
|
inline bool SAL_CALL operator==( const oslSocket socketHandle ) const;
|
|
|
|
/** Closes a definite or both directions of the bidirectional stream.
|
|
|
|
@param Direction
|
|
@see osl_shutdownSocket()
|
|
*/
|
|
inline void SAL_CALL shutdown( oslSocketDirection Direction = osl_Socket_DirReadWrite );
|
|
|
|
/** Closes a socket.
|
|
Note that closing a socket is identical to shutdown( osl_Socket_DirReadWrite ),
|
|
as the operating system distinguish both cases, both functions or offered in this API.
|
|
@see osl_closeSocket()
|
|
*/
|
|
inline void SAL_CALL close();
|
|
|
|
/** Retrieves the address of the local interface of this socket.
|
|
@param Addr [out] receives the address.
|
|
@see osl_getLocalAddrOfSocket()
|
|
*/
|
|
inline void SAL_CALL getLocalAddr( SocketAddr &Addr ) const;
|
|
|
|
/** Get the local port of the socket. Usually used after bind().
|
|
@return the port number or OSL_INVALID_PORT on errors.
|
|
*/
|
|
inline sal_Int32 SAL_CALL getLocalPort() const;
|
|
|
|
/** Get the hostname for the local interface.
|
|
@return the hostname or an empty string ("").
|
|
*/
|
|
inline ::rtl::OUString SAL_CALL getLocalHost() const;
|
|
|
|
/** Retrieves the address of the remote host of this socket.
|
|
@param Addr [out] receives the address.
|
|
*/
|
|
inline void SAL_CALL getPeerAddr( SocketAddr & Addr) const;
|
|
|
|
/** Get the remote port of the socket.
|
|
@return the port number or OSL_INVALID_PORT on errors.
|
|
*/
|
|
inline sal_Int32 SAL_CALL getPeerPort() const;
|
|
|
|
/** Get the hostname for the remote interface.
|
|
@return the hostname or an empty string ("").
|
|
*/
|
|
inline ::rtl::OUString SAL_CALL getPeerHost() const;
|
|
|
|
/** Binds the socket to the specified (local) interface.
|
|
@param LocalInterface Address of the Interface
|
|
@return True if bind was successful.
|
|
*/
|
|
inline bool SAL_CALL bind(const SocketAddr& LocalInterface);
|
|
|
|
/** Checks if read operations will block.
|
|
|
|
You can specify a timeout-value in seconds/nanoseconds that denotes
|
|
how the operation will block if the Socket is not ready.
|
|
@return <code>true</code> if read operations (recv, recvFrom, accept) on the Socket
|
|
will NOT block; <code>false</code> if it would block or if an error occurred.
|
|
|
|
@param pTimeout if 0, the operation will block without a timeout. Otherwise
|
|
the specified amout of time.
|
|
*/
|
|
inline bool SAL_CALL isRecvReady(const TimeValue *pTimeout = 0) const;
|
|
|
|
/** Checks if send operations will block.
|
|
|
|
You can specify a timeout-value in seconds/nanoseconds that denotes
|
|
how the operation will block if the Socket is not ready.
|
|
@return <code>true</code> if send operations (send, sendTo) on the Socket
|
|
will NOT block; <code>false</code> if it would block or if an error occurred.
|
|
|
|
@param pTimeout if 0, the operation will block without a timeout. Otherwise
|
|
the specified amout of time.
|
|
*/
|
|
inline bool SAL_CALL isSendReady(const TimeValue *pTimeout = 0) const;
|
|
|
|
|
|
/** Checks if a request for out-of-band data will block.
|
|
|
|
You can specify a timeout-value in seconds/nanoseconds that denotes
|
|
how the operation will block if the Socket has no pending OOB data.
|
|
|
|
@return <code>true</code> if OOB-request operations (recv with appropriate flags)
|
|
on the Socket will NOT block; <code>false</code> if it would block or if
|
|
an error occurred.
|
|
|
|
@param pTimeout if 0, the operation will block without a timeout. Otherwise
|
|
the specified amout of time.
|
|
*/
|
|
inline bool SAL_CALL isExceptionPending(const TimeValue *pTimeout = 0) const;
|
|
|
|
|
|
/** Queries the socket for its type.
|
|
@return one of:
|
|
<ul>
|
|
<li> <code>osl_Socket_TypeStream</code>
|
|
<li> <code>osl_Socket_TypeDgram</code>
|
|
<li> <code>osl_Socket_TypeRaw</code>
|
|
<li> <code>osl_Socket_TypeRdm</code>
|
|
<li> <code>osl_Socket_TypeSeqPacket</code>
|
|
<li> <code>osl_invalid_SocketType</code>, if an error occurred
|
|
</ul>
|
|
*/
|
|
inline oslSocketType SAL_CALL getType() const;
|
|
|
|
/** Retrieves option-attributes associated with the socket.
|
|
@param Option The attribute to query.
|
|
Valid values (depending on the Level) are:
|
|
<ul>
|
|
<li> <code>osl_Socket_Option_Debug</code><br>
|
|
(sal_Bool) Socket debug flag 1 = enabled, 0 = disabled.
|
|
|
|
<li> <code>osl_Socket_OptionAcceptConn</code><br>
|
|
<li> <code>osl_Socket_OptionReuseAddr</code><br>
|
|
(sal_Bool) Allows the socket to be bound to an address that is
|
|
already in use.
|
|
1 = multiple bound allowed, 0 = no multiple bounds allowed
|
|
|
|
<li><code>osl_Socket_OptionKeepAlive</code><br>
|
|
(sal_Bool) Keepalive packets are sent by the underlying socket.
|
|
1 = enabled, 0 = disabled
|
|
|
|
<li><code>osl_Socket_OptionDontRoute</code><br>
|
|
(sal_Bool) Do not route: send directly to interface.
|
|
1 = do not route , 0 = routing possible
|
|
|
|
<li><code>osl_Socket_OptionBroadcast</code><br>
|
|
(sal_Bool) Transmission of broadcast messages are allowed on the socket.
|
|
1 = transmission allowed, 0 = transmission disallowed
|
|
|
|
<li><code>osl_Socket_OptionUseLoopback</code><br>
|
|
|
|
<li><code>osl_Socket_OptionLinger</code><br>
|
|
(linger) Linger on close if unsent data is present.
|
|
linger has two members: l_onoff, l_linger
|
|
l_onoff = 0 is off, l_onoff > 0 and l_linger= timeout in seconds.
|
|
|
|
<li><code>osl_Socket_OptionOOBinLine</code><br>
|
|
|
|
|
|
<li><code>osl_Socket_OptionSndBuf</code><br>
|
|
(sal_Int32) Size of the send buffer in bytes. Data is sent after
|
|
SndTimeo or when the buffer is full. This allows faster writing
|
|
to the socket.
|
|
|
|
<li><code>osl_Socket_OptionRcvBuf</code><br>
|
|
(sal_Int32) Size of the receive buffer in bytes. Data is sent after
|
|
SndTimeo or when the buffer is full. This allows faster writing
|
|
to the socket and larger packet sizes.
|
|
|
|
<li><code>osl_Socket_OptionSndLowat</code><br>
|
|
|
|
<li><code>osl_Socket_OptionRcvLowat</code><br>
|
|
|
|
<li><code>osl_Socket_OptionSndTimeo</code><br>
|
|
(sal_Int32) Data is sent after this timeout. This allows gathering
|
|
of data to send larger packages but increases latency times.
|
|
|
|
<li><code>osl_Socket_OptionRcvTimeo</code><br>
|
|
|
|
<li><code>osl_Socket_OptionError</code><br>
|
|
<li><code>osl_Socket_OptionType</code><br>
|
|
|
|
<li><code>osl_Socket_OptionTcpNoDelay</code><br>
|
|
Disables the Nagle algorithm for send coalescing. (Do not
|
|
collect data until a packet is full, instead send immediately.
|
|
This increases network traffic but might improve latency-times.)
|
|
1 = disables the algorithm, 0 = keeps it enabled.
|
|
</ul>
|
|
|
|
If not above mentioned otherwise, the options are only valid for
|
|
level <code>osl_Socket_LevelSocket</code>.
|
|
@param pBuffer The Buffer will be filled with the attribute.
|
|
|
|
@param BufferLen The size of pBuffer.
|
|
|
|
@param Level The option level.
|
|
|
|
Valid values are:
|
|
<ul>
|
|
<li><code>osl_Socket_LevelSocket</code> : Socket Level
|
|
<li><code>osl_Socket_LevelTcp</code> : Level of Transmission Control Protocol
|
|
</ul>
|
|
@return The size of the attribute copied into pBuffer or -1 if an error
|
|
occurred.
|
|
*/
|
|
inline sal_Int32 SAL_CALL getOption(
|
|
oslSocketOption Option,
|
|
void* pBuffer,
|
|
sal_uInt32 BufferLen,
|
|
oslSocketOptionLevel Level= osl_Socket_LevelSocket) const;
|
|
|
|
/** Sets the sockets attributes.
|
|
|
|
@param Option denotes the option to modify.
|
|
Valid values (depending on the Level) are:
|
|
<ul>
|
|
<li> osl_Socket_Option_Debug
|
|
<li> osl_Socket_OptionAcceptConn
|
|
<li> osl_Socket_OptionReuseAddr
|
|
<li> osl_Socket_OptionKeepAlive
|
|
<li> osl_Socket_OptionDontRoute
|
|
<li> osl_Socket_OptionBroadcast
|
|
<li> osl_Socket_OptionUseLoopback
|
|
<li> osl_Socket_OptionLinger
|
|
<li> osl_Socket_OptionOOBinLine
|
|
<li> osl_Socket_OptionSndBuf
|
|
<li> osl_Socket_OptionRcvBuf
|
|
<li> osl_Socket_OptionSndLowat
|
|
<li> osl_Socket_OptionRcvLowat
|
|
<li> osl_Socket_OptionSndTimeo
|
|
<li> osl_Socket_OptionRcvTimeo
|
|
<li> osl_Socket_OptionError
|
|
<li> osl_Socket_OptionType
|
|
<li> osl_Socket_OptionTcpNoDelay
|
|
</ul>
|
|
|
|
If not above mentioned otherwise, the options are only valid for
|
|
level osl_Socket_LevelSocket.
|
|
|
|
@param pBuffer Pointer to a Buffer which contains the attribute-value.
|
|
|
|
@param BufferLen contains the length of the Buffer.
|
|
|
|
@param Level selects the level for which an option should be changed.
|
|
Valid values are:
|
|
<ul>
|
|
<li> osl_Socket_evel_Socket : Socket Level
|
|
<li> osl_Socket_Level_Tcp : Level of Transmission Control Protocol
|
|
</ul>
|
|
|
|
@return True if the option could be changed.
|
|
*/
|
|
inline bool SAL_CALL setOption( oslSocketOption Option,
|
|
void* pBuffer,
|
|
sal_uInt32 BufferLen,
|
|
oslSocketOptionLevel Level= osl_Socket_LevelSocket ) const;
|
|
|
|
/** Convenience function for setting sal_Bool and sal_Int32 option values.
|
|
@see setOption()
|
|
*/
|
|
inline bool setOption( oslSocketOption option, sal_Int32 nValue );
|
|
|
|
/** Convenience function for retrieving sal_Bool and sal_Int32 option values.
|
|
@see setOption()
|
|
*/
|
|
inline sal_Int32 getOption( oslSocketOption option ) const;
|
|
|
|
/** Enables/disables non-blocking mode of the socket.
|
|
@param bNonBlockingMode If <code>true</code>, blocking mode will be switched off
|
|
If <code>false</code>, the socket will become a blocking
|
|
socket (which is the default behaviour of a socket).
|
|
@return <code>true</code> if mode could be set.
|
|
*/
|
|
inline bool SAL_CALL enableNonBlockingMode( bool bNonBlockingMode);
|
|
|
|
/** Query blocking mode of the socket.
|
|
@return <code>true</code> if non-blocking mode is set.
|
|
*/
|
|
inline bool SAL_CALL isNonBlockingMode() const;
|
|
|
|
|
|
/** clears the error status
|
|
*/
|
|
inline void SAL_CALL clearError() const;
|
|
|
|
/** returns a constant describing the last error for the socket system.
|
|
|
|
@return osl_Socket_E_NONE if no error occurred, invalid_SocketError if
|
|
an unknown (unmapped) error occurred, otherwise an enum describing the
|
|
error.
|
|
@see osl_getLastSocketError()
|
|
*/
|
|
inline oslSocketError getError() const;
|
|
|
|
/** Builds a string with the last error-message for the socket.
|
|
*/
|
|
inline ::rtl::OUString getErrorAsString( ) const;
|
|
|
|
/** Returns the underlying handle unacquired (The caller must acquire it to keep it).
|
|
*/
|
|
inline oslSocket getHandle() const;
|
|
};
|
|
|
|
|
|
class StreamSocket : public Socket
|
|
{
|
|
public:
|
|
/** Creates a socket.
|
|
@param Family the Family of the socket (Inet by default)
|
|
@param Protocol the Protocon of the socket (IP by default)
|
|
@param Type For some protocols it might be desirable to
|
|
use a different type than <code>osl_Socket_TypeStream</code>
|
|
(like <code>osl_Socket_TypeSeqPacket</code>).
|
|
Therefore this parameter is not hidden.
|
|
*/
|
|
inline StreamSocket(oslAddrFamily Family = osl_Socket_FamilyInet,
|
|
oslProtocol Protocol = osl_Socket_ProtocolIp,
|
|
oslSocketType Type = osl_Socket_TypeStream);
|
|
|
|
inline StreamSocket( const StreamSocket & );
|
|
|
|
inline StreamSocket( oslSocket Socket , __sal_NoAcquire noacquire );
|
|
|
|
inline StreamSocket( oslSocket Socket );
|
|
|
|
/** Retrieves n bytes from the stream and copies them into pBuffer.
|
|
The method avoids incomplete reads due to packet boundaries and is thus
|
|
blocking.
|
|
@param pBuffer receives the read data. pBuffer must be large enough
|
|
to hold n bytes.
|
|
@param n the number of bytes to read.
|
|
@return the number of read bytes. The number will only be smaller than
|
|
n if an exceptional condition (e.g. connection closed) occurs.
|
|
*/
|
|
inline sal_Int32 SAL_CALL read(void* pBuffer, sal_uInt32 n);
|
|
|
|
/** Writes n bytes from pBuffer to the stream. The method avoids
|
|
incomplete writes due to packet boundaries and is thus blocking.
|
|
@param pBuffer contains the data to be written.
|
|
@param n the number of bytes to write.
|
|
@return the number of written bytes. The number will only be smaller than
|
|
n if an exceptional condition (e.g. connection closed) occurs.
|
|
*/
|
|
inline sal_Int32 SAL_CALL write(const void* pBuffer, sal_uInt32 n);
|
|
|
|
|
|
/** Tries to receive BytesToRead data from the connected socket,
|
|
|
|
@param[out] pBuffer Points to a buffer that will be filled with the received
|
|
data. pBuffer must have at least have a size of BytesToRead.
|
|
@param[in] BytesToRead The number of bytes to read.
|
|
@param[in] flags Modifier for the call. Valid values are:
|
|
|
|
<ul>
|
|
<li><code>osl_Socket_MsgNormal</code>
|
|
<li><code>osl_Socket_MsgOOB</code>
|
|
<li><code>osl_Socket_MsgPeek</code>
|
|
<li><code>osl_Socket_MsgDontRoute</code>
|
|
<li><code>osl_Socket_MsgMaxIOVLen</code>
|
|
</ul>
|
|
@return the number of received bytes, which may be less than BytesToRead.
|
|
*/
|
|
inline sal_Int32 SAL_CALL recv(void* pBuffer,
|
|
sal_uInt32 BytesToRead,
|
|
oslSocketMsgFlag flags= osl_Socket_MsgNormal);
|
|
|
|
/** Tries to send BytesToSend data to the connected socket.
|
|
|
|
@param pBuffer [in] Points to a buffer that contains the send-data.
|
|
@param BytesToSend [in] The number of bytes to send. pBuffer must have at least
|
|
this size.
|
|
@param Flag [in] Modifier for the call. Valid values are:
|
|
<ul>
|
|
<li><code>osl_Socket_MsgNormal</code>
|
|
<li><code>osl_Socket_MsgOOB</code>
|
|
<li><code>osl_Socket_MsgPeek</code>
|
|
<li><code>osl_Socket_MsgDontRoute</code>
|
|
<li><code>osl_Socket_MsgMaxIOVLen</code>
|
|
</ul>
|
|
|
|
@return the number of transferred bytes. It may be less than BytesToSend.
|
|
*/
|
|
sal_Int32 SAL_CALL send(const void* pBuffer,
|
|
sal_uInt32 BytesToSend,
|
|
oslSocketMsgFlag= osl_Socket_MsgNormal);
|
|
};
|
|
|
|
class ConnectorSocket : public StreamSocket
|
|
{
|
|
public:
|
|
/** Creates a socket that can connect to a (remote) host.
|
|
@param Family the Family of the socket (Inet by default)
|
|
@param Protocol the Protocon of the socket (IP by default)
|
|
@param Type For some protocols it might be desirable to
|
|
use a different type than sock_stream <code>osl_Socket_TypeSeqPacket</code>
|
|
(like <code>osl_Socket_TypeSeqPacket</code>).
|
|
Therefore we do not hide this parameter here.
|
|
*/
|
|
ConnectorSocket(oslAddrFamily Family = osl_Socket_FamilyInet,
|
|
oslProtocol Protocol = osl_Socket_ProtocolIp,
|
|
oslSocketType Type = osl_Socket_TypeStream);
|
|
|
|
|
|
/** Connects the socket to a (remote) host.
|
|
@param TargetHost The address of the target.
|
|
@param pTimeout The timeout for blocking. If 0, a default system dependent timeout
|
|
us used.
|
|
@return <code> osl_Socket_Ok</code> if connected successfully,
|
|
<code>osl_Socket_TimedOut</code> on timeout,
|
|
<code>osl_Socket_Interrupted</code> if unblocked forcefully (by osl::Socket::close()),
|
|
<code>osl_Socket_Error</code> if connect failed.
|
|
*/
|
|
oslSocketResult SAL_CALL connect(const SocketAddr& TargetHost, const TimeValue* pTimeout = 0);
|
|
};
|
|
|
|
/** Allows to accept socket connections.
|
|
*/
|
|
class AcceptorSocket : public Socket
|
|
{
|
|
public:
|
|
inline AcceptorSocket(oslAddrFamily Family = osl_Socket_FamilyInet,
|
|
oslProtocol Protocol = osl_Socket_ProtocolIp,
|
|
oslSocketType Type = osl_Socket_TypeStream);
|
|
|
|
/** Prepare a socket for the accept-call. The socket must have been
|
|
bound before to the local address.
|
|
@param MaxPendingConnections The maximum number of pending
|
|
connections (waiting to be accepted) on this socket. If you use
|
|
-1, a system default value is used.
|
|
@return <code>true</code> if call was successful.
|
|
*/
|
|
inline bool SAL_CALL listen(sal_Int32 MaxPendingConnections= -1);
|
|
|
|
/** Accepts incoming connections on the socket. You must
|
|
precede this call with osl::Socket::bind() and listen().
|
|
@param Connection receives the incoming connection.
|
|
@return <code>osl_Socket_Ok</code>, if a connection has been accepted,
|
|
<code>osl_Socket_TimedOut</code>, if m_RecvTimeout milliseconds passed without connect,
|
|
<code>osl_Socket_Error</code> on errors.
|
|
*/
|
|
inline oslSocketResult SAL_CALL acceptConnection( StreamSocket& Connection);
|
|
|
|
/** Accepts incoming connections on the socket. You must
|
|
precede this call with osl::Socket::bind() and listen().
|
|
@param PeerAddr receives the address of the connecting entity
|
|
(your communication partner).
|
|
@param Connection receives the incoming connection.
|
|
@return <code>osl_Socket_Ok</code>, if a connection has been accepted,
|
|
<code>osl_Socket_TimedOut</code>, if m_RecvTimeout milliseconds passed without connect,
|
|
<code>osl_Socket_Error</code> on errors.
|
|
*/
|
|
inline oslSocketResult SAL_CALL acceptConnection( StreamSocket& Connection, SocketAddr & PeerAddr);
|
|
};
|
|
|
|
|
|
|
|
/** A connectionless socket to send and receive datagrams.
|
|
*/
|
|
class DatagramSocket : public Socket
|
|
{
|
|
public:
|
|
|
|
/** Creates a datagram socket.
|
|
@param Family the Family of the socket (Inet by default)
|
|
@param Protocol the Protocon of the socket (IP by default)
|
|
@param Type is sock_dgram by default.
|
|
*/
|
|
inline DatagramSocket(oslAddrFamily Family= osl_Socket_FamilyInet,
|
|
oslProtocol Protocol= osl_Socket_ProtocolIp,
|
|
oslSocketType Type= osl_Socket_TypeDgram);
|
|
|
|
/** Tries to receives BufferSize data from the socket, if no error occurs.
|
|
|
|
@param pSenderAddr [out] You must provide pointer to a SocketAddr.
|
|
It will be filled with the address of the datagrams sender.
|
|
If pSenderAddr is 0, it is ignored.
|
|
@param pBuffer [out] Points to a buffer that will be filled with the received
|
|
datagram.
|
|
@param BufferSize [in] The size of pBuffer.
|
|
@param Flag [in] Modifier for the call. Valid values are:
|
|
<ul>
|
|
<li><code>osl_Socket_MsgNormal</code>
|
|
<li><code>osl_Socket_MsgOOB</code>
|
|
<li><code>osl_Socket_MsgPeek</code>
|
|
<li><code>osl_Socket_MsgDontRoute</code>
|
|
<li><code>osl_Socket_MsgMaxIOVLen</code>
|
|
</ul>
|
|
|
|
@return the number of received bytes.
|
|
*/
|
|
inline sal_Int32 SAL_CALL recvFrom(void* pBuffer,
|
|
sal_uInt32 BufferSize,
|
|
SocketAddr* pSenderAddr= 0,
|
|
oslSocketMsgFlag Flag= osl_Socket_MsgNormal);
|
|
|
|
/** Tries to send one datagram with BytesToSend size to the given ReceiverAddr.
|
|
Since there is only send one packet, the function doesn't care about
|
|
packet boundaries.
|
|
|
|
@param ReceiverAddr [in] A SocketAddr that contains
|
|
the destination address for this send.
|
|
|
|
@param pBuffer [in] Points to a buffer that contains the send-data.
|
|
@param BufferSize [in] The number of bytes to send. pBuffer must have at least
|
|
this size.
|
|
@param Flag [in] Modifier for the call. Valid values are:
|
|
|
|
<ul>
|
|
<li><code>osl_Socket_MsgNormal</code>
|
|
<li><code>osl_Socket_MsgOOB</code>
|
|
<li><code>osl_Socket_MsgPeek</code>
|
|
<li><code>osl_Socket_MsgDontRoute</code>
|
|
<li><code>osl_Socket_MsgMaxIOVLen</code>
|
|
</ul>
|
|
|
|
@return the number of transferred bytes.
|
|
*/
|
|
inline sal_Int32 SAL_CALL sendTo( const SocketAddr& ReceiverAddr,
|
|
const void* pBuffer,
|
|
sal_uInt32 BufferSize,
|
|
oslSocketMsgFlag Flag= osl_Socket_MsgNormal);
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|