$ git clone https://socialnetwork.ion.nu/socialnetwork.git
commit 32c3e417ca31e0f32093514e21cf9365b0bb0f44
Author: Alicia <...>
Date:   Wed Jul 26 16:57:13 2017 +0000

    Documented some of the peer API.

diff --git a/Documentation/api/socialnetwork-docs.xml b/Documentation/api/socialnetwork-docs.xml
index 7c460ba..674740f 100644
--- a/Documentation/api/socialnetwork-docs.xml
+++ b/Documentation/api/socialnetwork-docs.xml
@@ -8,7 +8,7 @@
   <bookinfo>
     <title>SocialNetwork Reference Manual</title>
     <releaseinfo>
-      for socialnetwork 0.x.
+      For SocialNetwork 0.x.
       The latest version of this documentation can be found on-line at
       <ulink role="online-location" url="https://socialnetwork.ion.nu/apidocs/">https://socialnetwork.ion.nu/apidocs/</ulink>.
     </releaseinfo>
@@ -33,10 +33,12 @@
     <title>API Index</title>
     <xi:include href="xml/api-index-full.xml"><xi:fallback /></xi:include>
   </index>
+  <!--
   <index id="deprecated-api-index" role="deprecated">
     <title>Index of deprecated API</title>
     <xi:include href="xml/api-index-deprecated.xml"><xi:fallback /></xi:include>
   </index>
+  -->
   <!-- enable this when you use gobject introspection annotations
   <xi:include href="xml/annotation-glossary.xml"><xi:fallback /></xi:include>
   -->
diff --git a/peer.h b/peer.h
index 85811d9..f4a5dc8 100644
--- a/peer.h
+++ b/peer.h
@@ -26,8 +26,29 @@
 #include <stdint.h>
 #include <gnutls/gnutls.h>
 #include "udpstream.h"
+/**
+* ID_SIZE:
+*
+* Number of bytes required to store a (binary) peer ID
+*/
 #define ID_SIZE 32
 
+/**
+* peer:
+* @peercount: The number of other peers this peer is connected to
+* @stream: The UDP stream connection to this peer
+* @tls: The TLS session on top of the UDP stream
+* @handshake: Whether the TLS handshake has been completed
+* @cmdlength: Length of an incomplete incoming command's name
+* @cmdname: Name of incomplete incoming command
+* @datalength: Length of an incomplete incoming command's data/parameters
+* @addr: Peer's address
+* @addrlen: Length of peer's address
+* @id: User ID, binary SHA2-256 fingerprint of public key
+* @cert: Certificate, containing the full public key
+*
+* A peer
+*/
 struct peer
 {
   unsigned int peercount;
@@ -39,26 +60,79 @@ struct peer
   int32_t datalength;
   struct sockaddr_storage addr;
   socklen_t addrlen;
-  unsigned char id[ID_SIZE]; // SHA2-256 sum of public key (binary)
+  unsigned char id[ID_SIZE];
   gnutls_x509_crt_t cert;
   // TODO: Account stuff?
 };
-// Macros for printing peer IDs in printf-family of functions
+
+/**
+* PEERFMT:
+*
+* Format string for printing peer IDs using the printf-family of functions, combine with PEERARG()
+*/
 #define PEERFMT "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x"
+/**
+* PEERARG:
+* @x: Binary peer ID
+*
+* Utility macro for printing peer IDs using the printf-family of functions, combine with #PEERFMT
+*/
 #define PEERARG(x) x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19],x[20],x[21],x[22],x[23],x[24],x[25],x[26],x[27],x[28],x[29],x[30],x[31]
 extern unsigned char peer_id[ID_SIZE];
 extern gnutls_privkey_t peer_privkey;
 
+/**
+* peer_registercmd:
+* @name: Command
+* @callback: Function to handle the command.
+* Called with a pointer to the sender's #peer structure,
+* a pointer to parameter data, and the length of the data
+*
+* Registers a callback to handle the specified command
+*/
 extern void peer_registercmd(const char* name, void(*callback)(struct peer*,void*,unsigned int));
 extern void peer_init(const char* keypath);
 extern struct peer* peer_new(struct udpstream* stream, char server);
 extern struct peer* peer_get(struct udpstream* stream);
 extern struct peer* peer_new_unique(int sock, struct sockaddr_storage* addr, socklen_t addrlen);
 extern void peer_bootstrap(int sock, const char* peerlist);
-extern void peer_handlesocket(int sock); // Incoming data
+/**
+* peer_handlesocket:
+* @sock: UDP socket
+*
+* Handle incoming network data, calls callbacks registered with peer_registercmd()
+*/
+extern void peer_handlesocket(int sock);
+/**
+* peer_sendcmd:
+* @peer: Recipient peer
+* @cmd: Command name
+* @data: Parameter data
+* @len: Length of data
+*
+* Send a command/request to another peer
+*/
 extern void peer_sendcmd(struct peer* peer, const char* cmd, const void* data, uint32_t len);
 extern void peer_disconnect(struct peer* peer, char cleanly);
-extern void peer_findpeer(const unsigned char id[ID_SIZE]); // Find and ask a peer to connect to us
+/**
+* peer_findpeer:
+* @id: Peer ID
+*
+* Find and ask a peer to connect to us
+*/
+extern void peer_findpeer(const unsigned char id[ID_SIZE]);
+/**
+* peer_findbyid:
+* @id: Peer ID
+*
+* Get the #peer struct of a connected peer by its ID
+*/
 extern struct peer* peer_findbyid(const unsigned char id[ID_SIZE]);
+/**
+* peer_exportpeers:
+* @path: Filename to write the list to
+*
+* Generate a list of peer addresses for bootstrapping
+*/
 extern void peer_exportpeers(const char* path);
 #endif