Blame view

trunk/src/app/srs_app_conn.hpp 1.6 KB
winlin authored
1 2 3
/*
The MIT License (MIT)
4
Copyright (c) 2013-2014 winlin
winlin authored
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
24 25
#ifndef SRS_APP_CONN_HPP
#define SRS_APP_CONN_HPP
winlin authored
26 27

/*
28
#include <srs_app_conn.hpp>
winlin authored
29 30 31 32
*/

#include <srs_core.hpp>
33
#include <srs_app_st.hpp>
winlin authored
34
winlin authored
35 36 37 38
class SrsServer;
class SrsConnection
{
protected:
39
    char* ip;
40 41 42
    SrsServer* server;
    st_netfd_t stfd;
    int connection_id;
winlin authored
43
public:
44 45
    SrsConnection(SrsServer* srs_server, st_netfd_t client_stfd);
    virtual ~SrsConnection();
winlin authored
46
public:
47
    virtual int start();
winlin authored
48
protected:
49
    virtual int do_cycle() = 0;
50 51
protected:
    virtual int get_peer_ip();
winlin authored
52
private:
53 54
    virtual void cycle();
    static void* cycle_thread(void* arg);
winlin authored
55 56
};
57
#endif