Advertisement
Guest User

mer.c

a guest
Dec 1st, 2016
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.37 KB | None | 0 0
  1.  
  2. cint_reset();
  3.  
  4.  
  5. int my_callback(
  6.     int unit,
  7.     bcm_port_t port,
  8.     bcm_macsec_event_t event,
  9.     int chanId,
  10.     int assocId,
  11.     void *user_data)
  12. {
  13.     int e = event;
  14.     /*bcm_macsec_secure_assoc_t */ void  *assoc;
  15.  
  16.     printf("u=%d p=%d e=%d c=%d a=%d userd=%p\n",
  17.             unit,port, e,chanId, assocId, user_data );
  18.  
  19.     /* Hard expiry */
  20.     if (e == BCM_MACSEC_EVENT_KEY_EXPIRED) {
  21.         char buf[128] = {0};
  22.         int u = 0;
  23.  
  24.         /* u = (int) user_data ; */
  25.  
  26.         /* SA create to turn off Active flag */
  27.         sprintf(buf, " ms sac  %d.0 AssocID=%d ChanID=%d FLAgs= ",
  28.                 u, assocId, chanId);
  29.         bshell(0, buf);
  30.  
  31.     }
  32.     return 0;
  33. }
  34.  
  35. {
  36.  
  37.     int bcm_gport;
  38.     int unit = 0;
  39.     int port = 1;
  40.     int rv =0;
  41.  
  42.     for (port = 19 ; port < 20 ; port++) {
  43.  
  44.     rv = bcm_macsec_event_register(unit, my_callback, (void *) 0 );
  45.     printf("rv = %d\n", rv);
  46.  
  47.     rv = bcm_macsec_event_enable_set(unit, BCM_MACSEC_EVENT_PRE_KEY_EXPIRE, 1);
  48.     printf("rv = %d\n", rv);
  49.     rv = bcm_macsec_event_enable_set(unit, BCM_MACSEC_EVENT_KEY_EXPIRED, 1);
  50.     printf("rv = %d\n", rv);
  51.     rv = bcm_macsec_event_enable_set(unit, BCM_MACSEC_EVENT_KEY_RENEWED, 1);
  52.     printf("rv = %d\n", rv);
  53.     rv = bcm_macsec_event_enable_set(unit, BCM_MACSEC_EVENT_HW_FAILURE, 1);
  54.     printf("rv = %d\n", rv);
  55.  
  56.     }
  57.  
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement