FreeNOS
NetworkClient.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2015 Niek Linnenbank
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef __LIB_LIBNET_NETWORKCLIENT_H
19#define __LIB_LIBNET_NETWORKCLIENT_H
20
21#include <Types.h>
22#include "IPV4.h"
23#include "Ethernet.h"
24
45{
46 public:
47
58
72
84
95
107
108 public:
109
115 NetworkClient(const char *networkDevice);
116
120 virtual ~NetworkClient();
121
128
138 int *socket);
139
149 Result connectSocket(const int sock,
150 const IPV4::Address addr,
151 const u16 port = 0);
152
162 Result bindSocket(const int sock,
163 const IPV4::Address addr = 0,
164 const u16 port = 0);
165
176 const int sock,
177 const Size msecTimeout);
178
186 Result close(const int sock);
187
188 private:
189
193 Result writeSocketInfo(const int sock,
194 const IPV4::Address addr,
195 const u16 port,
196 const SocketAction action);
197
198 private:
199
202};
203
209#endif /* __LIB_LIBNET_NETWORKCLIENT_H */
u8 type
Definition IntelACPI.h:0
u32 Address
IP-address.
Definition IPV4.h:47
Networking Client implementation.
String m_deviceName
Network device name.
Result bindSocket(const int sock, const IPV4::Address addr=0, const u16 port=0)
Bind socket to address/port.
Result close(const int sock)
Close the socket.
Result writeSocketInfo(const int sock, const IPV4::Address addr, const u16 port, const SocketAction action)
Set socket to new state.
SocketType
Socket types.
virtual ~NetworkClient()
Destructor.
Result initialize()
Perform initialization.
Result waitSocket(const NetworkClient::SocketType type, const int sock, const Size msecTimeout)
Wait until the given socket has data to receive.
SocketAction
Socket actions.
Result
Result codes.
Result connectSocket(const int sock, const IPV4::Address addr, const u16 port=0)
Connect socket to address/port.
struct NetworkClient::SocketInfo SocketInfo
Socket information.
Result createSocket(const SocketType type, int *socket)
Create new socket.
Abstraction of strings.
Definition String.h:42
User Datagram Protocol (UDP)
Definition UDP.h:42
unsigned long Address
A memory address.
Definition Types.h:131
unsigned short u16
Unsigned 16-bit number.
Definition Types.h:56
unsigned int Size
Any sane size indicator cannot go negative.
Definition Types.h:128
Describes a single packet.
Socket information.