lwres_test.c revision e4f074a2c2340ea80099beebecc3b89aa234fa8f
6fe42ff85ced80bd2ccc49b429d36831b5f2a5b9Tinderbox User * Copyright (C) 1999 Internet Software Consortium.
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence * Permission to use, copy, modify, and distribute this software for any
ec5347e2c775f027573ce5648b910361aa926c01Automatic Updater * purpose with or without fee is hereby granted, provided that the above
6017f424ee3c02d7f22132c77576ea38542fa949Andreas Gustafsson * copyright notice and this permission notice appear in all copies.
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
6017f424ee3c02d7f22132c77576ea38542fa949Andreas Gustafssonstatic inline void
9c566a852f31c3a5d0b9d6eaf11463114339c01dAndreas Gustafsson fprintf(stderr, "%s returned %d\n", msg, val);
743bbdc18f839499862e4fb28ec32f607b1632dcTatuya JINMEI 神明達哉hexdump(char *msg, void *base, size_t len)
5afa531442369eed0e93a8af14422b30f400bd89Mark Andrews unsigned char *p;
8907d8fa04fdaa65baf0bc6b01230b2ebde93106Mark Andrews unsigned int cnt;
90c099e88e9f16bfee9edee3ac1a51fc98843772Brian Wellington printf("*** %s (%u bytes @ %p)\n", msg, len, base);
1adb2e87a20a480e640385609c9652dac04c7dffAndreas Gustafssonstatic char *TESTSTRING = "This is a test. This is only a test. !!!";
351b62535d4c4f89883bfdba025999dd32490266Evan Hunt lwres_noopresponse_t noopresponse, *noopresponse2;
6017f424ee3c02d7f22132c77576ea38542fa949Andreas Gustafsson ret = lwres_context_create(&ctx, NULL, NULL, NULL);
6017f424ee3c02d7f22132c77576ea38542fa949Andreas Gustafsson nooprequest.datalength = strlen(TESTSTRING);
45e1bd63587102c3bb361eaca42ee7b714fb3542Mark Andrews ret = lwres_nooprequest_render(ctx, &nooprequest, &pkt, &b);
11156f82bab19b2e7f5d4df6184ae0c99518442fAutomatic Updater * Now, parse it into a new structure.
11156f82bab19b2e7f5d4df6184ae0c99518442fAutomatic Updater ret = lwres_nooprequest_parse(ctx, &b, &pkt2, &nooprequest2);
5a17fe2916ce37793c12b243ab08c16095a59cf7Evan Hunt assert(nooprequest.datalength == nooprequest2->datalength);