The Pedigree Project  0.1
CdiNet.h
1 /*
2  * Copyright (c) 2008-2014, Pedigree Developers
3  *
4  * Please see the CONTRIB file in the root of the source tree for a full
5  * list of contributors.
6  *
7  * Permission to use, copy, modify, and distribute this software for any
8  * purpose with or without fee is hereby granted, provided that the above
9  * copyright notice and this permission notice appear in all copies.
10  *
11  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 #ifndef CDI_CPP_NET_H
21 #define CDI_CPP_NET_H
22 
23 #include <stdbool.h>
24 #include "cdi.h"
25 #include "cdi/net.h"
26 #include "pedigree/kernel/machine/Network.h"
27 #include "pedigree/kernel/processor/types.h"
28 #include "pedigree/kernel/utilities/String.h"
29 
31 class CdiNet : public Network
32 {
33  public:
34  CdiNet(struct cdi_net_device* device);
35  CdiNet(Network* pDev, struct cdi_net_device* device);
36  ~CdiNet();
37 
38  virtual void getName(String &str)
39  {
40  if((!m_Device) || (!m_Device->dev.name))
41  str = "cdi-net";
42  else
43  {
44  str = m_Device->dev.name;
45  }
46  }
47 
48  virtual bool send(size_t nBytes, uintptr_t buffer);
49 
50  virtual bool setStationInfo(const StationInfo &info);
51  virtual const StationInfo &getStationInfo();
52 
53  const struct cdi_net_device *getCdiDevice() const
54  {
55  return m_Device;
56  }
57 
58  private:
59  CdiNet(const CdiNet&);
60  const CdiNet & operator = (const CdiNet&);
61 
62  struct cdi_net_device* m_Device;
63 };
64 
65 #endif
virtual const StationInfo & getStationInfo()
Definition: CdiNet.cc:76
virtual bool setStationInfo(const StationInfo &info)
Definition: CdiNet.cc:81
Definition: String.h:49
Definition: CdiNet.h:31
virtual void getName(String &str)
Definition: CdiNet.h:38
virtual bool send(size_t nBytes, uintptr_t buffer)
Definition: CdiNet.cc:65
CdiNet(struct cdi_net_device *device)
Definition: CdiNet.cc:49