Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cloudwu/pbc
A protocol buffers library for C
https://github.com/cloudwu/pbc
Last synced: about 2 months ago
JSON representation
A protocol buffers library for C
- Host: GitHub
- URL: https://github.com/cloudwu/pbc
- Owner: cloudwu
- License: mit
- Archived: true
- Created: 2011-11-28T19:16:06.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2022-11-03T03:00:02.000Z (over 1 year ago)
- Last Synced: 2024-02-01T08:50:38.223Z (5 months ago)
- Language: C
- Homepage:
- Size: 305 KB
- Stars: 1,609
- Watchers: 165
- Forks: 596
- Open Issues: 74
-
Metadata Files:
- Readme: README.md
- License: license.txt
Lists
- awesome-c - pbc - Protocol buffers library. [`Expat`](https://directory.fsf.org/wiki/License:Expat) (Utilities ## / Vim ###)
- awesome-stars - cloudwu/pbc - A protocol buffers library for C (others)
- awesome-c-zh - pbc - 协议缓冲区库。[](https://spdx.org/licenses/MIT.html) (公用事业 / YAML)
README
## PBC
[![travis-ci status](https://travis-ci.org/cloudwu/pbc.svg?branch=master)](https://travis-ci.org/cloudwu/pbc)
PBC is a google protocol buffers library for C without code generation.
## Quick Example
package tutorial;
message Person {
required string name = 1;
required int32 id = 2; // Unique ID number for this person.
optional string email = 3;
enum PhoneType {
MOBILE = 0;
HOME = 1;
WORK = 2;
}
message PhoneNumber {
required string number = 1;
optional PhoneType type = 2 [default = HOME];
}
repeated PhoneNumber phone = 4;
}```C
struct pbc_rmessage * m = pbc_rmessage_new(env, "tutorial.Person", slice);
printf("name = %s\n", pbc_rmessage_string(m , "name" , 0 , NULL));
printf("id = %d\n", pbc_rmessage_integer(m , "id" , 0 , NULL));
printf("email = %s\n", pbc_rmessage_string(m , "email" , 0 , NULL));int phone_n = pbc_rmessage_size(m, "phone");
int i;for (i=0;i