Difference between revisions of "User:Void Singer/Tea Strainer"

From Second Life Wiki
Jump to navigation Jump to search
m (~corrections)
m (+403 recognition)
Line 18: Line 18:
|content=
|content=
=== Tea Strainer ===
=== Tea Strainer ===
* Save in a [[Mono#How_to_use_Mono|MONO]] script named "'''Tea Strainer v0.3.1'''"
----
<lsl>/*( Teacup Traffic Monitor v0.3.1 )*/
* Save in a [[Mono#How_to_use_Mono|MONO]] script named "'''Tea Strainer v0.5'''"
 
<lsl>/*( Tea Strainer v0.5 )*/
//-- Code optimized for Speed, NOT Size


integer gIntAct; //-- pre-declaration for speed
integer gIntAct; //-- pre-declaration for speed
integer gIntCnt; //-- Allow visual tracking since last reset
integer gIntCnt; //-- Allow visual tracking since last reset
//-- optimized for speed, NOT size


default{
default{
    link_message( integer vIntSrc, integer vIntDta, string vStrDta, key vKeyDta ){
link_message( integer vIntSrc, integer vIntDta, string vStrDta, key vKeyDta ){
        if (vKeyDta){
if (vKeyDta){
            if (~gIntAct = llListFindList( [204, 202, 201, 200, 100, 404, 418], [vIntDta] )){
if (~gIntAct = llListFindList( [204, 202, 201, 200, 100, 403, 404, 418], [vIntDta] )){
                if (4 & gIntAct){ if (2 & gIntAct){/*if (1 & gIntAct){
if (4 & gIntAct){ if (2 & gIntAct){ if (1 & gIntAct){
                }else*/{
llOwnerSay( (string)(++gIntCnt) + ": ‘" + (string)vKeyDta + "’ Server Query: 418 “" + llGetSubString( vStrDta, 0, 35 ) + llList2String( ["”…", "”"], llStringLength( vStrDta ) < 37 ) );
                    llOwnerSay( (string)(++gIntCnt) + ": ‘" + (string)vKeyDta + "’ Server Query: 418 “" + llGetSubString( vStrDta, 0, 35 ) + llList2String( ["”…", "”"], llStringLength( vStrDta ) < 37 ) );
}else{
                }}else if (1 & gIntAct){
llOwnerSay( (string)(++gIntCnt) + ": ‘" + (string)vKeyDta + "’ Service Reply: 404 'Not Found'" );
                    llOwnerSay( (string)(++gIntCnt) + ": ‘" + (string)vKeyDta + "’ Service Reply: 404 'Not Found'" );
}}else if (1 & gIntAct){
                }else{
llOwnerSay( (string)(++gIntCnt) + ": ‘" + (string)vKeyDta + "’ Service Reply: 403 'Forbidden'" );
                    llOwnerSay( (string)(++gIntCnt) + ": ‘" + (string)vKeyDta + "’ Service Reply: 100 'Continue'" );
}else{
                }}else if (2 & gIntAct){ if (1 & gIntAct){
llOwnerSay( (string)(++gIntCnt) + ": ‘" + (string)vKeyDta + "’ Service Reply: 100 'Continue'" );
                    llOwnerSay( (string)(++gIntCnt) + ": ‘" + (string)vKeyDta + "’ Service Reply: 200 'Success'" );
}}else if (2 & gIntAct){ if (1 & gIntAct){
                }else{
llOwnerSay( (string)(++gIntCnt) + ": ‘" + (string)vKeyDta + "’ Service Reply: 200 'Success'" );
                    llOwnerSay( (string)(++gIntCnt) + ": ‘" + (string)vKeyDta + "’ Service Reply: 201 'Created'" );
}else{
                }}else if (1 & gIntAct){
llOwnerSay( (string)(++gIntCnt) + ": ‘" + (string)vKeyDta + "’ Service Reply: 201 'Created'" );
                    llOwnerSay( (string)(++gIntCnt) + ": ‘" + (string)vKeyDta + "’ Service Reply: 202 'Accepted'" );
}}else if (1 & gIntAct){
                }else{
llOwnerSay( (string)(++gIntCnt) + ": ‘" + (string)vKeyDta + "’ Service Reply: 202 'Accepted'" );
                    llOwnerSay( (string)(++gIntCnt) + ": ‘" + (string)vKeyDta + "’ Service Reply: 204 'No Content'" );
}else{
                }
llOwnerSay( (string)(++gIntCnt) + ": ‘" + (string)vKeyDta + "’ Service Reply: 204 'No Content'" );
            }else{
}
                llOwnerSay( "Received unknown message from link (" + (string)vIntSrc + ")“" +
}else{
                  llGetLinkName( vIntSrc ) +"”\n{(" + (string)vIntDta + "), “" + llGetSubString( vStrDta, 0, 35 ) +
llOwnerSay( "Received unknown message from link (" + (string)vIntSrc + ")“" +
                  llList2String( ["”…, ‘", "”, ‘"], llStringLength( vStrDta ) < 37 ) + (string)vKeyDta + "’}" );
  llGetLinkName( vIntSrc ) +"”\n{(" + (string)vIntDta + "), “" + llGetSubString( vStrDta, 0, 35 ) +
            }
  llList2String( ["”…, ‘", "”, ‘"], llStringLength( vStrDta ) < 37 ) + (string)vKeyDta + "’}" );
        }else if (NULL_KEY == (string)vKeyDta){
}
            if (~gIntAct = llListFindList( [418, 600, 601], [vIntDta] )){
}else if (NULL_KEY == (string)vKeyDta){
                if (2 & gIntAct){ /*if (1 & gIntAct){
if (~gIntAct = llListFindList( [418, 600, 601], [vIntDta] )){
                    //-- unused
if (2 & gIntAct){ /*if (1 & gIntAct){
                }else*/{
//-- unused
                    llOwnerSay( (string)(++gIntCnt) + ": " + "File Service: 601 'File Added' “" + vStrDta + "”" );
}else*/{
                }}else if (1 & gIntAct){
llOwnerSay( (string)(++gIntCnt) + ": " + "File Service: 601 'File Added' “" + vStrDta + "”" );
                    llOwnerSay( (string)(++gIntCnt) + ": " + "File Service: 600 'File Removed' “" + vStrDta + "”" );
}}else if (1 & gIntAct){
                }else{
llOwnerSay( (string)(++gIntCnt) + ": " + "File Service: 600 'File Removed' “" + vStrDta + "”" );
                    if ("Teacup URL changed" == vStrDta){
}else{
                        vStrDta += "”\n“ " + llList2String( llGetPrimitiveParams( [PRIM_TEXT] ), 0 ) + " ";
if ("Teacup URL changed" == vStrDta){
                        gIntCnt = 0;
vStrDta += "”\n“ " + llList2String( llGetPrimitiveParams( [PRIM_TEXT] ), 0 ) + " ";
                    }
gIntCnt = 0;
                    llOwnerSay( (string)(++gIntCnt) + ": " + "General Advertisement: “" + vStrDta + "”" );
}
                }
llOwnerSay( (string)(++gIntCnt) + ": " + "General Advertisement: “" + vStrDta + "”" );
            }else{
}
                llOwnerSay( "Received unknown message from link (" + (string)vIntSrc + ")“" +
}else{
                  llGetLinkName( vIntSrc ) +"”\n{(" + (string)vIntDta + "), “" + llGetSubString( vStrDta, 0, 35 ) +
llOwnerSay( "Received unknown message from link (" + (string)vIntSrc + ")“" +
                  llList2String( ["”…, ‘", "”, ‘"], llStringLength( vStrDta ) < 37 ) + (string)vKeyDta + "’}" );
  llGetLinkName( vIntSrc ) +"”\n{(" + (string)vIntDta + "), “" + llGetSubString( vStrDta, 0, 35 ) +
            }
  llList2String( ["”…, ‘", "”, ‘"], llStringLength( vStrDta ) < 37 ) + (string)vKeyDta + "’}" );
        }else{
}
            llOwnerSay( "Received unknown message from link (" +
}else{
              (string)vIntSrc + ")“" + llGetLinkName( vIntSrc ) +"”\n{(" + (string)vIntDta + "), “" +
llOwnerSay( "Received unknown message from link (" +
              llGetSubString( vStrDta, 0, 35 ) + llList2String( ["”…, ‘", "”, ‘"], llStringLength( vStrDta ) < 37 ) +
  (string)vIntSrc + ")“" + llGetLinkName( vIntSrc ) +"”\n{(" + (string)vIntDta + "), “" +
              llGetSubString( vKeyDta, 0, 35 ) + llList2String( ["’…}", "’}"], llStringLength( vKeyDta ) < 37 ) );
  llGetSubString( vStrDta, 0, 35 ) + llList2String( ["”…, ‘", "”, ‘"], llStringLength( vStrDta ) < 37 ) +
        }
  llGetSubString( vKeyDta, 0, 35 ) + llList2String( ["’…}", "’}"], llStringLength( vKeyDta ) < 37 ) );
    }
}
}
}
}
/*//--                          License Text                          --//*/
/*//--                          License Text                          --//*/
Line 95: Line 97:
* [[User:Void_Singer/Teacup|Teacup]] - [[Server_In_a_Prim|SIP]] front end
* [[User:Void_Singer/Teacup|Teacup]] - [[Server_In_a_Prim|SIP]] front end
* [[User:Void_Singer/Red_Tea|Red Tea]] - A very simple [[Server_In_a_Prim|SIP]] back end File Service for a starting point.
* [[User:Void_Singer/Red_Tea|Red Tea]] - A very simple [[Server_In_a_Prim|SIP]] back end File Service for a starting point.
* [[User:Void_Singer/Region_Stats|Region Stats]] - A single page Extension that gets live data from the region and refreshes every minute
* [[User:Void_Singer/Saucer|Saucer]] - Optional Fast 404 Extension for preventing long timeouts for missing/bad pages
* [[User:Void_Singer/Saucer|Saucer]] - Optional Fast 404 Extension for preventing long timeouts for missing/bad pages


