|
|
| version 1.1, 2011/09/07 15:59:46 | version 1.1.2.1, 2011/09/07 15:59:46 |
|---|---|
| Line 0 | Line 1 |
| #include <stdio.h> | |
| #include <string.h> | |
| #include <aitsess.h> | |
| int main() | |
| { | |
| tagSess *n = NULL; | |
| int i = 255; | |
| char *dat, szVal[256]; | |
| /* | |
| 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); | |
| */ | |
| ipc_createSession("/tmp/abra-kadabra-123", 1003, 4096, &n); | |
| if (sess_GetErrno()) { | |
| printf("Error:: #%d - %s\n", sess_GetErrno(), sess_GetError()); | |
| return 2; | |
| } | |
| ipc_attachSession(n, NULL); | |
| if (!dat) | |
| return 1; | |
| // sess_SetValue(n, "piuk_gniah++", "mryyynnnnn"); | |
| printf(">>> String=%s\n", n->addr); | |
| getchar(); | |
| printf("12345678 Define? %d\n", ISDEF(sess_GetValue(n, "12345678", szVal, &i))); | |
| printf("111 Define? %d\n", ISDEF(sess_SetValue(n, "111", "321"))); | |
| printf("88 Define? %d\n", ISDEF(sess_GetValue(n, "88", szVal, &i))); | |
| printf("222 find=%d value=%s vlen=%d\n", ISDEF(sess_SetValue(n, "222", NULL))); | |
| printf("12345678 find=%d value=%s vlen=%d\n", sess_GetValue(n, "12345678", szVal, &i), szVal, i); | |
| printf("111 find=%d value=%s vlen=%d\n", sess_GetValue(n, "111", szVal, &i), szVal, i); | |
| printf("222 find=%d value=%s vlen=%d\n", ISDEF(sess_GetValue(n, "222", szVal, &i)), szVal, i); | |
| printf("000 find=%d value=%s vlen=%d\n", sess_GetValue(n, "000", szVal, &i), szVal, i); | |
| printf("00 find=%d value=%s vlen=%d\n", sess_GetValue(n, "00", szVal, &i), szVal, i); | |
| printf("insert Result?%d\n", ISNEW(sess_SetValue(n, "789", "Gniah40"))); | |
| printf("00 find=%d value=%s vlen=%d\n", sess_GetValue(n, "00", szVal, &i), szVal, i); | |
| printf(">>> String=%s\n", n->addr); | |
| printf("update Result=%d\n", sess_SetValue(n, "789", NULL)); | |
| // printf(">>> String=%s\n", dat); | |
| // sess_DelValue(n, "789"); | |
| sess_DelValue(n, "GratisT"); | |
| sess_DelValue(n, "szUser"); | |
| getchar(); | |
| printf("end %p>>> String=%s\n", n->addr, n->addr); | |
| ipc_detachSession(n); | |
| getchar(); | |
| ipc_destroySession("/tmp/abra-kadabra-123", &n); | |
| return 0; | |
| } |