socket.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /*
  2. * netlink/socket.h Netlink Socket
  3. *
  4. * This library is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU Lesser General Public
  6. * License as published by the Free Software Foundation version 2.1
  7. * of the License.
  8. *
  9. * Copyright (c) 2003-2008 Thomas Graf <tgraf@suug.ch>
  10. */
  11. #ifndef NETLINK_SOCKET_H_
  12. #define NETLINK_SOCKET_H_
  13. #include <netlink/types.h>
  14. #include <netlink/handlers.h>
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif
  18. extern struct nl_sock * nl_socket_alloc(void);
  19. extern struct nl_sock * nl_socket_alloc_cb(struct nl_cb *);
  20. extern void nl_socket_free(struct nl_sock *);
  21. extern uint32_t nl_socket_get_local_port(const struct nl_sock *);
  22. extern void nl_socket_set_local_port(struct nl_sock *, uint32_t);
  23. extern int nl_socket_add_memberships(struct nl_sock *, int, ...);
  24. extern int nl_socket_add_membership(struct nl_sock *, int);
  25. extern int nl_socket_drop_memberships(struct nl_sock *, int, ...);
  26. extern int nl_socket_drop_membership(struct nl_sock *,
  27. int);
  28. extern void nl_join_groups(struct nl_sock *, int);
  29. extern uint32_t nl_socket_get_peer_port(const struct nl_sock *);
  30. extern void nl_socket_set_peer_port(struct nl_sock *,
  31. uint32_t);
  32. extern uint32_t nl_socket_get_peer_groups(const struct nl_sock *sk);
  33. extern void nl_socket_set_peer_groups(struct nl_sock *sk, uint32_t groups);
  34. extern struct nl_cb * nl_socket_get_cb(const struct nl_sock *);
  35. extern void nl_socket_set_cb(struct nl_sock *,
  36. struct nl_cb *);
  37. extern int nl_socket_modify_cb(struct nl_sock *, enum nl_cb_type,
  38. enum nl_cb_kind,
  39. nl_recvmsg_msg_cb_t, void *);
  40. extern int nl_socket_modify_err_cb(struct nl_sock *, enum nl_cb_kind,
  41. nl_recvmsg_err_cb_t, void *);
  42. extern int nl_socket_set_buffer_size(struct nl_sock *, int, int);
  43. extern int nl_socket_set_msg_buf_size(struct nl_sock *, size_t);
  44. extern size_t nl_socket_get_msg_buf_size(struct nl_sock *);
  45. extern int nl_socket_set_passcred(struct nl_sock *, int);
  46. extern int nl_socket_recv_pktinfo(struct nl_sock *, int);
  47. extern void nl_socket_disable_seq_check(struct nl_sock *);
  48. extern unsigned int nl_socket_use_seq(struct nl_sock *);
  49. extern void nl_socket_disable_auto_ack(struct nl_sock *);
  50. extern void nl_socket_enable_auto_ack(struct nl_sock *);
  51. extern int nl_socket_get_fd(const struct nl_sock *);
  52. extern int nl_socket_set_nonblocking(const struct nl_sock *);
  53. extern void nl_socket_enable_msg_peek(struct nl_sock *);
  54. extern void nl_socket_disable_msg_peek(struct nl_sock *);
  55. #ifdef __cplusplus
  56. }
  57. #endif
  58. #endif