⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ospxmlparse.c

📁 radius协议源码÷The Radius Stack will connect to a Radius Server. This stack implementation is built upo
💻 C
📖 第 1 页 / 共 5 页
字号:
                    ospvEncoding);            }            else if (isEntityDecl)            {                ospvErrCode = OSPPXMLDocSkipEntityDecl(ospvBfrAddr,                    ospvEncoding);            }            else            {                /*                 * We didn't find any of the special items, so read                 * the next character. It might be the end of our                 * markup declaration. Of course, it could be a                 * a PEReference, in which case we'll just keep                 * going.                 */                ospvErrCode = OSPPXMLDocReadChar(ospvBfrAddr, ospvEncoding,                    &readChar);                if (ospvErrCode == OSPC_ERR_NO_ERROR)                {                    if (readChar == OSPC_XMLDOC_MARKUPDECLCLOSE)                    {                        /* we've finally reached the end; break the loop */                        break;                    }                }            }        }    }    return(ospvErrCode);}/**//*-----------------------------------------------------------------------* * OSPPXMLDocSkipDecl() - skip XML declaration (if present) *-----------------------------------------------------------------------*/unsigned                          /* returns error code */OSPPXMLDocSkipDecl(    OSPTBFR    **ospvBfrAddr,     /* buffer containing document */    OSPTXMLENC   ospvEncoding     /* character encoding for the document */){    unsigned            ospvErrCode = OSPC_ERR_NO_ERROR;    const unsigned char tag[] = { OSPC_XMLDOC_DECLEND };    unsigned char       scratch[OSPC_XMLDOC_DECLENDLEN+1];    unsigned            isDecl = OSPC_FALSE;    if (ospvBfrAddr  == OSPC_OSNULL)    {        ospvErrCode = OSPC_ERR_BUF_EMPTY;    }    if (*ospvBfrAddr == OSPC_OSNULL)    {        ospvErrCode = OSPC_ERR_BUF_EMPTY;    }    if (ospvEncoding == ospeXMLEncUnknown)    {        ospvErrCode = OSPC_ERR_XML_BAD_ENC;    }    /*     * The first thing we do is look for the beginning of an XML     * declaration. If there's not one, we don't have any work to do.     */    if (ospvErrCode == OSPC_ERR_NO_ERROR)    {        ospvErrCode = OSPPXMLDocIsDecl(ospvBfrAddr, ospvEncoding, &isDecl);    }    if ((ospvErrCode == OSPC_ERR_NO_ERROR) && isDecl)    {        /*         * Yes, we've found a comment. Now we just read through         * the buffer until we've found the closing tag. Note         * that we don't have to explicitly read the opening         * tag (we've only "peeked" it so far) since the         * closing tag does not appear in the opening tag.         */        ospvErrCode = OSPPXMLDocSkipPast(ospvBfrAddr, ospvEncoding,            tag, scratch);    }    return(ospvErrCode);}/**//*-----------------------------------------------------------------------* * OSPPXMLDocSkipComment() - skip XML comment (if present) *-----------------------------------------------------------------------*/unsigned                          /* returns error code */OSPPXMLDocSkipComment(    OSPTBFR    **ospvBfrAddr,     /* buffer containing document */    OSPTXMLENC   ospvEncoding     /* character encoding for the document */){    unsigned            ospvErrCode = OSPC_ERR_NO_ERROR;    const unsigned char tag[] = { OSPC_XMLDOC_COMMENTEND };    unsigned char       scratch[OSPC_XMLDOC_COMMENTENDLEN+1];    unsigned            isComment = OSPC_FALSE;    if (ospvBfrAddr  == OSPC_OSNULL)    {        ospvErrCode = OSPC_ERR_BUF_EMPTY;    }    if (*ospvBfrAddr == OSPC_OSNULL)    {        ospvErrCode = OSPC_ERR_BUF_EMPTY;    }    if (ospvEncoding == ospeXMLEncUnknown)    {        ospvErrCode = OSPC_ERR_XML_BAD_ENC;    }    /*     * The first thing we do is look for the beginning of an XML     * comment. If there's not one, we don't have any work to do.     */    if (ospvErrCode == OSPC_ERR_NO_ERROR)    {        ospvErrCode = OSPPXMLDocIsComment(ospvBfrAddr, ospvEncoding,            &isComment);    }    if ((ospvErrCode == OSPC_ERR_NO_ERROR) && isComment)    {        /*         * Yes, we've found a comment. Now we just read through         * the buffer until we've found the closing tag. Note         * that we don't have to explicitly read the opening         * tag (we've only "peeked" it so far) since the         * closing tag does not appear in the opening tag.         */        ospvErrCode = OSPPXMLDocSkipPast(ospvBfrAddr, ospvEncoding, tag,            scratch);    }    return(ospvErrCode);}/**//*-----------------------------------------------------------------------* * OSPPXMLDocSkipPI() - skip XML processing instruction (if present) *-----------------------------------------------------------------------*/unsigned                          /* returns error code */OSPPXMLDocSkipPI(    OSPTBFR    **ospvBfrAddr,     /* buffer containing document */    OSPTXMLENC   ospvEncoding     /* character encoding for the document */){    unsigned            ospvErrCode = OSPC_ERR_NO_ERROR;    const unsigned char tag[] = { OSPC_XMLDOC_PIEND };    unsigned char       scratch[OSPC_XMLDOC_PIENDLEN+1];    unsigned            isPI = OSPC_FALSE;    if (ospvBfrAddr  == OSPC_OSNULL)    {        ospvErrCode = OSPC_ERR_BUF_EMPTY;    }    if (*ospvBfrAddr == OSPC_OSNULL)    {        ospvErrCode = OSPC_ERR_BUF_EMPTY;    }    if (ospvEncoding == ospeXMLEncUnknown)    {        ospvErrCode = OSPC_ERR_XML_BAD_ENC;    }    /*     * The first thing we do is look for the beginning of an XML     * processing instruction. If there's not one, we don't have     * any work to do.     */    if (ospvErrCode == OSPC_ERR_NO_ERROR)    {        ospvErrCode = OSPPXMLDocIsPI(ospvBfrAddr, ospvEncoding,            &isPI);    }    if ((ospvErrCode == OSPC_ERR_NO_ERROR) && isPI)    {        /*         * Yes, we've found a PI. Now we just read through         * the buffer until we've found the closing tag. Note         * that we don't have to explicitly read the opening         * tag (we've only "peeked" it so far) since the         * closing tag does not appear in the opening tag.         */        ospvErrCode = OSPPXMLDocSkipPast(ospvBfrAddr, ospvEncoding, tag,            scratch);    }    return(ospvErrCode);}/**//*-----------------------------------------------------------------------* * OSPPXMLDocSkipElementDecl() - skip XML element declaration (if present) *-----------------------------------------------------------------------*/unsigned                          /* returns error code */OSPPXMLDocSkipElementDecl(    OSPTBFR    **ospvBfrAddr,     /* buffer containing document */    OSPTXMLENC   ospvEncoding     /* character encoding for the document */){    unsigned            ospvErrCode = OSPC_ERR_NO_ERROR;    const unsigned char tag[] = { OSPC_XMLDOC_ELEMENTDECLEND };    unsigned char       scratch[OSPC_XMLDOC_ELEMENTDECLENDLEN+1];    unsigned            isDecl = OSPC_FALSE;    if (ospvBfrAddr  == OSPC_OSNULL)    {        ospvErrCode = OSPC_ERR_BUF_EMPTY;    }    if (*ospvBfrAddr == OSPC_OSNULL)    {        ospvErrCode = OSPC_ERR_BUF_EMPTY;    }    if (ospvEncoding == ospeXMLEncUnknown)    {        ospvErrCode = OSPC_ERR_XML_BAD_ENC;    }    /*     * The first thing we do is look for the beginning of an XML     * element declaration. If there's not one, we don't have     * any work to do.     */    if (ospvErrCode == OSPC_ERR_NO_ERROR)    {        ospvErrCode = OSPPXMLDocIsElementDecl(ospvBfrAddr, ospvEncoding,            &isDecl);    }    if ((ospvErrCode == OSPC_ERR_NO_ERROR) && isDecl)    {        /*         * Yes, we've found a declaration. Now we just read through         * the buffer until we've found the closing tag. Note         * that we don't have to explicitly read the opening         * tag (we've only "peeked" it so far) since the         * closing tag does not appear in the opening tag.         */        ospvErrCode = OSPPXMLDocSkipPast(ospvBfrAddr, ospvEncoding, tag,            scratch);    }    return(ospvErrCode);}/**//*-----------------------------------------------------------------------* * OSPPXMLDocSkipEntityDecl() - skip XML entity declaration (if present) *-----------------------------------------------------------------------*/unsigned                          /* returns error code */OSPPXMLDocSkipEntityDecl(    OSPTBFR    **ospvBfrAddr,     /* buffer containing document */    OSPTXMLENC   ospvEncoding     /* character encoding for the document */){    unsigned            ospvErrCode = OSPC_ERR_NO_ERROR;    const unsigned char tag[] = { OSPC_XMLDOC_ENTITYDECLEND };    unsigned char       scratch[OSPC_XMLDOC_ENTITYDECLENDLEN+1];    unsigned            isDecl = OSPC_FALSE;    if (ospvBfrAddr  == OSPC_OSNULL)    {        ospvErrCode = OSPC_ERR_BUF_EMPTY;    }    if (*ospvBfrAddr == OSPC_OSNULL)    {        ospvErrCode = OSPC_ERR_BUF_EMPTY;    }    if (ospvEncoding == ospeXMLEncUnknown)    {        ospvErrCode = OSPC_ERR_XML_BAD_ENC;    }    /*     * The first thing we do is look for the beginning of an XML     * entity declaration. If there's not one, we don't have     * any work to do.     */    if (ospvErrCode == OSPC_ERR_NO_ERROR)    {        ospvErrCode = OSPPXMLDocIsEntityDecl(ospvBfrAddr, ospvEncoding,            &isDecl);    }    if ((ospvErrCode == OSPC_ERR_NO_ERROR) && isDecl)    {        /*         * Yes, we've found a declaration. Now we just read through         * the buffer until we've found the closing tag. Note         * that we don't have to explicitly read the opening         * tag (we've only "peeked" it so far) since the         * closing tag does not appear in the opening tag.         */        ospvErrCode = OSPPXMLDocSkipPast(ospvBfrAddr, ospvEncoding, tag,            scratch);    }    return(ospvErrCode);}/**//*-----------------------------------------------------------------------* * OSPPXMLDocSkipAttlist() - skip XML attribute list (if present) *-----------------------------------------------------------------------*/unsigned                          /* returns error code */OSPPXMLDocSkipAttlist(    OSPTBFR    **ospvBfrAddr,     /* buffer containing document */    OSPTXMLENC   ospvEncoding     /* character encoding for the document */){    unsigned            ospvErrCode = OSPC_ERR_NO_ERROR;    const unsigned char tag[] = { OSPC_XMLDOC_ATTLISTEND };    unsigned char       scratch[OSPC_XMLDOC_ATTLISTENDLEN+1];    unsigned            isList = OSPC_FALSE;    if (ospvBfrAddr  == OSPC_OSNULL)    {        ospvErrCode = OSPC_ERR_BUF_EMPTY;    }    if (*ospvBfrAddr == OSPC_OSNULL)    {        ospvErrCode = OSPC_ERR_BUF_EMPTY;    }    if (ospvEncoding == ospeXMLEncUnknown)    {        ospvErrCode = OSPC_ERR_XML_BAD_ENC;    }    /*     * The first thing we do is look for the beginning of an XML     * attribute list. If there's not one, we don't have     * any work to do.     */    if (ospvErrCode == OSPC_ERR_NO_ERROR)    {        ospvErrCode = OSPPXMLDocIsAttlist(ospvBfrAddr, ospvEncoding,            &isList);    }    if ((ospvErrCode == OSPC_ERR_NO_ERROR) && isList)    {        /*         * Yes, we've found a list. Now we just read through         * the buffer until we've found the closing tag. Note         * that we don't have to explicitly read the opening         * tag (we've only "peeked" it so far) since the         * closing tag does not appear in the opening tag.         */        ospvErrCode = OSPPXMLDocSkipPast(ospvBfrAddr, ospvEncoding, tag,            scratch);    }    return(ospvErrCode);}/**//*-----------------------------------------------------------------------* * OSPPXMLDocSkipPastCdataBeg() - skip XML CDATA beginning section *-----------------------------------------------------------------------*/unsigned                          /* returns error code */OSPPXMLDocSkipPastCdataBeg(    OSPTBFR    **ospvBfrAddr,     /* buffer containing document */    OSPTXMLENC   ospvEncoding     /* character encoding for the document */){    unsigned            ospvErrCode = OSPC_ERR_NO_ERROR;    const unsigned char tag[] = OSPC_XMLDOC_CDATABEG;    unsigned char       scratch[OSPC_XMLDOC_CDATABEGLEN+1];    if (ospvBfrAddr  == OSPC_OSNULL)    {        ospvErrCode = OSPC_ERR_BUF_EMPTY;    }    if (*ospvBfrAddr == OSPC_OSNULL)    {        ospvErrCode = OSPC_ERR_BUF_EMPTY;    }    if (ospvEncoding == ospeXMLEncUnknown)    {        ospvErrCode = OSPC_ERR_XML_BAD_ENC;    }    if (ospvErrCode == OSPC_ERR_NO_ERROR)    {        ospvErrCode = OSPPXMLDocSkipPast(ospvBfrAddr, ospvEncoding, tag,            scratch);    }    return(ospvErrCode);}/**//*-----------------------------------------------------------------------* * OSPPXMLDocSkipPastCdataEnd() - skip XML CDATA end section *-----------------------------------------------------------------------*/unsigned                          /* returns error code */OSPPXMLDocSkipPastCdataEnd(    OSPTBFR    **ospvBfrAddr,     /* buffer containing document */    OSPTXMLENC   ospvEncoding     /* character encoding for the document */){    unsigned            ospvErrCode = OSPC_ERR_NO_ERROR;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -