tizen 2.3 release
[kernel/api/system-resource.git] / src / network / specific-trace.c
1 /*
2  * resourced
3  *
4  * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
5  *
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
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
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.
17  *
18  */
19
20 /*
21  * @file specific-trace.c
22  *
23  * @desc functions for tracing complex entities
24  *
25  * Copyright (c) 2013 Samsung Electronics Co., Ltd. All rights reserved.
26  *
27  */
28
29 #include <sys/socket.h>
30 #include <netinet/in.h>
31 #include <arpa/inet.h>
32
33 #include "specific-trace.h"
34 #include "macro.h"
35 #include "trace.h"
36
37 gboolean print_appstat(gpointer key, gpointer value,
38         void __attribute__((__unused__)) *data)
39 {
40         struct application_stat *appstat = (struct application_stat *)value;
41         struct classid_iftype_key *composite_key =
42                 (struct classid_iftype_key *)key;
43
44         if (!appstat || !composite_key) {
45                 _E("Please provide valid argument for printing app stat\n");
46                 return TRUE; /*stop printing*/
47         }
48
49        _SD("appid %s, pid %d, rcv %u, snd %u, classid %u, iftype %d, ifname %s," \
50                " is_roaming %d",
51                 appstat->application_id, appstat->pid, appstat->rcv_count,
52                 appstat->snd_count, (u_int32_t)composite_key->classid,
53                 composite_key->iftype, composite_key->ifname,
54                 appstat->is_roaming);
55
56         return FALSE;
57 }