RE: Rabbit web
"'Tom Collins' tom-lnEA/wrDJtNWk0Htik3J/[email protected] [rabbit-semi]" <[email protected]> Mon, 25 Apr 2016 12:59:23 -0700
| Newsgroups | gmane.comp.hardware.rabbit-semiconductor |
|---|---|
| Message-ID | <[email protected]> |
Stev,
There isn’t a simple solution to what you’re trying to accomplish.
If this was a project I was working on, I would probably make use of the #web_update directive to add a callback for any changes made to a settings structure.
Then I would modify that function to take a parameter of “HttpState *state” instead of void as directed in Digi’s documentation. Finally, modify zhtml_applychanges() in rabbitweb.lib to pass “state” to fp() as it loops through fplist.
I was able to update Samples/RCM3700/RabbitWeb/BLINKLEDS.C with those changes, and the following update:
void updatefcn(HttpState *state)
{
char buffer[16];
if (state) {
printf("change from %s\n", inet_ntoa(buffer, state->s.hisaddr));
}
ledControl.period[0] = 500/ledControl.ledBlinkRate[0];
ledControl.period[1] = 500/ledControl.ledBlinkRate[1];
}
Note that I also had to update main() to add “NULL” as a parameter to its call to updatefcn().
With those changes in place, it printed “change from 192.168.1.102” to the Stdio window when I submitted the form. Other web_update function should work fine, since they’re declared as taking no parameters, and will ignore the HttpState pointer passed to the function.
-Tom
From: [email protected] [mailto:[email protected]]
Sent: Wednesday, April 20, 2016 4:52 PM
To: [email protected]
Subject: Re: [rabbit-semi] Rabbit web
Thanks Tom,
My web pager already use password ( single password ).
My goal is if user change setting, i'm collect user ip address and send trap to my server.
Thanks.
Stev
On Thu, Apr 21, 2016 at 5:54 AM, Tom Collins tom-lnEA/wrDJtNWk0Htik3J/[email protected] <mailto:[email protected]> [rabbit-semi] <[email protected] <mailto:[email protected]> > wrote:
I'm not sure how to do that. Are you looking for the IP address of each request, or the username used to authenticate (for password-protected pages)?
What do you plan to do with that information?
Knowing more about your plans will help me find a possible way to access the information you're looking for.
-Tom
On Apr 8, 2016, at 7:07 PM, S Sutikno [email protected] <mailto:[email protected]> [rabbit-semi] wrote:
My program can handle request from browser,i want to know who is request from main().
Stev
On Saturday, April 9, 2016, Tom Collins tom-lnEA/wrDJtNWk0Htik3J/[email protected] <mailto:[email protected]> [rabbit-semi] <[email protected] <mailto:[email protected]> > wrote:
Not sure I understand your question. Do you want to know from main() whether or not the HTTP server is handling requests from a web browser?
I believe you can set up Rabbitweb variables to call a function whenever the server needs to read a value -- you could put code in there to keep track of whenever a page was requested.
Would that accomplish your goals?
-Tom
On Apr 6, 2016, at 4:59 PM, S Sutikno [email protected] <mailto:[email protected]> [rabbit-semi] wrote:
I'm use RCM3700 and DC9.62 and rabbit web. How to detect if user connected to rcm3700 use web browser.
Thanks.
Stev