]> git.ipfire.org Git - thirdparty/libnl.git/commitdiff
socket: constify interface
authorThomas Graf <tgraf@suug.ch>
Thu, 18 Nov 2010 11:47:16 +0000 (12:47 +0100)
committerThomas Graf <tgraf@suug.ch>
Thu, 18 Nov 2010 11:47:16 +0000 (12:47 +0100)
include/netlink/socket.h
lib/socket.c

index 31a36d3df6ba968d43fb9e574213e853f5bb8448..f0062b593348ba4205e969a668982424928d38c0 100644 (file)
@@ -23,7 +23,7 @@ extern struct nl_sock *       nl_socket_alloc(void);
 extern struct nl_sock *        nl_socket_alloc_cb(struct nl_cb *);
 extern void            nl_socket_free(struct nl_sock *);
 
-extern uint32_t                nl_socket_get_local_port(struct nl_sock *);
+extern uint32_t                nl_socket_get_local_port(const struct nl_sock *);
 extern void            nl_socket_set_local_port(struct nl_sock *, uint32_t);
 
 extern int             nl_socket_add_memberships(struct nl_sock *, int, ...);
@@ -34,12 +34,12 @@ extern int          nl_socket_drop_membership(struct nl_sock *,
 extern void            nl_join_groups(struct nl_sock *, int);
 
 
-extern uint32_t                nl_socket_get_peer_port(struct nl_sock *);
+extern uint32_t                nl_socket_get_peer_port(const struct nl_sock *);
 extern void            nl_socket_set_peer_port(struct nl_sock *,
                                                        uint32_t);
-extern uint32_t        nl_socket_get_peer_groups(struct nl_sock *sk);
+extern uint32_t        nl_socket_get_peer_groups(const struct nl_sock *sk);
 extern void            nl_socket_set_peer_groups(struct nl_sock *sk, uint32_t groups);
-extern struct nl_cb *  nl_socket_get_cb(struct nl_sock *);
+extern struct nl_cb *  nl_socket_get_cb(const struct nl_sock *);
 extern void            nl_socket_set_cb(struct nl_sock *,
                                                 struct nl_cb *);
 extern int             nl_socket_modify_cb(struct nl_sock *, enum nl_cb_type,
@@ -55,8 +55,8 @@ extern unsigned int   nl_socket_use_seq(struct nl_sock *);
 extern void            nl_socket_disable_auto_ack(struct nl_sock *);
 extern void            nl_socket_enable_auto_ack(struct nl_sock *);
 
-extern int             nl_socket_get_fd(struct nl_sock *);
-extern int             nl_socket_set_nonblocking(struct nl_sock *);
+extern int             nl_socket_get_fd(const struct nl_sock *);
+extern int             nl_socket_set_nonblocking(const struct nl_sock *);
 extern void            nl_socket_enable_msg_peek(struct nl_sock *);
 extern void            nl_socket_disable_msg_peek(struct nl_sock *);
 
index bed53c1303bd2cd479178231ccd516c2a44d5a0b..ebdf4e8adce3186bd643caf2048c70479667dfa6 100644 (file)
@@ -239,7 +239,7 @@ void nl_socket_enable_auto_ack(struct nl_sock *sk)
  * @{
  */
 
-uint32_t nl_socket_get_local_port(struct nl_sock *sk)
+uint32_t nl_socket_get_local_port(const struct nl_sock *sk)
 {
        return sk->s_local.nl_pid;
 }
@@ -388,7 +388,7 @@ void nl_join_groups(struct nl_sock *sk, int groups)
  * @{
  */
 
-uint32_t nl_socket_get_peer_port(struct nl_sock *sk)
+uint32_t nl_socket_get_peer_port(const struct nl_sock *sk)
 {
        return sk->s_peer.nl_pid;
 }
@@ -398,7 +398,7 @@ void nl_socket_set_peer_port(struct nl_sock *sk, uint32_t port)
        sk->s_peer.nl_pid = port;
 }
 
-uint32_t nl_socket_get_peer_groups(struct nl_sock *sk)
+uint32_t nl_socket_get_peer_groups(const struct nl_sock *sk)
 {
        return sk->s_peer.nl_groups;
 }
@@ -417,7 +417,7 @@ void nl_socket_set_peer_groups(struct nl_sock *sk, uint32_t groups)
  * @{
  */
 
-int nl_socket_get_fd(struct nl_sock *sk)
+int nl_socket_get_fd(const struct nl_sock *sk)
 {
        return sk->s_fd;
 }
@@ -428,7 +428,7 @@ int nl_socket_get_fd(struct nl_sock *sk)
  *
  * @return 0 on success or a negative error code.
  */
-int nl_socket_set_nonblocking(struct nl_sock *sk)
+int nl_socket_set_nonblocking(const struct nl_sock *sk)
 {
        if (sk->s_fd == -1)
                return -NLE_BAD_SOCK;
@@ -464,7 +464,7 @@ void nl_socket_disable_msg_peek(struct nl_sock *sk)
  * @{
  */
 
-struct nl_cb *nl_socket_get_cb(struct nl_sock *sk)
+struct nl_cb *nl_socket_get_cb(const struct nl_sock *sk)
 {
        return nl_cb_get(sk->s_cb);
 }