static struct in_addr IPv4MulticastAddress = { 0 };
#define IPv6_DOMAINS 16
-#define IPv6_MULTICAST_INT "ff01::fd"
+#define IPv6_MULTICAST_INT "ff01::158"
static struct in6_addr IPv6MulticastAddressInt;
-#define IPv6_MULTICAST_LNK "ff02::fd"
+#define IPv6_MULTICAST_LNK "ff02::158"
static struct in6_addr IPv6MulticastAddressLnk;
-#define IPv6_MULTICAST_RLM "ff03::fd"
+#define IPv6_MULTICAST_RLM "ff03::158"
static struct in6_addr IPv6MulticastAddressRlm;
-#define IPv6_MULTICAST_ADM "ff04::fd"
+#define IPv6_MULTICAST_ADM "ff04::158"
static struct in6_addr IPv6MulticastAddressAdm;
-#define IPv6_MULTICAST_SIT "ff05::fd"
+#define IPv6_MULTICAST_SIT "ff05::158"
static struct in6_addr IPv6MulticastAddressSit;
-#define IPv6_MULTICAST_ORG "ff08::fd"
+#define IPv6_MULTICAST_ORG "ff08::158"
static struct in6_addr IPv6MulticastAddressOrg;
-#define IPv6_MULTICAST_GLB "ff0e::fd"
+#define IPv6_MULTICAST_GLB "ff0e::158"
static struct in6_addr IPv6MulticastAddressGlb;
static char *ipv6mcnames[IPv6_DOMAINS] = {
PUSH_IP_SOCKET(m4, eventArray, socketArray, arraySize);
PUSH_IP_SOCKET(m4s, eventArray, socketArray, arraySize);
- if (-1 != caglobals.ip.shutdownEvent)
+ if (WSA_INVALID_EVENT != caglobals.ip.shutdownEvent)
{
INSERT_SOCKET(OC_INVALID_SOCKET, socketArray, arraySize);
PUSH_HANDLE(caglobals.ip.shutdownEvent, eventArray, arraySize);
}
// Break out if shutdownEvent is triggered
- if ((caglobals.ip.shutdownEvent != -1) &&
+ if ((caglobals.ip.shutdownEvent != WSA_INVALID_EVENT) &&
(caglobals.ip.shutdownEvent == eventArray[eventIndex]))
{
break;
if (caglobals.ip.terminate)
{
- caglobals.ip.shutdownEvent = -1;
+ caglobals.ip.shutdownEvent = WSA_INVALID_EVENT;
WSACleanup();
}
}
static CAResult_t CAReceiveMessage(CASocketFd_t fd, CATransportFlags_t flags)
{
- char recvBuffer[COAP_MAX_PDU_SIZE];
+ char recvBuffer[COAP_MAX_PDU_SIZE] = {0};
- size_t len;
- int level, type, namelen;
- struct sockaddr_storage srcAddr;
+ size_t len = 0;
+ int level = 0;
+ int type = 0;
+ int namelen = 0;
+ struct sockaddr_storage srcAddr = { .ss_family = 0 };
unsigned char *pktinfo = NULL;
#if !defined(WSA_CMSG_DATA)
struct cmsghdr *cmp = NULL;
}
WSABUF iov = {.len = sizeof (recvBuffer), .buf = recvBuffer};
- WSAMSG msg = {.name = &srcAddr,
+ WSAMSG msg = {.name = (PSOCKADDR)&srcAddr,
.namelen = namelen,
.lpBuffers = &iov,
.dwBufferCount = 1,
}
#endif
struct sockaddr_storage sa = { .ss_family = family };
- socklen_t socklen;
+ socklen_t socklen = 0;
if (family == AF_INET6)
{
caglobals.ip.selectTimeout = -1; // don't poll for shutdown
int ret = -1;
#if defined(WSA_WAIT_EVENT_0)
- caglobals.ip.shutdownEvent = -1;
caglobals.ip.shutdownEvent = WSACreateEvent();
-
- if (caglobals.ip.shutdownEvent == WSA_INVALID_EVENT)
- {
- caglobals.ip.shutdownEvent = -1;
- }
- else
+ if (WSA_INVALID_EVENT != caglobals.ip.shutdownEvent)
{
ret = 0;
}
(void)cast; // eliminates release warning
(void)fam;
- struct sockaddr_storage sock;
+ struct sockaddr_storage sock = { .ss_family = 0 };
CAConvertNameToAddr(endpoint->addr, endpoint->port, &sock);
- socklen_t socklen;
+ socklen_t socklen = 0;
if (sock.ss_family == AF_INET6)
{
/** @todo figure out correct usage for ifindex, and sin6_scope_id */
{
eps[j].flags = CA_IPV4;
eps[j].port = caglobals.ip.u4.port;
- /** @todo eps[j].addr not populated with IPv4 address string.
- * it was using ifitem->ipv4addr to accomplish this.
- * Need to understand what ipv4addr means to whom*/
}
+ OICStrcpy(eps[j].addr, sizeof(eps[j].addr), ifitem->addr);
#ifdef __WITH_DTLS__
j++;
{
eps[j].flags = CA_IPV4 | CA_SECURE;
eps[j].port = caglobals.ip.u4s.port;
- inet_ntop(AF_INET, &(ifitem->ipv4addr), eps[j].addr, MAX_ADDR_STR_SIZE_CA);
}
+ OICStrcpy(eps[j].addr, sizeof(eps[j].addr), ifitem->addr);
#endif
j++;
}
*info = eps;
- *size = len;
+ *size = length;
u_arraylist_destroy(iflist);