#ifndef WIN32
#include <unistd.h>
#endif
-#include "mcast.h"
#ifndef WIN32
#include <poll.h>
#endif
#include <switch_utils.h>
+#include "mcast.h"
+
int mcast_socket_create(const char *host, int16_t port, mcast_handle_t *handle, mcast_flag_t flags)
{
handle->send_addr.sin_addr.s_addr = inet_addr(host);
handle->send_addr.sin_port = htons(port);
- if ( setsockopt(handle->sock, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one)) != 0 ) {
+ if ( setsockopt(handle->sock, SOL_SOCKET, SO_REUSEADDR, (void *)&one, sizeof(one)) != 0 ) {
close(handle->sock);
return -1;
}
mreq.imr_multiaddr.s_addr = inet_addr(host);
mreq.imr_interface.s_addr = htonl(INADDR_ANY);
- if (setsockopt(handle->sock, IPPROTO_IP, IP_ADD_MEMBERSHIP, &mreq, sizeof(mreq)) < 0) {
+ if (setsockopt(handle->sock, IPPROTO_IP, IP_ADD_MEMBERSHIP, (void *)&mreq, sizeof(mreq)) < 0) {
close(handle->sock);
handle->sock = -1;
return -1;
handle->ttl = 255;
}
- if ( setsockopt(handle->sock, IPPROTO_IP, IP_MULTICAST_TTL, &handle->ttl, sizeof(handle->ttl)) != 0 ) {
+ if ( setsockopt(handle->sock, IPPROTO_IP, IP_MULTICAST_TTL, (void *)&handle->ttl, sizeof(handle->ttl)) != 0 ) {
return -1;
}
!strncmp(request.content_type, "application/x-www-form-urlencoded", 33)) {
char *buffer = NULL;
- int len = 0, bytes = 0;
+ switch_size_t len = 0, bytes = 0;
if (request.content_length > 2 * 1024 * 1024 - 1) {
char *data = "HTTP/1.1 413 Request Entity Too Large\r\n"
return -1;
}
-static ws_socket_t prepare_socket(int ip, int port)
+static ws_socket_t prepare_socket(int ip, uint16_t port)
{
ws_socket_t sock = ws_sock_invalid;
#ifndef WIN32
}
if (pfds[x].revents & SWITCH_POLL_READ) {
- if (profile->mcast_ip && pfds[x].sock == profile->mcast_sub.sock) {
+ if (profile->mcast_ip && pfds[x].sock == (switch_os_socket_t)profile->mcast_sub.sock) {
handle_mcast_sub(profile);
} else {
start_jsock(profile, pfds[x].sock);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Done\n");
}
-static void parse_ip(char *host, int *port, in_addr_t *addr, char *input)
+static void parse_ip(char *host, uint16_t *port, in_addr_t *addr, char *input)
{
char *p;
struct hostent *hent;
if ((p = strchr(host, ':')) != NULL) {
*p++ = '\0';
- *port = atoi(p);
+ *port = (uint16_t)atoi(p);
}
if ( host[0] < '0' || host[0] > '9' ) {