Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
New 'WiFi' routing, that makes it easier to specify WiFi network zones
[simgrid.git] / include / simgrid / kernel / routing / WifiZone.hpp
diff --git a/include/simgrid/kernel/routing/WifiZone.hpp b/include/simgrid/kernel/routing/WifiZone.hpp
new file mode 100644 (file)
index 0000000..2227093
--- /dev/null
@@ -0,0 +1,42 @@
+/* Copyright (c) 2013-2020. The SimGrid Team. All rights reserved.          */
+
+/* This program is free software; you can redistribute it and/or modify it
+ * under the terms of the license (GNU LGPL) which comes with this package. */
+
+#ifndef SIMGRID_ROUTING_WIFI_HPP_
+#define SIMGRID_ROUTING_WIFI_HPP_
+
+#include <simgrid/kernel/routing/RoutedZone.hpp>
+
+namespace simgrid {
+namespace kernel {
+namespace routing {
+
+/** @ingroup ROUTING_API
+ *  @brief NetZone modeling a Wifi zone
+ *
+ *  This routing has only one link, representing the wifi medium (ie, the air).
+ *  That link is used for all communications within the zone.
+ */
+class XBT_PRIVATE WifiZone : public RoutedZone {
+public:
+  explicit WifiZone(NetZoneImpl* father, const std::string& name, resource::NetworkModel* netmodel);
+  WifiZone(const WifiZone&) = delete;
+  WifiZone& operator=(const WifiZone) = delete;
+  ~WifiZone()                         = default;
+
+  void seal() override;
+  void get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) override;
+  s4u::Link* create_link(const std::string& name, const std::vector<double>& bandwidths, double latency,
+                         s4u::Link::SharingPolicy policy,
+                         const std::unordered_map<std::string, std::string>* props) override;
+
+private:
+  resource::LinkImpl* wifi_link_ = nullptr; // Representing the air media (there is no such thing in NS-3)
+  NetPoint* access_point_        = nullptr; // Zone's gateway to the external world
+};
+} // namespace routing
+} // namespace kernel
+} // namespace simgrid
+
+#endif /* SIMGRID_ROUTING_WIFI_HPP_ */