libcyberradio  22.01.24
TransmitSocket.h
1 /***************************************************************************
2  * \file TransmitSocket.h
3  *
4  * \brief NDR651 transmitter socket class.
5  *
6  * \author NH
7  * \copyright Copyright (c) 2015-2021 CyberRadio Solutions, Inc.
8  *
9  */
10 
11 #ifndef INCLUDED_LIBCYBERRADIO_NDR651_TRANSMITSOCKET_H
12 #define INCLUDED_LIBCYBERRADIO_NDR651_TRANSMITSOCKET_H
13 
14 #include <string>
15 #include <vector>
16 #include <boost/thread/mutex.hpp>
17 
21 namespace LibCyberRadio
22 {
27  namespace NDR651
28  {
33  {
34  public:
40  TransmitSocket(const std::string& ifname, unsigned int sport);
44  virtual ~TransmitSocket();
49  std::string getMacAddress();
54  std::string getIpAddress();
59  std::string getIpBroadcastAddress();
66  bool sendFrame(unsigned char * frame, const int & frameLen);
67  bool isUsingRawSocket(void) { return _isRaw; };
68  bool isUsingUdpSocket(void) { return !_isRaw; };
69  // bool sendFrame(std::vector<short> frame);
70  // int sendFrame(std::vector<std::complex>);
71 
72  private:
73  int _sockfd;
74  std::string _ifname;
75  bool _isRaw, _isBroadcast;
76  boost::mutex _txMutex;
77  int _txBytes;
78  long unsigned int _sendCount, _byteCount;
79  unsigned int _sport;
80 
81  bool _makeSocket();
82  bool _makeRawSocket();
83  bool _makeUdpSocket();
84 
85  };
86 
87  } /* namespace NDR651 */
88 }
89 
90 #endif /* INCLUDED_LIBCYBERRADIO_NDR651_TRANSMITSOCKET_H */
bool sendFrame(unsigned char *frame, const int &frameLen)
Sends a frame of data.
std::string getIpBroadcastAddress()
Gets the IP broadcast address.
Defines functionality for LibCyberRadio applications.
Definition: App.h:23
std::string getMacAddress()
Gets the MAC address.
TransmitSocket(const std::string &ifname, unsigned int sport)
Constructs a TransmitSocket object.
std::string getIpAddress()
Gets the IP address.
virtual ~TransmitSocket()
Destroys a TransmitSocket object.