
/*-----------------------------------------------------------------------------------------------*/
/* ipcmd_if.h                                                                                    */
/* copyright (c) innovaphone 2022                                                                */
/*                                                                                               */
/* interface of command for IOS modules                                                          */
/*-----------------------------------------------------------------------------------------------*/

#define CMD_USER_LEN         16
#define CMD_PWD_LEN_OLD     16
#define CMD_PWD_LEN         64
#define CMD_USER_PWD_LEN(user_pwd) (((user_pwd)[CMD_USER_LEN + CMD_PWD_LEN_OLD - 1] != 0) ? CMD_USER_LEN + CMD_PWD_LEN : CMD_USER_LEN + CMD_PWD_LEN_OLD)
#define CMD_STD_USR "admin"

class ipcmd_if : public module_entity, public serial {
public:
    ipcmd_if(class module * module, const char * module_name, class irql * irql, const char * name, word num, bool trace) : module_entity(module, module_name), serial(irql, name, num, trace, this) {};

    virtual void module_config(class serial * src, class module_event_config & module_config) = 0;
    virtual class serial * get_flash() = 0;
    virtual void update_password() = 0;
    virtual void update_certificate(const byte * cert, size_t cert_len) = 0;

    char user[CMD_USER_LEN + CMD_PWD_LEN];
    char * password;
};
