commit - 4a1921341a413f7147802d912fe133977642d763
commit + 749e209cc5eeaa07ceace3db6cd03eca8e49e24a
blob - 4a1b7780aef447b311cdd9df18413185c21fc2f2
blob + 21353f51bd2965a456bcd099e33d31aeaa140ab3
--- Makefile
+++ Makefile
-TESTS = test_nfa test_regex test_pcre test_hammer
-APPS = simcard
-OBJS = nfa.o
+TESTS = test_nfa test_regex test_pcre test_hammer
+APPS = simcard
+OBJS = nfa.o
+MANS = simcard.1 nfa.7
+MANDOC ?= mandoc
+PAPER ?= a4
+
.PHONY: all clean benchmark
-all: ${OBJS} ${TESTS} ${APPS}
+all: ${OBJS} ${TESTS} ${APPS} ${MANS}
clean:
- rm -f ${OBJS} ${TESTS} ${APPS}
+ rm -f ${OBJS} ${TESTS} ${APPS} ${MANS}
benchmark: ${TESTS}
./test_nfa -b
./test_regex -b
simcard: $(OBJS) simcard.c
$(CC) $(CFLAGS) -o $@ $(OBJS) $<
+
+
+.SUFFIXES: .mdoc .pdf .html
+.mdoc:
+ $(MANDOC) -I os= -T lint $<
+ cp -f $< $@
+.mdoc.pdf:
+ $(MANDOC) -I os= -O paper=$(PAPER) -T pdf $< > $@
+.mdoc.html:
+ $(MANDOC) -I os= -T html $< > $@
blob - /dev/null
blob + acfcf883916aa6be4aabd70369b218f983b34cad (mode 644)
--- /dev/null
+++ nfa.7.mdoc
+.Dd May 26, 2022
+.Dt NFA 7
+.Os
+.Sh NAME
+.Nm nfa
+.Nd minimalist finite state machine combinators in C
+.Sh INTRODUCTION
+.Sh DESCRIPTION
+.Ss Combinators
+.Ss Internal Representation
+.Ss Input and Output Alphabets
+.Ss Execution Algorithm
+.Sh EXAMPLES
+.Sh SEE ALSO
+.Xr simcard 1 ,
+.Xr nfa 3
+.Sh BIBLIOGRAPHY
+.Sh AUTHORS
+.An Sven M. Hallberg
+.Mt pesco@khjk.org
+.Sh TODO
+.Bd -literal
+- Struktur:
+ - Kombinatoren
+ - Algorithmus zur Ausführung
+ - Innere Darstellung (struct nfa)
+ - Konzept Input/Ausgabe/Aktionen/Gedanken/...
+ - Postelsches Prinzip (neu gedacht / in diesem Kontext)
+ - Anwendungsbeispiel
+
+- Umdrehen (Rollentausch)? <- oder Ausblick?
+
+- Standard-Teile:
+ - Introduction
+ - ...
+ - Evaluation
+ - performance?
+ - security?
+ - Related Work
+ - session languages
+ - session types
+ - ...?
+ - Acknowledgements
+ - Future Directions
+ - Conclusion
+.Ed
blob - /dev/null
blob + 6f1c043a02fbef61696eec1d14e88ab8fdaae33b (mode 644)
--- /dev/null
+++ simcard.1.mdoc
+.Dd March 31, 2022
+.Dt SIMCARD 1
+.Os
+.Sh NAME
+.Nm simcard
+.Nd emulate a SIM card application layer
+.Sh SYNOPSIS
+.Nm
+.Li < command.bin > response.bin
+.Sh DESCRIPTION
+The
+.Nm
+program implements the application layer protocol used by
+mobile telephone SIM cards
+as described in ETSI\ TS\ 102\ 221.
+It reads a single command APDU (application protocol data unit) from
+standard input,
+executes the transaction,
+and writes a corresponding response APDU to standard output.
+Diagnostics appear on standard error.
+.Sh EXIT STATUS
+.Ex -std
+.Sh EXAMPLES
+.Bd -literal
+.Sy $ Li printf '\ex00\exA4\ex00\ex0C' | simcard | od -t x1
+action: SELECT_MF
+0000000 90 00
+0000002
+.Ed
+.Bd -literal
+.Sy $ Li printf '\ex12\ex34' | simcard
+Protocol error.
+.Ed
+.Bd -literal
+.Sy $ Li simcard </dev/null
+Protocol error.
+.Ed
+.Sh DIAGNOSTICS
+.Bl -diag
+.It Protocol error.
+The protocol automaton entered a stuck state.
+Most likely, the input APDU was not recognized.
+.It Trailing garbage (after %n bytes).
+A command APDU of length
+.Ar %n
+was recognized and processed,
+but the rest of the input was not.
+.El
+.Sh SEE ALSO
+.Xr od 1 ,
+.Xr printf 1 ,
+.Xr nfa 3
+.Sh STANDARDS
+.Rs
+.%R ISO/IEC 7816
+.%T Identification cards \(em Integrated circuit cards \(em \
+ Part 4: Organization, security and commands for interchange
+.%D 2005
+.Re
+.Pp
+.Rs
+.%R ETSI TS 102 221
+.%T Smart Cards; UICC-Terminal interface; Physical and logical characteristics
+.%D 2020
+.Re
+.Sh AUTHORS
+.An Sven M. Hallberg
+.Mt pesco@khjk.org
+.Sh BUGS
+Currently, only the
+.Qq SELECT MF
+command is implemented as a stub.