2 * Network Configuration Module
4 * Copyright (c) 2012-2013 Samsung Electronics Co., Ltd. All rights reserved.
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
27 #include "network-clock.h"
28 #include "network-state.h"
29 #include "network-statistics.h"
30 #include "signal-handler.h"
31 #include "wifi-agent.h"
33 static GMainLoop *main_loop = NULL;
35 int main(int argc, char* argv[])
37 DBusGConnection *connection;
39 DBG("Network Configuration Module");
41 if (daemon(0, 0) != 0)
42 DBG("Cannot start daemon");
44 netconfig_set_wifi_mac_address();
48 main_loop = g_main_loop_new(NULL, FALSE);
50 connection = netconfig_setup_dbus();
51 if (connection == NULL)
54 if (netconfig_network_state_create_and_init(connection) == NULL)
57 netconfig_register_signal();
59 /* Registering the agent for exchanging security credentials */
60 netconfig_agent_register();
62 if (netconfig_wifi_create_and_init(connection) == NULL)
65 if (netconfig_network_statistics_create_and_init(connection) == NULL)
68 /* If its environment uses Emulator, network configuration is set by emulator default */
69 netconfig_emulator_test_and_start();
71 g_main_loop_run(main_loop);
73 netconfig_deregister_signal();
74 netconfig_wifi_state_notifier_cleanup();
76 /* Unregistering the agent */
77 netconfig_agent_unregister();