acme-client/src/mimik_acme_client.c
int mk_json_parse_directory_resource(char *databuff, acme_directory *dr)
{
   cJSON *jroot = NULL;
   char *name = NULL;
   int rc = 0;

   if ((!databuff) || (!dr)) {
      return -1;
   }

   if (dr->jroot != NULL) {
      MK_LOG(LOG_ERR,"%s() dr->jroot=%p is not empty, may have been parsed already \n",__func__,dr->jroot);
      mk_json_free_directory_resource(dr);
   }

   jroot = cJSON_Parse(databuff);
   if (!jroot) {
      return -1;
   }
   dr->jroot = jroot;

   //"newAccount"
    name = "newAccount";
    rc = mk_json_get_string_item_value(jroot,name,&dr->newAccount);
    if (rc == 0) {
        MK_LOG(LOG_DEBUG,"%s() name(%s) => value(%s) \n ",__func__,name,dr->newAccount);
    }

   //"newNonce"
    name = "newNonce";
    rc = mk_json_get_string_item_value(jroot,name,&dr->newNonce);
    if (rc == 0) {
        MK_LOG(LOG_DEBUG,"%s() name(%s) => value(%s) \n ",__func__,name,dr->newNonce);
    }

   //"newOrder"
    name = "newOrder";
    rc = mk_json_get_string_item_value(jroot,name,&dr->newOrder);
    if (rc == 0) {
        MK_LOG(LOG_DEBUG,"%s() name(%s) => value(%s) \n ",__func__,name,dr->newOrder);
    }

   return 0;
}
//mk_json_parse_directory_resource() parses the content of the string databuff as
//JSON object to equivalent c struct and places the result in structure members.
//returns 0 on success and -1 on failure
mk_json_parse_directory_resource() parses the content of the string databuff as
JSON object to equivalent c struct and places the result in structure members.
returns 0 on success and -1 on failure
mk_json_parse_directory_resource () parses the content of the string databuff as JSON object to equivalent c struct and places the result in structure members . returns 0 on success and - 1 on failure
int mk_json_parse_directory_resource(char *databuff, acme_directory *dr)
{
   cJSON *jroot = NULL;
   char *name = NULL;
   int rc = 0;
   if ((!databuff) || (!dr)) {
      return -1;
   }
   if (dr->jroot != NULL) {
      MK_LOG(LOG_ERR,"%s() dr->jroot=%p is not empty, may have been parsed already \n",__func__,dr->jroot);
      mk_json_free_directory_resource(dr);
   }
   jroot = cJSON_Parse(databuff);
   if (!jroot) {
      return -1;
   }
   dr->jroot = jroot;
    name = "newAccount";
    rc = mk_json_get_string_item_value(jroot,name,&dr->newAccount);
    if (rc == 0) {
        MK_LOG(LOG_DEBUG,"%s() name(%s) => value(%s) \n ",__func__,name,dr->newAccount);
    }
    name = "newNonce";
    rc = mk_json_get_string_item_value(jroot,name,&dr->newNonce);
    if (rc == 0) {
        MK_LOG(LOG_DEBUG,"%s() name(%s) => value(%s) \n ",__func__,name,dr->newNonce);
    }
    name = "newOrder";
    rc = mk_json_get_string_item_value(jroot,name,&dr->newOrder);
    if (rc == 0) {
        MK_LOG(LOG_DEBUG,"%s() name(%s) => value(%s) \n ",__func__,name,dr->newOrder);
    }
   return 0;
}
int mk_json_parse_directory_resource ( char * databuff , acme_directory * dr ) { cJSON * jroot = NULL ; char * name = NULL ; int rc = 0 ; if ( ( ! databuff ) || ( ! dr ) ) { return -1 ; } if ( dr -> jroot != NULL ) { MK_LOG ( LOG_ERR , " \n " , __func__ , dr -> jroot ) ; mk_json_free_directory_resource ( dr ) ; } jroot = cJSON_Parse ( databuff ) ; if ( ! jroot ) { return -1 ; } dr -> jroot = jroot ; name = " " ; rc = mk_json_get_string_item_value ( jroot , name , & dr -> newAccount ) ; if ( rc == 0 ) { MK_LOG ( LOG_DEBUG , " \n " , __func__ , name , dr -> newAccount ) ; } name = " " ; rc = mk_json_get_string_item_value ( jroot , name , & dr -> newNonce ) ; if ( rc == 0 ) { MK_LOG ( LOG_DEBUG , " \n " , __func__ , name , dr -> newNonce ) ; } name = " " ; rc = mk_json_get_string_item_value ( jroot , name , & dr -> newOrder ) ; if ( rc == 0 ) { MK_LOG ( LOG_DEBUG , " \n " , __func__ , name , dr -> newOrder ) ; } return 0 ; }
mk_json_parse_directory_resource() parses the content of the string databuff as
JSON object to equivalent c struct and places the result in structure members.
mk_json_parse_directory_resource () parses the content of the string databuff as JSON object to equivalent c struct and places the result in structure members .
//"newAccount" //"newNonce" //"newOrder"