1 /* -*- Mode:C; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
|
2 /* |
|
3 * Copyright (c) 2008 Liu Jian |
|
4 * |
|
5 * This program is free software; you can redistribute it and/or modify |
|
6 * it under the terms of the GNU General Public License version 2 as |
|
7 * published by the Free Software Foundation; |
|
8 * |
|
9 * This program is distributed in the hope that it will be useful, |
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 * GNU General Public License for more details. |
|
13 * |
|
14 * You should have received a copy of the GNU General Public License |
|
15 * along with this program; if not, write to the Free Software |
|
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
17 * |
|
18 * Author: Liu Jian <liujatp@gmail.com> |
|
19 * Hajime Tazaki <tazaki@sfc.wide.ad.jp> |
|
20 */ |
|
21 |
|
22 #ifndef NETLINK_SOCKET_ADDRESS_H |
|
23 #define NETLINK_SOCKET_ADDRESS_H |
|
24 |
|
25 #include "ns3/ptr.h" |
|
26 #include "ns3/address.h" |
|
27 |
|
28 namespace ns3 { |
|
29 |
|
30 class NetlinkSocketAddress |
|
31 { |
|
32 public: |
|
33 NetlinkSocketAddress (uint32_t pid, uint32_t groups); |
|
34 NetlinkSocketAddress (); |
|
35 ~NetlinkSocketAddress (); |
|
36 |
|
37 void SetProcessID (uint32_t pid); |
|
38 void SetGroupsMask (uint32_t mask); |
|
39 |
|
40 uint32_t GetProcessID (void) const; |
|
41 uint32_t GetGroupsMask (void) const; |
|
42 |
|
43 /** |
|
44 * \returns an Address instance which represents this |
|
45 * NetlinkSocketAddress instance. |
|
46 */ |
|
47 operator Address (void) const; |
|
48 /** |
|
49 * \param address the Address instance to convert from. |
|
50 * |
|
51 * Returns an NetlinkSocketAddress which corresponds to the input |
|
52 * Address |
|
53 */ |
|
54 static NetlinkSocketAddress ConvertFrom (const Address &address); |
|
55 /** |
|
56 * \returns true if the address matches, false otherwise. |
|
57 */ |
|
58 static bool IsMatchingType (const Address &address); |
|
59 private: |
|
60 static uint8_t GetType (void); |
|
61 Address ConvertTo (void) const; |
|
62 |
|
63 uint32_t m_pid; |
|
64 uint32_t m_groups; |
|
65 |
|
66 }; |
|
67 |
|
68 |
|
69 } // namespace ns3 |
|
70 |
|
71 #endif /* NETLINK_SOCKET_ADDRESS_H */ |
|