Skip to content

Commit 2399cb7

Browse files
committed
Refactor network interface and protocol headers
Renamed and reorganized network interface and protocol header files from 'net/' to 'core/' for improved clarity and modularity. Updated all relevant includes and references throughout the codebase. Consolidated and refactored DHCP and AutoIP status checks, and replaced GetHostName() with HostName() for hostname retrieval. Moved global network variables and logic from emac/net.cpp to emac/network.cpp, removing the obsolete net.cpp file.
1 parent 78e382c commit 2399cb7

File tree

62 files changed

+380
-443
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+380
-443
lines changed

lib-artnet/src/controller/artnetcontroller.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ ArtNetController::ArtNetController()
9999
art_poll_reply_.Status2 |=
100100
artnet::Status2::kPortAddress15Bit | (artnet::kVersion >= 4 ? artnet::Status2::kSacnAbleToSwitch : artnet::Status2::kSacnNoSwitch);
101101
art_poll_reply_.Status2 &= static_cast<uint8_t>(~artnet::Status2::kIpDhcp);
102-
art_poll_reply_.Status2 |= network::iface::IsDhcpUsed() ? artnet::Status2::kIpDhcp : artnet::Status2::kIpManualy;
102+
art_poll_reply_.Status2 |= network::iface::Dhcp() ? artnet::Status2::kIpDhcp : artnet::Status2::kIpManualy;
103103
art_poll_reply_.Status2 &= static_cast<uint8_t>(~artnet::Status2::kDhcpCapable);
104104
art_poll_reply_.Status2 |= network::iface::IsDhcpCapable() ? artnet::Status2::kDhcpCapable : static_cast<uint8_t>(0);
105105

lib-artnet/src/node/artnetnode.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ void ArtNetNode::Start()
165165
art_poll_reply_.Status2 |=
166166
artnet::Status2::kPortAddress15Bit | (artnet::kVersion >= 4 ? artnet::Status2::kSacnAbleToSwitch : artnet::Status2::kSacnNoSwitch);
167167
art_poll_reply_.Status2 &= static_cast<uint8_t>(~artnet::Status2::kIpDhcp);
168-
art_poll_reply_.Status2 |= network::iface::IsDhcpUsed() ? artnet::Status2::kIpDhcp : artnet::Status2::kIpManualy;
168+
art_poll_reply_.Status2 |= network::iface::Dhcp() ? artnet::Status2::kIpDhcp : artnet::Status2::kIpManualy;
169169
art_poll_reply_.Status2 &= static_cast<uint8_t>(~artnet::Status2::kDhcpCapable);
170170
art_poll_reply_.Status2 |= network::iface::IsDhcpCapable() ? artnet::Status2::kDhcpCapable : static_cast<uint8_t>(0);
171171
#if defined(ENABLE_HTTPD) && defined(ENABLE_CONTENT)

lib-artnet/src/node/artnetnodehandleipprog.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ void ArtNetNode::HandleIpProg()
5151
const auto* const kPArtIpProg = reinterpret_cast<artnet::ArtIpProg*>(receive_buffer_);
5252
const auto kCommand = kPArtIpProg->command;
5353
auto* reply = reinterpret_cast<artnet::ArtIpProgReply*>(receive_buffer_);
54-
const auto kIsDhcp = network::iface::IsDhcpUsed();
54+
const auto kIsDhcp = network::iface::Dhcp();
5555

5656
reply->op_code = static_cast<uint16_t>(artnet::OpCodes::kOpIpprogreply);
5757

@@ -83,7 +83,7 @@ void ArtNetNode::HandleIpProg()
8383
network::SetGatewayIp(ip.u32);
8484
}
8585

86-
if ( network::iface::IsDhcpUsed())
86+
if ( network::iface::Dhcp())
8787
{
8888
reply->status = (1U << 6);
8989
}
@@ -94,7 +94,7 @@ void ArtNetNode::HandleIpProg()
9494

9595
reply->spare2 = 0;
9696

97-
auto is_changed = (kIsDhcp != network::iface::IsDhcpUsed());
97+
auto is_changed = (kIsDhcp != network::iface::Dhcp());
9898

9999
ip.u32 = network::GetPrimaryIp();
100100
is_changed |= (memcmp(&kPArtIpProg->prog_ip_hi, ip.u8, artnet::kIpSize) != 0);
@@ -116,7 +116,7 @@ void ArtNetNode::HandleIpProg()
116116
if (is_changed)
117117
{
118118
art_poll_reply_.Status2 = static_cast<uint8_t>((art_poll_reply_.Status2 & (~(artnet::Status2::kIpDhcp))) |
119-
( network::iface::IsDhcpUsed() ? artnet::Status2::kIpDhcp : artnet::Status2::kIpManualy));
119+
( network::iface::Dhcp() ? artnet::Status2::kIpDhcp : artnet::Status2::kIpManualy));
120120

