My colleagues have a system by which they annotate TCP packets at a mid-point (think router) with additional TCP header fields to convey some information to a third element (again, think router) which uses that information to operate in different ways on the packet. (I don't think the actual operation is germane to the question I'm trying to get to, and they don't want me sharing anyways, so I'm leaving it somewhat abstract.)
We know how to do this at the router level - lets call this upstream for lack of a better name. Now they want to do the same thing in the downstream direction at the application level. I'm struggling to find a way of exposing these optional TCP header fields to applications. I'm working on getting my colleagues to work at the application layer (e.g., HTTP headers) which is easily exposed to apps. Let's use the Android APIs as an example, but I have the same question for other smartphone operating systems.
I don't want application developers to have to make kernel extensions to get to these headers and I don't want them having to use NDK either. Both of these smell to me like a fail.
I couldn't find any Android APIs that expose this kind of information to client apps. Is this something where I can develop an Android Service to relieve the app developers from having top figure this out, rather they just use my service for HTTP operations and I can the elevate those TCP headers into the HTTP space? Using the NDK perhaps? Other libraries I should be considering (libpcap comes to mind...)
I did see this question but it seems to be going the wrong direction - writing packets instead of reading them.