~noskcaj/ubuntu/saucy/sflphone/merge-1.2.3-2

« back to all changes in this revision

Viewing changes to daemon/src/sip/sipaccount.h

  • Committer: Package Import Robot
  • Author(s): Mark Purcell
  • Date: 2012-05-19 21:46:37 UTC
  • mfrom: (1.1.7)
  • Revision ID: package-import@ubuntu.com-20120519214637-la8rbrford5kj6m3
Tags: 1.1.0-1
* New upstream release 
  - Fixes "FTBFS with libccrtp-dev/2.0.2 from experimental" (Closes: #663282)
* NEW Maintainer: Debian VoIP Team - Thanks Francois for your work.
  - (Closes: #665789: O: sflphone -- SIP and IAX2 compatible VoIP phone)
* Added Build-Depends: libdbus-c++-bin
* Add gcc47-fixes.patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
47
47
    class YamlEmitter;
48
48
    class MappingNode;
49
49
    // SIP specific configuration keys
50
 
    const char *const interfaceKey = "interface";
51
 
    const char *const portKey = "port";
52
 
    const char *const publishAddrKey = "publishAddr";
53
 
    const char *const publishPortKey = "publishPort";
54
 
    const char *const sameasLocalKey = "sameasLocal";
55
 
    const char *const dtmfTypeKey = "dtmfType";
56
 
    const char *const serviceRouteKey = "serviceRoute";
57
 
    const char *const updateContactHeaderKey = "updateContact";
 
50
    const char *const INTERFACE_KEY = "interface";
 
51
    const char *const PORT_KEY = "port";
 
52
    const char *const PUBLISH_ADDR_KEY = "publishAddr";
 
53
    const char *const PUBLISH_PORT_KEY = "publishPort";
 
54
    const char *const SAME_AS_LOCAL_KEY = "sameasLocal";
 
55
    const char *const DTMF_TYPE_KEY = "dtmfType";
 
56
    const char *const SERVICE_ROUTE_KEY = "serviceRoute";
 
57
    const char *const UPDATE_CONTACT_HEADER_KEY = "updateContact";
 
58
    const char *const KEEP_ALIVE_ENABLED = "keepAlive";
58
59
 
59
60
    // TODO: write an object to store credential which implement serializable
60
 
    const char *const srtpKey = "srtp";
61
 
    const char *const srtpEnableKey = "enable";
62
 
    const char *const keyExchangeKey = "keyExchange";
63
 
    const char *const rtpFallbackKey = "rtpFallback";
 
61
    const char *const SRTP_KEY = "srtp";
 
62
    const char *const SRTP_ENABLE_KEY = "enable";
 
63
    const char *const KEY_EXCHANGE_KEY = "keyExchange";
 
64
    const char *const RTP_FALLBACK_KEY = "rtpFallback";
64
65
 
65
66
    // TODO: wirte an object to store zrtp params wich implement serializable
66
 
    const char *const zrtpKey = "zrtp";
67
 
    const char *const displaySasKey = "displaySas";
68
 
    const char *const displaySasOnceKey = "displaySasOnce";
69
 
    const char *const helloHashEnabledKey = "helloHashEnabled";
70
 
    const char *const notSuppWarningKey = "notSuppWarning";
 
67
    const char *const ZRTP_KEY = "zrtp";
 
68
    const char *const DISPLAY_SAS_KEY = "displaySas";
 
69
    const char *const DISPLAY_SAS_ONCE_KEY = "displaySasOnce";
 
70
    const char *const HELLO_HASH_ENABLED_KEY = "helloHashEnabled";
 
71
    const char *const NOT_SUPP_WARNING_KEY = "notSuppWarning";
71
72
 
72
73
    // TODO: write an object to store tls params which implement serializable
73
 
    const char *const tlsKey = "tls";
74
 
    const char *const tlsPortKey = "tlsPort";
75
 
    const char *const certificateKey = "certificate";
76
 
    const char *const calistKey = "calist";
77
 
    const char *const ciphersKey = "ciphers";
78
 
    const char *const tlsEnableKey = "enable";
79
 
    const char *const methodKey = "method";
80
 
    const char *const timeoutKey = "timeout";
81
 
    const char *const tlsPasswordKey = "password";
82
 
    const char *const privateKeyKey = "privateKey";
83
 
    const char *const requireCertifKey = "requireCertif";
84
 
    const char *const serverKey = "server";
85
 
    const char *const verifyClientKey = "verifyClient";
86
 
    const char *const verifyServerKey = "verifyServer";
87
 
 
88
 
    const char *const stunEnabledKey = "stunEnabled";
89
 
    const char *const stunServerKey = "stunServer";
90
 
 
91
 
    const char *const credKey = "credential";
 
74
    const char *const TLS_KEY = "tls";
 
75
    const char *const TLS_PORT_KEY = "tlsPort";
 
76
    const char *const CERTIFICATE_KEY = "certificate";
 
77
    const char *const CALIST_KEY = "calist";
 
78
    const char *const CIPHERS_KEY = "ciphers";
 
79
    const char *const TLS_ENABLE_KEY = "enable";
 
80
    const char *const METHOD_KEY = "method";
 
81
    const char *const TIMEOUT_KEY = "timeout";
 
82
    const char *const TLS_PASSWORD_KEY = "password";
 
83
    const char *const PRIVATE_KEY_KEY = "privateKey";
 
84
    const char *const REQUIRE_CERTIF_KEY = "requireCertif";
 
85
    const char *const SERVER_KEY = "server";
 
86
    const char *const VERIFY_CLIENT_KEY = "verifyClient";
 
87
    const char *const VERIFY_SERVER_KEY = "verifyServer";
 
88
 
 
89
    const char *const STUN_ENABLED_KEY = "stunEnabled";
 
90
    const char *const STUN_SERVER_KEY = "stunServer";
 
91
    const char *const CRED_KEY = "credential";
92
92
}
93
93
 
94
94
class SIPVoIPLink;
100
100
 
101
101
class SIPAccount : public Account {
102
102
    public:
 
103
        static const char * const IP2IP_PROFILE;
103
104
        static const char * const OVERRTP_STR;
104
105
        static const char * const SIPINFO_STR;
105
106
 
109
110
         */
110
111
        SIPAccount(const std::string& accountID);
111
112
 
112
 
        /**
113
 
         * Virtual destructor
114
 
         */
115
 
        virtual ~SIPAccount();
116
 
 
117
113
        virtual VoIPLink* getVoIPLink();
118
114
 
119
115
        std::string getUserAgentName() const;
122
118
        }
123
119
 
124
120
        /**
 
121
         * Returns true if this is the IP2IP account
 
122
         */
 
123
        bool isIP2IP() const;
 
124
 
 
125
        /**
125
126
         * Serialize internal state of this account for configuration
126
127
         * @param YamlEmitter the configuration engine which generate the configuration file
127
128
         */
128
 
        virtual void serialize(Conf::YamlEmitter *emitter);
 
129
        virtual void serialize(Conf::YamlEmitter &emitter);
129
130
 
130
131
        /**
131
132
         * Populate the internal state for this account based on info stored in the configuration file
132
133
         * @param The configuration node for this account
133
134
         */
134
 
        virtual void unserialize(Conf::MappingNode *map);
 
135
        virtual void unserialize(const Conf::MappingNode &map);
135
136
 
136
137
        /**
137
138
         * Set the internal state for this account, mainly used to manage account details from the client application.
190
191
        void stopKeepAliveTimer();
191
192
 
192
193
 
193
 
        pjsip_cred_info *getCredInfo() const {
194
 
            return cred_;
 
194
        const pjsip_cred_info* getCredInfo() const {
 
195
            return &(*cred_.begin());
195
196
        }
196
197
 
197
198
        /**
205
206
        }
206
207
 
207
208
        void setCredentials(const std::vector<std::map<std::string, std::string> >& details);
208
 
        const std::vector<std::map<std::string, std::string> > &getCredentials();
 
209
 
 
210
        const std::vector<std::map<std::string, std::string> > &
 
211
        getCredentials() const;
209
212
 
210
213
        /**
211
214
         * A client sendings a REGISTER request MAY suggest an expiration
467
470
         * @param The public IPV4 address in the standard dot notation.
468
471
         * @return void
469
472
         */
470
 
        void setPublishedAddress(const std::string& publishedIpAddress) {
 
473
        void setPublishedAddress(const std::string &publishedIpAddress) {
471
474
            publishedIpAddress_ = publishedIpAddress;
472
475
        }
473
476
 
495
498
            return zrtpHelloHash_;
496
499
        }
497
500
 
 
501
        void setReceivedParameter(const std::string &received) {
 
502
            receivedParameter_ = received;
 
503
        }
 
504
 
 
505
        std::string getReceivedParameter() const {
 
506
            return receivedParameter_;
 
507
        }
 
508
 
 
509
        int getRPort() const {
 
510
            if (rPort_ == -1)
 
511
                return localPort_;
 
512
            else
 
513
                return rPort_;
 
514
        }
 
515
 
 
516
        void setRPort(int rPort) { rPort_ = rPort; }
 
517
 
498
518
        /**
499
519
         * Timer used to periodically send re-register request based
500
520
         * on the "Expire" sip header (or the "expire" Contact parameter)
501
521
         */
502
522
        static void keepAliveRegistrationCb(pj_timer_heap_t *th, pj_timer_entry *te);
503
523
 
 
524
        bool isKeepAliveEnabled() const {
 
525
            return keepAliveEnabled_;
 
526
        }
 
527
 
 
528
        /**
 
529
         * Pointer to the transport used by this acccount
 
530
         */
504
531
        pjsip_transport* transport_;
 
532
 
505
533
    private:
506
534
        NON_COPYABLE(SIPAccount);
507
535
 
 
536
        /**
 
537
         * Map of credential for this account 
 
538
         */
508
539
        std::vector< std::map<std::string, std::string > > credentials_;
509
540
 
510
 
        /* Maps a string description of the SSL method
 
541
        /** 
 
542
         * Maps a string description of the SSL method
511
543
         * to the corresponding enum value in pjsip_ssl_method.
512
544
         * @param method The string representation
513
545
         * @return pjsip_ssl_method The corresponding value in the enum
514
546
         */
515
547
        static pjsip_ssl_method sslMethodStringToPjEnum(const std::string& method);
516
548
 
517
 
        /*
 
549
        /**
518
550
         * Initializes tls settings from configuration file.
519
 
         *
520
551
         */
521
552
        void initTlsConfiguration();
522
553
 
523
 
        /*
 
554
        /**
524
555
         * Initializes STUN config from the config file
525
556
         */
526
557
        void initStunConfiguration();
543
574
         */
544
575
        bool bRegister_;
545
576
 
546
 
        // Network settings
 
577
        /** 
 
578
         * Network settings
 
579
         */
547
580
        int registrationExpire_;
548
581
 
549
 
        // interface name on which this account is bound
 
582
        /** 
 
583
         * interface name on which this account is bound
 
584
         */
550
585
        std::string interface_;
551
586
 
552
 
        // Flag which determine if localIpAddress_ or publishedIpAddress_ is used in
553
 
        // sip headers
 
587
        /**
 
588
         * Flag which determine if localIpAddress_ or publishedIpAddress_ is used in
 
589
         * sip headers
 
590
         */
554
591
        bool publishedSameasLocal_;
555
592
 
 
593
        /**
 
594
         * Published IP address, ued only if defined by the user in account
 
595
         * configuration
 
596
         */
556
597
        std::string publishedIpAddress_;
557
598
 
 
599
        /**
 
600
         * Local port to whih this account is bound
 
601
         */
558
602
        pj_uint16_t localPort_;
 
603
 
 
604
        /**
 
605
         * Published port, used only if defined by the user
 
606
         */
559
607
        pj_uint16_t publishedPort_;
560
608
 
 
609
        /**
 
610
         * Optional list of SIP service this  
 
611
         */
561
612
        std::string serviceRoute_;
562
613
 
563
614
        /**
576
627
        /**
577
628
         * Credential information stored for further registration.
578
629
         */
579
 
        pjsip_cred_info *cred_;
 
630
        std::vector<pjsip_cred_info> cred_;
580
631
 
581
632
        /**
582
633
         * The TLS settings, used only if tls is chosen as a sip transport.
617
668
        std::string tlsEnable_;
618
669
 
619
670
        /**
620
 
         * Specify the TLS port
621
 
         */
622
 
        int tlsPort_;
623
 
 
624
 
        /**
625
671
         * Certificate autority file
626
672
         */
627
673
        std::string tlsCaListFile_;
690
736
        std::pair<int, std::string> registrationStateDetailed_;
691
737
 
692
738
        /**
 
739
         * Determine if the keep alive timer will be activated or not
 
740
         */
 
741
        bool keepAliveEnabled_;
 
742
 
 
743
        /**
693
744
         * Timer used to regularrly send re-register request based
694
745
         * on the "Expire" sip header (or the "expire" Contact parameter)
695
746
         */
696
747
        pj_timer_entry keepAliveTimer_;
697
748
 
 
749
        /**
 
750
         * Once enabled, this variable tells if the keepalive timer is activated
 
751
         * for this accout
 
752
         */
 
753
        bool keepAliveTimerActive_;
698
754
 
699
755
        /**
700
756
         * Voice over IP Link contains a listener thread and calls
701
757
         */
702
758
        SIPVoIPLink* link_;
 
759
 
 
760
        /**
 
761
         * Optional: "received" parameter from VIA header
 
762
         */
 
763
        std::string receivedParameter_;
 
764
 
 
765
        /**
 
766
         * Optional: "rport" parameter from VIA header
 
767
         */
 
768
        int rPort_;
703
769
};
704
770
 
705
771
#endif