Skip to content
This repository was archived by the owner on Nov 16, 2020. It is now read-only.

Commit fd57213

Browse files
authored
Update README.md
1 parent 1f0e98b commit fd57213

File tree

1 file changed

+54
-1
lines changed

1 file changed

+54
-1
lines changed

README.md

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,54 @@
1-
# oncrpc-api-design
1+
# ONC/RPC API Design
2+
3+
4+
- Example 1 [rls](https://github.com/phyunsj/oncrpc-api-design/tree/master/rls) (remote `ls` - original version)
5+
6+
- Example 2 [rls_v2](https://github.com/phyunsj/oncrpc-api-design/tree/master/rls_v2) (revised)
7+
8+
- Example 3 [calc](https://github.com/phyunsj/oncrpc-api-design/tree/master/calc)
9+
10+
## Example 3 calc
11+
12+
**ONCRPC** restricted us to remote procedures that accept a single parameter and return a single parameter. (Might not be true now but stick to this restriction)
13+
14+
Instead of starting with **IDL** (like Example 1 & 2), start wtih **API.h** and generate ONCRPC middle-layer automatically. Keep (or share) the same local implementation between RPC server and RPC client.
15+
16+
17+
Similar to non-RPC application, the below files are manaully created. Create RPC middle-layer to integrate the local APIs defined in `cl_calc.h`.
18+
19+
`cl_common.c/h` : RPC Client handler
20+
`cl_calc.c/h` : functions declaration, definition.
21+
`cl_client.c` : client main program
22+
23+
**CL** is an imaginary product name for example 3.
24+
25+
26+
1. **cpp** cl_calc.h -o cl_calc.i
27+
2. **pycparser** to generate AST
28+
3. AST visitor extracts ***typdef*** & *** fucntion declaration *** out of AST
29+
4. generate IDL & RPC middle-layer Interface
30+
31+
The following files are generated from `cl_calc.h`
32+
33+
- CL.x (ONCRPC IDL)
34+
- CL_proc.c (Client Middlelayer)
35+
- CL_svc_proc.c (Server Middlelayer)
36+
- CL_proc.h
37+
38+
`CL.x` generates :
39+
40+
- CL.h
41+
- CL_svc.c
42+
- CL_clnt.c
43+
- CL_xdr.c
44+
45+
46+
## FYI
47+
48+
### pycparser
49+
50+
Complete C99 parser in pure Python
51+
52+
**pycparser** installation. ( powered by [PLY](https://github.com/dabeaz/ply) )
53+
54+
> pip install --index-url=https://pypi.python.org/simple/ pycparser

0 commit comments

Comments
 (0)