home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / boot / i386 / root / usr / share / YaST2 / scrconf / run_ifconfig.scr < prev    next >
Encoding:
Text File  |  2006-11-29  |  2.2 KB  |  97 lines

  1. /**
  2.  * File:
  3.  *   run_ifconfig.scr
  4.  * Summary:
  5.  *   SCR Agent for reading the result from /sbin/ifconfig
  6.  * Access:
  7.  *   read-only
  8.  * Authors:
  9.  *   Unknown <yast2-hacker@suse.de>
  10.  * See:
  11.  *   anyagent
  12.  *   libscr
  13.  *   man ifconfig
  14.  * Example:
  15.  *   Read(.run.ifconfig)
  16.  *   ([$["name":"eth0",
  17.  *       "value":$["flags":["UP", "BROADCAST", "RUNNING", "MULTICAST",
  18.  *                          " MTU:1500", " Metric:1"],
  19.  *                 "inet":$["addr":168427678,
  20.  *                          "bcast":168493055,
  21.  *                          "mask":4294901760],
  22.  *                 "link":"Link encap:Ethernet  HWaddr 00:00:1C:B5:A8:5A  "
  23.  *               ]
  24.  *     ],
  25.  *     $["name":"lo",
  26.  *       "value":$["flags":["UP", "LOOPBACK", "RUNNING",
  27.  *                          " MTU:3924", " Metric:1"],
  28.  *                 "inet":$["addr":2130706433,
  29.  *                          "mask":4278190080],
  30.  *                 "link":"Link encap:Local Loopback  "]
  31.  *               ]
  32.  *   ])
  33.  *
  34.  * $Id: run_ifconfig.scr 13018 2003-12-11 12:52:53Z jhumpol $
  35.  *
  36.  * AnyAgent for reading ip address, broadcast and netmask (as the ip4numbers)
  37.  * of running network interfaces from ifconfig output
  38.  *
  39.  * Returns a <b>list of maps</b>. Each map (list-entry) corresponds
  40.  * with one network interface.
  41.  */
  42. .run.ifconfig
  43.  
  44. /*
  45.  */
  46.  
  47. `ag_anyagent(
  48.   `Description (
  49.     (`Run("/sbin/ifconfig | /bin/sed -e '/.*inet6.*/d'")),
  50.     "\n",
  51.     true,
  52.     (`List(
  53.         `Tuple(
  54.         `name(`String("^\t ")),
  55.         `value(`Tuple(
  56.             `Whitespace(), `link(`String("^\n")), "\n",
  57.             `Whitespace(), "inet", `inet(
  58.             `Tuple (
  59.                 `Optional (`Whitespace ()),
  60.                 `Choice (
  61.                 [
  62.                     "addr:",
  63.                     `addr (`Ip4Number ())
  64.                     ],
  65.                 [
  66.                     "Bcast:",
  67.                     `bcast (`Ip4Number ())
  68.                     ],
  69.                 [
  70.                     "P-t-P:",
  71.                     `ptp (`Ip4Number ())
  72.                     ],
  73.                 [
  74.                     "Mask:",
  75.                     `mask (`Ip4Number ())
  76.                     ],
  77.                 [
  78.                     `String ("^\n\t "),
  79.                     `Skip()
  80.                     ]
  81.                 ),
  82.                 `Continue (`Whitespace ())
  83.                 )
  84.             ), "\n",
  85.             `Whitespace(), `flags(`List(`Sequence(`Optional(`Whitespace()), `String("^ \n")), " ")), "\n",
  86.             // the rest is not important
  87.             `List(
  88.             `Sequence(`Whitespace(), `String("^\n")),
  89.             "\n"
  90.             )
  91.             ))
  92.         ),
  93.         ""
  94.         ))
  95.     )
  96. )
  97.