Prusa MINI Firmware overview
def.c File Reference
#include "lwip/opt.h"
#include "lwip/def.h"
#include <string.h>

Functions

u16_t lwip_htons (u16_t n)
 
u32_t lwip_htonl (u32_t n)
 
char * lwip_strnstr (const char *buffer, const char *token, size_t n)
 
int lwip_stricmp (const char *str1, const char *str2)
 
int lwip_strnicmp (const char *str1, const char *str2, size_t len)
 
void lwip_itoa (char *result, size_t bufsize, int number)
 

Detailed Description

Common functions used throughout the stack.

These are reference implementations of the byte swapping functions. Again with the aim of being simple, correct and fully portable. Byte swapping is the second thing you would want to optimize. You will need to port it to your architecture and in your cc.h:

#define lwip_htons(x) your_htons #define lwip_htonl(x) your_htonl

Note lwip_ntohs() and lwip_ntohl() are merely references to the htonx counterparts.

If you #define them to htons() and htonl(), you should #define LWIP_DONT_PROVIDE_BYTEORDER_FUNCTIONS to prevent lwIP from defining htonx/ntohx compatibility macros.

Function Documentation

◆ lwip_htons()

u16_t lwip_htons ( u16_t  n)

Convert an u16_t from host- to network byte order.

Parameters
nu16_t in host byte order
Returns
n in network byte order
77 {
78  return (u16_t)PP_HTONS(n);
79 }
Here is the caller graph for this function:

◆ lwip_htonl()

u32_t lwip_htonl ( u32_t  n)

Convert an u32_t from host- to network byte order.

Parameters
nu32_t in host byte order
Returns
n in network byte order
91 {
92  return (u32_t)PP_HTONL(n);
93 }
u16_t
uint16_t u16_t
Definition: arch.h:121
u32_t
uint32_t u32_t
Definition: arch.h:123
PP_HTONL
#define PP_HTONL(x)
Definition: def.h:81
PP_HTONS
#define PP_HTONS(x)
Definition: def.h:79