Browse Source

faux.msg: Description

Serj Kalichev 3 years ago
parent
commit
54ce531bb7
3 changed files with 24 additions and 28 deletions
  1. 1 0
      faux/all.h
  2. 20 25
      faux/msg.h
  3. 3 3
      faux/msg/msg.c

+ 1 - 0
faux/all.h

@@ -18,4 +18,5 @@
 #include <faux/file.h>
 #include <faux/ini.h>
 #include <faux/sched.h>
+#include <faux/msg.h>
 #include <faux/testc_helpers.h>

+ 20 - 25
faux/msg.h

@@ -1,37 +1,32 @@
-/** @file proto.h
+/** @file msg.h
  *
  * @brief Library to implement simple network protocol
  *
- * CRSP is a protocol to send requests to CRSP server. CRSP server stores
- * information about CDPs, periodically renews CRLs.
+ * Message (request or answer) has the following structure:
  *
- * The CRSP protocol supposes request/answer method. Each request must have an
- * answer. The CRSP server is synchronous. It means that server will answer
- * immediately or nearly immediately. It can plans a long-time operations but
- * it sends answer to client immediately. For example client asks for status
- * of specified CDP but server has no such CDP in its database. So server will
- * answer with status something like "has no such CDP yet" immediately but it
- * schedules the long-time task to get CDP information. Later client can send
- * the same request but now server already has a status for specified CDP and
- * answers with correspondent status.
- *
- * Each CRSP protocol message (request or answer) has the same structure:
- *
- * [ CRSP header ]
- * [ CRSP first parameter's header ]
+ * [ Message header ]
+ * [ First parameter's header ]
  * [ ... ]
- * [ CRSP n-th parameter's header ]
+ * [ N-th parameter's header ]
  * [ First parameter's data ]
  * [ ... ]
  * [ N-th parameter's data ]
  *
- * The length of CRSP message can vary. CRSP header has constant length and
- * contains total length of whole message and number of parameters. It also
- * contains magic number, CRSP version number, CRSP command, status and
- * request ID (to identify request/answer). There are parameter header for each
- * parameter. Parameter's header contains parameter type and length of
- * parameter. After parameter headers array the parameter's data follows in
- * a sequence.
+ * Message header has such standard fields as:
+ * - Magic number
+ * - Protocol version major number
+ * - Protocol version minor number
+ * - Command code
+ * - Status
+ * - Request ID field to identify session
+ * - Number of parameters
+ * - Whole message length
+ *
+ * The length of message can vary. Header has constant length and
+ * contains total length of whole message and number of parameters. There are
+ * parameter headers for each parameter. Parameter's header contains parameter
+ * type and length of parameter. After parameter headers array the parameter's
+ * data follows in a sequence.
  */
 
 

+ 3 - 3
faux/msg/msg.c

@@ -1,7 +1,7 @@
-/** @file crsp_msg.c
- * @brief Class represents a single message of CRSP protocol.
+/** @file msg.c
+ * @brief Class represents a single message for custom protocol.
  *
- * CRSP message consist of main header, a block of parameter headers and then
+ * Message consist of main header, a block of parameter headers and then
  * parameters themselfs. Class stores these data. Additionally class knows
  * the structure of message and can send and receive messages via socket. It
  * uses external faux_net_t object to do so. The receive function is necessary