aboutsummaryrefslogtreecommitdiff
path: root/goldap/attribute_description.go
diff options
context:
space:
mode:
authorQuentin Dufour <quentin@deuxfleurs.fr>2021-09-16 13:41:01 +0200
committerQuentin Dufour <quentin@deuxfleurs.fr>2021-09-16 13:41:01 +0200
commit477d7014edc787ba9a977acd19fcbfc55531768b (patch)
treeac8b65be8634fa9526cd727da60893244d11e88a /goldap/attribute_description.go
parenta53641e773730ba171df2602c8d199968d6e6447 (diff)
downloadbottin-477d7014edc787ba9a977acd19fcbfc55531768b.tar.gz
bottin-477d7014edc787ba9a977acd19fcbfc55531768b.zip
Vendor goldap
Diffstat (limited to 'goldap/attribute_description.go')
-rw-r--r--goldap/attribute_description.go50
1 files changed, 50 insertions, 0 deletions
diff --git a/goldap/attribute_description.go b/goldap/attribute_description.go
new file mode 100644
index 0000000..04bb03d
--- /dev/null
+++ b/goldap/attribute_description.go
@@ -0,0 +1,50 @@
+package message
+
+import "fmt"
+
+//
+// AttributeDescription ::= LDAPString
+// -- Constrained to <attributedescription>
+// -- [RFC4512]
+
+func (description AttributeDescription) Pointer() *AttributeDescription { return &description }
+
+func readAttributeDescription(bytes *Bytes) (ret AttributeDescription, err error) {
+ var ldapstring LDAPString
+ ldapstring, err = readLDAPString(bytes)
+ if err != nil {
+ err = LdapError{fmt.Sprintf("readAttributeDescription:\n%s", err.Error())}
+ return
+ }
+ // @TODO: check RFC4512
+ ret = AttributeDescription(ldapstring)
+ return
+}
+
+func readTaggedAttributeDescription(bytes *Bytes, class int, tag int) (ret AttributeDescription, err error) {
+ var ldapstring LDAPString
+ ldapstring, err = readTaggedLDAPString(bytes, class, tag)
+ // @TODO: check RFC4512
+ if err != nil {
+ err = LdapError{fmt.Sprintf("readTaggedAttributeDescription:\n%s", err.Error())}
+ return
+ }
+ ret = AttributeDescription(ldapstring)
+ return
+}
+
+func (description AttributeDescription) size() int {
+ return LDAPString(description).size()
+}
+
+func (description AttributeDescription) sizeTagged(tag int) int {
+ return LDAPString(description).sizeTagged(tag)
+}
+
+func (description AttributeDescription) write(bytes *Bytes) int {
+ return LDAPString(description).write(bytes)
+}
+
+func (description AttributeDescription) writeTagged(bytes *Bytes, class int, tag int) int {
+ return LDAPString(description).writeTagged(bytes, class, tag)
+}