{"id":18576322,"url":"https://github.com/d4vidsha/rpc-framework","last_synced_at":"2025-04-30T10:48:31.870Z","repository":{"id":175822920,"uuid":"646067955","full_name":"d4vidsha/rpc-framework","owner":"d4vidsha","description":"Remote Procedure Call (RPC) framework written in C.","archived":false,"fork":false,"pushed_at":"2023-10-30T03:55:56.000Z","size":122,"stargazers_count":3,"open_issues_count":4,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-30T10:48:27.855Z","etag":null,"topics":["remote-procedure-call","rpc"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/d4vidsha.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-05-27T07:17:49.000Z","updated_at":"2024-05-01T06:09:10.000Z","dependencies_parsed_at":null,"dependency_job_id":"f4795c1e-bba1-4686-a0f0-be185081b29e","html_url":"https://github.com/d4vidsha/rpc-framework","commit_stats":null,"previous_names":["d4vidsha/rpc-framework"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d4vidsha%2Frpc-framework","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d4vidsha%2Frpc-framework/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d4vidsha%2Frpc-framework/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d4vidsha%2Frpc-framework/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/d4vidsha","download_url":"https://codeload.github.com/d4vidsha/rpc-framework/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251685099,"owners_count":21627237,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["remote-procedure-call","rpc"],"created_at":"2024-11-06T23:24:30.827Z","updated_at":"2025-04-30T10:48:31.853Z","avatar_url":"https://github.com/d4vidsha.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Remote Procedure Call (RPC) System\n\nIn this project, we will implement a remote procedure call (RPC) system using a client-server architecture.\n\n## Getting Started\n\n`client.c` and `server.c` are the client and server programs which use the RPC system. The full API of the RPC system is defined in `rpc.h`, while the RPC system is implemented in `rpc.c`.\n\n### Quick Start\n\n```bash\n# compile the client and server programs\nmake\n\n# run the server program on port 8080\n./rpc-server -p 8080\n\n# in another terminal, run the client program on ipv6 loopback address ::1 on port 8080\n./rpc-client -i ::1 -p 8080\n```\n\n```bash\n# clean up the compiled files\nmake clean\n\n# format the source code\nmake format\n```\n\n### Usage\n\n#### Server\n\n```bash\n./rpc-server [-p port]\n```\n\nThe server program will listen for incoming connections on the specified port. If no port is specified, then the server will listen on port 3000.\n\n#### Client\n\n```bash\n./rpc-client [-i ip_address] [-p port]\n```\n\nThe client program will connect to the specified IP address and port. If no IP address is specified, then the client will connect to the ipv6 loopback address `::1`. If no port is specified, then the client will connect to port 3000.\n\n### Development\n\nIf you want to debug the RPC system, then `#define DEBUG TRUE` in `config.h`. This will print out debug messages to `stdout`.\n\nEnsure you are using Valgrind frequently to check for memory leaks:\n\n```bash\nvalgrind --leak-check=full --show-leak-kinds=all ./rpc-server -p 8080\nvalgrind --leak-check=full --show-leak-kinds=all ./rpc-client -i ::1 -p 8080\n```\n\n## About the RPC System\n\n### Protocol Design\n\nWe will use a single `rpc_message` struct to represent both requests and responses.\n\n#### Operations\n\n1. Client sends `rpc_message` to server.\n2. Server receives `rpc_message`.\n3. Server sends a new `rpc_message` to client.\n4. Client receives `rpc_message`.\n\n#### Message Structure\n\nThe `rpc_message` struct will contain the following fields:\n| Field           | Data Type  | Description                                                                                                                                                               |\n|-----------------|------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `request_id`    | `int`      | The ID of the request. Useful for matching requests to responses. The current implementation does not use this but including this may be useful for future extendibility. |\n| `op`            | `enum`     | The operation can be either FIND, CALL, REPLY_SUCCESS, or REPLY_FAILURE.                                                                                                  |\n| `function_name` | `char *`   | The name of the function to be called or returned.                                                                                                                        |\n| `data`          | `rpc_data` | The data to be passed to the function or returned by the function.                                                                                                        |\n\nThis `rpc_message` struct will be serialised into a byte array and sent over the network. When serialising, we already ensure that there are no padding or endianness issues.\n\n## Notable Mentions\n\n- A hash table is used to store the function pointers in the server program.\n- A protocol with a request and response message structure is used to communicate between the client and server programs. The serialisation and deserialisation of the messages are done through functions in `protocol.c`.\n- Elias Gamma Coding is used for the serialisation and deserialisation of `size_t` data types.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fd4vidsha%2Frpc-framework","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fd4vidsha%2Frpc-framework","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fd4vidsha%2Frpc-framework/lists"}