Correct and standardize some naming used in the previous commits.
This commit is contained in:
parent
dafc88ed25
commit
6b9d23c6aa
@ -79,7 +79,7 @@
|
||||
/* Using the following defintions, the following socket() arguments should
|
||||
* provide a valid socket in all configurations:
|
||||
*
|
||||
* ret = socket(NETLIB_AF_FAMILY, NETLIB_SOCK_IOCTL, NETLIB_SOCK_PROTOCOL);
|
||||
* ret = socket(NETLIB_SOCK_FAMILY, NETLIB_SOCK_TYPE, NETLIB_SOCK_PROTOCOL);
|
||||
*/
|
||||
|
||||
/* The address family that we used to create the socket really does not
|
||||
@ -87,17 +87,17 @@
|
||||
*/
|
||||
|
||||
#if defined(CONFIG_NET_IPv4)
|
||||
# define NETLIB_AF_FAMILY AF_INET
|
||||
# define NETLIB_SOCK_FAMILY AF_INET
|
||||
#elif defined(CONFIG_NET_IPv6)
|
||||
# define NETLIB_AF_FAMILY AF_INET6
|
||||
# define NETLIB_SOCK_FAMILY AF_INET6
|
||||
#elif defined(CONFIG_NET_LOCAL)
|
||||
# define NETLIB_AF_FAMILY AF_LOCAL
|
||||
# define NETLIB_SOCK_FAMILY AF_LOCAL
|
||||
#elif defined(CONFIG_NET_PKT)
|
||||
# define NETLIB_AF_FAMILY AF_PACKET
|
||||
# define NETLIB_SOCK_FAMILY AF_PACKET
|
||||
#elif defined(CONFIG_NET_IEEE802154)
|
||||
# define NETLIB_AF_FAMILY AF_IEEE802154
|
||||
# define NETLIB_SOCK_FAMILY AF_IEEE802154
|
||||
#elif defined(CONFIG_NET_USRSOCK)
|
||||
# define NETLIB_AF_FAMILY AF_INET
|
||||
# define NETLIB_SOCK_FAMILY AF_INET
|
||||
#endif
|
||||
|
||||
/* Socket protocol of zero normally works */
|
||||
@ -112,36 +112,36 @@
|
||||
* selected address family.
|
||||
*/
|
||||
|
||||
#if NETLIB_AF_FAMILY == AF_INET
|
||||
#if NETLIB_SOCK_FAMILY == AF_INET
|
||||
# if defined(CONFIG_NET_UDP)
|
||||
# define NETLIB_SOCK_IOCTL SOCK_DGRAM
|
||||
# define NETLIB_SOCK_TYPE SOCK_DGRAM
|
||||
# elif defined(CONFIG_NET_TCP)
|
||||
# define NETLIB_SOCK_IOCTL SOCK_STREAM
|
||||
# define NETLIB_SOCK_TYPE SOCK_STREAM
|
||||
# elif defined(CONFIG_NET_ICMP_SOCKET)
|
||||
# define NETLIB_SOCK_IOCTL SOCK_DGRAM
|
||||
# define NETLIB_SOCK_TYPE SOCK_DGRAM
|
||||
# undef NETLIB_SOCK_PROTOCOL
|
||||
# define NETLIB_SOCK_PROTOCOL IPPROTO_ICMP
|
||||
# endif
|
||||
#elif NETLIB_AF_FAMILY == AF_INET6
|
||||
#elif NETLIB_SOCK_FAMILY == AF_INET6
|
||||
# if defined(CONFIG_NET_UDP)
|
||||
# define NETLIB_SOCK_IOCTL SOCK_DGRAM
|
||||
# define NETLIB_SOCK_TYPE SOCK_DGRAM
|
||||
# elif defined(CONFIG_NET_TCP)
|
||||
# define NETLIB_SOCK_IOCTL SOCK_STREAM
|
||||
# define NETLIB_SOCK_TYPE SOCK_STREAM
|
||||
# elif defined(CONFIG_NET_ICMPv6_SOCKET)
|
||||
# define NETLIB_SOCK_IOCTL SOCK_DGRAM
|
||||
# define NETLIB_SOCK_TYPE SOCK_DGRAM
|
||||
# undef NETLIB_SOCK_PROTOCOL
|
||||
# define NETLIB_SOCK_PROTOCOL IPPROTO_ICMP6
|
||||
# endif
|
||||
#elif NETLIB_AF_FAMILY == AF_LOCAL
|
||||
#elif NETLIB_SOCK_FAMILY == AF_LOCAL
|
||||
# if defined(CONFIG_NET_LOCAL_DGRAM)
|
||||
# define NETLIB_SOCK_IOCTL SOCK_DGRAM
|
||||
# define NETLIB_SOCK_TYPE SOCK_DGRAM
|
||||
# elif defined(CONFIG_NET_LOCAL_STREAM)
|
||||
# define NETLIB_SOCK_IOCTL SOCK_STREAM
|
||||
# define NETLIB_SOCK_TYPE SOCK_STREAM
|
||||
# endif
|
||||
#elif NETLIB_AF_FAMILY == AF_PACKET
|
||||
# define NETLIB_SOCK_IOCTL SOCK_RAW
|
||||
#elif NETLIB_AF_FAMILY == AF_IEEE802154
|
||||
# define NETLIB_SOCK_IOCTL SOCK_DGRAM
|
||||
#elif NETLIB_SOCK_FAMILY == AF_PACKET
|
||||
# define NETLIB_SOCK_TYPE SOCK_RAW
|
||||
#elif NETLIB_SOCK_FAMILY == AF_IEEE802154
|
||||
# define NETLIB_SOCK_TYPE SOCK_DGRAM
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -80,7 +80,7 @@ int netlib_icmpv6_autoconfiguration(FAR const char *ifname)
|
||||
{
|
||||
/* Get an IPv6 socket */
|
||||
|
||||
int sockfd = socket(PF_INET6, NETLIB_SOCK_IOCTL, 0);
|
||||
int sockfd = socket(PF_INET6, NETLIB_SOCK_TYPE, 0);
|
||||
if (sockfd >= 0)
|
||||
{
|
||||
/* Create a request consisting only of the interface name */
|
||||
|
@ -78,7 +78,7 @@ int netlib_del_arpmapping(FAR const struct sockaddr_in *inaddr)
|
||||
|
||||
if (inaddr != NULL)
|
||||
{
|
||||
int sockfd = socket(PF_INET, NETLIB_SOCK_IOCTL, 0);
|
||||
int sockfd = socket(PF_INET, NETLIB_SOCK_TYPE, 0);
|
||||
if (sockfd >= 0)
|
||||
{
|
||||
struct arpreq req;
|
||||
|
@ -81,7 +81,7 @@ int netlib_get_arpmapping(FAR const struct sockaddr_in *inaddr,
|
||||
|
||||
if (inaddr != NULL && macaddr != NULL)
|
||||
{
|
||||
int sockfd = socket(PF_INET, NETLIB_SOCK_IOCTL, 0);
|
||||
int sockfd = socket(PF_INET, NETLIB_SOCK_TYPE, 0);
|
||||
if (sockfd >= 0)
|
||||
{
|
||||
struct arpreq req;
|
||||
|
@ -81,7 +81,7 @@ int netlib_get_dripv4addr(FAR const char *ifname, FAR struct in_addr *addr)
|
||||
|
||||
if (ifname && addr)
|
||||
{
|
||||
int sockfd = socket(PF_INET, NETLIB_SOCK_IOCTL, 0);
|
||||
int sockfd = socket(PF_INET, NETLIB_SOCK_TYPE, 0);
|
||||
if (sockfd >= 0)
|
||||
{
|
||||
struct ifreq req;
|
||||
|
@ -104,7 +104,7 @@ int netlib_getessid(FAR const char *ifname, FAR char *essid, size_t idlen)
|
||||
{
|
||||
/* Get a socket (only so that we get access to the INET subsystem) */
|
||||
|
||||
int sockfd = socket(PF_FAMILY, NETLIB_SOCK_IOCTL, 0);
|
||||
int sockfd = socket(PF_FAMILY, NETLIB_SOCK_TYPE, 0);
|
||||
if (sockfd >= 0)
|
||||
{
|
||||
struct iwreq req;
|
||||
|
@ -101,7 +101,7 @@ int netlib_getifstatus(FAR const char *ifname, FAR uint8_t *flags)
|
||||
{
|
||||
/* Get a socket (only so that we get access to the INET subsystem) */
|
||||
|
||||
int sockfd = socket(AF_FAMILY, NETLIB_SOCK_IOCTL, 0);
|
||||
int sockfd = socket(AF_FAMILY, NETLIB_SOCK_TYPE, 0);
|
||||
if (sockfd >= 0)
|
||||
{
|
||||
struct ifreq req;
|
||||
|
@ -81,7 +81,7 @@ int netlib_get_ipv4addr(FAR const char *ifname, FAR struct in_addr *addr)
|
||||
|
||||
if (ifname && addr)
|
||||
{
|
||||
int sockfd = socket(PF_INET, NETLIB_SOCK_IOCTL, 0);
|
||||
int sockfd = socket(PF_INET, NETLIB_SOCK_TYPE, 0);
|
||||
if (sockfd >= 0)
|
||||
{
|
||||
struct ifreq req;
|
||||
|
@ -81,7 +81,7 @@ int netlib_get_ipv4netmask(FAR const char *ifname, FAR struct in_addr *addr)
|
||||
|
||||
if (ifname && addr)
|
||||
{
|
||||
int sockfd = socket(PF_INET, NETLIB_SOCK_IOCTL, 0);
|
||||
int sockfd = socket(PF_INET, NETLIB_SOCK_TYPE, 0);
|
||||
if (sockfd >= 0)
|
||||
{
|
||||
struct ifreq req;
|
||||
|
@ -81,7 +81,7 @@ int netlib_get_ipv6addr(FAR const char *ifname, FAR struct in6_addr *addr)
|
||||
|
||||
if (ifname && addr)
|
||||
{
|
||||
int sockfd = socket(PF_INET6, NETLIB_SOCK_IOCTL, 0);
|
||||
int sockfd = socket(PF_INET6, NETLIB_SOCK_TYPE, 0);
|
||||
if (sockfd >= 0)
|
||||
{
|
||||
struct lifreq req;
|
||||
|
@ -98,7 +98,7 @@ int netlib_getmacaddr(const char *ifname, uint8_t *macaddr)
|
||||
{
|
||||
/* Get a socket (only so that we get access to the INET subsystem) */
|
||||
|
||||
int sockfd = socket(AF_FAMILY, NETLIB_SOCK_IOCTL, 0);
|
||||
int sockfd = socket(AF_FAMILY, NETLIB_SOCK_TYPE, 0);
|
||||
if (sockfd >= 0)
|
||||
{
|
||||
struct ifreq req;
|
||||
|
@ -83,7 +83,7 @@ int netlib_getnodnodeaddr(FAR const char *ifname,
|
||||
{
|
||||
/* Get a socket (only so that we get access to the INET subsystem) */
|
||||
|
||||
int sockfd = socket(PF_INET6, NETLIB_SOCK_IOCTL, 0);
|
||||
int sockfd = socket(PF_INET6, NETLIB_SOCK_TYPE, 0);
|
||||
if (sockfd >= 0)
|
||||
{
|
||||
/* Copy the network interface name */
|
||||
|
@ -83,7 +83,7 @@ int netlib_getpanid(FAR const char *ifname, FAR uint8_t *panid)
|
||||
{
|
||||
/* Get a socket (only so that we get access to the INET subsystem) */
|
||||
|
||||
int sockfd = socket(PF_INET6, NETLIB_SOCK_IOCTL, 0);
|
||||
int sockfd = socket(PF_INET6, NETLIB_SOCK_TYPE, 0);
|
||||
if (sockfd >= 0)
|
||||
{
|
||||
/* Perform the IOCTL */
|
||||
|
@ -83,7 +83,7 @@ int netlib_getproperties(FAR const char *ifname,
|
||||
{
|
||||
/* Get a socket (only so that we get access to the INET subsystem) */
|
||||
|
||||
int sockfd = socket(PF_INET6, NETLIB_SOCK_IOCTL, 0);
|
||||
int sockfd = socket(PF_INET6, NETLIB_SOCK_TYPE, 0);
|
||||
if (sockfd >= 0)
|
||||
{
|
||||
/* Copy the network interface name */
|
||||
|
@ -90,7 +90,7 @@ int ipmsfilter(FAR const char *ifname, FAR const struct in_addr *multiaddr,
|
||||
{
|
||||
/* Get a socket (only so that we get access to the INET subsystem) */
|
||||
|
||||
int sockfd = socket(PF_INET, NETLIB_SOCK_IOCTL, 0);
|
||||
int sockfd = socket(PF_INET, NETLIB_SOCK_TYPE, 0);
|
||||
if (sockfd >= 0)
|
||||
{
|
||||
struct ip_msfilter imsf;
|
||||
|
@ -107,7 +107,7 @@ static int _netlib_ipv4adaptor(in_addr_t destipaddr, FAR in_addr_t *srcipaddr)
|
||||
ifc.ifc_req = NULL;
|
||||
ifc.ifc_len = 0;
|
||||
|
||||
sd = socket(AF_INET, NETLIB_SOCK_IOCTL, 0);
|
||||
sd = socket(AF_INET, NETLIB_SOCK_TYPE, 0);
|
||||
if (sd < 0)
|
||||
{
|
||||
ret = -errno;
|
||||
|
@ -108,7 +108,7 @@ static int _netlib_ipv6adaptor(FAR const struct in6_addr *destipaddr,
|
||||
lifc.lifc_req = NULL;
|
||||
lifc.lifc_len = 0;
|
||||
|
||||
sd = socket(AF_INET6, NETLIB_SOCK_IOCTL, 0);
|
||||
sd = socket(AF_INET6, NETLIB_SOCK_TYPE, 0);
|
||||
if (sd < 0)
|
||||
{
|
||||
ret = -errno;
|
||||
|
@ -81,7 +81,7 @@ int netlib_set_arpmapping(FAR const struct sockaddr_in *inaddr,
|
||||
|
||||
if (inaddr != NULL && macaddr != NULL)
|
||||
{
|
||||
int sockfd = socket(PF_INET, NETLIB_SOCK_IOCTL, 0);
|
||||
int sockfd = socket(PF_INET, NETLIB_SOCK_TYPE, 0);
|
||||
if (sockfd >= 0)
|
||||
{
|
||||
struct arpreq req;
|
||||
|
@ -78,7 +78,7 @@ int netlib_set_dripv4addr(FAR const char *ifname,
|
||||
|
||||
if (ifname && addr)
|
||||
{
|
||||
int sockfd = socket(PF_INET, NETLIB_SOCK_IOCTL, 0);
|
||||
int sockfd = socket(PF_INET, NETLIB_SOCK_TYPE, 0);
|
||||
if (sockfd >= 0)
|
||||
{
|
||||
FAR struct sockaddr_in *inaddr;
|
||||
|
@ -78,7 +78,7 @@ int netlib_set_dripv6addr(FAR const char *ifname,
|
||||
|
||||
if (ifname && addr)
|
||||
{
|
||||
int sockfd = socket(PF_INET6, NETLIB_SOCK_IOCTL, 0);
|
||||
int sockfd = socket(PF_INET6, NETLIB_SOCK_TYPE, 0);
|
||||
if (sockfd >= 0)
|
||||
{
|
||||
FAR struct sockaddr_in6 *inaddr;
|
||||
|
@ -83,7 +83,7 @@ int netlib_seteaddr(FAR const char *ifname, FAR const uint8_t *eaddr)
|
||||
{
|
||||
/* Get a socket (only so that we get access to the INET subsystem) */
|
||||
|
||||
int sockfd = socket(PF_INET6, NETLIB_SOCK_IOCTL, 0);
|
||||
int sockfd = socket(PF_INET6, NETLIB_SOCK_TYPE, 0);
|
||||
if (sockfd >= 0)
|
||||
{
|
||||
/* Perform the IOCTL */
|
||||
|
@ -103,7 +103,7 @@ int netlib_setessid(FAR const char *ifname, FAR const char *essid)
|
||||
{
|
||||
/* Get a socket (only so that we get access to the INET subsystem) */
|
||||
|
||||
int sockfd = socket(PF_FAMILY, NETLIB_SOCK_IOCTL, 0);
|
||||
int sockfd = socket(PF_FAMILY, NETLIB_SOCK_TYPE, 0);
|
||||
if (sockfd >= 0)
|
||||
{
|
||||
struct iwreq req;
|
||||
|
@ -99,7 +99,7 @@ int netlib_ifup(const char *ifname)
|
||||
{
|
||||
/* Get a socket (only so that we get access to the INET subsystem) */
|
||||
|
||||
int sockfd = socket(AF_FAMILY, NETLIB_SOCK_IOCTL, 0);
|
||||
int sockfd = socket(AF_FAMILY, NETLIB_SOCK_TYPE, 0);
|
||||
if (sockfd >= 0)
|
||||
{
|
||||
struct ifreq req;
|
||||
@ -142,7 +142,7 @@ int netlib_ifdown(const char *ifname)
|
||||
{
|
||||
/* Get a socket (only so that we get access to the INET subsystem) */
|
||||
|
||||
int sockfd = socket(AF_FAMILY, NETLIB_SOCK_IOCTL, 0);
|
||||
int sockfd = socket(AF_FAMILY, NETLIB_SOCK_TYPE, 0);
|
||||
if (sockfd >= 0)
|
||||
{
|
||||
struct ifreq req;
|
||||
|
@ -77,7 +77,7 @@ int netlib_set_ipv4addr(FAR const char *ifname, FAR const struct in_addr *addr)
|
||||
|
||||
if (ifname && addr)
|
||||
{
|
||||
int sockfd = socket(PF_INET, NETLIB_SOCK_IOCTL, 0);
|
||||
int sockfd = socket(PF_INET, NETLIB_SOCK_TYPE, 0);
|
||||
if (sockfd >= 0)
|
||||
{
|
||||
FAR struct sockaddr_in *inaddr;
|
||||
|
@ -77,7 +77,7 @@ int netlib_set_ipv4netmask(FAR const char *ifname,
|
||||
|
||||
if (ifname && addr)
|
||||
{
|
||||
int sockfd = socket(PF_INET, NETLIB_SOCK_IOCTL, 0);
|
||||
int sockfd = socket(PF_INET, NETLIB_SOCK_TYPE, 0);
|
||||
if (sockfd >= 0)
|
||||
{
|
||||
FAR struct sockaddr_in *inaddr;
|
||||
|
@ -78,7 +78,7 @@ int netlib_set_ipv6addr(FAR const char *ifname,
|
||||
|
||||
if (ifname && addr)
|
||||
{
|
||||
int sockfd = socket(PF_INET6, NETLIB_SOCK_IOCTL, 0);
|
||||
int sockfd = socket(PF_INET6, NETLIB_SOCK_TYPE, 0);
|
||||
if (sockfd >= 0)
|
||||
{
|
||||
FAR struct sockaddr_in6 *inaddr;
|
||||
|
@ -77,7 +77,7 @@ int netlib_set_ipv6netmask(FAR const char *ifname,
|
||||
|
||||
if (ifname && addr)
|
||||
{
|
||||
int sockfd = socket(PF_INET6, NETLIB_SOCK_IOCTL, 0);
|
||||
int sockfd = socket(PF_INET6, NETLIB_SOCK_TYPE, 0);
|
||||
if (sockfd >= 0)
|
||||
{
|
||||
FAR struct sockaddr_in6 *inaddr;
|
||||
|
@ -105,7 +105,7 @@ int netlib_setmacaddr(const char *ifname, const uint8_t *macaddr)
|
||||
{
|
||||
/* Get a socket (only so that we get access to the INET subsystem) */
|
||||
|
||||
int sockfd = socket(PF_FAMILY, NETLIB_SOCK_IOCTL, 0);
|
||||
int sockfd = socket(PF_FAMILY, NETLIB_SOCK_TYPE, 0);
|
||||
if (sockfd >= 0)
|
||||
{
|
||||
struct ifreq req;
|
||||
|
@ -83,7 +83,7 @@ int netlib_setnodeaddr(FAR const char *ifname,
|
||||
{
|
||||
/* Get a socket (only so that we get access to the INET subsystem) */
|
||||
|
||||
int sockfd = socket(PF_INET6, NETLIB_SOCK_IOCTL, 0);
|
||||
int sockfd = socket(PF_INET6, NETLIB_SOCK_TYPE, 0);
|
||||
if (sockfd >= 0)
|
||||
{
|
||||
/* Copy the network interface name */
|
||||
|
Loading…
Reference in New Issue
Block a user