Ignore:
Timestamp:
Nov 6, 2013 8:05:11 AM (9 years ago)
Author:
bennylp
Message:

Re #1519: Added persistent API in pjsua2, with JSON as the format. The API is extensible to support more formats. All config structures are serializable now. Tested in Python.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/branches/projects/pjsua2/pjsip/include/pjsua2/account.hpp

    r4639 r4644  
    11/* $Id$ */ 
    22/* 
    3  * Copyright (C) 2008-2012 Teluu Inc. (http://www.teluu.com) 
     3 * Copyright (C) 2013 Teluu Inc. (http://www.teluu.com) 
    44 * 
    55 * This program is free software; you can redistribute it and/or modify 
     
    2525 */ 
    2626#include <pjsua-lib/pjsua.h> 
    27 #include <pjsua2/types.hpp> 
     27#include <pjsua2/persistent.hpp> 
     28#include <pjsua2/siptypes.hpp> 
    2829 
    2930/** 
     
    4647 * Account registration config. This will be specified in AccountConfig. 
    4748 */ 
    48 struct AccountRegConfig 
     49struct AccountRegConfig : public PersistentObject 
    4950{ 
    5051    /** 
     
    138139     */ 
    139140    unsigned            proxyUse; 
     141 
     142public: 
     143    /** 
     144     * Read this object from a container node. 
     145     * 
     146     * @param node              Container to read values from. 
     147     */ 
     148    virtual void readObject(const ContainerNode &node) throw(Error); 
     149 
     150    /** 
     151     * Write this object to a container node. 
     152     * 
     153     * @param node              Container to write values to. 
     154     */ 
     155    virtual void writeObject(ContainerNode &node) const throw(Error); 
     156 
    140157}; 
    141158 
     
    147164 * AccountConfig. 
    148165 */ 
    149 struct AccountSipConfig 
     166struct AccountSipConfig : public PersistentObject 
    150167{ 
    151168    /** 
     
    221238     */ 
    222239    TransportId         transportId; 
     240 
     241public: 
     242    /** 
     243     * Read this object from a container node. 
     244     * 
     245     * @param node              Container to read values from. 
     246     */ 
     247    virtual void readObject(const ContainerNode &node) throw(Error); 
     248 
     249    /** 
     250     * Write this object to a container node. 
     251     * 
     252     * @param node              Container to write values to. 
     253     */ 
     254    virtual void writeObject(ContainerNode &node) const throw(Error); 
    223255}; 
    224256 
     
    226258 * Account's call settings. This will be specified in AccountConfig. 
    227259 */ 
    228 struct AccountCallConfig 
     260struct AccountCallConfig : public PersistentObject 
    229261{ 
    230262    /** 
     
    265297    unsigned            timerSessExpiresSec; 
    266298 
     299public: 
     300    /** 
     301     * Read this object from a container node. 
     302     * 
     303     * @param node              Container to read values from. 
     304     */ 
     305    virtual void readObject(const ContainerNode &node) throw(Error); 
     306 
     307    /** 
     308     * Write this object to a container node. 
     309     * 
     310     * @param node              Container to write values to. 
     311     */ 
     312    virtual void writeObject(ContainerNode &node) const throw(Error); 
    267313}; 
    268314 
     
    270316 * Account presence config. This will be specified in AccountConfig. 
    271317 */ 
    272 struct AccountPresConfig 
     318struct AccountPresConfig : public PersistentObject 
    273319{ 
    274320    /** 
     
    317363     */ 
    318364    string              pidfTupleId; 
     365 
     366public: 
     367    /** 
     368     * Read this object from a container node. 
     369     * 
     370     * @param node              Container to read values from. 
     371     */ 
     372    virtual void readObject(const ContainerNode &node) throw(Error); 
     373 
     374    /** 
     375     * Write this object to a container node. 
     376     * 
     377     * @param node              Container to write values to. 
     378     */ 
     379    virtual void writeObject(ContainerNode &node) const throw(Error); 
    319380}; 
    320381 
     
    323384 * in AccountConfig. 
    324385 */ 
    325 struct AccountMwiConfig 
     386struct AccountMwiConfig : public PersistentObject 
    326387{ 
    327388    /** 
     
    342403     */ 
    343404    unsigned            expirationSec; 
     405 
     406public: 
     407    /** 
     408     * Read this object from a container node. 
     409     * 
     410     * @param node              Container to read values from. 
     411     */ 
     412    virtual void readObject(const ContainerNode &node) throw(Error); 
     413 
     414    /** 
     415     * Write this object to a container node. 
     416     * 
     417     * @param node              Container to write values to. 
     418     */ 
     419    virtual void writeObject(ContainerNode &node) const throw(Error); 
    344420}; 
    345421 
     
    348424 * specified in AccountConfig. 
    349425 */ 
    350 struct AccountNatConfig 
     426struct AccountNatConfig : public PersistentObject 
    351427{ 
    352428    /** 
     
    561637     */ 
    562638    string              udpKaData; 
     639 
     640public: 
     641    /** 
     642     * Read this object from a container node. 
     643     * 
     644     * @param node              Container to read values from. 
     645     */ 
     646    virtual void readObject(const ContainerNode &node) throw(Error); 
     647 
     648    /** 
     649     * Write this object to a container node. 
     650     * 
     651     * @param node              Container to write values to. 
     652     */ 
     653    virtual void writeObject(ContainerNode &node) const throw(Error); 
    563654}; 
    564655 
     
    567658 * specified in AccountConfig. 
    568659 */ 
    569 struct AccountMediaConfig 
     660struct AccountMediaConfig : public PersistentObject 
    570661{ 
    571662    /** 
     
    618709     */ 
    619710    pjsua_ipv6_use      ipv6Use; 
     711 
     712public: 
     713    /** 
     714     * Read this object from a container node. 
     715     * 
     716     * @param node              Container to read values from. 
     717     */ 
     718    virtual void readObject(const ContainerNode &node) throw(Error); 
     719 
     720    /** 
     721     * Write this object to a container node. 
     722     * 
     723     * @param node              Container to write values to. 
     724     */ 
     725    virtual void writeObject(ContainerNode &node) const throw(Error); 
    620726}; 
    621727 
     
    623729 * Account video config. This will be specified in AccountConfig. 
    624730 */ 
    625 struct AccountVideoConfig 
     731struct AccountVideoConfig : public PersistentObject 
    626732{ 
    627733    /** 
     
    694800     */ 
    695801    unsigned                    rateControlBandwidth; 
     802 
     803public: 
     804    /** 
     805     * Read this object from a container node. 
     806     * 
     807     * @param node              Container to read values from. 
     808     */ 
     809    virtual void readObject(const ContainerNode &node) throw(Error); 
     810 
     811    /** 
     812     * Write this object to a container node. 
     813     * 
     814     * @param node              Container to write values to. 
     815     */ 
     816    virtual void writeObject(ContainerNode &node) const throw(Error); 
    696817}; 
    697818 
     
    699820 * Account configuration. 
    700821 */ 
    701 struct AccountConfig 
     822struct AccountConfig : public PersistentObject 
    702823{ 
    703824    /** 
     
    777898    void fromPj(const pjsua_acc_config &prm, const pjsua_media_config *mcfg); 
    778899 
     900    /** 
     901     * Read this object from a container node. 
     902     * 
     903     * @param node              Container to read values from. 
     904     */ 
     905    virtual void readObject(const ContainerNode &node) throw(Error); 
     906 
     907    /** 
     908     * Write this object to a container node. 
     909     * 
     910     * @param node              Container to write values to. 
     911     */ 
     912    virtual void writeObject(ContainerNode &node) const throw(Error); 
    779913}; 
    780914 
Note: See TracChangeset for help on using the changeset viewer.