Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
b32df8a
update
Oguz96 Dec 3, 2024
3c0a87e
added missing files, added some definitions
Oguz96 Dec 17, 2024
f6bed3a
changed enum of wifi security
Oguz96 Jan 13, 2025
c5e2276
made changes regarding send buffers for lwip on ti platform
Oguz96 Jan 14, 2025
e587297
change tcp_mss size
Oguz96 Jan 16, 2025
e601d5f
Task: change to make clang compiler happy
shrikrishnaborade Jan 17, 2025
8b4d93f
added is tracer set function, adjusted lwip config
Oguz96 Jan 31, 2025
4a035d7
Task: Currently using TI based LWIP 2.1.3.
shrikrishnaborade Feb 7, 2025
7266ceb
fix crash in lwip, remove verify block
Oguz96 Apr 16, 2025
f4e65bc
changed assert to really assert
Oguz96 Apr 17, 2025
22fb200
added locking, unlocking tcpip core
Oguz96 Apr 22, 2025
d8112b7
removed content in destructor of udpwriter
Oguz96 Apr 23, 2025
1b6ec5c
Task: IPV6 support added
shrikrishnaborade Apr 25, 2025
9973f6e
Merge remote-tracking branch 'origin/main' into HEAD
richardapeters May 14, 2025
0c5c03e
Remove TracerIsSet()
richardapeters May 14, 2025
793b0cd
Remove tracing from ConnectionMbedTls; use TracingConnectionMbedTls i…
richardapeters May 14, 2025
40fb97b
Revert a number of (hopefully) unnecessary changes
richardapeters May 15, 2025
392ba09
Restore missing #endif
richardapeters May 15, 2025
371c96e
Restore lwipopts.h
richardapeters May 15, 2025
f8d85ab
Remove LWIP_RAND from cc.h
richardapeters May 15, 2025
60635fa
chore: upgrade protobuf to version 31.0
richardapeters May 16, 2025
f1b3879
Remove ProtoOptional
richardapeters May 16, 2025
34826ce
Merge remote-tracking branch 'origin/feature/upgrade-protobuf' into f…
richardapeters May 16, 2025
4383170
Restore BUILD_TESTING after including Absl
richardapeters May 16, 2025
23d2e7b
Merge remote-tracking branch 'origin/feature/upgrade-protobuf' into f…
richardapeters May 16, 2025
384d434
Fix missing "INTERNAL"
richardapeters May 16, 2025
7760f99
Merge remote-tracking branch 'origin/feature/upgrade-protobuf' into f…
richardapeters May 16, 2025
2d1421b
Merge remote-tracking branch 'origin/main' into HEAD
richardapeters May 27, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions infra/stream/OutputStream.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "infra/stream/OutputStream.hpp"
#include "infra/util/BoundedString.hpp"
#include <cmath>
#include <limits>

Expand Down Expand Up @@ -91,9 +92,11 @@ namespace infra

TextOutputStream& TextOutputStream::operator<<(const char* zeroTerminatedString)
{
const auto len = std::strlen(zeroTerminatedString); //NOSONAR
OutputOptionalPadding(len);
Writer().Insert(ReinterpretCastByteRange(MakeRange(zeroTerminatedString, zeroTerminatedString + len)), ErrorPolicy());
infra::BoundedConstString string(zeroTerminatedString);
OutputOptionalPadding(string.size());

Writer().Insert(infra::StringAsByteRange(string), ErrorPolicy());

return *this;
}

Expand Down
1 change: 1 addition & 0 deletions infra/util/SharedPtr.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define INFRA_SHARED_PTR_HPP

#include "infra/util/Function.hpp"
#include "infra/util/ReallyAssert.hpp"
#include "infra/util/StaticStorage.hpp"
#include <cassert>
#include <cstdint>
Expand Down
16 changes: 11 additions & 5 deletions lwip/lwip_config/arch/cc.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#ifndef LIGHTWEIGHT_IP_CC_H
#define LIGHTWEIGHT_IP_CC_H

#include <stdlib.h>
#include <stdint.h>
#include <stdlib.h>

#define LWIP_PROVIDE_ERRNO

#define U16_F "hu"
#define S16_F "d"
Expand All @@ -12,18 +14,18 @@
#define X32_F "x"
#define SZT_F "uz"

#if defined (__GNUC__)
#if defined(__GNUC__)

#ifndef BYTE_ORDER
#define BYTE_ORDER LITTLE_ENDIAN
#endif

#define PACK_STRUCT_BEGIN
#define PACK_STRUCT_STRUCT __attribute__ ((__packed__))
#define PACK_STRUCT_STRUCT __attribute__((__packed__))
#define PACK_STRUCT_END
#define PACK_STRUCT_FIELD(x) x

