歡迎您光臨本站 註冊首頁

traffic server plugin 編譯及相關問題

←手機掃碼閱讀     火星人 @ 2014-03-04 , reply:0

traffic server plugin 編譯及相關問題

1. 本人使用sdk3.2,ubuntu 10 Linux,想開發一個類似於example 里protocol組件的功能。 根據http://trafficserver.apache.org/docs/trunk/sdk/getting-started/a-simple-plugin.en.html 指南,用tsxs編譯的時候,出現如下錯誤。thread主要適用example里的thread-pool里的代碼。查看錯誤后,貌似無法編譯thrad.h里的typedef int (*ExecFunc) (TSCont, void *);句子。不知道如何解決這個問題?請指教!謝謝

tc@ubuntu:/usr/compile$ tsxs -o ctxplugin.so -c thread.h thread.c content_plugin.h content_plugin.c
  compiling thread.h -> thread.lo
thread.h:36: error: expected 『)』 before 『void』
thread.h:42: error: expected specifier-qualifier-list before 『TSCont』
thread.h:62: error: expected specifier-qualifier-list before 『TSMutex』
thread.h:77: error: expected 『)』 before 『contp』
Compile failed: gcc -I/usr/local/include -march=i586 -g -pipe -Wall -Werror -O3 -feliminate-unused-debug-symbols -fno-strict-aliasing -fpic -c thread.h -o thread.lo
tc@ubuntu:/usr/compile$

2. 對於分析http頭,本人的代碼如下,但貌似不很專業,兄是否有更好的解決方案:
void parse_request(char * request_data, CustomRequest * request)    ////////////// general ok
{
    TSDebug("protocol", "Entering parse_request");

    char *token = NULL;
    token = strtok(request_data, "\r\n");
    while (token)
    {

        char * g  = strstr(token, "GET");
        if (g != NULL)
        {
            char* get = strstr(g, "/");
            char ret;
            get++;
            strncpy ( ret, get, strlen(get)-9 );
            ret = '\0';
            request->transfer_id = ret;
        }


        char * pch  = strstr(token, "Ingress-Capacity");
        if (pch != NULL)
        {
            char* ret = strstr(pch, ":");
            ret ++ ;

            request->ingress_capacity = 0;//num;
        }

        char * r  = strstr(token, "Range");
        if (r != NULL)
        {
            char* ret = strstr(r, "=");
            ret ++;
            request->range = ret;
        }

        token = strtok(NULL, "\r\n");
    }

    TSDebug("protocol", "Exit parse_request");
}

3. 為了測試,需要建立一個server以檢測plugin功能正常,目前計劃用java實現,如果方便的話,兄是否有類似解決方案供參考一下。
《解決方案》

回復 1# qiucx


    你的問題都是我不擅長的唉。這個問題有點麻煩啦。bbs的消息,讀了就找不到了,是不是你發的?我的新浪微薄 @ming_zym 可私信聯繫。

[火星人 ] traffic server plugin 編譯及相關問題已經有99次圍觀

http://coctec.com/docs/service/show-post-12212.html