mirror of https://github.com/sipwise/libtcap.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
2.6 KiB
57 lines
2.6 KiB
#include <stdio.h>
|
|
#include "libtcap.h"
|
|
#include "ComponentPortion.h"
|
|
#include "Component.h"
|
|
|
|
|
|
|
|
//const char tcap[] = "\x64\x81\x86\x49\x03\x0a\x7e\x71\x6b\x2a\x28\x28\x06\x07\x00\x11\x86\x05\x01\x01\x01\xa0\x1d\x61\x1b\xa1\x0d\x06\x0b\x2a\x81\x76\x82\x15\x01\x01\x01\x01\x00\x01\xa2\x03\x02\x01\x00\xa3\x05\xa1\x03\x02\x01\x00\x6c\x53\xa1\x10\x02\x01\x58\x02\x01\x22\xbf\x33\x07\x83\x05\x31\x30\x30\x32\x34\xa1\x3f\x02\x01\x59\x02\x01\x14\x30\x37\xa0\x0e\x04\x0c\x83\x90\x89\x10\x10\x80\x22\x08\x00\x55\x50\x05\x83\x01\x09\x9a\x22\x30\x20\xa0\x1e\x80\x01\x00\x81\x01\x00\x82\x01\x01\x83\x01\x01\x84\x01\x00\x85\x01\x00\x86\x01\x01\x87\x01\x01\x88\x01\x00\x89\x01\x00";
|
|
//const char tcap[] = "\x62\x51\x48\x03\x0a\x7e\x71\x6b\x22\x28\x20\x06\x07\x00\x11\x86\x05\x01\x01\x01\xa0\x15\x60\x13\x80\x02\x07\x80\xa1\x0d\x06\x0b\x2a\x81\x76\x82\x15\x01\x01\x01\x01\x00\x01\x6c\x26\xa1\x24\x02\x01\x01\x02\x01\x00\x30\x1c\x80\x01\x02\x82\x07\x03\x90\x08\x00\x55\x50\xf5\x83\x07\x83\x13\x17\x45\x64\x86\x08\x85\x01\x0a\x9a\x02\x20\x01";
|
|
const char tcap[] = {
|
|
0x62, 0x1c, 0x48, 0x00, 0x6c, 0x18, 0xa1, 0x16, 0x02, 0x01, 0x00, 0x02,
|
|
0x01, 0x14, 0x30, 0x0e, 0xa0, 0x0c, 0x04, 0x0a, 0x31, 0x32, 0x33, 0x34,
|
|
0x35, 0x36, 0x37, 0x38, 0x39, 0x30
|
|
};
|
|
//const int tcap_len = sizeof(tcap) - 1;
|
|
const int tcap_len = sizeof(tcap);
|
|
|
|
static void print_outbuf(const char *desc, int ret, struct output_buffer *out)
|
|
{
|
|
printf("%s: returned %i, value: ", desc, ret);
|
|
for (int i = 0; i < out->used; i++)
|
|
printf("%#02x ", out->buf[i]);
|
|
printf("\n");
|
|
}
|
|
|
|
int main() {
|
|
int i;
|
|
struct output_buffer out;
|
|
char buf[256];
|
|
|
|
// OUTPUT_BUFFER_INIT(&out, buf);
|
|
// i = tcap_extract(tcap, tcap_len, "end.components.1.invoke.opCode.localValue", &out);
|
|
// print_outbuf("tcap_extract opcode", i, &out);
|
|
//
|
|
// OUTPUT_BUFFER_INIT(&out, buf);
|
|
// i = inap_extract(tcap, tcap_len, "ConnectArg", &out);
|
|
// print_outbuf("inap_extract ConnectArg", i, &out);
|
|
//
|
|
// OUTPUT_BUFFER_INIT(&out, buf);
|
|
// i = inap_extract(tcap, tcap_len, "ConnectArg.cutAndPaste", &out);
|
|
// print_outbuf("inap_extract ConnectArg.cutAndPaste", i, &out);
|
|
//
|
|
// OUTPUT_BUFFER_INIT(&out, buf);
|
|
// i = inap_extract(tcap, tcap_len, "ConnectArg.destinationRoutingAddress", &out);
|
|
// print_outbuf("inap_extract ConnectArg.destinationRoutingAddress", i, &out);
|
|
//
|
|
OUTPUT_BUFFER_INIT(&out, buf);
|
|
i = inap_extract(tcap, tcap_len, "ConnectArg.destinationRoutingAddress.0", &out);
|
|
print_outbuf("inap_extract ConnectArg", i, &out);
|
|
|
|
// OUTPUT_BUFFER_INIT(&out, buf);
|
|
// i = inap_extract(tcap, tcap_len, "InitialDPArg.calledPartyNumber", &out);
|
|
// print_outbuf("inap_extract InitialDPArg", i, &out);
|
|
|
|
return 0;
|
|
}
|