Android 4.1 Netd detailed analysis (2) source file/module/basic class

Source: Internet
Author: User

Personal email:

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
\ Iptable System Call hook
========================================================== ====================================
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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.