summaryrefslogtreecommitdiffhomepage
path: root/public/tools/mgmt.oe/src/CommandLine.cc
blob: 67b7a01be5c34226fc633cf5af3705078c5e9b07 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// Copyright 2024-2025, Amlal El Mahrouss (amlal@nekernel.org)
// Licensed under the Apache License, Version 2.0 (see LICENSE file)
// Official repository: https://github.com/ne-foss-org/nekernel

#include <libSystem/SystemKit/Jail.h>
#include <libSystem/SystemKit/System.h>

/// @author Amlal El Mahrouss
/// @brief OpenEnclave management tool

static JAIL* kJailSrv = nullptr;

SInt32 _NeMain(SInt32 argc, Char* argv[]) {
  LIBSYS_UNUSED(argc);
  LIBSYS_UNUSED(argv);

  kJailSrv = ::JailGetCurrent();

  MUST_PASS(kJailSrv);

  ::PrintOut(nullptr, "%s", "mgmt.oe: OpenEnclave Management Tool.");

  /// @note JailGetCurrent returns client as nullptr if we're not that client (we'll not be able to
  /// access the jail then)
  if (kJailSrv->fClient == nullptr) return EXIT_FAILURE;

  ::PrintOut(nullptr, "Jail-Hash: %ul", kJailSrv->fJailHash);
  ::PrintOut(nullptr, "Parent-ID: %ul", kJailSrv->fParentID);

  return EXIT_FAILURE;
}