[haiku-gsoc] Re: Queries regarding the current code for tcp

  • From: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
  • To: haiku-gsoc@xxxxxxxxxxxxx
  • Date: Mon, 05 Jun 2017 12:57:03 +0000

On Mon, 5 Jun 2017, 6:30 AM Ayush Agrawal <echo.27.04.96@xxxxxxxxx> wrote:

I have been going through the code for TCP at
https://github.com/haiku/haiku/blob/master/src/add-ons/kernel/network/protocols/tcp/tcp.cpp
and I have the following doubts:

*Q1*. Modules basically export an API to be used by other modules and
drivers. The tcp module (sTCPModule) exports many functions. I couldn't
find any other module or driver that calls those functions or any file that
does a get_module on "network/protocols/tcp/v1". I used `grep -ri tcp_` to
search for files calling the exported functions.


They will be called using the function pointer names defined in the struct,
so you won't see calls to the implemented function names.

As per the network stack described at
https://www.haiku-os.org/docs/api/group__network.html, the core stack
module or the network stack driver should be using the tcp module as per my
understanding.

So actually I wanted some clarity on how things go from calling socket(..)
in userland, to the devfs and which driver or module calls upon the tcp
module and how.

*Q2*. The naming convention. Many variable names are prefixed with either
a 'g' or an 's' like sEndpointManagerLock and gStackModule. What does the
letters symbolize?


s is for static variables (local to file/translation unit), g is for global
variables (accessible in other files/translation units).

Q3. tcp.cpp, checking the argument "level" in two different ways:
                  line 525 @ tcp_control: (level & LEVEL_MASK) ==
IPPROTO_TCP



Other related posts: