[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lwip-devel] [task #14314] Implement interface name/index APIs
From: |
Joel Cunningham |
Subject: |
[lwip-devel] [task #14314] Implement interface name/index APIs |
Date: |
Wed, 1 Feb 2017 15:04:08 +0000 (UTC) |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/602.4.8 (KHTML, like Gecko) Version/10.0.3 Safari/602.4.8 |
Follow-up Comment #35, task #14314 (project lwip):
> It seems to break the clean separation between APIs:
> - core should not include 'api' header files (thus netif.c should not
include if.h and cannot access IF_NAMESIZE
I could move the define to netif.h or add a new define like NETIF_NAMESIZE (in
netif.h) which is the canonical definition and then #define IF_NAMESIZE to it
in if.h
> - the fact that an 'index' is 1-based and 0 is invalid is an RFC3493
definition. To me, the API provided by netif.h would better work on 'num' only
and the conversion +/-1 to index should be done in if.c?
I put the main implementation of the index/name conversion in the netif APIs
because David talked about needing to use the APIs from raw/core code and not
the high level sockets API
> - same thing for netif name conversion, but this is a bit more strange as
'index_to_name' returns a long name but 'name_to_index' only checks the first
2 chars.
> --> The netif.h/.c functions should use 'num' instead of 'index' (do we need
an 'invalud num' then?) and we might need to increase the size of struct
netif's 'name' field to make index->name->index check the name correctly.
I'm not sure if I follow this completely. netif_name_to_index relies on
netif_find() to compare the input name to the netif name. This function
handles comparing the 2 chars and num. In netif_index_to_name, we compare the
index, then output the 2 chars and number. IFNAMESZ is defined to exactly fit
LwIP's name size which is 2 characters and a number (up to 3 digits, max of
255). I didn't see a reason to increase the name storage in the netif
structure to also include a string version of the num. Is that what you were
suggesting?
_______________________________________________________
Reply to this item at:
<http://savannah.nongnu.org/task/?14314>
_______________________________________________
Message sent via/by Savannah
http://savannah.nongnu.org/
- [lwip-devel] [task #14314] Implement interface name/index APIs, Dirk Ziegelmeier, 2017/02/01
- [lwip-devel] [task #14314] Implement interface name/index APIs, Simon Goldschmidt, 2017/02/01
- [lwip-devel] [task #14314] Implement interface name/index APIs, Dirk Ziegelmeier, 2017/02/01
- [lwip-devel] [task #14314] Implement interface name/index APIs, David van Moolenbroek, 2017/02/01
- [lwip-devel] [task #14314] Implement interface name/index APIs, David van Moolenbroek, 2017/02/01
- [lwip-devel] [task #14314] Implement interface name/index APIs, Simon Goldschmidt, 2017/02/01
- [lwip-devel] [task #14314] Implement interface name/index APIs, David van Moolenbroek, 2017/02/01
- [lwip-devel] [task #14314] Implement interface name/index APIs,
Joel Cunningham <=
- [lwip-devel] [task #14314] Implement interface name/index APIs, Joel Cunningham, 2017/02/02
- [lwip-devel] [task #14314] Implement interface name/index APIs, Simon Goldschmidt, 2017/02/03
- [lwip-devel] [task #14314] Implement interface name/index APIs, Joel Cunningham, 2017/02/03
- [lwip-devel] [task #14314] Implement interface name/index APIs, Joel Cunningham, 2017/02/03
- [lwip-devel] [task #14314] Implement interface name/index APIs, Simon Goldschmidt, 2017/02/03
- [lwip-devel] [task #14314] Implement interface name/index APIs, Joel Cunningham, 2017/02/03
- [lwip-devel] [task #14314] Implement interface name/index APIs, Joel Cunningham, 2017/02/03
- [lwip-devel] [task #14314] Implement interface name/index APIs, Dirk Ziegelmeier, 2017/02/05
- [lwip-devel] [task #14314] Implement interface name/index APIs, Simon Goldschmidt, 2017/02/09
- [lwip-devel] [task #14314] Implement interface name/index APIs, Joel Cunningham, 2017/02/09