Go to the documentation of this file.
38 Size numberOfMounts = 0;
46 for (
Size i = 0; i < numberOfMounts; i++)
48 const String mountPath(mounts[i].path);
50 if (mountPath.
length() > 0 && mountPath.
compareTo(
"/network/",
true, 9) == 0)
89 path <<
"/arp/socket";
93 path <<
"/icmp/factory";
97 path <<
"/udp/factory";
107 ERROR(
"failed to open socket factory at " << *path <<
108 ": result = " << (
int) result);
133 const Size msecTimeout)
137 DEBUG(
"type = " << (
int)
type <<
" sock = " << sock);
141 ERROR(
"protocol not supported: " << (
int)
type);
147 if (!fd || !fd->
open)
149 ERROR(
"failed to get FileDescriptor for socket " << sock <<
": " << (fd ?
"closed" :
"not found"));
165 DEBUG(
"operation timed out");
170 ERROR(
"failed to wait for socket " << sock <<
" with inode " <<
171 waitSet.
inode <<
": result = " << (
int) waitResult);
187 Size sz =
sizeof(buf);
193 if (!fd || !fd->
open)
203 ERROR(
"failed to read from socket " << sock <<
204 ": result = " << (
int) readResult);
213 ERROR(
"failed to stat socket at path " << buf <<
": result = " << (
int) statResult);
230 ERROR(
"failed to write info to socket " << sock <<
231 ": result = " << (
int) writeResult);
246 ERROR(
"failed to close socket " << sock <<
": result = " << (
int) result);
String m_deviceName
Network device name.
SocketAction
Socket actions.
static FileDescriptor * instance()
Retrieve the instance.
Result initialize()
Perform initialization.
Result createSocket(const SocketType type, int *socket)
Create new socket.
Size length() const
Same as count().
Result close(const int sock)
Close the socket.
Represents a mounted filesystem.
FileSystem::Result statFile(const char *path, FileSystem::FileStat *st) const
Retrieve status of a file.
FileSystemClient provides a simple interface to a FileSystemServer.
bool open
< Current position indicator.
Provides information about an inode.
virtual int compareTo(const String &str) const
Compares this String to the given String.
Result connectSocket(const int sock, const IPV4::Address addr, const u16 port=0)
Connect socket to address/port.
Entry * getEntry(const Size index)
Retrieve a file descriptor Entry.
FileSystem::Result writeFile(const Size descriptor, const void *buf, Size *size) const
Write a file.
#define DEBUG(msg)
Output a debug message to standard output.
virtual ~NetworkClient()
Destructor.
FileSystem::Result closeFile(const Size descriptor) const
Close a file.
Describes a single file opened by a user process.
FileSystem::Result openFile(const char *path, Size &descriptor) const
Open a file.
unsigned short u16
Unsigned 16-bit number.
unsigned int Size
Any sane size indicator cannot go negative.
FileSystemMount * getFileSystems(Size &numberOfMounts) const
Get file system mounts table.
u16 requested
< Inode number
Result bindSocket(const int sock, const IPV4::Address addr=0, const u16 port=0)
Bind socket to address/port.
FileSystem::Result readFile(const Size descriptor, void *buf, Size *size) const
Read a file.
u16 current
< Requested status flags of the inode
Contains file information.
#define ERROR(msg)
Output an error message.
char path[FileSystemPath::MaximumLength]
Path of the mount.
Result
Result code for filesystem Actions.
NetworkClient(const char *networkDevice)
Constructor.
ProcessID pid
< Inode number of the file
Result writeSocketInfo(const int sock, const IPV4::Address addr, const u16 port, const SocketAction action)
Set socket to new state.
FileSystem::Result waitFile(const char *filesystemPath, const FileSystem::WaitSet *waitSet, const Size count, const Size msecTimeout) const
Wait for one or more files to become readable/writable.
Result waitSocket(const NetworkClient::SocketType type, const int sock, const Size msecTimeout)
Wait until the given socket has data to receive.
ProcessID pid
< Inode number