FreeNOS
API.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 __KERNEL_API_H
19#define __KERNEL_API_H
20
21#include <Log.h>
22#include <Types.h>
23#include <Vector.h>
24
39class API
40{
41 public:
42
59
81
87
91 typedef enum Operation
92 {
93 Create = 0,
94 Delete = 1,
95 Send = 2,
98 Read = 5,
99 Write = 6,
100 ReadPhys = 7
103
104 public:
105
109 API();
110
114 Result invoke(Number number,
115 ulong arg1,
116 ulong arg2,
117 ulong arg3,
118 ulong arg4,
119 ulong arg5);
120
121 private:
122
125};
126
133
134/*
135 * Include generic kernel API functions.
136 */
137
138#include "API/PrivExec.h"
139#include "API/ProcessCtl.h"
140#include "API/SystemInfo.h"
141#include "API/VMCopy.h"
142#include "API/VMCtl.h"
143#include "API/VMShare.h"
144#include "API/ProcessID.h"
145
146#endif /* __KERNEL_API_H */
Log & operator<<(Log &log, API::Operation op)
Operator to print a Operation to a Log.
Definition API.cpp:50
Generic Kernel API implementation.
Definition API.h:40
Result
Enumeration of generic kernel API result codes.
Definition API.h:69
@ MaxValue
Definition API.h:79
@ NotFound
Definition API.h:73
@ IOError
Definition API.h:76
@ OutOfMemory
Definition API.h:75
@ RangeError
Definition API.h:72
@ AlreadyExists
Definition API.h:77
@ Success
Definition API.h:70
@ InvalidArgument
Definition API.h:74
@ AccessViolation
Definition API.h:71
@ TemporaryUnavailable
Definition API.h:78
enum API::Number Number
Enumeration of supported generic kernel API functions.
Operation
Various actions which may be performed inside an APIHandler.
Definition API.h:92
@ ReadPhys
Definition API.h:100
@ Send
Definition API.h:95
@ Read
Definition API.h:98
@ Write
Definition API.h:99
@ Create
Definition API.h:93
@ SendReceive
Definition API.h:97
@ Delete
Definition API.h:94
@ Receive
Definition API.h:96
Result invoke(Number number, ulong arg1, ulong arg2, ulong arg3, ulong arg4, ulong arg5)
Execute a generic API function.
Definition API.cpp:35
enum API::Operation Operation
Various actions which may be performed inside an APIHandler.
API()
Constructor.
Definition API.cpp:21
Result Handler(ulong, ulong, ulong, ulong, ulong)
Function which handles an kernel API (system call) request.
Definition API.h:86
Vector< Handler * > m_apis
API handlers.
Definition API.h:124
@ VMCtlNumber
Definition API.h:55
@ VMCopyNumber
Definition API.h:54
@ VMShareNumber
Definition API.h:56
@ PrivExecNumber
Definition API.h:51
@ SystemInfoNumber
Definition API.h:53
@ ProcessCtlNumber
Definition API.h:52
Logging class.
Definition Log.h:97
Vectors are dynamically resizeable Arrays.
Definition Vector.h:42
unsigned long ulong
Unsigned long number.
Definition Types.h:47
#define UINT_MAX
Definition Macros.h:78