Icecast Streaming Media Server Forum Index Icecast Streaming Media Server
Icecast is a Xiph Foundation Project
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Authentication Questions

 
Post new topic   Reply to topic    Icecast Streaming Media Server Forum Index -> Icecast Server
View previous topic :: View next topic  
Author Message
woogieman



Joined: 11 Apr 2009
Posts: 33
Location: Eugene, OR. USA

PostPosted: Mon Jan 04, 2010 3:23 pm    Post subject: Authentication Questions Reply with quote

I have studied the 'c' code and the PHP code and have a pretty good handle on how the authentication is managed. It is a really nice system by the way but needs just a little more.
Questions
1. How do I get the bytes sent and the bytes read in html or php? I can see it appears in the stats.xsl file but that is not easy to read or figure out where the variables are. How do I get the same info on my own, but field by field?
2. When using URL authentication, can the username be a generic name like <option name="username" value="user"/> Can I actually use that line?
3. I repeat the question but for the password? Can the password be a generic password? Can I also use the line. <option name="password" value="pass"/>
I want to authenticate all users up to a maximum that will be allowed for that mountpoint. Say we allow a mountpoint to have 50 listeners / users, then I want to automatically authenticate all users up to number 51 at which point I will refuse more listeners.
Hope that makes sense.
Back to top
View user's profile Send private message Visit poster's website
karlH
Code Warrior
Code Warrior


Joined: 13 Jun 2005
Posts: 5476
Location: UK

PostPosted: Mon Jan 04, 2010 7:18 pm    Post subject: Reply with quote

1. Getting the read/sent bytes can be done in one of two ways. either by the xsl query (eg stats.xsl) or via the stats interface
eg curl -X STATS http://admin:pw@host:port/

Those particular values could be retrieved by an custom webroot xsl (which could be auth'd) and don't forget that an xsl is not required to produce html, it could be simple csv content (look at status2.xsl)

2-3. yes that is possible, the auth engine may require username/password authentication that is not related to any particular listening client.

karl.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
woogieman



Joined: 11 Apr 2009
Posts: 33
Location: Eugene, OR. USA

PostPosted: Tue Jan 05, 2010 4:15 pm    Post subject: Authentication Questions Reply with quote

@karlH: Thanks for answering so quickly. The first question is still a little hazy to me as I haven't been able to find where the variable names are in the XSL scripts. I just haven't studied it closely enough yet as the plate is extremely full.
Also thanks for the answers to questions 2 and 3.
I am quite proficient in c though and can understand the server source quite well. I found the auth_url.c file and found that to be very easy to understand. I will simply make a modified / customized version of the file to add parameters to be sent to the action.php file sitting on one of my websites and using the database to track all of the info I need that way. It will require a hit on the performance but I think if I do most of my action when the mount / source or the client / user disconnects then the hit will be minor on the other threads as it is part of a shutdown process.
I just want to say that I am enjoying the code for icecast2 more than I have in a long time. The coding is excellent and reminds me of the JPL style I was taught programming A/D controllers. Anyway it works awesome and I send my kudos to the chefs.
Back to top
View user's profile Send private message Visit poster's website
karlH
Code Warrior
Code Warrior


Joined: 13 Jun 2005
Posts: 5476
Location: UK

PostPosted: Tue Jan 05, 2010 6:14 pm    Post subject: Reply with quote

just do a grep of stats_event in the source files to see the possible stats raised. The /admin/stats content should also provide the complete set as well.

Adding parameters was something that I was considering so if you wish to add that then fine. I was thinking something like

<option name="listener_add" value="http://........" />
<option name="listener_add_param" value="IP" />
<option name="listener_add_param" value="Mount" />

karl.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
woogieman



Joined: 11 Apr 2009
Posts: 33
Location: Eugene, OR. USA

PostPosted: Wed Jan 06, 2010 12:15 am    Post subject: Authentication Questions Reply with quote

@karlH: Awesome! It's good to think I am on the right track. I will figure out the XSLT stuff and use that if I can. But I like the idea of adding parameters. I have already set up php code to add the user to mysql if the user does not exist in the database, that way anonymous users can log on. I use the command:
<option name="username" value="*" />
in the XML config file. That will signal me that there is an anonymous user and I turn their name into their ip address. Then I can track them also.
I am debating if I should save the 'bytes_read' and 'bytes_sent' variables when the listener exits since the structures are already loaded in the url_remove_listener function and then add up all the amounts by 'mountname' when I want a report. OR if I should add parameters to the url_stream_end function and add the client_t and connection_t structures to get the bytes read, which seems to be more difficult. I will muddle through until I have it working the way I want.
I really appreciate your input as I believe I saw your name in the authors file. Once again thanks a lot.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Icecast Streaming Media Server Forum Index -> Icecast Server All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2002 phpBB Group
subRebel style by ktauber