aboutsummaryrefslogtreecommitdiffstats
path: root/api
diff options
context:
space:
mode:
authorRastislav Szabo <raszabo@cisco.com>2017-05-22 13:59:34 +0200
committerRastislav Szabo <raszabo@cisco.com>2017-05-22 14:00:46 +0200
commitc38cb25d746736f062ee16e87f553c8a4ec5fced (patch)
tree231a1befaff3b83b020461e584e9de27a39d06a4 /api
parentc60a4ee4e6114ff0dc3cbc9fd9a58321ca2a8abc (diff)
binapi-generator renamed & moved, finished documentation
Change-Id: I7d3b53fa238e822b36a6a82c61ffb792da3898bf Signed-off-by: Rastislav Szabo <raszabo@cisco.com>
Diffstat (limited to 'api')
-rw-r--r--api/api.go4
-rw-r--r--api/ifcounters/doc.go27
2 files changed, 28 insertions, 3 deletions
diff --git a/api/api.go b/api/api.go
index f478bf1..fe6a34a 100644
--- a/api/api.go
+++ b/api/api.go
@@ -32,7 +32,7 @@ const (
OtherMessage
)
-// Message is an interface that is implemented by all VPP Binary API messages generated by the binapi_generator.
+// Message is an interface that is implemented by all VPP Binary API messages generated by the binapi-generator.
type Message interface {
// GetMessageName returns the original VPP name of the message, as defined in the VPP API.
GetMessageName() string
@@ -44,7 +44,7 @@ type Message interface {
GetCrcString() string
}
-// DataType is an interface that is implemented by all VPP Binary API data types by the binapi_generator.
+// DataType is an interface that is implemented by all VPP Binary API data types by the binapi-generator.
type DataType interface {
// GetTypeName returns the original VPP name of the data type, as defined in the VPP API.
GetTypeName() string
diff --git a/api/ifcounters/doc.go b/api/ifcounters/doc.go
index c918941..35c7f7b 100644
--- a/api/ifcounters/doc.go
+++ b/api/ifcounters/doc.go
@@ -1,4 +1,29 @@
// Package ifcounters provides the helper API for decoding VnetInterfaceCounters binary API message
// that contains binary-encoded statistics data into the Go structs that are better consumable by the Go code.
-// TODO: example usage - currently in the example_client.go
+//
+// VPP provides two types of interface counters that can be encoded inside of a single VnetInterfaceCounters
+// message: simple and combined. For both of them, ifcounters API provides a separate decode function:
+// DecodeCounters or DecodeCombinedCounters. The functions return a slice of simple or combined counters respectively:
+//
+// notifMsg := <-notifChan:
+// notif := notifMsg.(*interfaces.VnetInterfaceCounters)
+//
+// if notif.IsCombined == 0 {
+// // simple counter
+// counters, err := ifcounters.DecodeCounters(ifcounters.VnetInterfaceCounters(*notif))
+// if err != nil {
+// fmt.Println("Error:", err)
+// } else {
+// fmt.Printf("%+v\n", counters)
+// }
+// } else {
+// // combined counter
+// counters, err := ifcounters.DecodeCombinedCounters(ifcounters.VnetInterfaceCounters(*notif))
+// if err != nil {
+// fmt.Println("Error:", err)
+// } else {
+// fmt.Printf("%+v\n", counters)
+// }
+// }
+//
package ifcounters