Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 19 Aug 2016 10:49:14 GMT
From:      yuanxunzhang@FreeBSD.org
To:        svn-soc-all@FreeBSD.org
Subject:   socsvn commit: r308008 - soc2016/yuanxunzhang/head/usr.sbin/eaps
Message-ID:  <201608191049.u7JAnEBi053158@socsvn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: yuanxunzhang
Date: Fri Aug 19 10:49:13 2016
New Revision: 308008
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=308008

Log:
  EAPS: modify eaps socket interface

Modified:
  soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c
  soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.h
  soc2016/yuanxunzhang/head/usr.sbin/eaps/keywords

Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c
==============================================================================
--- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c	Fri Aug 19 09:11:50 2016	(r308007)
+++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c	Fri Aug 19 10:49:13 2016	(r308008)
@@ -97,6 +97,8 @@
 static void	create_domain(int, char **, int);
 static void delete_domain(int, char **, int);
 static void show_eaps_status(int, char **, int);
+static void set_eaps_mode(int, char **, int);
+static void set_eaps_priority(int, char **, int);
 static void usage(const char *);
 void load_module(const char *);
 
@@ -122,6 +124,10 @@
 		case K_SHOW:
 			show_eaps_status(argc, argv, s);
 			break;
+		case K_MODE:
+			break;
+		case K_PRIORITY:
+			break;
 		}
 	usage(*argv);
 	return retval;
@@ -223,6 +229,34 @@
 	exit(error);
 }
 
+static void 
+set_eaps_mode(int argc, char **argv, int s)
+{
+	int error = 0;
+
+	struct eaps_state es;
+	bzero(&es, sizeof(es));
+
+	char *domain_name = *(++argv);
+
+	// check eaps domain name
+	if (domain_name == NULL) {
+		err(1, "EAPS domain name is NULL!");
+	} 
+
+	char *mode = *(++argv);
+	printf("Debug print: the switch mode is %s!\n", mode);
+	
+	//check the eaps switch mode
+	if ((mode != eaps_mode_message[EAPS_MODE_TRANSIT]) 
+		|| (mode != aps_mode_message[EAPS_MODE_MASTER])) {
+		err(1, "Wrong swith mode, swith mode should be transit or master!\n");
+	}
+
+	exit(error);
+}
+
+
 static void
 usage(const char *cp)
 {

Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.h
==============================================================================
--- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.h	Fri Aug 19 09:11:50 2016	(r308007)
+++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.h	Fri Aug 19 10:49:13 2016	(r308008)
@@ -48,16 +48,6 @@
 	uint8_t         mode;               /* switch mode for a node: transit or master, default transit */
 	uint8_t         priority;           /* EAPS domain priority high or normal */
 };
-/*
- * EAPS ring node states
- */
-#define	EAPS_S_IDLE		0x00	/* EAPS Domain (Master/Transit) not running */
-#define	EAPS_S_COMPLETE		0x01	/* Master node in COMPLETE state */
-#define	EAPS_S_FAILED		0x02	/* Master node in FAILED state */
-#define	EAPS_S_LINKS_UP		0x03	/* Transit UP: Pri & Sec ring ports are up */
-#define	EAPS_S_LINK_DOWN	0x04 	/* Transit DOWN: Pri and/or Sec ports down */
-#define	EAPS_S_PREFORWARD	0x05	/* Transit in PREFORWARDING State */
-#define	EAPS_S_INIT		0x06	/* Master node in INIT state */
 
 /*
  * EAPS ring status states (active or not active)
@@ -65,4 +55,11 @@
 #define EAPS_STATUS_ACTIVE       0x00    /* Eaps is active */
 #define EAPS_STATUS_NOT_ACTIVE   0x01    /* Eaps is not active */
 
+#define EAPS_MODE_TRANSIT        0x00    /* EAPS swith mode - transit (default) */
+#define EAPS_MODE_MASTER         0x01    /* EAPS swith mode - master */
+
+#define EAPS_PRIORITY_NORMAL       0x00    /* EAPS domain priority - normal */
+#define EAPS_PRIORITY_HIGH         0x01    /* EAPS domain priority - high (default) */
+ 
+
 #define	SIOCSEAPSDOMAIN		 _IOWR('i', 300, struct eaps_state)

Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/keywords
==============================================================================
--- soc2016/yuanxunzhang/head/usr.sbin/eaps/keywords	Fri Aug 19 09:11:50 2016	(r308007)
+++ soc2016/yuanxunzhang/head/usr.sbin/eaps/keywords	Fri Aug 19 10:49:13 2016	(r308008)
@@ -4,3 +4,6 @@
 create
 delete
 show
+mode
+priority
+



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201608191049.u7JAnEBi053158>