121121
memcpy(art_poll_reply_.IPAddress, &reply->prog_ip_hi, artnet::kIpSize);
122122
#if (ARTNET_VERSION >= 4)

lib-displayudf/include/displayudf.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ class DisplayUdf final : public Display
198198
void ShowHostName()
199199
{
200200
ClearEndOfLine();
201-
Write(labels_[static_cast<uint32_t>(displayudf::Labels::kHostname)], network::iface::GetHostName());
201+
Write(labels_[static_cast<uint32_t>(displayudf::Labels::kHostname)], network::iface::HostName());
202202
}
203203

204204
void ShowDhcpStatus(network::dhcp::State state)

lib-e131/src/controller/e131controller.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ E131Controller::E131Controller()
6161

6262
char aSourceName[e131::kSourceNameLength];
6363
uint8_t nLength;
64-
snprintf(aSourceName, e131::kSourceNameLength, "%.48s %s", network::iface::GetHostName(), hal::BoardName(nLength));
64+
snprintf(aSourceName, e131::kSourceNameLength, "%.48s %s", network::iface::HostName(), hal::BoardName(nLength));
6565
SetSourceName(aSourceName);
6666

6767
hal::UuidCopy(cid_);

lib-e131/src/node/e131bridge.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ E131Bridge::E131Bridge()
7979
#if defined(E131_HAVE_DMXIN) || defined(NODE_SHOWFILE)
8080
char source_name[e131::kSourceNameLength];
8181
uint8_t length;
82-
snprintf(source_name, e131::kSourceNameLength, "%.48s %s", network::iface::GetHostName(), hal::BoardName(length));
82+
snprintf(source_name, e131::kSourceNameLength, "%.48s %s", network::iface::HostName(), hal::BoardName(length));
8383
SetSourceName(source_name);
8484

8585
hal::UuidCopy(cid_);

lib-midi/src/net/applemidi.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ AppleMidi::AppleMidi()
132132
memcpy(cast32.u8, &mac_address[2], 4);
133133
ssrc_ = cast32.u32;
134134

135-
SetSessionName( network::iface::GetHostName());
135+
SetSessionName( network::iface::HostName());
136136

137137
memset(&session_status_, 0, sizeof(struct applemidi::SessionStatus));
138138

lib-network/include/apps/mdns.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
* THE SOFTWARE.
2424
*/
2525

26-
#ifndef NET_APPS_MDNS_H_
27-
#define NET_APPS_MDNS_H_
26+
#ifndef APPS_MDNS_H_
27+
#define APPS_MDNS_H_
2828

2929
#include <cstdint>
3030

@@ -65,4 +65,4 @@ bool ServiceRecordDelete(mdns::Services service);
6565
void SendAnnouncement(uint32_t ttl);
6666
} // namespace mdns
6767

68-
#endif // NET_APPS_MDNS_H_
68+
#endif // APPS_MDNS_H_

lib-network/include/apps/ntpclient.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
* THE SOFTWARE.
2424
*/
2525

26-
#ifndef NET_APPS_NTPCLIENT_H_
27-
#define NET_APPS_NTPCLIENT_H_
26+
#ifndef APPS_NTPCLIENT_H_
27+
#define APPS_NTPCLIENT_H_
2828

2929
#include <cstdint>
3030

@@ -71,4 +71,4 @@ ntp::Status GetStatus();
7171

7272
} // namespace ntpclient
7373

74-
#endif // NET_APPS_NTPCLIENT_H_
74+
#endif // APPS_NTPCLIENT_H_

lib-network/include/apps/tftpdaemon.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
* THE SOFTWARE.
2424
*/
2525

26-
#ifndef NET_APPS_TFTPDAEMON_H_
27-
#define NET_APPS_TFTPDAEMON_H_
26+
#ifndef APPS_TFTPDAEMON_H_
27+
#define APPS_TFTPDAEMON_H_
2828

2929
#include <cstdint>
3030
#include <cstddef>
@@ -94,4 +94,4 @@ class TFTPDaemon
9494
static inline TFTPDaemon* s_this;
9595
};
9696

97-
#endif // NET_APPS_TFTPDAEMON_H_
97+
#endif // APPS_TFTPDAEMON_H_

0 commit comments

Comments
 (0)