X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=lib%2Fjson.h;h=cfe9457ef82c641d76c47e4df7ec43a114c76c89;hb=0ef165ecb57943e17a8ee8270df68ffb8d032e29;hp=611dea50e6a72d4d3560d21c6f6becd8c26922a6;hpb=f6f8c3ba779e357801ebaefdf8ef8a426ab73ea4;p=sliver-openvswitch.git diff --git a/lib/json.h b/lib/json.h index 611dea50e..cfe9457ef 100644 --- a/lib/json.h +++ b/lib/json.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009 Nicira Networks. + * Copyright (c) 2009, 2010 Nicira, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,6 +32,12 @@ #include "shash.h" +#ifdef __cplusplus +extern "C" { +#endif + +struct ds; + /* Type of a JSON value. */ enum json_type { JSON_NULL, /* null */ @@ -111,6 +117,7 @@ void json_parser_abort(struct json_parser *); struct json *json_from_string(const char *string); struct json *json_from_file(const char *file_name); +struct json *json_from_stream(FILE *stream); /* Serializing JSON. */ @@ -119,5 +126,14 @@ enum { JSSF_SORT = 1 << 1 /* Object members in sorted order, if true. */ }; char *json_to_string(const struct json *, int flags); +void json_to_ds(const struct json *, int flags, struct ds *); + +/* JSON string formatting operations. */ + +bool json_string_unescape(const char *in, size_t in_len, char **outp); + +#ifdef __cplusplus +} +#endif #endif /* json.h */