当前位置: 首页>>代码示例>>C++>>正文


C++ xmlrpc_strfree函数代码示例

本文整理汇总了C++中xmlrpc_strfree函数的典型用法代码示例。如果您正苦于以下问题:C++ xmlrpc_strfree函数的具体用法?C++ xmlrpc_strfree怎么用?C++ xmlrpc_strfree使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了xmlrpc_strfree函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: unescapeHostPathQuery

static void
unescapeHostPathQuery(const char *const host,
                      const char *const path,
                      const char *const query,
                      const char **const hostP,
                      const char **const pathP,
                      const char **const queryP,
                      const char **const errorP) {
/*----------------------------------------------------------------------------
   Unescape each of the four components of a URI.

   Each may be NULL, in which case we return NULL.
-----------------------------------------------------------------------------*/
    if (host)
        unescapeUri(host, hostP, errorP);
    else
        *hostP = NULL;
    if (!*errorP) {
        if (path)
            unescapeUri(path, pathP, errorP);
        else
            *pathP = NULL;
        if (!*errorP) {
            if (query)
                unescapeUri(query, queryP, errorP);
            else
                *queryP = NULL;
            if (*errorP)
                xmlrpc_strfree(*pathP);
        } else {
            if (*hostP)
                xmlrpc_strfree(*hostP);
        }
    }
}
开发者ID:arssivka,项目名称:naomech,代码行数:35,代码来源:http.c

示例2: HandleTime

abyss_bool HandleTime(TSession *r)
{
    char z[50];
    time_t ltime;
    TDate date;
    const char * dateString;
    const char * answer;

    if (strcmp(r->uri,"/time")!=0)
        return FALSE;

    if (!RequestAuth(r,"Mot de passe","moez","hello"))
        return TRUE;

    time(&ltime);
    DateFromGMT(&date, ltime);

    DateToString(&date, &dateString);

    xmlrpc_asprintf(&answer, "The time is %s", dateString);

    Answer(r, 200, answer);

    xmlrpc_strfree(dateString);
    xmlrpc_strfree(answer);

    return TRUE;
}
开发者ID:roguehit,项目名称:aos3,代码行数:28,代码来源:main.c

示例3: sendHeader

static void
sendHeader(TConn * const connP,
           TTable  const fields) {
/*----------------------------------------------------------------------------
   Send the HTTP response header whose fields are fields[].

   Don't include the blank line that separates the header from the body.

   fields[] contains syntactically valid HTTP header field names and values.
   But to the extent that int contains undefined field names or semantically
   invalid values, the header we send is invalid.
-----------------------------------------------------------------------------*/
    unsigned int i;

    for (i = 0; i < fields.size; ++i) {
        TTableItem * const fieldP = &fields.item[i];
        const char * const fieldValue = formatFieldValue(fieldP->value);

        const char * line;

        xmlrpc_asprintf(&line, "%s: %s\r\n", fieldP->name, fieldValue);
        ConnWrite(connP, line, strlen(line));
        xmlrpc_strfree(line);
        xmlrpc_strfree(fieldValue);
    }
}
开发者ID:BirminghamConservatoire,项目名称:IntegraLive,代码行数:26,代码来源:response.c

示例4: RequestAuth

bool
RequestAuth(TSession *   const sessionP,
            const char * const credential,
            const char * const user,
            const char * const pass) {
/*----------------------------------------------------------------------------
   Authenticate requester, in a very simplistic fashion.

   If the request executing on session *sessionP specifies basic
   authentication (via Authorization header) with username 'user', password
   'pass', then return TRUE.  Else, return FALSE and set up an authorization
   failure response (HTTP response status 401) that says user must supply an
   identity in the 'credential' domain.

   When we return TRUE, we also set the username in the request info for the
   session to 'user' so that a future SessionGetRequestInfo can get it.
-----------------------------------------------------------------------------*/
    bool authorized;
    char * authHdrPtr;

    authHdrPtr = RequestHeaderValue(sessionP, "authorization");
    if (authHdrPtr) {
        const char * authType;
        NextToken((const char **)&authHdrPtr);
        GetTokenConst(&authHdrPtr, &authType);
        authType = GetToken(&authHdrPtr);
        if (authType) {
            if (xmlrpc_strcaseeq(authType, "basic")) {
                const char * userPass;
                char userPassEncoded[80];

                NextToken((const char **)&authHdrPtr);

                xmlrpc_asprintf(&userPass, "%s:%s", user, pass);
                xmlrpc_base64Encode(userPass, userPassEncoded);
                xmlrpc_strfree(userPass);

                if (xmlrpc_streq(authHdrPtr, userPassEncoded)) {
                    sessionP->requestInfo.user = strdup(user);
                    authorized = TRUE;
                } else
                    authorized = FALSE;
            } else
                authorized = FALSE;
        } else
            authorized = FALSE;
    } else
        authorized = FALSE;

    if (!authorized) {
        const char * hdrValue;
        xmlrpc_asprintf(&hdrValue, "Basic realm=\"%s\"", credential);
        ResponseAddField(sessionP, "WWW-Authenticate", hdrValue);

        xmlrpc_strfree(hdrValue);

        ResponseStatus(sessionP, 401);
    }
    return authorized;
}
开发者ID:BirminghamConservatoire,项目名称:IntegraLive,代码行数:60,代码来源:http.c

