Skip to content

Commit 0b36467

Browse files
committed
examples: Update to new autoconf scheme
1 parent c4f6d39 commit 0b36467

10 files changed

Lines changed: 55 additions & 32 deletions

File tree

examples/LiveUpdate/config.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
{
22
"net" : [
3-
["10.0.0.42", "255.255.255.0", "10.0.0.1"]
3+
{
4+
"iface": 0,
5+
"config": "dhcp-with-fallback",
6+
"address": "10.0.0.42",
7+
"netmask": "255.255.255.0",
8+
"gateway": "10.0.0.1"
9+
}
410
]
511
}

examples/STREAM/README.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
### STREAM: Sustainable Memory Bandwidth in High Performance Computers
22

3+
Using Qemu and the IncludeOS boot program:
34
```
4-
mkdir build
5-
cd build
6-
cmake ..
7-
make
8-
../run.sh stream_example
5+
boot .
96
```
107

118
Output should show estimated memory bandwidth inside virtual machine.

examples/STREAM/vm.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"mem" : 1024
2+
"mem" : 256
33
}

examples/acorn/config.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
{
22
"net" : [
3-
"dhcp"
3+
{
4+
"iface": 0,
5+
"config": "dhcp-with-fallback",
6+
"address": "10.0.0.42",
7+
"netmask": "255.255.255.0",
8+
"gateway": "10.0.0.1"
9+
}
410
]
511
}

examples/acorn/service.cpp

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Disk_ptr disk;
3636
#include <isotime>
3737
#include <net/inet4>
3838

39-
void Service::start()
39+
static void start_acorn(net::Inet<net::IP4>& inet)
4040
{
4141
/** SETUP LOGGER */
4242
const int LOGBUFFER_LEN = 1024*16;
@@ -56,12 +56,10 @@ void Service::start()
5656

5757
// init the first legit partition/filesystem
5858
disk->init_fs(
59-
[] (fs::error_t err, auto& fs)
59+
[&inet] (fs::error_t err, auto& fs)
6060
{
6161
if (err) panic("Could not mount filesystem...\n");
6262

63-
auto& inet = net::Super_stack::get<net::IP4>(0);
64-
6563
// only works with synchronous disks (memdisk)
6664
list_static_content(disk);
6765

@@ -163,3 +161,15 @@ void Service::start()
163161
}); // < disk
164162

165163
}
164+
165+
void Service::start()
166+
{
167+
auto& inet = net::Super_stack::get<net::IP4>(0);
168+
if (not inet.is_configured())
169+
{
170+
inet.on_config(start_acorn);
171+
}
172+
else {
173+
start_acorn(inet);
174+
}
175+
}

examples/demo_service/README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
### IncludeOS Demo Service
22

3+
To start, using boot:
34
```
4-
mkdir build
5-
cd build
6-
cmake ..
7-
make
8-
../run.sh IncludeOS_example
5+
boot .
96
```
107

118
This demo-service should start an instance of IncludeOS that brings up a minimal web service on port 80 with static content.
9+
10+
The default static IP is 10.0.0.42, unless running on a network with DHCP.

examples/demo_service/config.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
{
22
"net" : [
3-
["10.0.0.42", "255.255.255.0", "10.0.0.1"]
3+
{
4+
"iface": 0,
5+
"config": "dhcp-with-fallback",
6+
"address": "10.0.0.42",
7+
"netmask": "255.255.255.0",
8+
"gateway": "10.0.0.1"
9+
}
410
]
511
}

examples/tcp/CMakeLists.txt

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,6 @@ set(SOURCES
1818
service.cpp # ...add more here
1919
)
2020

21-
#
22-
# Service CMake options
23-
# (uncomment to enable)
24-
#
25-
26-
# MISC:
27-
2821
# To add your own include paths:
2922
# set(LOCAL_INCLUDES ".")
3023

examples/tcp/config.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"net" : [
3+
{
4+
"iface": 0,
5+
"config": "dhcp-with-fallback",
6+
"address": "10.0.0.42",
7+
"netmask": "255.255.255.0",
8+
"gateway": "10.0.0.1"
9+
}
10+
]
11+
}

examples/tcp/service.cpp

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,9 @@ void handle_python_on_read(Connection_ptr client, const std::string& response) {
5151
client->write(response);
5252
}
5353

54-
void Service::start(const std::string&)
54+
void Service::start()
5555
{
56-
// Static IP configuration will get overwritten by DHCP, if found
57-
auto& inet = net::Inet4::ifconfig<0>(10);
58-
inet.network_config({ 10,0,0,42 }, // IP
59-
{ 255,255,255,0 }, // Netmask
60-
{ 10,0,0,1 }, // Gateway
61-
{ 8,8,8,8 }); // DNS
56+
auto& inet = net::Super_stack::get<net::IP4>(0);
6257

6358
// Set up a TCP server on port 80
6459
auto& server = inet.tcp().listen(80);

0 commit comments

Comments
 (0)