Line 100: Line 103:
----
----
* None
* None
* Limitation: only receives messages sent to the prim it's in, may be useful for troubleshooting


=== Requested Feature Upgrades ===
=== Requested Feature Upgrades ===
Line 109: Line 113:
Most Recent Changes are at the top, old version links below.
Most Recent Changes are at the top, old version links below.
* Version will be considered stable when it reaches 1.0
* Version will be considered stable when it reaches 1.0
* Tea Strainer v0.03.1
* Tea Strainer v0.5
** Added 403 recognition
** version jump to match [[Teacup]]
* [http://wiki.secondlife.com/w/index.php?title=User:Void_Singer/Tea_Strainer&oldid=1141628 Tea Strainer v0.03.1]
** Initial Public Release
** Initial Public Release
:[[User:Void Singer/Tea_Strainer#Return_to_Void_Singers_user_page|Return to top]]
:[[User:Void Singer/Tea_Strainer#Return_to_Void_Singers_user_page|Return to top]]

Revision as of 23:22, 3 May 2011

Tea Strainer

What is it?

Tea Strainer is a small utility script to debug the messages being passed to and from Teacup.

How Does it Work?

By intercepting the link message traffic in the prim Teacup resides in, it checks for messages that Teacup and it's components are passing back and forth to and outputs them as llOwnerSay messages. All currently known protocols are properly parsed, and unknown messages are labeled and output in condensed format as well.

Code

Tea Strainer


  • Save in a MONO script named "Tea Strainer v0.5"

<lsl>/*( Tea Strainer v0.5 )*/

integer gIntAct; //-- pre-declaration for speed integer gIntCnt; //-- Allow visual tracking since last reset

//-- optimized for speed, NOT size

default{ link_message( integer vIntSrc, integer vIntDta, string vStrDta, key vKeyDta ){ if (vKeyDta){ if (~gIntAct = llListFindList( [204, 202, 201, 200, 100, 403, 404, 418], [vIntDta] )){ if (4 & gIntAct){ if (2 & gIntAct){ if (1 & gIntAct){ llOwnerSay( (string)(++gIntCnt) + ": ‘" + (string)vKeyDta + "’ Server Query: 418 “" + llGetSubString( vStrDta, 0, 35 ) + llList2String( ["”…", "”"], llStringLength( vStrDta ) < 37 ) ); }else{

llOwnerSay( (string)(++gIntCnt) + ": ‘" + (string)vKeyDta + "’ Service Reply: 404 'Not Found'" );

else if (1 & gIntAct){

llOwnerSay( (string)(++gIntCnt) + ": ‘" + (string)vKeyDta + "’ Service Reply: 403 'Forbidden'" ); }else{ llOwnerSay( (string)(++gIntCnt) + ": ‘" + (string)vKeyDta + "’ Service Reply: 100 'Continue'" ); }}else if (2 & gIntAct){ if (1 & gIntAct){ llOwnerSay( (string)(++gIntCnt) + ": ‘" + (string)vKeyDta + "’ Service Reply: 200 'Success'" ); }else{ llOwnerSay( (string)(++gIntCnt) + ": ‘" + (string)vKeyDta + "’ Service Reply: 201 'Created'" ); }}else if (1 & gIntAct){ llOwnerSay( (string)(++gIntCnt) + ": ‘" + (string)vKeyDta + "’ Service Reply: 202 'Accepted'" ); }else{ llOwnerSay( (string)(++gIntCnt) + ": ‘" + (string)vKeyDta + "’ Service Reply: 204 'No Content'" ); } }else{ llOwnerSay( "Received unknown message from link (" + (string)vIntSrc + ")“" + llGetLinkName( vIntSrc ) +"”\n{(" + (string)vIntDta + "), “" + llGetSubString( vStrDta, 0, 35 ) + llList2String( ["”…, ‘", "”, ‘"], llStringLength( vStrDta ) < 37 ) + (string)vKeyDta + "’}" ); } }else if (NULL_KEY == (string)vKeyDta){ if (~gIntAct = llListFindList( [418, 600, 601], [vIntDta] )){ if (2 & gIntAct){ /*if (1 & gIntAct){ //-- unused }else*/{ llOwnerSay( (string)(++gIntCnt) + ": " + "File Service: 601 'File Added' “" + vStrDta + "”" ); }}else if (1 & gIntAct){ llOwnerSay( (string)(++gIntCnt) + ": " + "File Service: 600 'File Removed' “" + vStrDta + "”" ); }else{ if ("Teacup URL changed" == vStrDta){ vStrDta += "”\n“ " + llList2String( llGetPrimitiveParams( [PRIM_TEXT] ), 0 ) + " "; gIntCnt = 0; } llOwnerSay( (string)(++gIntCnt) + ": " + "General Advertisement: “" + vStrDta + "”" ); } }else{ llOwnerSay( "Received unknown message from link (" + (string)vIntSrc + ")“" + llGetLinkName( vIntSrc ) +"”\n{(" + (string)vIntDta + "), “" + llGetSubString( vStrDta, 0, 35 ) + llList2String( ["”…, ‘", "”, ‘"], llStringLength( vStrDta ) < 37 ) + (string)vKeyDta + "’}" ); } }else{ llOwnerSay( "Received unknown message from link (" + (string)vIntSrc + ")“" + llGetLinkName( vIntSrc ) +"”\n{(" + (string)vIntDta + "), “" + llGetSubString( vStrDta, 0, 35 ) + llList2String( ["”…, ‘", "”, ‘"], llStringLength( vStrDta ) < 37 ) + llGetSubString( vKeyDta, 0, 35 ) + llList2String( ["’…}", "’}"], llStringLength( vKeyDta ) < 37 ) ); } } } /*//-- License Text --//*/ /*// Free to copy, use, modify, distribute, or sell, with attribution. //*/ /*// (C)2011 (CC-BY) [ http://creativecommons.org/licenses/by/3.0 ] //*/ /*// Void Singer [ https://wiki.secondlife.com/wiki/User:Void_Singer ] //*/ /*// All usages must contain a plain text copy of the previous 2 lines. //*/ /*//-- --//*/</lsl>

Return to top

}}

Notes

Compatible Servers, File Systems, and Extensions


  • Teacup - SIP front end
  • Red Tea - A very simple SIP back end File Service for a starting point.
  • Region Stats - A single page Extension that gets live data from the region and refreshes every minute
  • Saucer - Optional Fast 404 Extension for preventing long timeouts for missing/bad pages

Known Bugs


  • None
  • Limitation: only receives messages sent to the prim it's in, may be useful for troubleshooting

Requested Feature Upgrades


  • If you add an extension for Teacup and it has any messages not covered, add a note here and I'll see about adding it. All additions must comply with current protocol limitations as noted for Teacup server

Change Log / Old Versions


Most Recent Changes are at the top, old version links below.

  • Version will be considered stable when it reaches 1.0
  • Tea Strainer v0.5
    • Added 403 recognition
    • version jump to match Teacup
  • Tea Strainer v0.03.1
    • Initial Public Release
Return to top

Questions or Comments?

Feel free to leave me a note on the discussion page.