]> git.proxmox.com Git - mirror_frr.git/blobdiff - lib/sockunion.h
*: auto-convert to SPDX License IDs
[mirror_frr.git] / lib / sockunion.h
index 5e80ba1090b2a71b1244a564be32e257fe8d90f4..e5072559999df5dbd2f017c434eb849925a95066 100644 (file)
@@ -1,22 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Socket union header.
  * Copyright (c) 1997 Kunihiro Ishiguro
- *
- * This file is part of GNU Zebra.
- *
- * GNU Zebra is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2, or (at your option) any
- * later version.
- *
- * GNU Zebra is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; see the file COPYING; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #ifndef _ZEBRA_SOCKUNION_H
@@ -24,6 +9,7 @@
 
 #include "privs.h"
 #include "if.h"
+#include <sys/un.h>
 #ifdef __OpenBSD__
 #include <netmpls/mpls.h>
 #endif
@@ -36,6 +22,7 @@ union sockunion {
        struct sockaddr sa;
        struct sockaddr_in sin;
        struct sockaddr_in6 sin6;
+       struct sockaddr_un sun;
 #ifdef __OpenBSD__
        struct sockaddr_mpls smpls;
        struct sockaddr_rtlabel rtlabel;
@@ -71,6 +58,7 @@ enum connect_result { connect_error, connect_success, connect_in_progress };
 /* Prototypes. */
 extern int str2sockunion(const char *, union sockunion *);
 extern const char *sockunion2str(const union sockunion *, char *, size_t);
+int in6addr_cmp(const struct in6_addr *addr1, const struct in6_addr *addr2);
 extern int sockunion_cmp(const union sockunion *, const union sockunion *);
 extern int sockunion_same(const union sockunion *, const union sockunion *);
 extern unsigned int sockunion_hash(const union sockunion *);
@@ -92,7 +80,6 @@ extern int sockunion_bind(int sock, union sockunion *, unsigned short,
                          union sockunion *);
 extern int sockopt_ttl(int family, int sock, int ttl);
 extern int sockopt_minttl(int family, int sock, int minttl);
-extern int sockopt_cork(int sock, int onoff);
 extern int sockunion_socket(const union sockunion *su);
 extern const char *inet_sutop(const union sockunion *su, char *str);
 extern enum connect_result sockunion_connect(int fd, const union sockunion *su,
@@ -106,6 +93,16 @@ extern int sockunion_is_null(const union sockunion *su);
 
 #ifdef _FRR_ATTRIBUTE_PRINTFRR
 #pragma FRR printfrr_ext "%pSU"  (union sockunion *)
+#pragma FRR printfrr_ext "%pSU"  (struct sockaddr *)
+#pragma FRR printfrr_ext "%pSU"  (struct sockaddr_storage *)
+#pragma FRR printfrr_ext "%pSU"  (struct sockaddr_in *)
+#pragma FRR printfrr_ext "%pSU"  (struct sockaddr_in6 *)
+#pragma FRR printfrr_ext "%pSU"  (struct sockaddr_un *)
+
+/* AF_INET/PF_INET & co., using "PF" to avoid confusion with AFI/SAFI */
+#pragma FRR printfrr_ext "%dPF"  (int)
+/* SOCK_STREAM & co. */
+#pragma FRR printfrr_ext "%dSO"  (int)
 #endif
 
 #ifdef __cplusplus