There are function on service-utils.inc/services.inc for this already!

If snort has these functions does not mean they do not exist :)