60#define lwip_xchar(i) ((char)((i) < 10 ? '0' + (i) : 'A' + (i) - 10))
72ip6addr_aton(
const char *
cp, ip6_addr_t *
addr)
77 int check_ipv4_mapped = 0;
83 for (
s =
cp; *
s != 0;
s++) {
87 }
else if (*
s ==
'.') {
89 check_ipv4_mapped = 1;
105 current_block_index = 0;
106 current_block_value = 0;
107 for (
s =
cp; *
s != 0;
s++) {
110 if (current_block_index & 0x1) {
111 addr->addr[addr_index++] |= current_block_value;
114 addr->addr[addr_index] = current_block_value << 16;
117 current_block_index++;
119 if (check_ipv4_mapped) {
120 if (current_block_index == 6) {
122 int ret = ip4addr_aton(
s + 1, &ip4);
126 current_block_index++;
127 goto fix_byte_order_and_return;
134 current_block_value = 0;
135 if (current_block_index > 7) {
148 if (current_block_index & 0x1) {
152 addr->addr[addr_index] = 0;
155 current_block_index++;
156 if (current_block_index > 7) {
164 current_block_value = (current_block_value << 4) +
174 if (current_block_index & 0x1) {
175 addr->addr[addr_index++] |= current_block_value;
178 addr->addr[addr_index] = current_block_value << 16;
181fix_byte_order_and_return:
184 for (addr_index = 0; addr_index < 4; addr_index++) {
188 ip6_addr_clear_zone(
addr);
191 const char *scopestr =
s + 1;
195 ip6_addr_assign_zone(
addr, IP6_UNKNOWN,
netif);
202 if (current_block_index != 7) {
218ip6addr_ntoa(
const ip6_addr_t *
addr)
221 return ip6addr_ntoa_r(
addr,
str, 40);
234ip6addr_ntoa_r(
const ip6_addr_t *
addr,
char *
buf,
int buflen)
236 u32_t current_block_index, current_block_value, next_block_value;
238 u8_t zero_flag, empty_block_flag;
241 if (ip6_addr_isipv4mappedipv6(
addr)) {
245#define IP4MAPPED_HEADER "::FFFF:"
246 char *buf_ip4 =
buf +
sizeof(IP4MAPPED_HEADER) - 1;
247 int buflen_ip4 = buflen -
sizeof(IP4MAPPED_HEADER) + 1;
248 if (buflen < (
int)
sizeof(IP4MAPPED_HEADER)) {
251 memcpy(
buf, IP4MAPPED_HEADER,
sizeof(IP4MAPPED_HEADER));
252 addr4.addr =
addr->addr[3];
253 ret = ip4addr_ntoa_r(&addr4, buf_ip4, buflen_ip4);
254 if (
ret != buf_ip4) {
261 empty_block_flag = 0;
263 for (current_block_index = 0; current_block_index < 8; current_block_index++) {
265 current_block_value =
lwip_htonl(
addr->addr[current_block_index >> 1]);
266 if ((current_block_index & 0x1) == 0) {
267 current_block_value = current_block_value >> 16;
269 current_block_value &= 0xffff;
272 if (current_block_value == 0) {
273 if (current_block_index == 7 && empty_block_flag == 1) {
281 if (empty_block_flag == 0) {
284 next_block_value =
lwip_htonl(
addr->addr[(current_block_index + 1) >> 1]);
285 if ((current_block_index & 0x1) == 0x01) {
286 next_block_value = next_block_value >> 16;
288 next_block_value &= 0xffff;
289 if (next_block_value == 0) {
290 empty_block_flag = 1;
297 }
else if (empty_block_flag == 1) {
301 }
else if (empty_block_flag == 1) {
303 empty_block_flag = 2;
306 if (current_block_index > 0) {
313 if ((current_block_value & 0xf000) == 0) {
316 buf[
i++] = lwip_xchar(((current_block_value & 0xf000) >> 12));
323 if (((current_block_value & 0xf00) == 0) && (zero_flag)) {
326 buf[
i++] = lwip_xchar(((current_block_value & 0xf00) >> 8));
333 if (((current_block_value & 0xf0) == 0) && (zero_flag)) {
337 buf[
i++] = lwip_xchar(((current_block_value & 0xf0) >> 4));
344 buf[
i++] = lwip_xchar((current_block_value & 0xf));
bool zero_blocks(PEXT2_FILESYS fs, ULONG blk, ULONG num, ULONG *ret_blk, ULONG *ret_count)
GLenum GLuint GLenum GLsizei const GLchar * buf
GLenum const GLvoid * addr
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
struct netif * netif_find(const char *name)
#define IPADDR6_INIT(a, b, c, d)
#define memcpy(s1, s2, n)