示例5: ServerFree

void
ServerFree(TServer * const serverP) {

    struct _TServer * const srvP = serverP->srvP;

    if (srvP->weCreatedListenSocket)
        SocketDestroy(srvP->listenSocketP);

    xmlrpc_strfree(srvP->name);

    xmlrpc_strfree(srvP->filespath);
    
    ListFree(&srvP->defaultfilenames);

    terminateHandlers(&srvP->handlers);

    ListFree(&srvP->handlers);

    logClose(srvP);

    if (srvP->logfilename)
        xmlrpc_strfree(srvP->logfilename);

    free(srvP);
}
开发者ID:BenedictHiddleston,项目名称:xmlrpc-c-1.06.30,代码行数:25,代码来源:server.c

示例6: handleDirectory

static void
handleDirectory(TSession *const sessionP,
                const char *const dirName,
                time_t const fileModTime,
                MIMEType *const mimeTypeP) {

    bool text;
    bool ascending;
    uint16_t sort;    /* 1=by name, 2=by date */
    const char *error;

    determineSortType(sessionP->requestInfo.query,
                      &ascending, &sort, &text, &error);

    if (error) {
        ResponseStatus(sessionP, 400);
        xmlrpc_strfree(error);
    } else if (notRecentlyModified(sessionP, fileModTime)) {
        ResponseStatus(sessionP, 304);
        ResponseWriteStart(sessionP);
    } else {
        TPool pool;
        bool succeeded;
        succeeded = PoolCreate(&pool, 1024);
        if (!succeeded)
            ResponseStatus(sessionP, 500);
        else {
            TList list;
            uint16_t responseStatus;
            const char *error;
            generateListing(&list, dirName, sessionP->requestInfo.uri,
                            &pool, &error, &responseStatus);
            if (error) {
                ResponseStatus(sessionP, responseStatus);
                xmlrpc_strfree(error);
            } else {
                ResponseStatus(sessionP, 200);
                ResponseContentType(sessionP,
                                    text ? "text/plain" : "text/html");

                addLastModifiedHeader(sessionP, fileModTime);

                ResponseChunked(sessionP);
                ResponseWriteStart(sessionP);

                if (sessionP->requestInfo.method != m_head)
                    sendDirectoryDocument(&list, ascending, sort, text,
                                          sessionP->requestInfo.uri, mimeTypeP,
                                          sessionP);

                HTTPWriteEndChunk(sessionP);

                ListFree(&list);
            }
            PoolFree(&pool);
        }
    }
}
开发者ID:arssivka,项目名称:naomech,代码行数:58,代码来源:handler.c

示例7: createServerBare

static void
createServerBare(xmlrpc_env *                      const envP,
                 const xmlrpc_server_abyss_parms * const parmsP,
                 unsigned int                      const parmSize,
                 TServer *                         const serverP,
                 TChanSwitch **                    const chanSwitchPP) {
/*----------------------------------------------------------------------------
   Create a bare server.  It will need further setup before it is ready
   to use.
-----------------------------------------------------------------------------*/
    bool socketBound;
    const struct sockaddr * sockAddrP;
    socklen_t sockAddrLen;
    unsigned int portNumber;
    TOsSocket socketFd;
    const char * logFileName;

    extractServerCreateParms(envP, parmsP, parmSize,
                             &socketBound,
                             &sockAddrP, &sockAddrLen, &portNumber, &socketFd,
                             &logFileName);

    if (!envP->fault_occurred) {
        TChanSwitch * chanSwitchP;

        if (socketBound)
            createChanSwitchOsSocket(envP, socketFd, &chanSwitchP);
        else {
            if (sockAddrP)
                createChanSwitchSockAddr(envP, sockAddrP, sockAddrLen,
                                         &chanSwitchP);
            else
                createChanSwitchIpv4Port(envP, portNumber, &chanSwitchP);
        }
        if (!envP->fault_occurred) {
            const char * error;

            ServerCreateSwitch(serverP, chanSwitchP, &error);

            if (error) {
                xmlrpc_faultf(envP, "Abyss failed to create server.  %s",
                              error);
                xmlrpc_strfree(error);
            } else {
                *chanSwitchPP = chanSwitchP;
                    
                ServerSetName(serverP, "XmlRpcServer");
            
                if (logFileName)
                    ServerSetLogFileName(serverP, logFileName);
            }
            if (envP->fault_occurred)
                ChanSwitchDestroy(chanSwitchP);
        }
        if (logFileName)
            xmlrpc_strfree(logFileName);
    }
}
开发者ID:TekatoD,项目名称:xmlrpc-c,代码行数:58,代码来源:xmlrpc_server_abyss.c