#elif defined (_MSC_VER)
#elif defined(_MSC_VER)

#ifndef BYTE_ORDER
#define BYTE_ORDER LITTLE_ENDIAN
Expand All @@ -40,6 +42,10 @@

#endif

#define LWIP_PLATFORM_ASSERT(x) do { abort(); } while (0)
#define LWIP_PLATFORM_ASSERT(x) \
do \
{ \
abort(); \
} while (0)

#endif
99 changes: 99 additions & 0 deletions lwip/lwip_config/arch/sys_arch.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
/*
* Copyright (c) 2017 Simon Goldschmidt
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE.
*
* This file is part of the lwIP TCP/IP stack.
*
* Author: Simon Goldschmdit <[email protected]>
*
*/
#ifndef LWIP_ARCH_SYS_ARCH_H
#define LWIP_ARCH_SYS_ARCH_H

#include "lwip/arch.h"
#include "lwip/opt.h"

/** This is returned by _fromisr() sys functions to tell the outermost function
* that a higher priority task was woken and the scheduler needs to be invoked.
*/
#define ERR_NEED_SCHED 123

/* This port includes FreeRTOS headers in sys_arch.c only.
* FreeRTOS uses pointers as object types. We use wrapper structs instead of
* void pointers directly to get a tiny bit of type safety.
*/

void sys_arch_msleep(u32_t delay_ms);
#define sys_msleep(ms) sys_arch_msleep(ms)

#if SYS_LIGHTWEIGHT_PROT
typedef u32_t sys_prot_t;
#endif /* SYS_LIGHTWEIGHT_PROT */

#if !LWIP_COMPAT_MUTEX
struct _sys_mut
{
void* mut;
};
typedef struct _sys_mut sys_mutex_t;
#define sys_mutex_valid_val(mutex) ((mutex).mut != NULL)
#define sys_mutex_valid(mutex) (((mutex) != NULL) && sys_mutex_valid_val(*(mutex)))
#define sys_mutex_set_invalid(mutex) ((mutex)->mut = NULL)
#endif /* !LWIP_COMPAT_MUTEX */

struct _sys_sem
{
void* sem;
};
typedef struct _sys_sem sys_sem_t;
#define sys_sem_valid_val(sema) ((sema).sem != NULL)
#define sys_sem_valid(sema) (((sema) != NULL) && sys_sem_valid_val(*(sema)))
#define sys_sem_set_invalid(sema) ((sema)->sem = NULL)

struct _sys_mbox
{
void* mbx;
};
typedef struct _sys_mbox sys_mbox_t;
#define sys_mbox_valid_val(mbox) ((mbox).mbx != NULL)
#define sys_mbox_valid(mbox) (((mbox) != NULL) && sys_mbox_valid_val(*(mbox)))
#define sys_mbox_set_invalid(mbox) ((mbox)->mbx = NULL)

struct _sys_thread
{
void* thread_handle;
};
typedef struct _sys_thread sys_thread_t;

#if LWIP_NETCONN_SEM_PER_THREAD
sys_sem_t* sys_arch_netconn_sem_get(void);
void sys_arch_netconn_sem_alloc(void);
void sys_arch_netconn_sem_free(void);
#define LWIP_NETCONN_THREAD_SEM_GET() sys_arch_netconn_sem_get()
#define LWIP_NETCONN_THREAD_SEM_ALLOC() sys_arch_netconn_sem_alloc()
#define LWIP_NETCONN_THREAD_SEM_FREE() sys_arch_netconn_sem_free()
#endif /* LWIP_NETCONN_SEM_PER_THREAD */

#endif /* LWIP_ARCH_SYS_ARCH_H */
2 changes: 1 addition & 1 deletion lwip/lwip_config/lwipopts.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ extern "C"
#define LWIP_DNS 1
#define LWIP_RAW 0
#define LWIP_IGMP 1
uint32_t StaticLwIpRand();
uint32_t StaticLwIpRand();
#define LWIP_RAND() StaticLwIpRand()
#define MEM_ALIGNMENT 4
#define LWIP_STATS 0
Expand Down
2 changes: 1 addition & 1 deletion lwip/lwip_cpp/ConnectionLwIp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

