<! -- @ Page {margin: 2 cm} P {margin-bottom: 0.21} -->
In the init. rc file, you can see the following services loaded:
Service nexus/system/bin/nexus
Socket nexus stream 0660 root system
Disabled
The nexus service code is in the directory:
Android-2.0/system/core/nexus
The nexus Service monitors network commands and provides network management functions.
The main function code is analyzed as follows:
Int main (){
LOGI ("Nexus version 0.1 firing up ");
CommandListener * cl = new CommandListener ();
This Code creates a command listener.
NetworkManager * nm;
If (! (Nm = NetworkManager: Instance ())){
LOGE ("Unable to create NetworkManager ");
Exit (-1 );
};
This Code creates a network manager.
Nm-> setBroadcaster (SocketListener *) cl );
Nm-> attachController (new LoopController (nm-> getPropMngr (), nm ));
Nm-> attachController (new TiwlanWifiController (nm-> getPropMngr (), nm, "/system/lib/modules/wlan. ko", "wlan ",""));
// Nm-> attachController (new AndroidL2TPVpnController (nm-> getPropMngr (), nm ));
Nm-> attachController (new OpenVpnController (nm-> getPropMngr (), nm ));
This Code sets the network listener.
If (NetworkManager: Instance ()-> run ()){
LOGE ("Unable to Run NetworkManager (% s)", strerror (errno ));
Exit (1 );
}
If (cl-> startListener ()){
LOGE ("Unable to start CommandListener (% s)", strerror (errno ));
Exit (1 );
}
// XXX: well use the main thread for the NetworkManager eventually
While (1 ){
Sleep (1000 );
}
This code starts the network listener and keeps the network listener processing commands.
LOGI ("Nexus exiting ");
Exit (0 );
}