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.
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_ senf::LLSocketAddress::LLSocketAddress()
39 prefix_ senf::LLSocketAddress::LLSocketAddress(unsigned protocol, std::string interface)
42 this->protocol(protocol);
43 this->interface(interface);
46 prefix_ senf::LLSocketAddress::LLSocketAddress(std::string interface)
49 this->interface(interface);
52 prefix_ void senf::LLSocketAddress::clear()
54 ::memset(&addr_,0,sizeof(addr_));
55 addr_.sll_family = AF_PACKET;
58 prefix_ unsigned senf::LLSocketAddress::protocol()
61 return ntohs(addr_.sll_protocol);
64 prefix_ unsigned senf::LLSocketAddress::arptype()
67 /** \todo make sure, that the value really is in network byte
69 return ntohs(addr_.sll_hatype);
72 prefix_ unsigned senf::LLSocketAddress::pkttype()
75 /** \todo make sure, that the value really is in network byte
77 return ntohs(addr_.sll_pkttype);
80 prefix_ senf::LLSocketAddress::LLAddress senf::LLSocketAddress::address()
83 return LLAddress(&addr_.sll_addr[0], &addr_.sll_addr[addr_.sll_halen]);
86 prefix_ void senf::LLSocketAddress::protocol(unsigned protocol)
88 addr_.sll_protocol = htons(protocol);
91 prefix_ struct sockaddr * senf::LLSocketAddress::sockaddr_p()
93 return reinterpret_cast<struct sockaddr *>(&addr_);
96 prefix_ struct sockaddr const * senf::LLSocketAddress::sockaddr_p()
99 return reinterpret_cast<struct sockaddr const *>(&addr_);
102 prefix_ unsigned senf::LLSocketAddress::sockaddr_len()
105 return sizeof(addr_);
108 ///////////////////////////////cci.e///////////////////////////////////////
115 // c-file-style: "senf"
116 // indent-tabs-mode: nil
117 // ispell-local-dictionary: "american"