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/endpoint.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 
     
    2424 * @brief PJSUA2 Base Agent Operation 
    2525 */ 
    26 #include <pjsua2/types.hpp> 
     26#include <pjsua2/persistent.hpp> 
     27#include <pjsua2/siptypes.hpp> 
    2728 
    2829/** PJSUA2 API is inside pj namespace */ 
     
    162163////////////////////////////////////////////////////////////////////////////// 
    163164 
    164 struct UaConfig 
     165struct UaConfig : public PersistentObject 
    165166{ 
    166167    /** 
     
    265266     */ 
    266267    pjsua_config toPj() const; 
     268 
     269    /** 
     270     * Read this object from a container. 
     271     * 
     272     * @param node              Container to write values from. 
     273     */ 
     274    virtual void readObject(const ContainerNode &node) throw(Error); 
     275 
     276    /** 
     277     * Write this object to a container. 
     278     * 
     279     * @param node              Container to write values to. 
     280     */ 
     281    virtual void writeObject(ContainerNode &node) const throw(Error); 
     282 
    267283}; 
    268284 
     
    307323 * Lib::init(). 
    308324 */ 
    309 struct LogConfig 
     325struct LogConfig : public PersistentObject 
    310326{ 
    311327    /** Log incoming and outgoing SIP message? Yes!  */ 
     
    350366    /** Generate pjsua_logging_config. */ 
    351367    pjsua_logging_config toPj() const; 
     368 
     369    /** 
     370     * Read this object from a container. 
     371     * 
     372     * @param node              Container to write values from. 
     373     */ 
     374    virtual void readObject(const ContainerNode &node) throw(Error); 
     375 
     376    /** 
     377     * Write this object to a container. 
     378     * 
     379     * @param node              Container to write values to. 
     380     */ 
     381    virtual void writeObject(ContainerNode &node) const throw(Error); 
    352382}; 
    353383 
     
    357387 * when calling Lib::init(). 
    358388 */ 
    359 struct MediaConfig 
     389struct MediaConfig : public PersistentObject 
    360390{ 
    361391public: 
     
    555585    /** Export */ 
    556586    pjsua_media_config toPj() const; 
     587 
     588    /** 
     589     * Read this object from a container. 
     590     * 
     591     * @param node              Container to write values from. 
     592     */ 
     593    virtual void readObject(const ContainerNode &node) throw(Error); 
     594 
     595    /** 
     596     * Write this object to a container. 
     597     * 
     598     * @param node              Container to write values to. 
     599     */ 
     600    virtual void writeObject(ContainerNode &node) const throw(Error); 
    557601}; 
    558602 
     
    561605 * Endpoint configuration 
    562606 */ 
    563 struct EpConfig 
     607struct EpConfig : public PersistentObject 
    564608{ 
    565609    /** UA config */ 
     
    571615    /** Media config */ 
    572616    MediaConfig         medConfig; 
     617 
     618    /** 
     619     * Read this object from a container. 
     620     * 
     621     * @param node              Container to write values from. 
     622     */ 
     623    virtual void readObject(const ContainerNode &node) throw(Error); 
     624 
     625    /** 
     626     * Write this object to a container. 
     627     * 
     628     * @param node              Container to write values to. 
     629     */ 
     630    virtual void writeObject(ContainerNode &node) const throw(Error); 
     631 
    573632}; 
    574633 
Note: See TracChangeset for help on using the changeset viewer.