summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2017-09-05 16:42:28 -0400
committerLuke Shumaker <lukeshu@lukeshu.com>2017-09-08 16:55:55 -0400
commit74919bfa1107615f77931bd5ee94ef9010832b49 (patch)
tree83c5b943cf53ef3f716ff86d3c1922030f12016e
parent34dc135db83376686e1f13f6f5a14fa530422570 (diff)
nslcd_proto: Add some doc comments
-rw-r--r--nslcd_proto/io.go14
1 files changed, 13 insertions, 1 deletions
diff --git a/nslcd_proto/io.go b/nslcd_proto/io.go
index 9252aca..a2adade 100644
--- a/nslcd_proto/io.go
+++ b/nslcd_proto/io.go
@@ -1,4 +1,4 @@
-// Copyright (C) 2015 Luke Shumaker <lukeshu@sbcglobal.net>
+// Copyright (C) 2015, 2017 Luke Shumaker <lukeshu@sbcglobal.net>
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@@ -27,17 +27,29 @@ import (
"golang.org/x/sys/unix"
)
+// NslcdError represents a normal, expected error when dealing with
+// the nslcd protocol. Passing invalid data to a Write operation is
+// *not* an NslcdError, nor is passing a non-pointer to a Read
+// operation; those are programming errors, and result in a panic().
type NslcdError string
func (o NslcdError) Error() string {
return string(o)
}
+// An nslcdObject is an object with a different network representation
+// than a naive structure.
type nslcdObject interface {
+ // May panic(interface{}) if given invalid data.
+ //
+ // May panic(NslcdError) if encountering a network error.
nslcdWrite(fd io.Writer)
}
+// An nslcdObjectPtr is a pointer to an object with a different
+// network representation than a naive structure.
type nslcdObjectPtr interface {
+ // May panic(NslcdError) if encountering a network error.
nslcdRead(fd io.Reader)
}