Ejemplo n.º 1
0
XPCGetProtocol::XPCGetProtocol(int _iProtocol)
{
#ifdef UNIX
        cIteratorFlag = 0;
#endif
#ifdef __linux
        // Retrieves the protocol structure by number
        char buf[1024];

        getprotobynumber_r(_iProtocol,&protocol,
                          buf, sizeof(buf), &protocolPtr);


        //protocolPtr = getprotobynumber_r(_iProtocol);//thread safe fix suggested by Mark Moseley
#else
        // Retrieves the protocol structure by number
        protocolPtr = getprotobynumber(_iProtocol);
#endif
        if (protocolPtr == NULL)
        {
              XPCException exceptObject("Could Not Get Protocol By Number");
              throw exceptObject;
              return;
        }
}
Ejemplo n.º 2
0
XPCGetHostInfo::XPCGetHostInfo(in_addr_t *_netAddr)
{
    if (*_netAddr == INADDR_NONE)
    {
        XPCException exceptObject("Error Getting Host By Address");
        throw exceptObject;
        return;
    }

    hostPtr = gethostbyaddr((char *)_netAddr, sizeof(*_netAddr), AF_INET);
    if (hostPtr == NULL)
    {
        XPCException exceptObject("Error Getting Host By Address");
        throw exceptObject;
        return;
    }
}
Ejemplo n.º 3
0
XPCGetHostInfo::XPCGetHostInfo(const char *_sHost, hostType _type)
{
#ifdef UNIX
    cIteratorFlag = 0;
#endif
    if (_type == NAME)
    {
        // Retrieve host by name
        hostPtr = gethostbyname(_sHost);
        if (hostPtr == NULL)
        {
            XPCException exceptObject("Error Getting Host By Name");
            throw exceptObject;
            return;
        }
    }    
    else if (_type == ADDRESS)
    {
        // Retrieve host by address
        //
        in_addr_t  netAddr = inet_addr(_sHost);
        if (netAddr == INADDR_NONE)
        {
            XPCException exceptObject("Error Getting Host By Address");
            throw exceptObject;
            return;
        }

        hostPtr = gethostbyaddr((char *)&netAddr, sizeof(netAddr), AF_INET);
        if (hostPtr == NULL)
        {
            XPCException exceptObject("Error Getting Host By Address");
            throw exceptObject;
            return;
        }
    }    
    else
    {
        XPCException exceptObject("Parameter Error Constructing XPCGetHostInfo");
        throw exceptObject;    
        return;
    }
}
Ejemplo n.º 4
0
XPCGetProtocol::XPCGetProtocol(const char *_sName)
{
#ifdef UNIX
       cIteratorFlag = 0;
#endif
       // Retrieves the protocol structure by name
       protocolPtr = getprotobyname(_sName);
       if (protocolPtr == NULL)
       {
             XPCException exceptObject("Could Not Get Protocol By Name");
             throw exceptObject;
             return;
        }
}
Ejemplo n.º 5
0
XPCGetProtocol::XPCGetProtocol(int _iProtocol)
{
#ifdef UNIX
        cIteratorFlag = 0;
#endif
        // Retrieves the protocol structure by number
        protocolPtr = getprotobynumber(_iProtocol);
        if (protocolPtr == NULL)
        {
              XPCException exceptObject("Could Not Get Protocol By Number");
              throw exceptObject;
              return;
        }
}