openbmc/build/tmp/deploy/sdk/witherspoon-2019-08-08/sysroots/armv6-openbmc-linux-gnueabi/usr/src/debug/rsyslog/8.1903.0-r0/rsyslog-8.1903.0/tools/omfwd.c
static rsRetVal TCPSendInit(void* pvData)
{
    DEFiRet;
    wrkrInstanceData_t* pWrkrData = (wrkrInstanceData_t*)pvData;
    instanceData* pData;

    assert(pWrkrData != NULL);
    pData = pWrkrData->pData;

    if (pWrkrData->pNetstrm == NULL)
    {
        dbgprintf("TCPSendInit CREATE\n");
        CHKiRet(netstrms.Construct(&pWrkrData->pNS));
        /* the stream driver must be set before the object is finalized! */
        CHKiRet(netstrms.SetDrvrName(pWrkrData->pNS, pData->pszStrmDrvr));
        CHKiRet(netstrms.ConstructFinalize(pWrkrData->pNS));

        /* now create the actual stream and connect to the server */
        CHKiRet(netstrms.CreateStrm(pWrkrData->pNS, &pWrkrData->pNetstrm));
        CHKiRet(netstrm.ConstructFinalize(pWrkrData->pNetstrm));
        CHKiRet(netstrm.SetDrvrMode(pWrkrData->pNetstrm, pData->iStrmDrvrMode));
        /* now set optional params, but only if they were actually configured */
        if (pData->pszStrmDrvrAuthMode != NULL)
        {
            CHKiRet(netstrm.SetDrvrAuthMode(pWrkrData->pNetstrm,
                                            pData->pszStrmDrvrAuthMode));
        }
        if (pData->pszStrmDrvrPermitExpiredCerts != NULL)
        {
            CHKiRet(netstrm.SetDrvrPermitExpiredCerts(
                pWrkrData->pNetstrm, pData->pszStrmDrvrPermitExpiredCerts));
        }

        if (pData->pPermPeers != NULL)
        {
            CHKiRet(netstrm.SetDrvrPermPeers(pWrkrData->pNetstrm,
                                             pData->pPermPeers));
        }
        /* params set, now connect */
        if (pData->gnutlsPriorityString != NULL)
        {
            CHKiRet(netstrm.SetGnutlsPriorityString(
                pWrkrData->pNetstrm, pData->gnutlsPriorityString));
        }
        CHKiRet(netstrm.Connect(pWrkrData->pNetstrm, glbl.GetDefPFFamily(),
                                (uchar*)pData->port, (uchar*)pData->target,
                                pData->device));

        /* set keep-alive if enabled */
        if (pData->bKeepAlive)
        {
            CHKiRet(netstrm.SetKeepAliveProbes(pWrkrData->pNetstrm,
                                               pData->iKeepAliveProbes));
            CHKiRet(netstrm.SetKeepAliveIntvl(pWrkrData->pNetstrm,
                                              pData->iKeepAliveIntvl));
            CHKiRet(netstrm.SetKeepAliveTime(pWrkrData->pNetstrm,
                                             pData->iKeepAliveTime));
            CHKiRet(netstrm.EnableKeepAlive(pWrkrData->pNetstrm));
        }
    }

finalize_it:
    if (iRet != RS_RET_OK)
    {
        dbgprintf("TCPSendInit FAILED with %d.\n", iRet);
        DestructTCPInstanceData(pWrkrData);
    }

    RETiRet;
}
/* initializes everything so that TCPSend can work.
 * rgerhards, 2007-12-28
 */
