From owner-svn-soc-all@freebsd.org Fri Aug 19 10:49:15 2016 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C576ABBFF52 for ; Fri, 19 Aug 2016 10:49:15 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B88CC1AB0 for ; Fri, 19 Aug 2016 10:49:15 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u7JAnFU7053285 for ; Fri, 19 Aug 2016 10:49:15 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7JAnEBi053158 for svn-soc-all@FreeBSD.org; Fri, 19 Aug 2016 10:49:14 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Fri, 19 Aug 2016 10:49:14 GMT Message-Id: <201608191049.u7JAnEBi053158@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r308008 - soc2016/yuanxunzhang/head/usr.sbin/eaps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Aug 2016 10:49:15 -0000 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 +