namespace services
{
#ifdef ESP_PLATFORM
#if defined(ESP_PLATFORM) || defined(TI_PLATFORM)
static const uint32_t tcpSndBuf = 2 * TCP_MSS;
static const uint32_t tcpSndQueueLen = ((4 * (tcpSndBuf) + (TCP_MSS - 1)) / (TCP_MSS));
static const uint32_t tcpWnd = (4 * TCP_MSS);
Expand Down
16 changes: 16 additions & 0 deletions lwip/lwip_cpp/LightweightIp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
#include "lwip/timeouts.h"
#endif

#include "services/tracer/GlobalTracer.hpp"

namespace
{
hal::SynchronousRandomDataGenerator* randomDataGenerator = nullptr;
Expand Down Expand Up @@ -75,6 +77,8 @@ namespace services

void LightweightIp::RegisterInstance()
{
services::GlobalTracer().Trace() << "******** LightweightIp::RegisterInstance *********\r\n";

if (instances.empty())
netif_add_ext_callback(&instanceCallback, &InstanceCallback);

Expand All @@ -83,6 +87,7 @@ namespace services

void LightweightIp::DeregisterInstance()
{
services::GlobalTracer().Trace() << "LightweightIp::DeregisterInstance";
instances.erase(*this);

if (instances.empty())
Expand All @@ -99,17 +104,21 @@ namespace services
{
bool linkUp = (netif_default->flags & NETIF_FLAG_LINK_UP) != 0;

services::GlobalTracer().Trace() << "LightweightIp::ExtCallback: " << netif_default->name[0] << netif_default->name[1] << " : link " << (linkUp ? "up" : "down");

auto newIpv4Address = GetIPv4Address();

if (!linkUp)
newIpv4Address = IPv4Address();

if ((reason & (LWIP_NSC_IPV4_SETTINGS_CHANGED | LWIP_NSC_LINK_CHANGED)) != 0 && ipv4Address != newIpv4Address)
{
services::GlobalTracer().Trace() << "LightweightIp::ExtCallback: 1 : ip " << newIpv4Address;
ipv4Address = newIpv4Address;

if (ipv4Address == IPv4Address())
{
services::GlobalTracer().Trace() << "LightweightIp::ExtCallback: ip lost";
if (connected != infra::none && !stopping)
{
stopping = true;
Expand All @@ -121,6 +130,7 @@ namespace services
}
else
{
services::GlobalTracer().Trace() << "LightweightIp::ExtCallback: connected, with valid ip";
if (!stopping)
{
connected.Emplace(connectedCreator, *this);
Expand All @@ -130,10 +140,16 @@ namespace services
starting = true;
}
}
else
{
services::GlobalTracer().Trace() << "LightweightIp::ExtCallback: 2 : reason 0x" << infra::hex << reason << ", ip " << newIpv4Address;
}
}

void LightweightIp::OnStopped()
{
services::GlobalTracer().Trace() << "LightweightIp::ExtCallback: OnStopped";

connected = infra::none;
stopping = false;

Expand Down
14 changes: 11 additions & 3 deletions services/network/WiFiNetwork.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,18 @@ namespace services
{
case SecurityMode::open:
return "open";
case SecurityMode::wpa2MixedPsk:
return "wpa-2";
case SecurityMode::wep:
return "wep";
case SecurityMode::wpa:
return "wpa";
case SecurityMode::wpa2:
return "wpa2";
case SecurityMode::wpa3Psk:
return "wpa-3";
return "wpa3Psk";
case SecurityMode::wpa2MixedPsk:
return "wpa2MixedPsk";
case SecurityMode::wpa2plus:
return "wpa2plus";
default:
return "unknown";
}
Expand Down
6 changes: 5 additions & 1 deletion services/network/WiFiNetwork.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,12 @@ namespace services
{
unknown = -1,
open = 0,
wep,
wpa,
wpa2,
wpa3Psk,
wpa2MixedPsk,
wpa3Psk
wpa2plus,
};

WiFiSecurity() = default;
Expand Down
20 changes: 10 additions & 10 deletions services/util/ConfigurationStore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,16 +115,16 @@ namespace services

void ConfigurationBlobFlash::VerifyBlock()
{
if (currentVerificationIndex != blob.size())
flash.ReadBuffer(infra::Head(verificationBuffer, blob.size() - currentVerificationIndex), currentVerificationIndex, [this]()
{
auto verificationBlock = infra::Head(verificationBuffer, blob.size() - currentVerificationIndex);
really_assert(infra::ContentsEqual(verificationBlock, infra::Head(infra::DiscardHead(blob, currentVerificationIndex), verificationBuffer.size())));
currentVerificationIndex += verificationBlock.size();
VerifyBlock();
});
else
onDone();
// if (currentVerificationIndex != blob.size())
// flash.ReadBuffer(infra::Head(verificationBuffer, blob.size() - currentVerificationIndex), currentVerificationIndex, [this]()
// {
// auto verificationBlock = infra::Head(verificationBuffer, blob.size() - currentVerificationIndex);
// really_assert(infra::ContentsEqual(verificationBlock, infra::Head(infra::DiscardHead(blob, currentVerificationIndex), verificationBuffer.size())));
// currentVerificationIndex += verificationBlock.size();
// VerifyBlock();
// });
// else
onDone();
}

void ConfigurationBlobFlash::VerifyIfIsErased()
Expand Down
Loading