initializes everything so that TCPSend can work.
initializes everything so that TCPSend can work .
static rsRetVal TCPSendInit(void* pvData)
{
    DEFiRet;
    wrkrInstanceData_t* pWrkrData = (wrkrInstanceData_t*)pvData;
    instanceData* pData;
    assert(pWrkrData != NULL);
    pData = pWrkrData->pData;
    if (pWrkrData->pNetstrm == NULL)
    {
        dbgprintf("TCPSendInit CREATE\n");
        CHKiRet(netstrms.Construct(&pWrkrData->pNS));
        CHKiRet(netstrms.SetDrvrName(pWrkrData->pNS, pData->pszStrmDrvr));
        CHKiRet(netstrms.ConstructFinalize(pWrkrData->pNS));
        CHKiRet(netstrms.CreateStrm(pWrkrData->pNS, &pWrkrData->pNetstrm));
        CHKiRet(netstrm.ConstructFinalize(pWrkrData->pNetstrm));
        CHKiRet(netstrm.SetDrvrMode(pWrkrData->pNetstrm, pData->iStrmDrvrMode));
        if (pData->pszStrmDrvrAuthMode != NULL)
        {
            CHKiRet(netstrm.SetDrvrAuthMode(pWrkrData->pNetstrm,
                                            pData->pszStrmDrvrAuthMode));
        }
        if (pData->pszStrmDrvrPermitExpiredCerts != NULL)
        {
            CHKiRet(netstrm.SetDrvrPermitExpiredCerts(
                pWrkrData->pNetstrm, pData->pszStrmDrvrPermitExpiredCerts));
        }
        if (pData->pPermPeers != NULL)
        {
            CHKiRet(netstrm.SetDrvrPermPeers(pWrkrData->pNetstrm,
                                             pData->pPermPeers));
        }
        if (pData->gnutlsPriorityString != NULL)
        {
            CHKiRet(netstrm.SetGnutlsPriorityString(
                pWrkrData->pNetstrm, pData->gnutlsPriorityString));
        }
        CHKiRet(netstrm.Connect(pWrkrData->pNetstrm, glbl.GetDefPFFamily(),
                                (uchar*)pData->port, (uchar*)pData->target,
                                pData->device));
        if (pData->bKeepAlive)
        {
            CHKiRet(netstrm.SetKeepAliveProbes(pWrkrData->pNetstrm,
                                               pData->iKeepAliveProbes));
            CHKiRet(netstrm.SetKeepAliveIntvl(pWrkrData->pNetstrm,
                                              pData->iKeepAliveIntvl));
            CHKiRet(netstrm.SetKeepAliveTime(pWrkrData->pNetstrm,
                                             pData->iKeepAliveTime));
            CHKiRet(netstrm.EnableKeepAlive(pWrkrData->pNetstrm));
        }
    }
finalize_it:
    if (iRet != RS_RET_OK)
    {
        dbgprintf("TCPSendInit FAILED with %d.\n", iRet);
        DestructTCPInstanceData(pWrkrData);
    }
    RETiRet;
}
static rsRetVal TCPSendInit ( void * pvData ) { DEFiRet ; wrkrInstanceData_t * pWrkrData = ( wrkrInstanceData_t * ) pvData ; instanceData * pData ; assert ( pWrkrData != NULL ) ; pData = pWrkrData -> pData ; if ( pWrkrData -> pNetstrm == NULL ) { dbgprintf ( " \n " ) ; CHKiRet ( netstrms . Construct ( & pWrkrData -> pNS ) ) ; CHKiRet ( netstrms . SetDrvrName ( pWrkrData -> pNS , pData -> pszStrmDrvr ) ) ; CHKiRet ( netstrms . ConstructFinalize ( pWrkrData -> pNS ) ) ; CHKiRet ( netstrms . CreateStrm ( pWrkrData -> pNS , & pWrkrData -> pNetstrm ) ) ; CHKiRet ( netstrm . ConstructFinalize ( pWrkrData -> pNetstrm ) ) ; CHKiRet ( netstrm . SetDrvrMode ( pWrkrData -> pNetstrm , pData -> iStrmDrvrMode ) ) ; if ( pData -> pszStrmDrvrAuthMode != NULL ) { CHKiRet ( netstrm . SetDrvrAuthMode ( pWrkrData -> pNetstrm , pData -> pszStrmDrvrAuthMode ) ) ; } if ( pData -> pszStrmDrvrPermitExpiredCerts != NULL ) { CHKiRet ( netstrm . SetDrvrPermitExpiredCerts ( pWrkrData -> pNetstrm , pData -> pszStrmDrvrPermitExpiredCerts ) ) ; } if ( pData -> pPermPeers != NULL ) { CHKiRet ( netstrm . SetDrvrPermPeers ( pWrkrData -> pNetstrm , pData -> pPermPeers ) ) ; } if ( pData -> gnutlsPriorityString != NULL ) { CHKiRet ( netstrm . SetGnutlsPriorityString ( pWrkrData -> pNetstrm , pData -> gnutlsPriorityString ) ) ; } CHKiRet ( netstrm . Connect ( pWrkrData -> pNetstrm , glbl . GetDefPFFamily ( ) , ( uchar * ) pData -> port , ( uchar * ) pData -> target , pData -> device ) ) ; if ( pData -> bKeepAlive ) { CHKiRet ( netstrm . SetKeepAliveProbes ( pWrkrData -> pNetstrm , pData -> iKeepAliveProbes ) ) ; CHKiRet ( netstrm . SetKeepAliveIntvl ( pWrkrData -> pNetstrm , pData -> iKeepAliveIntvl ) ) ; CHKiRet ( netstrm . SetKeepAliveTime ( pWrkrData -> pNetstrm , pData -> iKeepAliveTime ) ) ; CHKiRet ( netstrm . EnableKeepAlive ( pWrkrData -> pNetstrm ) ) ; } } finalize_it : if ( iRet != RS_RET_OK ) { dbgprintf ( " \n " , iRet ) ; DestructTCPInstanceData ( pWrkrData ) ; } RETiRet ; }
initializes everything so that TCPSend can work.
initializes everything so that TCPSend can work .
/* the stream driver must be set before the object is finalized! */ /* now create the actual stream and connect to the server */ /* now set optional params, but only if they were actually configured */ /* params set, now connect */ /* set keep-alive if enabled */