|
FreeNOS
|
Networking server. More...
#include <NetworkServer.h>
Public Member Functions | |
| NetworkServer (const char *path) | |
| Constructor. More... | |
| virtual | ~NetworkServer () |
| Destructor. More... | |
| void | registerNetworkDevice (NetworkDevice *dev) |
| Register network device. More... | |
| virtual FileSystem::Result | initialize () |
| Initialize the NetworkServer. More... | |
| virtual void | onProcessTerminated (const ProcessID pid) |
| Called whenever another Process is terminated. More... | |
| virtual bool | retryRequests () |
| Starts DMA on NetworkDevices after all pending requests are done. More... | |
Public Member Functions inherited from DeviceServer | |
| DeviceServer (const char *path) | |
| Constructor. More... | |
| virtual | ~DeviceServer () |
| Destructor. More... | |
| void | registerDevice (Device *dev, const char *path) |
| Add a Device. More... | |
| void | registerInterrupt (Device *dev, Size vector) |
| Register an interrupt vector for the given device. More... | |
| virtual void | interruptHandler (Size vector) |
| Interrupt request handler. More... | |
Public Member Functions inherited from FileSystemServer | |
| FileSystemServer (Directory *root, const char *path) | |
| Constructor function. More... | |
| virtual | ~FileSystemServer () |
| Destructor function. More... | |
| const char * | getMountPath () const |
| Get mount path. More... | |
| u32 | getNextInode () |
| Get next unused inode. More... | |
| FileSystem::Result | mount () |
| Mount the FileSystem. More... | |
| FileSystem::Result | registerFile (File *file, const char *path) |
| Register a new File. More... | |
| FileSystem::Result | registerDirectory (Directory *dir, const char *path) |
| Register a new Directory. More... | |
| FileSystem::Result | unregisterFile (const char *path) |
| Remove a File from the FileSystemServer. More... | |
| virtual File * | createFile (const FileSystem::FileType type) |
| Create a new file. More... | |
| void | pathHandler (FileSystemMessage *msg) |
| Process an incoming filesystem request using a path. More... | |
| void | mountHandler (FileSystemMessage *msg) |
| Process a filesystem mount request message. More... | |
| void | getFileSystemsHandler (FileSystemMessage *msg) |
| Read the file system mounts table. More... | |
Public Member Functions inherited from ChannelServer< FileSystemServer, FileSystemMessage > | |
| ChannelServer (FileSystemServer *inst) | |
| Constructor function. More... | |
| virtual | ~ChannelServer () |
| Destructor function. More... | |
| int | run () |
| Enters an infinite loop, serving incoming requests. More... | |
| void | setTimeout (const uint msec) |
| Set a sleep timeout. More... | |
Private Attributes | |
| NetworkDevice * | m_device |
| Network device instance. More... | |
Additional Inherited Members | |
Public Types inherited from ChannelServer< FileSystemServer, FileSystemMessage > | |
| enum | Result |
| Result codes. More... | |
Protected Types inherited from ChannelServer< FileSystemServer, FileSystemMessage > | |
| typedef void(FileSystemServer ::* | IPCHandlerFunction) (FileSystemMessage *) |
| Member function pointer inside Base, to handle IPC messages. More... | |
| typedef void(FileSystemServer ::* | IRQHandlerFunction) (Size) |
| Member function pointer inside Base, to handle interrupts. More... | |
Protected Member Functions inherited from FileSystemServer | |
| FileSystem::Result | processRequest (FileSystemRequest &req) |
| Process a FileSystemRequest. More... | |
| FileSystem::Result | inodeHandler (FileSystemRequest &req) |
| Handle a request for a File specified by its inode. More... | |
| FileSystem::Result | waitFileHandler (FileSystemRequest &req) |
| Handle a WaitFile request. More... | |
| void | sendResponse (FileSystemMessage *msg) const |
| Send response for a FileSystemMessage. More... | |
| bool | redirectRequest (const char *path, FileSystemMessage *msg) |
| Try to forward the given FileSystemMessage to a mount file system. More... | |
| void | setRoot (Directory *newRoot) |
| Change the filesystem root directory. More... | |
| Directory * | getParentDirectory (const char *path) |
| Retrieve parent Directory for a file. More... | |
| FileCache * | lookupFile (const FileSystemPath &path) |
| Retrieve a File from storage. More... | |
| FileCache * | findFileCache (const char *path) const |
| Search the cache for an entry. More... | |
| FileCache * | findFileCache (const String &path) const |
| Search the cache for an entry. More... | |
| FileCache * | findFileCache (const FileSystemPath &path) const |
| Search the cache for an entry. More... | |
| FileCache * | insertFileCache (File *file, const char *pathFormat) |
| Inserts a file into the in-memory filesystem tree. More... | |
| void | removeFileFromCache (FileCache *cache, File *file) |
| Remove a File from the cache. More... | |
| void | clearFileCache (FileCache *cache=ZERO) |
| Cleans up the entire file cache (except opened file caches and root). More... | |
Protected Member Functions inherited from ChannelServer< FileSystemServer, FileSystemMessage > | |
| void | addIPCHandler (const Size slot, IPCHandlerFunction h, const bool sendReply=true) |
| Register a new IPC message action handler. More... | |
| void | addIRQHandler (const Size slot, IRQHandlerFunction h) |
| Register a new IRQ message vector handler. More... | |
| virtual void | timeout () |
| Called when sleep timeout is reached. More... | |
| void | retryAllRequests () |
| Keep retrying requests until all served. More... | |
Protected Attributes inherited from FileSystemServer | |
| const ProcessID | m_pid |
| Process identifier. More... | |
| FileCache * | m_root |
| Root entry of the filesystem tree. More... | |
| HashTable< u32, File * > | m_inodeMap |
| Contains a mapping of inode number to file of all cached files. More... | |
| const char * | m_mountPath |
| Mount point path. More... | |
| FileSystemMount * | m_mounts |
| Table with mounted file systems (only used by the root file system). More... | |
| List< FileSystemRequest * > * | m_requests |
| Contains ongoing requests. More... | |
Protected Attributes inherited from ChannelServer< FileSystemServer, FileSystemMessage > | |
| FileSystemServer * | m_instance |
| Server object instance. More... | |
| ChannelClient * | m_client |
| Client for sending replies. More... | |
| ChannelRegistry & | m_registry |
| Contains registered channels. More... | |
| MemoryChannel | m_kernelEvent |
| Kernel event channel. More... | |
| Index< MessageHandler< IPCHandlerFunction >, MaximumHandlerCount > | m_ipcHandlers |
| IPC handler functions. More... | |
| Index< MessageHandler< IRQHandlerFunction >, MaximumHandlerCount > | m_irqHandlers |
| IRQ handler functions. More... | |
| ProcessID | m_self |
| ProcessID of ourselves. More... | |
| Timer::Info | m_time |
| System timer value. More... | |
| Timer::Info | m_expiry |
| System timer expiration value. More... | |
Networking server.
Definition at line 40 of file NetworkServer.h.
| NetworkServer::NetworkServer | ( | const char * | path | ) |
Constructor.
Definition at line 21 of file NetworkServer.cpp.
|
virtual |
Destructor.
Definition at line 27 of file NetworkServer.cpp.
|
virtual |
Initialize the NetworkServer.
Reimplemented from DeviceServer.
Definition at line 37 of file NetworkServer.cpp.
References DEBUG, and DeviceServer::initialize().
Referenced by main().
|
virtual |
Called whenever another Process is terminated.
| pid | ProcessID of the terminating process |
Reimplemented from ChannelServer< FileSystemServer, FileSystemMessage >.
Definition at line 43 of file NetworkServer.cpp.
References DEBUG, m_device, NetworkDevice::unregisterSockets(), and ZERO.
| void NetworkServer::registerNetworkDevice | ( | NetworkDevice * | dev | ) |
Register network device.
| dev | NetworkDevice pointer |
Definition at line 31 of file NetworkServer.cpp.
References m_device, and DeviceServer::registerDevice().
Referenced by main().
|
virtual |
Starts DMA on NetworkDevices after all pending requests are done.
Reimplemented from FileSystemServer.
Definition at line 53 of file NetworkServer.cpp.
References assert, ERROR, m_device, FileSystemServer::retryRequests(), NetworkDevice::startDMA(), FileSystem::Success, and ZERO.
|
private |
Network device instance.
Definition at line 85 of file NetworkServer.h.
Referenced by onProcessTerminated(), registerNetworkDevice(), and retryRequests().
1.8.17