-/*
- * matchcompIP()
- * Compiles an IP mask into an in_mask structure
- * The given <mask> can either be:
- * - An usual irc type mask, containing * and or ?
- * - An ip number plus a /bitnumber part, that will only consider
- * the first "bitnumber" bits of the IP (bitnumber must be in 0-31 range)
- * - An ip numer plus a /ip.bit.mask.values that will consider
- * only the bits marked as 1 in the ip.bit.mask.values
- * In the last two cases both the ip number and the bitmask can specify
- * less than 4 bytes, the missing bytes then default to zero, note that
- * this is *different* from the way inet_aton() does and that this does
- * NOT happen for normal IPmasks (not containing '/')
- * If the returned value is zero the produced in_mask might match some IP,
- * if it's nonzero it will never match anything (and the imask struct is
- * set so that always fails).
- *
- * The returned structure contains 3 fields whose meaning is the following:
- * im.mask = The bits considered significative in the IP
- * im.bits = What these bits should look like to have a match
- * im.fall = If zero means that the above information used as
- * ((IP & im.mask) == im.bits) is enough to tell if the compiled
- * mask matches the given IP, nonzero means that it is needed,
- * in case they did match, to call also the usual text match
- * functions, because the mask wasn't "completely compiled"
- *
- * They should be used like:
- * matchcompIP(&im, mask);
- * if ( ((IP & im.mask)!=im.bits)) || (im.fall&&match(mask,inet_ntoa(IP))) )
- * { handle_non_match } else { handle_match };
- * instead of:
- * if ( match(mask, inet_ntoa(IP)) )
- * { handle_non_match } else { handle_match };
- *
- * Note: This function could be smarter when dealing with complex masks,
- * this implementation is quite lazy and understands only very simple
- * cases, whatever contains a ? anywhere or contains a '*' that isn't
- * part of a trailing '.*' will fallback to text-match, this could be
- * avoided for masks like 12?3.5.6 12.*.3.4 1.*.*.2 72?72?72?72 and
- * so on that "could" be completely compiled to IP masks.
- * If you try to improve this be aware of the fact that ? and *
- * could match both dots and digits and we _must_ always reject
- * what doesn't match in textform (like leading zeros and so on),
- * so it's a LOT more tricky than it might seem. By now most common
- * cases are optimized.