zoukankan      html  css  js  c++  java
  • gsoap框架下的onvif程序流程分析

    SOAP_FMAC5 int SOAP_FMAC6 soap_serve(struct soap *soap)
    {
        do
        {
            unsigned int k = soap->max_keep_alive;
            if (soap->max_keep_alive > 0 && !--k)
                soap->keep_alive = 0;
            if (soap_begin_serve(soap))
            {    
                if (soap->error >= SOAP_STOP)
                    continue;
                return soap->error;
            }
            /*soap_begin_serve()函数在buf中解析到<body>位置,soap_server_request继续解析下一个元素,这个元素就是一种request。
            soap_serve_request()函数就是我们开放新功能的地方*/
    
            if (soap_serve_request(soap) || (soap->fserveloop && soap->fserveloop(soap))) 
            { 
                return soap_send_fault(soap); 
            } 
        } while (soap->keep_alive); return SOAP_OK; 
    }
    
    soap_begin_serve(struct soap *soap)
    {
        soap_begin(soap);
    
        if (soap_begin_recv(soap)             //阻塞在这里 收到消息后 调用http_parse解析http头部
            || soap_envelope_begin_in(soap)      /*从buf中找寻envelope开始标签(begin),in代表是从buf中解析结构  out代表把结构填充到buf中去。可以在这里做分流,
                                                 有<envelope>认为是onvif部分继续交gsoap处理,没有的交http服务器处理。*/
            || soap_recv_header(soap)            //从buf中分离出header域。
            || soap_body_begin_in(soap))         //找寻body的开始标签
        {     
            if (soap->error < SOAP_STOP)
            {
                if(soap->error!=SOAP_GET_METHOD && soap->error!=405) 
                {
                    return soap_send_fault(soap); //此句是原句
                }
                else
                {
                    return soap->error;
                }
            }
            return soap_closesock(soap);
        }
        return SOAP_OK;
    }
  • 相关阅读:
    egrep 正则邮箱
    centos 安装编译时常见错误总结
    线上系统和冷备系统同步单个表数据
    nagios微信报警配置
    saltstack批量加用户脚本
    阿里云服务器迁移流程
    HDU 4912 LCA + 贪心
    HDU 5242 树链剖分思想的贪心
    洛谷P3328(bzoj 4085)毒瘤线段树
    Codeforces 719E (线段树教做人系列) 线段树维护矩阵
  • 原文地址:https://www.cnblogs.com/victor-ma/p/3682190.html
Copyright © 2011-2022 走看看