Hi All.
I began navigating the code.
First of all, let me present the scenarios where we intend to run our code ::
a)
Our client-application, deployed on a vanilla Linux-Desktop, using WIFI to communicate with a "normal" server running on a public IP-Address.
b)
Our client-application, flashed on a micro-controller, which interfaces with a GPRS-module to communicate with the same "normal" server running on a public IP-Address.
Following are the options ::
OPTION 1 :
========
Segregate the application-code in a way, so that all code "including and below" Layer-4 (TCP) is end-device specific.
That means that for vanilla Linux-Desktop, we use the vanilla Berkley-Socket SOCK_STREAM APIs.
For embedded, we utilize the extended-AT-command-set exposed by the GPRS-module (which has been built over the embedded TCP/IP stack of the GPRS-module).
Above approach works for both the end-devices, but suffers from the fact that the extended-AT-command-set is not a standard, so deploying our application on some other GPRS-module will require integration with some other extended-AT-command-set.
OPTION 2 :
=========
Use lwIP for TCP-headers (Layer-4) in the application, and segregate the application in such a way so that all code "including and below" Layer-3 (IP) is end-device specific.
That means that for vanilla Linux-Desktop, we use vanilla SOCK_RAW APIs, with the default option of letting the API add the IP-header.
For embedded, we let the GPRS-module AP+BP handle the Layer3/Layer2/Layer1 functionality.
Above seems feasible "logically", please confirm.OPTION 3 :
=========
Use lwIP for TCP-headers (Layer-4) and IP-headers (Layer-3) in the application, and
segregate the application in such a way so that all code "including and
below" Layer-2 is end-device specific.
Now, here is my biggest query ::
Is it even logically-possible to separate the "Layer3 (IP) handling" (in the application) from "Layer2 handling" (in the end-device)? According to the limited knowledge that I have, the IP-layer needs accesses to the interfaces (as even evident from code in ip.c in lwIP). That would mean that BOTH the Layer3-handling and Layer2- handling must be present in the same code context?
Kindly help resolve these architectural doubts ... I will be grateful no end ...
Thanks and Regards,
Ajay