#include <stdio.h>
#include <string.h>
#include <aitsess.h>
#include <aitio.h>
int main(int argc, char **argv)
{
tagSess *n = NULL;
array_t *inp;
ait_val_t *v;
int i;
inp = io_arrayInit(argc);
for (i = 0; i < argc; i++) {
v = malloc(sizeof(ait_val_t));
AIT_SET_STR(v, argv[i]);
io_arraySet(inp, i, v);
}
/*
map_createSession("/tmp/abra-kadabra-123", 1003, 4096, &n);
if (sess_GetErrno()) {
printf("Error:: #%d - %s\n", sess_GetErrno(), sess_GetError());
return 2;
}
dat = map_attachSession(n, NULL);
if (!dat)
return 1;
printf("brym n=%d dat=%p dat=%s\n", n, dat, dat);
strcpy(dat, "nAuth=1:nStatus=0:szChanne=SIP/0765-4802:szSID=437d9371-3977e2de-099999:szUser=099999:szPass=123123:szCaller=123123123:szRadGro=ppcards:szPhone=0768:ExtCode=07:szDispl=Bulgaria:nMasterG=1:nPrice=82:nGPrice=82:nMPrice=82:nBillInc=2:nGBillIn=2:nMBillIn=2:nMCache=807901468:nCache=999338:nAccount=29297:nPricePa=1:nGPriceP=1:nMPriceP=1:WarnTime=0:GratisTi=0:ActTime=1132220092:");
sess_SetValue(n, "nAuth", NULL);
printf("begin>>> String=%s\n", dat);
printf("find=%d\n", sess_GetValue(n, "000", NULL, NULL));
if (sess_GetErrno()) {
printf("Error:: #%d - %s\n", sess_GetErrno(), sess_GetError());
return 2;
}
sess_DelValue(n, "000");
printf("CLOSE %p>>> String=%s\n", n->addr, n->addr);
strcat(dat, "Blaaaaaaaaaaaaaaaaaa da mu eb* mamataaaaa .....\n");
map_detachSession(n);
getchar();
freeSession(NULL, &n);
*/
if (ipc_createSession("/tmp/abra-kadabra-321", 1003, 4096, &n) == -1) {
printf("Error:: #%d - %s\n", sess_GetErrno(), sess_GetError());
return 2;
}
if (sess_commitSession(n, inp) == -1) {
printf("Error:: #%d - %s\n", sess_GetErrno(), sess_GetError());
DESTROY_SESSION("/tmp/abra-kadabra-321", &n);
return 2;
}
freeSession(NULL, &n);
io_arrayFree(inp);
io_arrayDestroy(&inp);
printf("set session");
getchar();
ipc_createSession("/tmp/abra-kadabra-321", 1003, 4096, &n);
if (sess_GetErrno()) {
printf("Error:: #%d - %s\n", sess_GetErrno(), sess_GetError());
return 3;
}
if (!(inp = sess_prepareSession(n, 0))) {
printf("Error:: #%d - %s\n", sess_GetErrno(), sess_GetError());
DESTROY_SESSION("/tmp/abra-kadabra-321", &n);
return 3;
}
for (i = 0; i < io_arraySize(inp); i++)
printf("i=%d->%s\n", i, AIT_GET_STR(io_array(inp, i, ait_val_t*)));
sess_doneSession(n, &inp);
freeSession(NULL, &n);
getchar();
ipc_createSession("/tmp/abra-kadabra-321", 1003, 4096, &n);
if (sess_GetErrno()) {
printf("Error:: #%d - %s\n", sess_GetErrno(), sess_GetError());
return 4;
}
if (!(inp = sess_prepareSession(n, 0))) {
printf("Error:: #%d - %s\n", sess_GetErrno(), sess_GetError());
DESTROY_SESSION("/tmp/abra-kadabra-321", &n);
return 4;
}
AIT_FREE_VAL(io_array(inp, 2, ait_val_t*));
AIT_SET_STR(io_array(inp, 2, ait_val_t*), "djmy");
for (i = 0; i < io_arraySize(inp); i++)
printf("i=%d->%s\n", i, AIT_GET_STR(io_array(inp, i, ait_val_t*)));
sess_commitSession(n, inp);
sess_doneSession(n, &inp);
freeSession(NULL, &n);
getchar();
ipc_createSession("/tmp/abra-kadabra-321", 1003, 4096, &n);
if (sess_GetErrno()) {
printf("Error:: #%d - %s\n", sess_GetErrno(), sess_GetError());
return 3;
}
if (!(inp = sess_prepareSession(n, 0))) {
printf("Error:: #%d - %s\n", sess_GetErrno(), sess_GetError());
DESTROY_SESSION("/tmp/abra-kadabra-321", &n);
return 3;
}
for (i = 0; i < io_arraySize(inp); i++)
printf("i=%d->%s\n", i, AIT_GET_STR(io_array(inp, i, ait_val_t*)));
sess_doneSession(n, &inp);
DESTROY_SESSION("/tmp/abra-kadabra-321", &n);
return 0;
}
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>