Annotation of libaitsess/contrib/test2.c, revision 1.1.2.2
1.1.2.1 misho 1: #include <stdio.h>
2: #include <string.h>
3: #include <aitsess.h>
1.1.2.2 ! misho 4: #include <aitio.h>
1.1.2.1 misho 5:
1.1.2.2 ! misho 6: int main(int argc, char **argv)
1.1.2.1 misho 7: {
8: tagSess *n = NULL;
1.1.2.2 ! misho 9: array_t *inp;
! 10:
! 11: inp = io_arrayFrom(&argv, argc);
! 12:
1.1.2.1 misho 13: /*
14: map_createSession("/tmp/abra-kadabra-123", 1003, 4096, &n);
15: if (sess_GetErrno()) {
16: printf("Error:: #%d - %s\n", sess_GetErrno(), sess_GetError());
17: return 2;
18: }
19: dat = map_attachSession(n, NULL);
20: if (!dat)
21: return 1;
22: printf("brym n=%d dat=%p dat=%s\n", n, dat, dat);
23: 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:");
24: sess_SetValue(n, "nAuth", NULL);
25: printf("begin>>> String=%s\n", dat);
26: printf("find=%d\n", sess_GetValue(n, "000", NULL, NULL));
27: if (sess_GetErrno()) {
28: printf("Error:: #%d - %s\n", sess_GetErrno(), sess_GetError());
29: return 2;
30: }
31: sess_DelValue(n, "000");
32: printf("CLOSE %p>>> String=%s\n", n->addr, n->addr);
33: strcat(dat, "Blaaaaaaaaaaaaaaaaaa da mu eb* mamataaaaa .....\n");
34: map_detachSession(n);
35: getchar();
36: freeSession(NULL, &n);
37: */
38:
1.1.2.2 ! misho 39: ipc_createSession("/tmp/abra-kadabra-321", 1003, 4096, &n);
1.1.2.1 misho 40: if (sess_GetErrno()) {
41: printf("Error:: #%d - %s\n", sess_GetErrno(), sess_GetError());
42: return 2;
43: }
44: ipc_attachSession(n, NULL);
45: if (!dat)
46: return 1;
47: // sess_SetValue(n, "piuk_gniah++", "mryyynnnnn");
48: printf(">>> String=%s\n", n->addr);
49: getchar();
50: printf("12345678 Define? %d\n", ISDEF(sess_GetValue(n, "12345678", szVal, &i)));
51: printf("111 Define? %d\n", ISDEF(sess_SetValue(n, "111", "321")));
52: printf("88 Define? %d\n", ISDEF(sess_GetValue(n, "88", szVal, &i)));
53: printf("222 find=%d value=%s vlen=%d\n", ISDEF(sess_SetValue(n, "222", NULL)));
54: printf("12345678 find=%d value=%s vlen=%d\n", sess_GetValue(n, "12345678", szVal, &i), szVal, i);
55: printf("111 find=%d value=%s vlen=%d\n", sess_GetValue(n, "111", szVal, &i), szVal, i);
56: printf("222 find=%d value=%s vlen=%d\n", ISDEF(sess_GetValue(n, "222", szVal, &i)), szVal, i);
57: printf("000 find=%d value=%s vlen=%d\n", sess_GetValue(n, "000", szVal, &i), szVal, i);
58: printf("00 find=%d value=%s vlen=%d\n", sess_GetValue(n, "00", szVal, &i), szVal, i);
59: printf("insert Result?%d\n", ISNEW(sess_SetValue(n, "789", "Gniah40")));
60: printf("00 find=%d value=%s vlen=%d\n", sess_GetValue(n, "00", szVal, &i), szVal, i);
61: printf(">>> String=%s\n", n->addr);
62: printf("update Result=%d\n", sess_SetValue(n, "789", NULL));
63: // printf(">>> String=%s\n", dat);
64: // sess_DelValue(n, "789");
65: sess_DelValue(n, "GratisT");
66: sess_DelValue(n, "szUser");
67: getchar();
68: printf("end %p>>> String=%s\n", n->addr, n->addr);
69: ipc_detachSession(n);
70: getchar();
71: ipc_destroySession("/tmp/abra-kadabra-123", &n);
72: return 0;
73: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>