FreeRTOS console and io devices support for compile
git-svn-id: svn://db.shs.com.ru/pip@688 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
@@ -56,11 +56,14 @@
|
||||
# include <netinet/in.h>
|
||||
# include <arpa/inet.h>
|
||||
# include <sys/socket.h>
|
||||
# include <net/if.h>
|
||||
# include <netdb.h>
|
||||
# ifndef ANDROID
|
||||
# include <net/if.h>
|
||||
# if !defined(ANDROID) && !defined(FREERTOS)
|
||||
# include <ifaddrs.h>
|
||||
# endif
|
||||
# ifdef FREERTOS
|
||||
# include <lwip/sockets.h>
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
#include <errno.h>
|
||||
@@ -478,7 +481,11 @@ bool PIEthernet::joinMulticastGroup(const PIString & group) {
|
||||
//if (!params[Broadcast])
|
||||
//;piCoutObj << "Warning: \"Broadcast\" parameter not set, \"joinMulticastGroup(\"" << group << "\")\" may be useless!";
|
||||
addr_r.set(path());
|
||||
#ifndef FREERTOS
|
||||
struct ip_mreqn mreq;
|
||||
#else
|
||||
struct ip_mreq mreq;
|
||||
#endif
|
||||
memset(&mreq, 0, sizeof(mreq));
|
||||
#ifdef LINUX
|
||||
//mreq.imr_address.s_addr = INADDR_ANY;
|
||||
@@ -486,8 +493,19 @@ bool PIEthernet::joinMulticastGroup(const PIString & group) {
|
||||
const PIEthernet::Interface * ci = il.getByAddress(addr_r.ipString());
|
||||
if (ci != 0) mreq.imr_ifindex = ci->index;*/
|
||||
#endif
|
||||
if (params[PIEthernet::Broadcast]) mreq.imr_address.s_addr = INADDR_ANY;
|
||||
else mreq.imr_address.s_addr = addr_r.ip();
|
||||
if (params[PIEthernet::Broadcast])
|
||||
#ifndef FREERTOS
|
||||
mreq.imr_address.s_addr = INADDR_ANY;
|
||||
#else
|
||||
mreq.imr_interface.s_addr = INADDR_ANY;
|
||||
#endif
|
||||
else
|
||||
#ifndef FREERTOS
|
||||
mreq.imr_address.s_addr = addr_r.ip();
|
||||
#else
|
||||
mreq.imr_interface.s_addr = addr_r.ip();
|
||||
#endif
|
||||
|
||||
/*#ifndef WINDOWS
|
||||
PIEthernet::InterfaceList il = interfaces();
|
||||
const PIEthernet::Interface * ci = il.getByAddress(ip_);
|
||||
@@ -529,10 +547,24 @@ bool PIEthernet::leaveMulticastGroup(const PIString & group) {
|
||||
}
|
||||
PIFlags<Parameters> params = parameters();
|
||||
addr_r.set(path());
|
||||
#ifndef FREERTOS
|
||||
struct ip_mreqn mreq;
|
||||
#else
|
||||
struct ip_mreq mreq;
|
||||
#endif
|
||||
memset(&mreq, 0, sizeof(mreq));
|
||||
if (params[PIEthernet::Broadcast]) mreq.imr_address.s_addr = INADDR_ANY;
|
||||
else mreq.imr_address.s_addr = addr_r.ip();
|
||||
if (params[PIEthernet::Broadcast])
|
||||
#ifndef FREERTOS
|
||||
mreq.imr_address.s_addr = INADDR_ANY;
|
||||
#else
|
||||
mreq.imr_interface.s_addr = INADDR_ANY;
|
||||
#endif
|
||||
else
|
||||
#ifndef FREERTOS
|
||||
mreq.imr_address.s_addr = addr_r.ip();
|
||||
#else
|
||||
mreq.imr_interface.s_addr = addr_r.ip();
|
||||
#endif
|
||||
mreq.imr_multiaddr.s_addr = inet_addr(group.dataAscii());
|
||||
if (ethSetsockopt(sock, IPPROTO_IP, IP_DROP_MEMBERSHIP, &mreq, sizeof(mreq)) == -1) {
|
||||
piCoutObj << "Can`t leave multicast group" << group << "," << ethErrorString();
|
||||
@@ -1023,6 +1055,8 @@ PIEthernet::InterfaceList PIEthernet::interfaces() {
|
||||
if (pAdapterInfo)
|
||||
HeapFree(GetProcessHeap(), 0, (pAdapterInfo));
|
||||
#else
|
||||
#ifdef FREERTOS
|
||||
#else
|
||||
/*# ifdef QNX
|
||||
PIStringList il, sl;
|
||||
PIProcess proc;
|
||||
@@ -1157,14 +1191,15 @@ PIEthernet::InterfaceList PIEthernet::interfaces() {
|
||||
piCout << "[PIEthernet] Can`t get interfaces:" << errorString();
|
||||
if (s != -1) ::close(s);
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
return il;
|
||||
}
|
||||
|
||||
|
||||
PIEthernet::Address PIEthernet::interfaceAddress(const PIString & interface_) {
|
||||
#ifdef WINDOWS
|
||||
piCout << "[PIEthernet] Not implemented on Windows, use \"PIEthernet::allAddresses\" or \"PIEthernet::interfaces\" instead";
|
||||
#if defined(WINDOWS) || defined(FREERTOS)
|
||||
piCout << "[PIEthernet] Not implemented, use \"PIEthernet::allAddresses\" or \"PIEthernet::interfaces\" instead";
|
||||
return Address();
|
||||
#else
|
||||
struct ifreq ifr;
|
||||
|
||||
Reference in New Issue
Block a user