void smbs_display_users(void) { int i, j; char rtsmb_user[CFG_RTSMB_MAX_USERNAME_SIZE + 1]; /* ascii user name */ int uid; rtp_printf("************** USERS ****************\n"); for (i = 0; i < prtsmb_srv_ctx->max_users; i++) { if (prtsmb_srv_ctx->userList.users[i].inUse) { rtsmb_util_rtsmb_to_ascii(prtsmb_srv_ctx->userList.users[i].name, rtsmb_user, CFG_RTSMB_USER_CODEPAGE); rtp_printf("USER TABLE ENTRY: %d USER: %s; PASSWORD: %s\n", i, rtsmb_user, prtsmb_srv_ctx->userList.users[i].password); uid = getUserIdFromName (prtsmb_srv_ctx->userList.users[i].name); rtp_printf("USER TABLE ENTRY: UID %d\n", uid); for (j = 0; j < prtsmb_srv_ctx->groupList.numGroups; j++) { if (prtsmb_srv_ctx->userList.users[uid].groups[j]) { rtp_printf("USER TABLE ENTRY: in GROUP %d\n", j); } } } } }
/* Test routines */ void wait_for_card_insert(void) { while ((sdcard_driveflags[0] & SDCARD_INSERTED)==0) { rtp_printf("Now re-insert the card card\r"); } rtp_printf("\n"); }
/** @memo Prompt the user for input. @doc Displays a prompt and retrieve keyboard input from the user. @return Nothing */ void rtp_gui_prompt_text(char *indent /** String of spaces used to indent before prompt. */, char *prompt,/** Prompt to display */ char *inbuffer/** Input goes here. Not length checked so use large buffers. */) { rtp_printf("%s %s :", indent, prompt); rtp_term_gets(inbuffer); rtp_printf("\n"); }
int printit(unsigned long *l) { int i,ii; for (i=0; i<2; i++) { for (ii=0; ii<8; ii++) { rtp_printf("%08lx ",l[i*8+ii]); } rtp_printf("\n"); } }
void wait_for_card_swap(void) { while (sdcard_driveflags[0] & SDCARD_INSERTED) { rtp_printf("Now remove the card card\r"); } wait_for_card_insert(); while ((sdcard_driveflags[0] & SDCARD_INSERTED)==0) { rtp_printf("Now re-insert the card card\r"); } }
void rtp_log_open(void) { if (rtp_file_open( &debugfd, LOG_FILENAME, RTP_FILE_O_RDWR|RTP_FILE_O_CREAT |RTP_FILE_O_TRUNC|RTP_FILE_O_BINARY, RTP_FILE_S_IWRITE|RTP_FILE_S_IREAD)==0) { start_system_msec = rtp_get_system_msec (); debugfd_valid = 1; rtp_printf("Logging enabled logging to file:%s\n", LOG_FILENAME); } else { rtp_printf("Logging disabled could not open log file:%s\n", LOG_FILENAME); debugfd_valid = 0; } }
static int in_printer( char *printerName, char *driverName, char *tempPath, char *prnFile) { int have_printer; rtp_printf("Note: The demo does not actually print data, it just captures print data to a temporary file.\n"); rtp_printf("Add a printer (y/n) ? "); have_printer = rtp_term_getch(); rtp_printf("\n"); if (have_printer == 'y' || have_printer == 'Y') { rtp_printf("Set up printer. press enter to keep defaults. \n"); rtp_printf("Printer name : "); rtp_term_promptstring (printerName, 0); rtp_printf("Driver name : "); rtp_term_promptstring (driverName, 0); rtp_printf("Print Capture Path : "); rtp_term_promptstring (tempPath, 0); rtp_printf("Print Capture File : "); rtp_term_promptstring (prnFile, 0); return(1); } return(0); }
static int http_client_init(HTTPManagedClient* phttpClient) { rtp_memset(phttpClient, 0, sizeof(*phttpClient)); if (HTTP_ManagedClientInit ( phttpClient, "EBS MANAGED CLIENT" /* User-Agent */, 0 /* Accept (mime types) */, 0 /* KeepAlive (bool) */, 0 /* Cookie context */, 0 /* Authentication context */, 0 /* SSL context */, 0 /* SSL enabled? (bool) */, 8192 /* write buffer size */, 0 /* max connections (0 == no limit) */, 0 /* max connections per host (0 == no limit) */ ) >= 0) { return (0); } else { rtp_printf("HTTP_ManagedClientInit Failed\n"); return (-1); } }
/* Helpers, see shel and test */ void mark_rv (int job, int rv, void *data) { int *idata = (int *)data; *idata = rv; if (rv==-52) rtp_printf("Bad Permissions, Marked = %d\n",*idata); }
// Dump information about an element static void showElInfo(wcEL El ,char *message) { #if (VERBOSE) int top,left,width,height; /* Display the coordinates reported by the display driver */ if (!wcElGetPosWin(El, &top,&left,&width,&height)) rtp_printf("%s: wcElGetPosWin() could not get coordinated \n", message); else rtp_printf("%s: wcElGetPosWin() (%d,%d,%d,%d) \n", message,top,left,width,height); /* Display the coordinates reported by the style manager */ if (!wcElGetPosStyle(El, &top,&left,&width,&height)) rtp_printf("%s: wcElGetPosStyle() could not get coordinated \n", message); else rtp_printf("%s: wcElGetPosStyle() (%d,%d,%d,%d) \n", message,top,left,width,height); #endif }
/*----------------------------------------------------------------------* rtp_debug_output_str *----------------------------------------------------------------------*/ void _rtp_debug_output_str ( char* msg, const char *file, long line_num ) { char* buffer; int i; #ifdef RTP_DEBUG_MULTITHREAD if (_rtp_InitDebugOutput()) { rtp_sig_mutex_claim(rtpDebugLock); #endif #ifdef RTP_DEBUG_OUTPUT_FILE_AND_LINE buffer = file; for (i = 0; buffer[i]; i++) { if (giRTPDebugOutputPos >= RTP_DEBUG_STRING_LEN) { giRTPDebugOutputPos = 0; } gcRTPDebugOutputStr[giRTPDebugOutputPos++] = buffer[i]; } if (line_num) { char tmpbuffer[33]; /* MAXINT can have 32 digits max, base 2 */ rtp_itoa(line_num, tmpbuffer, 2); buffer = tmpbuffer; for (i = 0; buffer[i]; i++) { if (giRTPDebugOutputPos >= RTP_DEBUG_STRING_LEN) { giRTPDebugOutputPos = 0; } gcRTPDebugOutputStr[giRTPDebugOutputPos++] = buffer[i]; } } #endif buffer = msg; for (i = 0; buffer[i]; i++) { if (giRTPDebugOutputPos >= RTP_DEBUG_STRING_LEN) { giRTPDebugOutputPos = 0; } gcRTPDebugOutputStr[giRTPDebugOutputPos++] = buffer[i]; } #ifdef RTP_DEBUG_MULTITHREAD rtp_sig_mutex_release(rtpDebugLock); } #endif rtp_printf("RTP debug %s\n",gcRTPDebugOutputStr); }
/*---------------------------------------------------------------------------*/ int rtp_timer_init (void) { if (rtpTimerInitialized == 0) { if (rtp_sig_mutex_alloc(&rtpTimerLock, 0) >= 0) { if (rtp_sig_semaphore_alloc(&rtpTimerSignal, 0) >= 0) { RTP_THREAD newThread; DLLIST_INIT(&rtpTimerNewList); DLLIST_INIT(&rtpTimerActiveList); rtpTimerNextToProcess = 0; if (rtp_thread_spawn (&newThread, _rtp_timer_thread, 0, 0, 2, 0) >= 0) { rtpTimerInitialized = 1; return (0); } rtp_sig_semaphore_free(rtpTimerSignal); } else { rtp_printf("rtp_timer_init - rtp_sig_semaphore_alloc failed!\n"); } rtp_sig_mutex_free(rtpTimerLock); } else { rtp_printf("rtp_timer_init - rtp_sig_mutex_alloc failed!"); } return (-1); } rtpTimerInitialized++; return (0); }
BBOOL Auth_DoPasswordsMatch (PSMB_SESSIONCTX pCtx, PFRTCHAR name, PFRTCHAR domainname, PFCHAR plaintext, PFBYTE ansi_password, PFBYTE uni_password) /*_YI_ */ { BBOOL ret_val; #if (INCLUDE_RTSMB_ENCRYPTION) byte passbuf [24]; #endif if(plaintext) /* if there is no need to check passwords, don't */ { ret_val = FALSE; #if (INCLUDE_RTSMB_ENCRYPTION) if (pCtx->dialect >= NT_LM) { int i; rtp_printf("Auth_DoPasswordsMatch: ansi_password = %s\n", plaintext); for (i=0; i<24; i++) rtp_printf("%x ", ansi_password[i]); } if (pCtx->dialect >= NT_LM && tc_memcmp (cli_util_encrypt_password_nt (plaintext, pCtx->encryptionKey, passbuf), ansi_password, 24)==0) { ret_val = TRUE; } else if (tc_memcmp (cli_util_encrypt_password_pre_nt (plaintext, pCtx->encryptionKey, passbuf), ansi_password, 24)==0) { ret_val = TRUE; } else if (name && domainname && uni_password && (tc_memcmp(cli_util_encrypt_password_lmv2 (plaintext, pCtx->encryptionKey, (PFCHAR)passbuf,uni_password, name, domainname), ansi_password, 24)==0)) { ret_val = TRUE; } #else if (tc_strcmp (plaintext, ansi_password) == 0) { ret_val = TRUE; } #endif } else ret_val = TRUE; return (ret_val); }
/** @memo Display the content contained in a list or menu object. And retrieve user input. @doc Displays the items added to the object by calls to rtp_gui_list_add_item() in its various forms and asks the user to select a choice. <br> rtp_gui_list_execute() uses the style, indent and isgreyed attribute to format the lists and to process the input with sub-menu support. If all options are greyed, like in a help screen or a status screen, a "Press Return" prompt is provided.<br> The generic version of rtp_gui_list_execute() is implemented using Rtplatfrom terminal IO primitives. If a GUI is available this function can be re-implemented in the target specific subdirectory using the GUI's native API. @precondition rtp_gui_list_init must be called first, rtp_gui_list_add_item() or rtp_gui_list_add_int_item() must have been called one or more times @return A handle to the item in the list. <br> See also rtp_gui_list_execute_int(), and rtp_gui_list_execute_void(). */ void * rtp_gui_list_execute_item(void *vplist /** Handle returned from rtp_gui_list_init() */) { struct rtp_gui_list *plist; struct rtp_gui_list_item *pitem; int numselections,selection; plist = (struct rtp_gui_list *) vplist; for (;;) { rtp_printf("%s %s \n", MENU_LEFT_INDENT, plist->title); rtp_printf("%s %s \n", MENU_LEFT_INDENT, plist->subtitle); numselections = rtp_gui_list_display(plist, 0, 0); if (numselections) { selection = _rtp_gui_prompt_int(MENU_LEFT_INDENT, plist->prompt); { pitem = _rtp_gui_list_item_by_index(plist, selection); { if (pitem->style & RTP_LIST_ITEM_STYLE_SUBMENU) { /* Toggle the collapsed versu expanded state and redraw */ if (pitem->style & RTP_LIST_ITEM_STYLE_EXPANDED) pitem->style &= ~RTP_LIST_ITEM_STYLE_EXPANDED; else pitem->style |= RTP_LIST_ITEM_STYLE_EXPANDED; } else return((void *)pitem); } } } else { char inbuff[32]; rtp_gui_prompt_text(MENU_LEFT_INDENT, "Press Return..", inbuff); rtp_printf("\n"); return(0); } } }
/* This function is called from rtfs_sys_callback() on entry to every API call to check for a status change. If an insert is detected Rtfs is called and passed buffering, and driver entery points If a remove is detected RTfs is alerted so it can invalidate the drive letter */ void SDCARDPollDeviceReady(void) { int sdcard_unit=0; /* If MMC/SD card is not opened - return */ if (!rtfs_sdcard_is_initialized) return; if (!sdcard_driveflags[sdcard_unit] & SDCARD_CHANGED) return; sdcard_driveflags[sdcard_unit] &= ~SDCARD_CHANGED; if (sdcard_driveflags[sdcard_unit] & SDCARD_INSERTED) { // HEREHERE Change 2 rtp_printf("Card insert detected\n"); } else { rtp_printf("Card reoval detected\n"); } }
static int in_guestaccount(void) { char allow[32]; allow[0] = 0; /* eos */ rtp_printf("Allow Guest login (y/n) : "); rtp_term_promptstring (allow, 0); if (allow[0] == 'Y' || allow[0] == 'y') return(1); return(0); }
static void * safemalloc(rtsmb_size bytes) { void * Result = rtp_malloc(bytes); if (bytes && !Result) { rtp_printf(("SMB Server: out of heap space\n")); exit(1); } tc_memset(Result, 0, bytes); return Result; }
static int in_user(char * userName, char *userPass, char *userPerm) { rtp_term_promptstring (userName, 0); if (userName[0]) { rtp_printf("Password : "******"rw"); rtp_printf("Select access rights , 'r'ead or 'rw' read-write : "); rtp_term_promptstring (userPerm, 0); if (rtp_strcmp(userPerm, "rw") == 0) break; else if (rtp_strcmp(userPerm, "r") == 0) break; } return(1); } return(0); }
static void socket_init () { #define WINSOCK_VER 0x0101 int result; RTSMB_STATIC struct WSAData wsa_data; result = WSAStartup (WINSOCK_VER, &wsa_data); if (result) { rtp_printf(("init: Winsock start up failed\n")); } }
static byte in_loginmode(void) { byte security_mode; char which_share_mode[32]; do { rtp_strcpy(which_share_mode, "s"); rtp_printf("press '?' for help or ..\n"); rtp_printf("Press 's' for share based passwords, 'u' for user passwords: "); rtp_term_promptstring (which_share_mode, 0); if (which_share_mode[0] == '?') help_security_mode(); } while (which_share_mode[0] != 's' && which_share_mode[0] != 'u'); if (which_share_mode[0] == 's') { security_mode = AUTH_SHARE_MODE; } else { security_mode = AUTH_USER_MODE; } return(security_mode); }
extern "C" void webCPollingLoopCB(void) { HTMLEvent *e=0; int loopcount = 0; int r; do { e = deQueEventForWebCPollingLoop(); if (webcinitializationcomplete && e) { void *target; HBROWSER_HANDLE which_Browser; if (e->type == HTML_EVENT_TIMER) { doFbBrowserTimeOut(); continue; } target = (void *)e->target; which_Browser = _FindBrowserByTarget(target); if (!which_Browser) { rtp_printf("Problem here folks !!!\n"); continue; } webc_BrowserSuspendDraw(which_Browser); r = webc_BrowserDispatchEvent(which_Browser, e); which_Browser = _FindBrowserByTarget(target); /* Search for the browser again in case it was destroyed by the event handler */ if (which_Browser) { if (webc_BrowserGetDrawState (which_Browser) > 0) webc_BrowserResumeDraw(which_Browser); } webc_BrowserSuspendDraw(which_Browser); // new webc_BrowserProcessLoadQueueAll(which_Browser); if (webc_BrowserGetDrawState (which_Browser) > 0) // new webc_BrowserResumeDraw(which_Browser); which_Browser = _FindBrowserByTarget(target); if (which_Browser) webc_BrowserDraw(which_Browser); } } while (e && loopcount++ < MAXWEBCMESSAGESPERLOOP); }
void wcache_stats_display(char *prompt) { struct wcache_stats_entry *pstats_entry,*prev; int n_entries = 0; rtp_printf("Cache statistics (%s)\r\n", prompt); rtp_printf("%4.4s %4.4s %4.4s %60.60s \r\n", "Creat", "Dele", "Hit", "Url Value"); rtp_printf("%4.4s %4.4s %4.4s %60.60s \r\n", "====", "====", "===", "========="); pstats_entry = wcache_stats_data; while (pstats_entry) { rtp_printf("% 4.4d % 4.4d % 4.4d %60.60s \r\n", pstats_entry->create_count, pstats_entry->delete_count, pstats_entry->hit_count,pstats_entry->key); prev = pstats_entry; pstats_entry = pstats_entry->pnext; n_entries += 1; } rtp_printf("%15.15s %15.15s %15.15s %15.15s \r\n", "bytesMax", "TotalBytesUsed", "maxFiles", "TotalNumFiles"); rtp_printf("%15.15s %15.15s %15.15s %15.15s \r\n", "========", "=========", "========", "========"); rtp_printf("%15d %15d %15d %15d \r\n", cc_accum.bytesMax, cc_accum.bytesUsed, cc_accum.maxFiles, cc_accum.numFiles); }
static int in_share(byte security_mode, char *shareName,char *sharePath,char *shareDesc,char *sharePass, char *secCode) { rtp_printf("Set up shares press enter to keep defaults. \n"); rtp_printf("Share name : "); rtp_term_promptstring (shareName, 0); if (!shareName[0]) return(0); rtp_printf("Share Path : "); rtp_term_promptstring (sharePath, 0); rtp_printf("Share Description : "); rtp_term_promptstring (shareDesc, 0); if (security_mode == AUTH_SHARE_MODE) { rtp_printf("Share Password (leave empty for no passwords): "); rtp_term_promptstring (sharePass, 0); rtp_printf("0==READONLY, 1==WRITEONLY, 2==READWRITE, 3==NOACCES, 4==NO SECRITY\n"); rtp_printf("Share Security 0,1,2,3,4: "); rtp_term_promptstring (secCode, 0); } return(1); }
static void dump_read_cache_info(char *prompt, unsigned char *buffer, long len) { int i,np,is_binary; is_binary = np = 0; // rtp_printf("%s: == len == %d [%40.40s]\n", prompt, len, buffer); rtp_printf("[%s]: len == [%d] \r\n", prompt, len); for (i = 0; i < len; i++) { if (buffer[i] > 127) { is_binary =1 ; break; } } if (is_binary) { rtp_printf("[%s]: len == [%d] \r\n", prompt, len); return; } else rtp_printf("ascii: %s: == len == %d \r\n", prompt, len); for (i = 0; i < len; i++) { if (buffer[i] < 127 && buffer[i] >= 32) { rtp_printf("%c", buffer[i]); np += 1; if( np > 60) { rtp_printf("\r\n"); np = 0; } } } rtp_printf("\r\n"); }
void TestDomApi(wcBROW browser, wcDOC doc) { wcCtx _Ctx; wcCtxtInit(&_Ctx, browser, doc); // Test1: - Use dynamic element creation and dom insertion to create a page. // Containing a table. rtp_printf("Test1: - Use dynamic element creation and dom insertion to create a page. Containing a table.\n"); wcEL table = wcElNew(&_Ctx, "table"); wcEL td; wcEL tr = wcElNew(&_Ctx, "tr"); wcELInsertFirst(table,tr); wcElSetId(table, "table0"); wcElSetStyle(table, "border-style:solid;border-thickness:2px;", wcTRUE); td = wcElNew(&_Ctx, "td"); wcELInsertFirst(tr,td); wcElSetId(tr, "row0"); // This crashes when we clone if it is a checkboxk wcElSetInnerHtml(td,"Hello from 0,0"); wcElSetId(td, "col0"); //wcElSetStyle(td, "border-style:solid;border-thickness:2px;"); td = wcElNew(&_Ctx, "td"); wcElSetId(td, "col1"); wcELInsertFirst(tr,td); wcElSetInnerHtml(td,"Hello from 0,1"); //wcElSetStyle(td, "border-style:solid;border-thickness:2px;"); wcDocInsertFirst(&_Ctx, table); wcEL checkboxdiv; checkboxdiv = wcElNew(&_Ctx, "div"); wcElSetInnerHtml(checkboxdiv,"<input id=\"check\" type=\"checkbox\" name=\"checkme\" value=\"Car\" checked=\"checked\" />"); wcDocRefresh(&_Ctx); rtp_printf("Test2: - Find the table cell by walking the dom.\n"); { wcBOOL Error = wcFALSE; wcEL El = wcELFind (&_Ctx, 0, "/table0/row0/col1", &Error); if (El) wcElSetInnerHtml(El,"0,0 again"); } rtp_printf("Test3: - Use the enumeration function to walk the tree and print Id values.\n"); // Garbage collect ascii return buffers when done. // See EnumTestCallback below. { int nfound = 0; wcDocEnumerate(&_Ctx, EnumTestCallback, 0, (void *) &nfound); rtp_printf("Enumeration stest fond this many objects == %d\n", nfound); // print the count we tabulated from the callback. wcCtxtRelease(&_Ctx); // free buffers that ascii strings were returned in. } rtp_printf("Test4: - Use the clone function to clone the table we just made.\n"); // Test4: - Use the clone function to clone the table we just made. // Insert it into our document, give it a new name and move it. // Re enumerate to see what we have // See EnumTestCallback below. wcEL tableClone = wcElClone(table, wcTRUE); if (tableClone) { wcBOOL Error = wcFALSE; int nfound = 0; wcEL El; wcDocInsertLast(&_Ctx, tableClone); wcElSetStyle(tableClone, "position:absolute;left:20px;top:100px;",wcTRUE); wcElSetId(tableClone, "clonetable0"); El = wcELFind (&_Ctx, 0, "/clonetable0/row0/col0", &Error); if (El) wcElSetInnerHtml(El,"0,0 cloned"); wcDocEnumerate(&_Ctx, EnumTestCallback, 0, (void *) &nfound); rtp_printf("Enumeration after clone found this many objects == %d\n", nfound); // print the count we tabulated from the callback. wcCtxtRelease(&_Ctx); // free buffers that ascii strings were returned in. wcDocRefresh(&_Ctx); } rtp_printf("Test5: - Create a button and attach an event handler to it.\n"); // Test5: - Create a button and attach an event handler to it. // The event handler will print out the events presented to it. // To demonstrate use of push and pop events we will over write the the event hendler that must // be clicked to pop the first handler into place. wcEL button = wcElNew(&_Ctx, "input type=button"); { wcBOOL Error = wcFALSE; int nfound = 0; static int whichhandler = 0; wcDocInsertLast(&_Ctx, button); wcElSetInnerHtml(button, "Clickme to toggle event handlers"); wcElSetValue(button, "Clickme"); wcElSetStyle(button, "position:absolute;left:20px;top:150px;",wcTRUE); // cloning of input tag crashes, needs debugging. // wcEL buttonClone = wcElClone(button, wcTRUE); wcEL buttonClone = wcElNew(&_Ctx, "input type=button"); wcDocInsertLast(&_Ctx, buttonClone); wcElSetInnerHtml(buttonClone, "Another butoon, no handler attached"); wcElSetValue(buttonClone, "Clickme"); wcElSetStyle(buttonClone, "position:absolute;left:20px;top:200px;",wcTRUE); wcElSetEventHandler(button, wcTestEventCallback); wcElSetEventHandler(button, ClickMeCallback); // enumerate to show it and its value wcDocEnumerate(&_Ctx, EnumTestCallback, 0, (void *) &nfound); wcCtxtRelease(&_Ctx); // free buffers that ascii strings were returned in. wcDocRefresh(&_Ctx); // wcElSetStyle(button, "position:absolute;left:120px;top:150px;width:100px;height:40px;"); wcDocRefresh(&_Ctx); } // Test6: - Verify push/pop data functioons. rtp_printf("Test6: - Verify element push/pop private data functions. \n"); { int v1 = 1; int v2 = 2; int *p; wcPushData(&_Ctx, button, (void *) &v1); wcPushData(&_Ctx, button, (void *) &v2); p = (int *) wcGetData(&_Ctx, button); if (p) rtp_printf(" wcGetdata test value should be two: %d\n", *p); else rtp_printf(" wcGetdata test failed"); wcPopData(&_Ctx, button); p = (int *) wcGetData(&_Ctx, button); if (p) rtp_printf(" wcGetdata test value should be one: %d\n", *p); else rtp_printf(" wcGetdata test failed"); v1 = 3; v2 = 4; wcPushData(&_Ctx, 0, (void *) &v1); wcPushData(&_Ctx, 0, (void *) &v2); p = (int *) wcGetData(&_Ctx, 0); if (p) rtp_printf(" wcGetdata test value should be four: %d\n", *p); else rtp_printf(" wcGetdata test failed"); wcPopData(&_Ctx, 0); p = (int *) wcGetData(&_Ctx, 0); if (p) rtp_printf(" wcGetdata test value should be three: %d\n", *p); else rtp_printf(" wcGetdata test failed"); } rtp_printf("Test7 and 8: - Verify modal window support. \n"); // Test7: - Create a modal window. Use the body callback event handler to create a button element. // Use the button to trigger a close of the window. // Note: This test also verifies the behavior of wcElGetPosWin, wcElGetPosStyle and wcElSetPosStyle. // The tests center a button on a screen without setting the left and top style attributes. // These test sequences demonstrate the code sequence that handles the HTML_EVENT_WINDOW_REFRESHED event // and calls wcElGetPosWin() to retrieve the coordinates where the elements is displayed and wcElSetPosStyle() to // set the top, left, height, width style attributes to the rendered position. OpenModalDialog("Dismiss the modal dialog to proceed"); // Test8: - Create a window. Combine a message and a dismiss button in the html text. // Give the find button an ID then attach a dismiss button handler to the button using // wcElFind and wcElSetEventHandler. // Call wcWinExecute instead of using the Modal argument to wcWinCreateEX SimpleModalDialog("I am a modal dialog box. Click to dismiss."); rtp_printf("Test9: - Verify window border setting support. \n"); // Test9: - Test window borders. TestWindowBorders(); dotest10: // Test10: - Create two windows each containing two edit controls. // First cycle the focus among the edit controls for 20 seconds. // Then move the windows around the screen wcBOOL Error = wcFALSE; OpenTest10Window(&Test10WindowZero, 100, 100, "Focus test: Window zero. Type. The focus changes every second."); OpenTest10Window(&Test10WindowOne, 325, 175, "Focus test: Window One.Type. The focus changes every second."); Test10Elements[0][0] = wcELFind (&Test10WindowZero, 0, "/0", &Error); Test10Elements[0][1] = wcELFind (&Test10WindowZero, 0, "/1", &Error); Test10Elements[0][2] = wcELFind (&Test10WindowZero, 0, "/2", &Error); Test10Elements[1][0] = wcELFind (&Test10WindowOne, 0, "/0", &Error); Test10Elements[1][1] = wcELFind (&Test10WindowOne, 0, "/1", &Error); Test10Elements[1][2] = wcELFind (&Test10WindowOne, 0, "/2", &Error); wcElSetEventHandler(Test10Elements[0][0], Test10Callback); CycleTest10(); // Note: CycleTest10() calls StartFlyingWindowDemo() when it is finished }
static int http_client_put(HTTPManagedClient* phttpClient) { HTTPManagedClientSession* session = 0; char urlpath[255]; char urlfile[255]; char localfile[255]; char contenttype[255]; HTTP_INT32 result = -1; HTTP_INT32 totalresult = 0; HTTPResponseInfo info; HTTP_INT32 contentLength; RTP_HANDLE fd; HTTP_INT32 nread; rtp_strcpy(contenttype, "application/x-www-form-urlencoded"); /* content-type */ rtp_gui_prompt_text(" ","IP Address (eg: 192.161.2.1) or domain name of host (eg: www.google.com)\n :", &urlpath[0]); rtp_gui_prompt_text(" ","File name on server\n :", &urlfile[0]); rtp_gui_prompt_text(" ","Local file name to put\n :", &localfile[0]); rtp_gui_prompt_text(" ","Content type eg: text/html\n :", &contenttype[0]); contentLength = 0; /* Set content length to zero so we use chunked encoding */ /* A HTTPManagedClientSession is the abstraction for a SINGLE HTTP request/response pair. Thus a new session must be opened for each HTTP operation (although this may not cause a new connection to be established, if keep alive is used), and closed when the operation has completed (though, again, this may not actually close a physical network connection) */ if (HTTP_ManagedClientStartTransaction ( phttpClient, &urlpath[0], 80, 4, HTTP_SESSION_TYPE_TCP, 1, /* blocking? */ &session ) < 0) { rtp_printf("Failed: connecting to %s\n", urlpath); return(-1); } /* Once the session is open, one command may be issued; in this case a Post */ HTTP_ManagedClientPut ( session, urlfile, /* path */ contenttype, contentLength /* content-length */ ); if (rtp_file_open (&fd, (const char *) &localfile[0], RTP_FILE_O_RDONLY, 0) < 0) { rtp_printf("Failure opening %s\n", localfile); return(-1); } /* write the POST data */ do { nread = rtp_file_read(fd,read_buffer, (long)read_buffer_size); if (nread > 0) HTTP_ManagedClientWrite (session, (HTTP_UINT8*) &read_buffer[0], nread); } while (nread >= 0); /* this function must be called when all data has been written */ HTTP_ManagedClientWriteDone (session); /* This may be called at any time after the command is issued to get information about the server response; this info includes the status code given, date when the request was processed, file mime type information (if a file is transferred as the result of a command), authentication information, etc. */ HTTP_ManagedClientReadResponseInfo(session, &info); do { /* Read data from the session */ result = HTTP_ManagedClientRead(session, read_buffer, read_buffer_size); } while (result > 0); /* Now we are done; close the session (see note above about sessions) */ HTTP_ManagedClientCloseSession(session); /* When all HTTP client activity is completed, the managed client context may safely be destroyed */ HTTP_ManagedClientDestroy(phttpClient); rtp_file_close(fd); if (result == 0) { rtp_printf("Success: putting file: %s to %s%s\n", localfile, urlpath, urlfile); return(0); } else { rtp_printf("Failed: putting file: %s to %s%s\n", localfile, urlpath, urlfile); return(-1); } }
// ---------------------------------------------------- // ENTRY POINT // ---------------------------------------------------- int smbservermain(void) { char c; int go; int have_printer; byte security_mode; RTP_THREAD new_thread; #ifndef RTSMB_RTIP int spinState = 0; char spinner[4] = {'\\', '-', '/', '|'}; #endif // ------------------------------------------------ #if (INCLUDE_RTIP) rtp_memcpy(my_ip_srv_address, my_ip_address, IP_ALEN); rtp_memcpy(ip_srv_mask_address, ip_mask_address, IP_ALEN); #endif // ------------------------------------------------ rtp_printf("\n\nRun Alt Port Numbers(Y/y) or Well-Known(N/n)"); while (!kbhit ()) { } c = getch (); if (c == 'Y' || c == 'y') { rtsmb_init_port_alt (); } if (c == 'N' || c == 'n') { rtsmb_init_port_well_know (); } // ------------------------------------------------ if (!rtp_file_mkdir (SHARE_PATH)) { rtp_printf("WARNING: mkdir of SHARE_PATH failed %s\n", SHARE_PATH, 0); } rtp_printf("\nsmbservermain - enter\n"); go = 1; /* Start ertfs on windows*/ //pc_ertfs_init (); /* initialize server */ rtsmb_srv_init (my_ip_srv_address, ip_srv_mask_address, NETWORK_NAME , NETWORK_GROUP); rtp_printf ("Initialized rtsmb\n"); #ifdef USE_CONFIG_FILE rtsmb_srv_read_config ("smb_config.txt"); #else rtp_printf("Note: The demo does not actually print data, it just captures print data to a temporary file.\n"); { char printerName[32]; char driverName[32]; char tempPath[32]; char prnFile[32]; rtp_strcpy(printerName, "SmbPrinter"); rtp_strcpy(driverName, "HP LaserJet 1100"); rtp_strcpy(tempPath, TEMP_PATH); rtp_strcpy(prnFile, "SmbPrintData.prn"); have_printer = in_printer(printerName,driverName, tempPath, prnFile); if (have_printer) { rtsmb_srv_share_add_printer (printerName, driverName, 1, (PSMBFILEAPI)0, tempPath, 0, (PFCHAR)0, prnFile); } } security_mode = in_loginmode(); //rtsmb_srv_share_add_tree (SHARE_NAME, DESCRIPTION, NULL, SHARE_PATH, SHARE_FLAGS_8_3, SECURITY_READWRITE, NULL); //rtsmb_srv_share_add_tree (SHARE_NAME, DESCRIPTION, (PSMBFILEAPI)0, SHARE_PATH, SHARE_FLAGS_CREATE, SECURITY_READWRITE, (PFCHAR)0); rtsmb_srv_share_add_ipc ((PFCHAR)0); rtsmb_srv_set_mode (security_mode); /* AUTH_USER_MODE or AUTH_SHARE_MODE */ rtsmb_srv_register_group ("rw_access"); rtsmb_srv_register_group ("rd_access"); { char shareName[32]; char sharePath[32]; char shareDesc[32]; char sharePass[32]; char secCode[32]; rtp_strcpy(shareName, SHARE_NAME); rtp_strcpy(shareDesc, "Rtsmbshare"); rtp_strcpy(sharePath, SHARE_PATH); rtp_strcpy(sharePass, ""); rtp_strcpy(secCode,"2"); if (in_share(security_mode, shareName, sharePath, shareDesc, sharePass, secCode)) { byte security_mode; /* Defult is 2 SECURITY_READWRITE */ char *psharePass; if (sharePass[0]) psharePass = &sharePass[0]; else psharePass = 0; security_mode = (byte)(secCode[0] -'0'); rtsmb_srv_share_add_tree (shareName, shareDesc, (PSMBFILEAPI)0, sharePath, SHARE_FLAGS_CREATE, security_mode, (PFCHAR)psharePass); rtsmb_srv_set_group_permissions ("rw_access", shareName, SECURITY_READWRITE); rtsmb_srv_set_group_permissions ("rd_access", shareName, SECURITY_READ); } } // rtsmb_srv_set_group_permissions ("rw_access", SHARE_NAME, SECURITY_READWRITE); rtsmb_srv_set_group_permissions ("rw_access", "IPC$", SECURITY_READWRITE); rtsmb_srv_set_group_permissions ("rd_access", "IPC$", SECURITY_READWRITE); //rtsmb_srv_register_group ("ro_access"); //rtsmb_srv_set_group_permissions ("ro_access", SHARE_NAME, SECURITY_READ); //rtsmb_srv_set_group_permissions ("ro_access", "IPC$", SECURITY_READWRITE); //rtsmb_srv_register_group ("wo_access"); //rtsmb_srv_set_group_permissions ("wo_access", SHARE_NAME, SECURITY_WRITE); //rtsmb_srv_set_group_permissions ("wo_access", "IPC$", SECURITY_READWRITE); /* No access */ //rtsmb_srv_register_group ("nonebs"); //rtsmb_srv_set_group_permissions ("nonebs", SHARE_NAME, SECURITY_NONE); //rtsmb_srv_set_group_permissions ("nonebs", "IPC$", SECURITY_NONE); //rtsmb_srv_register_user (SMB_GUESTNAME, (PFCHAR)0); //rtsmb_srv_register_user (SMB_GUESTNAME, "ebs"); //rtsmb_srv_add_user_to_group (SMB_GUESTNAME, "rw_access"); if (security_mode == AUTH_USER_MODE) { char userName[32]; char userPass[32]; char userPerm[32]; if (in_guestaccount()) rtsmb_srv_register_user (SMB_GUESTNAME, (PFCHAR)0); rtp_strcpy(userName, "user"); rtp_strcpy(userPass, "password"); rtp_printf("Add users, enter a blank user to stop : "); while (in_user(userName, userPass, userPerm)) { rtsmb_srv_register_user (userName, userPass); if (rtp_strcmp(userPerm, "rw") == 0) {rtsmb_srv_add_user_to_group (userName, "rw_access");break;} else if (rtp_strcmp(userPerm, "r") == 0) {rtsmb_srv_add_user_to_group (userName, "rd_access");break;} } } #endif //USE_CONFIG_FILE #if (1) if (rtp_thread_spawn ( &new_thread, (RTP_ENTRY_POINT_FN) rtsmb_main, (const char *) "RTIP_SMB_SRV", STACKSIZE_HUGE_INDEX, TASKPRIO_NORMAL_INDEX, (void *) 0 ) < 0) { rtp_term_puts("spawn of SMB task failed"); return(-1); } rtp_term_puts("spawn of SMB task WORKED"); while (1) { #ifndef RTSMB_RTIP spinState += 1; spinState = spinState%4; rtp_printf("\b%c",spinner[spinState]); #endif rtsmb_srv_cycle (1000); } #else //Main Loop while(go) { rtsmb_main (); if(rtp_term_kbhit()) { // switch (getch()) switch (rtp_term_getch()) { case 'q': go = 0; break; default: break; } } } //Shutdown rtp_printf("main: shutting down\n"); rtsmb_srv_shutdown (); rtp_net_exit (); #endif return(0); }//main
/* ============== ============== */ void rtsmb_srv_net_init (void) { RTSMB_STATIC PNET_THREAD tempThread; #if (CFG_RTSMB_PRINT_SIZES) char buffer[128]; rtp_sprintf (buffer, "net thread: %i\n", sizeof (NET_THREAD_T)); tm_puts (buffer); #endif #if INCLUDE_RTSMB_DC next_pdc_find = rtp_get_system_msec () + rtsmb_srv_net_pdc_next_interval (); #endif /** * You will note that we consistently use the term 'thread' to refer to the 'mainThread.' * In fact, it is not a full blown thread, but is only treated the same, for coding simplicity * purposes. This first thread always runs in the same thread/process as the caller of our API * functions. If CFG_RTSMB_MAX_THREADS is 0, no threads will ever be created. */ tempThread = rtsmb_srv_net_thread_new (); /* this will succeed because there is at least one thread free at start */ if (!tempThread) { RTSMB_DEBUG_OUTPUT_STR("rtsmb_srv_net_init: Error -- could not allocate main pseudo-thread.\n", RTSMB_DEBUG_TYPE_ASCII); return; } mainThread = tempThread; rtsmb_srv_net_thread_init (mainThread, 0); /* -------------------- */ /* get the three major sockets */ /* Name Service Datagram Socket */ if (rtsmb_net_socket_new (&net_nsSock, rtsmb_nbns_port, FALSE) < 0) { rtp_printf(("Could not allocate Name & Datagram service socket\n")); } /* SSN Reliable Socket */ #ifdef RTSMB_ALLOW_SMB_OVER_TCP if (rtsmb_net_socket_new (&net_ssnSock, rtsmb_nbss_direct_port, TRUE) < 0) { rtp_printf(("Could not allocate Name & Datagram service socket\n")); } #else if (rtsmb_net_socket_new (&net_ssnSock, rtsmb_nbss_port, TRUE) < 0) { rtp_printf (("Could not allocate SSN Reliable socket\n")); } #endif if (rtp_net_listen ((RTP_SOCKET) net_ssnSock, prtsmb_srv_ctx->max_sessions) != 0) { RTSMB_DEBUG_OUTPUT_STR("Error occurred while trying to listen on SSN Reliable socket.\n", RTSMB_DEBUG_TYPE_ASCII); } if (rtp_net_setbroadcast((RTP_SOCKET) net_nsSock, 1) < 0) { RTSMB_DEBUG_OUTPUT_STR("Error occurred while trying to set broadcast on Name & Datagram service socket\n", RTSMB_DEBUG_TYPE_ASCII); } }
static void help_security_mode(void) { rtp_printf("Sorry no help for you . \n"); }
static void do_sd_iotest(DDRIVE *pdr) { byte *user_buffer; dword user_buffer_size,maxcount, count,sector; unsigned long i,j; dword time_zero, elapsed_time; unsigned long *pl; user_buffer = pc_claim_user_buffer(pdr, &user_buffer_size, 0); /* released at cleanup */ if (!user_buffer) {ERTFS_ASSERT(rtfs_debug_zero())} #define TEST_SECTOR 40000 #define TEST_SIZE 64 #define READ_LOOP_COUNT 32 #define WRITE_LOOP_COUNT 1 #define TEST_WRITE_PATTERN 1 if (user_buffer_size > TEST_SIZE) maxcount = TEST_SIZE; else maxcount = user_buffer_size; sector = TEST_SECTOR; for (count = maxcount;count > 0; sector += count, count-- ) { #if (WRITE_LOOP_COUNT&&TEST_WRITE_PATTERN) pl=(unsigned long *)user_buffer; for (i = 0; i < (count*512)/4;i++) *pl++=0; if (!SDCARD_blkmedia_io((void *)&rtfs_sdcard_is_initialized, (void *) pdr, sector, user_buffer, count, FALSE)) { rtp_printf("Failed on initial write\n"); goto ex_it; } if (SDCARD_blkmedia_io((void *)&rtfs_sdcard_is_initialized, (void *) pdr, sector, user_buffer, count, TRUE)) { pl=(unsigned long *)user_buffer; for (j = 0; j < (count*512)/4;j++,pl++) { if (*pl!=0) { rtp_printf("Initial compare to zero failed at %d\n",j); break; } } } else { rtp_printf("Failed on initial write\n"); goto ex_it; } pl=(unsigned long *)user_buffer; for (i = 0; i < (count*512)/4;i++) *pl++=i; #endif #if (WRITE_LOOP_COUNT!=0) rtp_printf("Printf writing sector==%d bytes == %d\n", sector, (count * WRITE_LOOP_COUNT)*512); time_zero = rtfs_port_elapsed_zero(); for (i = 0; i < WRITE_LOOP_COUNT;i++) { if (SDCARD_blkmedia_io((void *)&rtfs_sdcard_is_initialized, (void *) pdr, sector, user_buffer, count, FALSE)) { ; } else { rtp_printf("Write Failure\n"); goto ex_it; } } elapsed_time = (rtfs_port_elapsed_zero() - time_zero); rtp_printf("Sucess elapsed(msec)== %d, bytespsec==%d \n",elapsed_time,((count * WRITE_LOOP_COUNT)*512/elapsed_time)*1000); #endif pl=(unsigned long *)user_buffer; for (i = 0; i < (count*512)/4;i++,pl++) *pl=0; rtp_printf("Printf reading sector==%d bytes == %d\n", sector, (count * READ_LOOP_COUNT)*512); time_zero = rtfs_port_elapsed_zero(); for (i = 0; i < READ_LOOP_COUNT;i++) { if (SDCARD_blkmedia_io((void *)&rtfs_sdcard_is_initialized, (void *) pdr, sector, user_buffer, count, TRUE)) { #if (1||TEST_WRITE_PATTERN) pl=(unsigned long *)user_buffer; for (j = 0; j < (count*512)/4;j++,pl++) { if (*pl!=j) { rtp_printf("Read test compare failed at offset %d\n", 4*j); break; } } #endif ; } else { rtp_printf("Read Failure\n"); goto ex_it; } } elapsed_time = (rtfs_port_elapsed_zero() - time_zero); rtp_printf("Sucess elapsed(msec)== %d, bytespsec==%d \n",elapsed_time,(((count * READ_LOOP_COUNT)*512)/elapsed_time)*1000); } ex_it: while(1) rtp_printf("Kill me now\r"); }