Key Pages: [
Rope Home Page |
Basics (tutorial) |
Language Reference |
Download
]
ROPE Registers
Rope supports the idea of "registers" - these are pretty much the same as scalar variables in perl or C.
- The following types of registers are available.
- 26 "user" registers called "$a" through to "$z" or accessed by number using the reg action.
- A number of "internal" registers listed in LanguageReference.
- A set of "global" (public) integer registers, accessed via the "greg" action and the /proc file system.
- User registers can hold any of the following Rope data types
- Internal system registers can only hold the specific type they are declared in the documentation to contain - ie, it is an error to put a string into an internal integer register.
- Global registers can only hold integer values.
- Their names start with a "$" and continue with any combination lower case letters, digits and underbars (upper case letters are not used).
- When they hold strings, Rope does not copy the string data into the register, but the register holds a pointer (and length) to the string data in some other memory location, which may be..
- In the code of the compiled script (a string constant)
- A portion of the packet being inspected.
- A portion of another string register.
- Their contents are accessed using "get" and changed using "put"
- Most (but not all) "internal" registers are read-only.
- Registers are always accessed "by reference" (see below).
Register References
When a Rope script refers to a user or "internal" register using a dollar character before the register name, Rope actually pushes a value onto the stack that is a reference to the register that was named.
The get action is used to collect the value contained in that register. For example, the following code puts the contents of $a onto the stack. Without the "get" the stack would contain a reference to $a instead of it's value.
$a get
The same logic is also used to collect the values of internal registers, for example.
$ip_saddr get
Rope actions that want to see values on the stack rather than register references perform a "get" internally, so that the following are equivalent:
$x print
$x get print
Some (but by no means all) registers can have their values changed using the "put" action, like this..
20 $x put
put( 13 $offset )
The reg and greg actions provide an alternative way of getting a register reference.
See Also
get, put, inc, dec, integer, string, block, reg, greg
Lowth.com: [
Home |
Rope |
P2PWall |
LinWiz |
cutter |
Protector - Free Antivirus software |
TapeIO ]