示例8: freeRequestInfo

static void
freeRequestInfo(TRequestInfo * const requestInfoP) {

    if (requestInfoP->requestline)
        xmlrpc_strfree(requestInfoP->requestline);

    if (requestInfoP->user)
        xmlrpc_strfree(requestInfoP->user);
}
开发者ID:4N7HR4X,项目名称:kamailio,代码行数:9,代码来源:abyss_http.c

示例9: unescapeUri

static void
unescapeUri(const char *  const uriComponent,
            const char ** const unescapedP,
            const char ** const errorP) {
/*----------------------------------------------------------------------------
   Unescape a component of a URI, e.g. the host name.  That component may
   have %HH encoding, especially of characters that are delimiters within
   a URI like slash and colon.

   Return the unescaped version as *unescapedP in newly malloced storage.
-----------------------------------------------------------------------------*/
    char * buffer;

    buffer = strdup(uriComponent);

    if (!buffer)
        xmlrpc_asprintf(errorP, "Couldn't get memory for URI unescape buffer");
    else {
        const char * src;
        char * dst;

        src = dst = buffer;
    
        *errorP = NULL;  /* initial value */

        while (*src && !*errorP) {
            switch (*src) {
            case '%': {
                char unescaped;
                const char * error;

                parsePerCentEscape(&src, &unescaped, &error);

                if (error) {
                    xmlrpc_asprintf(errorP,
                                    "Invalid %%HH escape sequence.  %s",
                                    error);
                    xmlrpc_strfree(error);
                } else
                    *dst++ = unescaped;
            } break;

            default:
                *dst++ = *src++;
                break;
            }
        }
        *dst = '\0';

        if (*errorP)
            xmlrpc_strfree(buffer);
        else
            *unescapedP = buffer;
    }
}
开发者ID:BlackPearl01,项目名称:quick-box,代码行数:55,代码来源:http.c

示例10: freeRequestInfo

static void
freeRequestInfo(TRequestInfo * const requestInfoP) {

    xmlrpc_strfreenull(requestInfoP->host);

    xmlrpc_strfreenull(requestInfoP->user);

    xmlrpc_strfree(requestInfoP->uri);

    xmlrpc_strfree(requestInfoP->requestline);
}
开发者ID:BirminghamConservatoire,项目名称:IntegraLive,代码行数:11,代码来源:http.c

示例11: releaseDecomposition

static void
releaseDecomposition(const struct decompTreeNode * const decompRootP,
                     bool                          const oldstyleMemMgmt) {
/*----------------------------------------------------------------------------
   Assuming that Caller has decomposed something according to 'decompRootP',
   release whatever resources the decomposed information occupies.

   E.g. if it's  an XML-RPC string, Caller would have allocated memory
   for the C string that represents the decomposed value of XML-RPC string,
   and we release that memory.
-----------------------------------------------------------------------------*/
    switch (decompRootP->formatSpecChar) {
    case 'i':
    case 'b':
    case 'd':
    case 'n':
    case 'I':
    case 't':
    case 'p':
        /* Nothing was allocated; nothing to release */
        break;
    case '8':
        xmlrpc_strfree(*decompRootP->store.Tdatetime8.valueP);
        break;
    case 's':
        xmlrpc_strfree(*decompRootP->store.Tstring.valueP);
        break;
    case 'w':
        free((void*)*decompRootP->store.TwideString.valueP);
        break;
    case '6':
        free((void*)*decompRootP->store.TbitString.valueP);
        break;
    case 'V':
        xmlrpc_DECREF(*decompRootP->store.Tvalue.valueP);
        break;
    case 'A':
        xmlrpc_DECREF(*decompRootP->store.TarrayVal.valueP);
        break;
    case 'S':
        xmlrpc_DECREF(*decompRootP->store.TstructVal.valueP);
        break;
    case '(':
        releaseDecompArray(decompRootP->store.Tarray, oldstyleMemMgmt);
        break;
    case '{':
        releaseDecompStruct(decompRootP->store.Tstruct, oldstyleMemMgmt);
        break;
    }
}
开发者ID:AbrahamJewowich,项目名称:FreeSWITCH,代码行数:50,代码来源:xmlrpc_decompose.c

