4 // Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
5 // Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
6 // Stefan Bund <stefan.bund@fokus.fraunhofer.de>
8 // This program is free software; you can redistribute it and/or modify
9 // it under the terms of the GNU General Public License as published by
10 // the Free Software Foundation; either version 2 of the License, or
11 // (at your option) any later version.
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the
20 // Free Software Foundation, Inc.,
21 // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 #ifndef HH_PacketSocketHandle_
24 #define HH_PacketSocketHandle_ 1
27 #include "SocketPolicy.hh"
28 #include "SocketProtocol.hh"
29 #include "ProtocolClientSocketHandle.hh"
30 #include "LLAddressing.hh"
31 #include "FramingPolicy.hh"
32 #include "CommunicationPolicy.hh"
33 #include "ReadWritePolicy.hh"
34 #include "BufferingPolicy.hh"
35 #include "BSDSocketProtocol.hh"
37 //#include "PacketSocketHandle.mpp"
38 #include "PacketSocketHandle.ih"
39 ///////////////////////////////hh.p////////////////////////////////////////
44 typedef MakeSocketPolicy<
46 DatagramFramingPolicy,
47 UnconnectedCommunicationPolicy,
51 >::policy Packet_Policy;
54 : public ConcreteSocketProtocol<Packet_Policy>,
55 public BSDSocketProtocol
58 enum SocketType { RawSocket, DatagramSocket };
60 void init_client(SocketType type = RawSocket, int protocol = -1) const;
62 std::auto_ptr<SocketProtocol> clone() const;
64 enum PromiscMode { Promiscuous, AllMulticast, None };
66 void promisc(std::string interface, PromiscMode mode) const;
67 // See LLSocketAddress for a discussion/rationale for
69 template <class ForwardRange>
70 void mcAdd(std::string interface, ForwardRange const & address) const;
71 template <class ForwardRange>
72 void mcDrop(std::string interface, ForwardRange const & address) const;
74 unsigned available() const;
78 template<class ForwardRange>
79 void do_mc(std::string interface, ForwardRange const & address, bool add) const;
80 void do_mc_i(std::string interface, detail::LLAddressCopier const & copier, bool add) const;
83 typedef ProtocolClientSocketHandle<PacketProtocol> PacketSocketHandle;
87 ///////////////////////////////hh.e////////////////////////////////////////
88 //#include "PacketSocketHandle.cci"
89 #include "PacketSocketHandle.ct"
90 #include "PacketSocketHandle.cti"
91 //#include "PacketSocketHandle.mpp"
97 // c-file-style: "satcom"