Personal email: xiaokeweng@gmail.com
This rough introduction-the basic functions of the source file/module under the Netd folder, and the organizational relationship between the main classes.
I. File Composition
Source file module under the Netd file ~ Organization and basic implementation functions:
========================================================== ====================================
Android. mk \ Android makefile
CleanSpec. mk
Main. cpp \ main function entry
========================================================== ====================================
CommandListener. cpp
\ Listen to the frameworek layer command through tcp
\ Register cmd for processing function commands at the framework layer
\ Implement the corresponding command processing function
CommandListener. h
========================================================== ====================================
NetlinkManager. cpp \ listens to the event of the kernel. It can be done through a connectionless socket.
\ It is understood that udp is implemented in setsocketopt with kernel
\ Associated listening Event Type
NetlinkManager. h
========================================================== ====================================
NetdCommand. cpp \ directly calls frameworkcommand
NetdCommand. h
NetlinkHandler. cpp
\ Inherited from NetlinkListener
Implementation of the \ onEvent Function
\ Different processing functions are called Based on the parsing of onEvent function commands
\ And call nm-> sendBroadcast broadcast ResponseCode
NetlinkHandler. h
NetdConstants. cpp
\ The Global Path is provided by the iptable operation function.
NetdConstants. h
========================================================== ====================================
List. h
Logwrapper. c
Ndc. c
Oem_iptables_hook.cpp
\ Iptable System Call hook
Oem_iptables_hook.h
========================================================== ====================================
DnsProxyListener. cpp \ DNS resolution independence
DnsProxyListener. h
MdnsSdListener. cpp \ Multi-DNS resolution independent part
MdnsSdListener. h
========================================================== ====================================
IdletimerController. cpp \ The processing part of the cmd to be registered to the Framework
IdletimerController. h
BandwidthController. cpp
BandwidthController. h
NatController. cpp
NatController. h
PanController. cpp
PanController. h
PppController. cpp
PppController. h
ResolverController. cpp
ResolverController. h
ResponseCode. h
SecondaryTableController. cpp
SecondaryTableController. h
SoftapController. cpp
SoftapController. h
TetherController. cpp
TetherController. h
ThrottleController. cpp
ThrottleController. h
========================================================== ====================================
II. The most important classes in files are:
Management class:
CommandListener, NetlinkManager, MdnsSdListener, DnsProxyListener
Processing class:
ResponseCode, Netlinkhandler, CommandListener: XXXCmd
Related Classes:
Socketlistener, SocketClient, NetlinkListener, NetlinkEvent, FrameworkListener, FrameworkCommand, and FrameworkClient
The following are some UML statements that are not standardized. You can understand them ~~ This document will be detailed later.
(1) CommandListener and NetlinkHandler
(2) upload/release of commands
(3) Various cmd Functions