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 // Definition of inline non-template functions
26 #include <sys/socket.h>
27 #include <netinet/in.h>
29 #define prefix_ inline
30 ///////////////////////////////cci.p///////////////////////////////////////
32 prefix_ satcom::lib::LLSocketAddress::LLSocketAddress()
37 prefix_ satcom::lib::LLSocketAddress::LLSocketAddress(unsigned protocol, std::string interface)
40 this->protocol(protocol);
41 this->interface(interface);
44 prefix_ satcom::lib::LLSocketAddress::LLSocketAddress(std::string interface)
47 this->interface(interface);
50 prefix_ void satcom::lib::LLSocketAddress::clear()
52 ::memset(&addr_,0,sizeof(addr_));
53 addr_.sll_family = AF_PACKET;
56 prefix_ unsigned satcom::lib::LLSocketAddress::protocol()
59 return ntohs(addr_.sll_protocol);
62 prefix_ unsigned satcom::lib::LLSocketAddress::arptype()
65 // TODO: Check, wether this is returned in network or host byte
67 return ntohs(addr_.sll_hatype);
70 prefix_ unsigned satcom::lib::LLSocketAddress::pkttype()
73 // TODO: Check, wether this is returned in network or host byte
75 return ntohs(addr_.sll_pkttype);
78 prefix_ satcom::lib::LLSocketAddress::LLAddress satcom::lib::LLSocketAddress::address()
81 return LLAddress(&addr_.sll_addr[0], &addr_.sll_addr[addr_.sll_halen]);
84 prefix_ void satcom::lib::LLSocketAddress::protocol(unsigned protocol)
86 addr_.sll_protocol = htons(protocol);
89 prefix_ struct sockaddr * satcom::lib::LLSocketAddress::sockaddr_p()
91 return reinterpret_cast<struct sockaddr *>(&addr_);
94 prefix_ struct sockaddr const * satcom::lib::LLSocketAddress::sockaddr_p()
97 return reinterpret_cast<struct sockaddr const *>(&addr_);
100 prefix_ unsigned satcom::lib::LLSocketAddress::sockaddr_len()
103 return sizeof(addr_);
106 ///////////////////////////////cci.e///////////////////////////////////////
112 // c-file-style: "satcom"