Search headers_in

I am starting to write a new module that uses a header token. I have
searched google for the answer about "how to seach in headers for a
name. I want to search for “X-session-token”. I am surprised that
there is not a library function that just does the search,

As I understand it now every module that wants to search for a header
writes it own search function?
Is there a “library search function”?

once I have the session token I use memcached in the PREACCESS phase to
load the session info, then in the ACCESS phase check the access