4 // Fraunhofer Institute for Open Communication Systems (FOKUS)
5 // Competence Center NETwork research (NET), St. Augustin, GERMANY
6 // Stefan Bund <g0dil@berlios.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.
24 \brief LLSocketAddress and LLAddressingPolicy inline non-template implementation
28 #include <sys/socket.h>
29 #include <netinet/in.h>
31 #define prefix_ inline
32 ///////////////////////////////cci.p///////////////////////////////////////
34 prefix_ void senf::LLSocketAddress::address(MACAddress const & addr)
36 std::copy(addr.begin(), addr.end(),&addr_.sll_addr[0]);
39 prefix_ senf::LLSocketAddress::LLSocketAddress()
40 : BSDSocketAddress (sizeof(sockaddr_ll), AF_PACKET)
43 prefix_ void senf::LLSocketAddress::protocol(unsigned prot)
45 addr_.sll_protocol = htons(prot);
48 prefix_ senf::LLSocketAddress::LLSocketAddress(unsigned prot, std::string const & iface)
49 : BSDSocketAddress (sizeof(sockaddr_ll), AF_PACKET)
55 prefix_ senf::LLSocketAddress::LLSocketAddress(std::string const &iface)
56 : BSDSocketAddress (sizeof(sockaddr_ll), AF_PACKET)
61 prefix_ senf::LLSocketAddress::LLSocketAddress(MACAddress const & addr,
62 std::string const & iface)
63 : BSDSocketAddress (sizeof(sockaddr_ll), AF_PACKET)
69 prefix_ senf::LLSocketAddress::LLSocketAddress(const LLSocketAddress& other)
70 : BSDSocketAddress (other)
73 prefix_ senf::LLSocketAddress& senf::LLSocketAddress::operator=(const LLSocketAddress& other)
75 BSDSocketAddress::operator=(other);
79 prefix_ unsigned senf::LLSocketAddress::protocol()
82 return ntohs(addr_.sll_protocol);
85 prefix_ unsigned senf::LLSocketAddress::arptype()
88 return ntohs(addr_.sll_hatype);
91 prefix_ senf::LLSocketAddress::PktType senf::LLSocketAddress::pkttype()
94 return PktType(ntohs(addr_.sll_pkttype));
97 prefix_ senf::MACAddress senf::LLSocketAddress::address()
100 return MACAddress::from_data(&addr_.sll_addr[0]);
103 ///////////////////////////////cci.e///////////////////////////////////////
110 // c-file-style: "senf"
111 // indent-tabs-mode: nil
112 // ispell-local-dictionary: "american"
113 // compile-command: "scons -u test"
114 // comment-column: 40