[master] cab1d55 Add VSA_Get_Proto() to find out what protocol it is.

Poul-Henning Kamp phk at FreeBSD.org
Tue Jan 13 12:10:00 CET 2015


commit cab1d55670cb0b9225833e375070de3f18fdf224
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Tue Jan 13 11:09:41 2015 +0000

    Add VSA_Get_Proto() to find out what protocol it is.

diff --git a/include/vsa.h b/include/vsa.h
index 8496278..5974974 100644
--- a/include/vsa.h
+++ b/include/vsa.h
@@ -40,6 +40,7 @@ int VSA_Compare(const struct suckaddr *, const struct suckaddr *);
 struct suckaddr *VSA_Clone(const struct suckaddr *sua);
 
 const struct sockaddr *VSA_Get_Sockaddr(const struct suckaddr *, socklen_t *sl);
+int VSA_Get_Proto(const struct suckaddr *);
 
 /*
  * 's' is a sockaddr of some kind, 'sal' is its length
diff --git a/lib/libvarnish/vsa.c b/lib/libvarnish/vsa.c
index 7057487..b543d55 100644
--- a/lib/libvarnish/vsa.c
+++ b/lib/libvarnish/vsa.c
@@ -286,6 +286,14 @@ VSA_Get_Sockaddr(const struct suckaddr *sua, socklen_t *sl)
 }
 
 int
+VSA_Get_Proto(const struct suckaddr *sua)
+{
+
+	CHECK_OBJ_NOTNULL(sua, SUCKADDR_MAGIC);
+	return (sua->sa.sa_family);
+}
+
+int
 VSA_Sane(const struct suckaddr *sua)
 {
 	CHECK_OBJ_NOTNULL(sua, SUCKADDR_MAGIC);



More information about the varnish-commit mailing list