示例12: ServerInit2

void
ServerInit2(TServer *     const serverP,
            const char ** const errorP) {
/*----------------------------------------------------------------------------
   Initialize a server to accept connections.

   Do not confuse this with creating the server -- ServerCreate().

   Not necessary or valid with a server that doesn't accept connections (i.e.
   user supplies the channels (TCP connections)).
-----------------------------------------------------------------------------*/
    struct _TServer * const srvP = serverP->srvP;
    
    if (!srvP->serverAcceptsConnections)
        xmlrpc_asprintf(errorP,
                        "ServerInit() is not valid on a server that doesn't "
                        "accept connections "
                        "(i.e. created with ServerCreateNoAccept)");
    else {
        *errorP = NULL;  /* initial value */

        if (!srvP->chanSwitchP) {
            const char * error;
            createChanSwitch(srvP, &error);

            if (error) {
                xmlrpc_asprintf(errorP, "Unable to create a channel switch "
                                "for the server.  %s", error);
                xmlrpc_strfree(error);
            }
        }

        if (!*errorP) {
            const char * error;

            assert(srvP->chanSwitchP);

            ChanSwitchListen(srvP->chanSwitchP, srvP->maxConnBacklog, &error);

            if (error) {
                xmlrpc_asprintf(errorP,
                                "Failed to listen on bound socket.  %s",
                                error);
                xmlrpc_strfree(error);
            }
        }
    }
}
开发者ID:BehnamEmamian,项目名称:openholdembot,代码行数:48,代码来源:server.c

示例13: ServerCreateSocket

abyss_bool
ServerCreateSocket(TServer *    const serverP,
                   const char * const name,
                   TOsSocket    const socketFd,
                   const char * const filesPath,
                   const char * const logFileName) {

    abyss_bool success;
    TSocket * socketP;

    createSocketFromOsSocket(socketFd, &socketP);

    if (socketP) {
        abyss_bool const noAcceptFalse = FALSE;

        const char * error;

        createServer(&serverP->srvP, noAcceptFalse, socketP, 0, &error);

        if (error) {
            TraceMsg(error);
            success = FALSE;
            xmlrpc_strfree(error);
        } else {
            success = TRUE;
            
            setNamePathLog(serverP, name, filesPath, logFileName);
        }
    } else
        success = FALSE;

    return success;
}
开发者ID:BenedictHiddleston,项目名称:xmlrpc-c-1.06.30,代码行数:33,代码来源:server.c

示例14: SessionLog

abyss_bool
SessionLog(TSession * const sessionP) {

    abyss_bool retval;

    if (!sessionP->validRequest)
        retval = FALSE;
    else {
        const char * const user = sessionP->request_info.user;

        const char * logline;
        char date[30];

        DateToLogString(&sessionP->date, date);

        xmlrpc_asprintf(&logline, "%d.%d.%d.%d - %s - [%s] \"%s\" %d %d",
                        IPB1(sessionP->conn->peerip),
                        IPB2(sessionP->conn->peerip),
                        IPB3(sessionP->conn->peerip),
                        IPB4(sessionP->conn->peerip),
                        user ? user : "",
                        date,
                        sessionP->request_info.requestline,
                        sessionP->status,
                        sessionP->conn->outbytes
            );
        if (logline) {
            LogWrite(sessionP->conn->server, logline);

            xmlrpc_strfree(logline);
        }
        retval = TRUE;
    }
    return retval;
}
开发者ID:Distrotech,项目名称:opensips,代码行数:35,代码来源:abyss_session.c

示例15: curlMulti_addHandle

void
curlMulti_addHandle(xmlrpc_env *       const envP,
                    curlMulti *        const curlMultiP,
                    CURL *             const curlSessionP) {

    CURLMcode rc;

    curlMultiP->lockP->acquire(curlMultiP->lockP);

    rc = curl_multi_add_handle(curlMultiP->curlMultiP, curlSessionP);
    
    curlMultiP->lockP->release(curlMultiP->lockP);

    /* Old libcurl (e.g. 7.12) actually returns CURLM_CALL_MULTI_PERFORM
       (by design) when it succeeds.  Current libcurl returns CURLM_OK.
    */

    if (rc != CURLM_OK && rc != CURLM_CALL_MULTI_PERFORM) {
        const char * reason;
        interpretCurlMultiError(&reason, rc);
        xmlrpc_faultf(envP, "Could not add Curl session to the "
                      "curl multi manager.  curl_multi_add_handle() "
                      "failed: %s", reason);
        xmlrpc_strfree(reason);
    }
}
开发者ID:BlackPearl01,项目名称:quick-box,代码行数:26,代码来源:curlmulti.c


注:本文中的xmlrpc_strfree函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。