Forum Discussion

Hamish's avatar
Hamish
Icon for Cirrocumulus rankCirrocumulus
Dec 15, 2009

find_string_class_member clarification needed...

 

Hi.

 

 

Does anyone know what find_class_string_member actually compares? Is it the whole string? Or just the portion up to the default field separator (' ')?

 

 

Given an (External) string class of (Ignore the syntax I know it's not correct, it's the strings that are important)

 

 

class mystrings {

 

"one.html text/html "

 

"two.html text/html "

 

}

 

 

Where gobbledegook is the base64 encoded contents of the files...

 

 

I (almost?) always seem to get a not-found (false) back from find_class_string_member when just searching for the string 'one.html'.

 

 

Which means that a subsequent add_string_class_member() will fail with it's usual helpful message that seems to indicate it already exists.

 

 

Is there a flag I'm missing to tell it how to do the search? Or is it dependent on something else? The docs seem pretty light in the iControl SDK on this. I'd be willing to accept you need the WHOLE string to match, But the interface isn't very clear to me whether strings need to be specified in their entirety, or if the match is link findclass in an iRule.

 

 

If you have to specify the whole string, then how is modify_string_class() supposed to work. It's got to be matching something, but there's no explicit key/value specified (Unless it's implied by the ' ' delimiter in the string).

 

If it does match a substring, then I have to ask why it fails... Docs either way would be appreciated....

 

 

 

TIA

 

Hamish.

 

2 Replies

  • The code does an exact string match. I have no clue on why you may be getting a positive result on a partial match. The logic in the code is as follows:

     

     

    Loop over the searches (the class_members array) 
       Loop over the class_members[ i ].members array 
         Loop over the entries in the class 
           if the class entry equals the search term, break and return true.

     

     

    We're using a 3rd party class library which overloads the == operator and I'm fairly confident this is doing a strcmp under the seams.

     

     

    I'll do some testing today to see if I can reproduce partial matches.

     

     

    -Joe
  • Hamish's avatar
    Hamish
    Icon for Cirrocumulus rankCirrocumulus
    That's OK. I think I'll try a different approach.

     

     

    H