summaryrefslogtreecommitdiffstats
path: root/watchlink/netlink_send.hh
blob: 3e13e5c8b89a2309c443d429217ff3e42c90654c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/*
 * Module: netlink_send.hh
 *
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License version 2 as published
 * by the Free Software Foundation.
 */
#ifndef __NETLINK_SEND_HH__
#define __NETLINK_SEND_HH__

class NetlinkSend
{
public:
  NetlinkSend(bool debug);
  ~NetlinkSend();
  
  int
  send_get(int sock, int type, int ifindex = -1);

  int
  send_set(int sock, int ifindex, uint32_t local_addr, uint32_t addr, int mask_len, int type);

  int
  send_set_route(int sock, int ifindex, uint32_t local_addr, uint32_t dst_addr, int mask_len, int type, int table, int rtn_type, int rt_scope);

private:
  int 
  addattr_l(struct nlmsghdr *n, int maxlen, int type, void *data, int alen);

  int 
  addattr32(struct nlmsghdr *n, int maxlen, int type, int data);

private:
  bool _debug;

};

#endif //__NETLINK_SEND_HH__