From 74919bfa1107615f77931bd5ee94ef9010832b49 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 5 Sep 2017 16:42:28 -0400 Subject: nslcd_proto: Add some doc comments --- nslcd_proto/io.go | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) 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 +// Copyright (C) 2015, 2017 Luke Shumaker // // 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) } -- cgit v1.2.3