Skip to content

Commit 1d6fea4

Browse files
committed
inet4: added default template param N=0 for stack getters
1 parent 637bfb6 commit 1d6fea4

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

api/net/inet4.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,15 +157,15 @@ namespace net {
157157
}
158158

159159
/** Return the stack on the given Nic */
160-
template <int N>
160+
template <int N = 0>
161161
static auto&& stack()
162162
{
163163
static Inet4 inet{hw::Devices::nic(N)};
164164
return inet;
165165
}
166166

167167
/** Static IP config */
168-
template <int N>
168+
template <int N = 0>
169169
static auto&& ifconfig(
170170
IP4::addr addr,
171171
IP4::addr nmask,
@@ -177,7 +177,7 @@ namespace net {
177177
}
178178

179179
/** DHCP config */
180-
template <int N>
180+
template <int N = 0>
181181
static auto& ifconfig(double timeout = 10.0, dhcp_timeout_func on_timeout = nullptr)
182182
{
183183
stack<N>().negotiate_dhcp(timeout, on_timeout);

examples/demo_service/service.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,11 @@ void Service::start(const std::string&)
7070
// DHCP on interface 0
7171
auto& inet = net::Inet4::ifconfig<0>(10.0);
7272
// static IP in case DHCP fails
73-
net::Inet4::ifconfig<0>(
73+
net::Inet4::ifconfig(
7474
{ 10,0,0,42 }, // IP
7575
{ 255,255,255,0 }, // Netmask
7676
{ 10,0,0,1 }, // Gateway
77-
{ 10,0,0,1 }); // DNS
77+
{ 10,0,0,1 }); // DNS
7878

7979
// Print some useful netstats every 30 secs
8080
Timers::periodic(5s, 30s,

0 commit comments

Comments
 (0)