simple-socket library 1.2.0
CANSocket.h
Go to the documentation of this file.
1#ifndef NET_CANSocket_h__
2#define NET_CANSocket_h__
3
4#include "SimpleSocket.h"
5
6struct sockaddr_can;
7
8namespace NET
9{
11 class CANSocket : public SimpleSocket
12 {
13 public:
19 void connect( std::string_view interface = "");
20
26 void bind( std::string_view interface = "");
27
33 std::string getLocalInterface() const;
34
40 std::string getForeignInterface() const;
41
42 protected:
44 CANSocket( int type, int protocol);
45
47 std::string getInterfaceName( const sockaddr_can& addr) const;
48
50 int getInterfaceIndex( std::string_view interface) const;
51 };
52
53} // namespace NET
54
55#endif // NET_CANSocket_h__
Definition CANFrame.h:7
std::string getLocalInterface() const
Definition CANSocket.cpp:36
int getInterfaceIndex(std::string_view interface) const
get CAN interface index from interface name
Definition CANSocket.cpp:69
CANSocket(int type, int protocol)
allows a subclass to create new socket
Definition CANSocket.cpp:12
void bind(std::string_view interface="")
Definition CANSocket.cpp:26
std::string getInterfaceName(const sockaddr_can &addr) const
get CAN interface name from socket address structure
Definition CANSocket.cpp:58
std::string getForeignInterface() const
Definition CANSocket.cpp:47
void connect(std::string_view interface="")
Definition CANSocket.cpp:16
SimpleSocket(int sockfd)
enables return of an accepted socket