summaryrefslogtreecommitdiff
path: root/sys/src/libventi/fcallfmt.c
diff options
context:
space:
mode:
authorTaru Karttunen <taruti@taruti.net>2011-03-30 15:46:40 +0300
committerTaru Karttunen <taruti@taruti.net>2011-03-30 15:46:40 +0300
commite5888a1ffdae813d7575f5fb02275c6bb07e5199 (patch)
treed8d51eac403f07814b9e936eed0c9a79195e2450 /sys/src/libventi/fcallfmt.c
Import sources from 2011-03-30 iso image
Diffstat (limited to 'sys/src/libventi/fcallfmt.c')
-rwxr-xr-xsys/src/libventi/fcallfmt.c55
1 files changed, 55 insertions, 0 deletions
diff --git a/sys/src/libventi/fcallfmt.c b/sys/src/libventi/fcallfmt.c
new file mode 100755
index 000000000..9b493f9aa
--- /dev/null
+++ b/sys/src/libventi/fcallfmt.c
@@ -0,0 +1,55 @@
+#include <u.h>
+#include <libc.h>
+#include <venti.h>
+
+int
+vtfcallfmt(Fmt *f)
+{
+ VtFcall *t;
+
+ t = va_arg(f->args, VtFcall*);
+ if(t == nil){
+ fmtprint(f, "<nil fcall>");
+ return 0;
+ }
+ switch(t->msgtype){
+ default:
+ return fmtprint(f, "%c%d tag %ud", "TR"[t->msgtype&1], t->msgtype>>1, t->tag);
+ case VtRerror:
+ return fmtprint(f, "Rerror tag %ud error %s", t->tag, t->error);
+ case VtTping:
+ return fmtprint(f, "Tping tag %ud", t->tag);
+ case VtRping:
+ return fmtprint(f, "Rping tag %ud", t->tag);
+ case VtThello:
+ return fmtprint(f, "Thello tag %ud vers %s uid %s strength %d crypto %d:%.*H codec %d:%.*H", t->tag,
+ t->version, t->uid, t->strength, t->ncrypto, t->ncrypto, t->crypto,
+ t->ncodec, t->ncodec, t->codec);
+ case VtRhello:
+ return fmtprint(f, "Rhello tag %ud sid %s rcrypto %d rcodec %d", t->tag, t->sid, t->rcrypto, t->rcodec);
+ case VtTgoodbye:
+ return fmtprint(f, "Tgoodbye tag %ud", t->tag);
+ case VtRgoodbye:
+ return fmtprint(f, "Rgoodbye tag %ud", t->tag);
+ case VtTauth0:
+ return fmtprint(f, "Tauth0 tag %ud auth %.*H", t->tag, t->nauth, t->auth);
+ case VtRauth0:
+ return fmtprint(f, "Rauth0 tag %ud auth %.*H", t->tag, t->nauth, t->auth);
+ case VtTauth1:
+ return fmtprint(f, "Tauth1 tag %ud auth %.*H", t->tag, t->nauth, t->auth);
+ case VtRauth1:
+ return fmtprint(f, "Rauth1 tag %ud auth %.*H", t->tag, t->nauth, t->auth);
+ case VtTread:
+ return fmtprint(f, "Tread tag %ud score %V blocktype %d count %d", t->tag, t->score, t->blocktype, t->count);
+ case VtRread:
+ return fmtprint(f, "Rread tag %ud count %d", t->tag, packetsize(t->data));
+ case VtTwrite:
+ return fmtprint(f, "Twrite tag %ud blocktype %d count %d", t->tag, t->blocktype, packetsize(t->data));
+ case VtRwrite:
+ return fmtprint(f, "Rwrite tag %ud score %V", t->tag, t->score);
+ case VtTsync:
+ return fmtprint(f, "Tsync tag %ud", t->tag);
+ case VtRsync:
+ return fmtprint(f, "Rsync tag %ud", t->tag);
+ }
+}