blob: 1985e6ff315b2a7a250f373739cd3ec391496ae4 [file] [log] [blame]
/******************************************************************************
*(C) Copyright 2014 Marvell International Ltd.
* All Rights Reserved
******************************************************************************/
/* -------------------------------------------------------------------------------------------------------------------
*
* Filename: mbim_util.h
*
* Authors: Adrian Zelezniak
*
* Description: all utiliy functions and macros needed for the MIBM translator
*
* HISTORY:
* Jan 7, 2014 - Initial Version
*
* Notes:
*
******************************************************************************/
#ifndef MBIM_BASIC_H
#define MBIM_BASIC_H
/******************************************************************************
* Include files
******************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include "mbim_types.h"
#include "mbim_protocol.h"
/******************************************************************************
* Macros
******************************************************************************/
extern MBIM_DATABASE mbimDb;
#define IP_CONNECT_LOCK() pthread_mutex_lock(&mbimDb.ip_connect_mutex)
#define IP_CONNECT_UNLOCK() pthread_mutex_unlock(&mbimDb.ip_connect_mutex)
/******************************************************************************
* Defines
******************************************************************************/
#define UUID_BASIC_CID_MAX 25
#define BASIC_CID_PARAMS UINT32 cid, UINT32 transactionId, UINT32 commandType, UINT32 infoBufLen, char *infoBuf_p
#define BASIC_CID_PARAMS_USAGE cid, transactionId, commandType, infoBufLen, infoBuf_p
typedef int (*basicUuidProcessors)(BASIC_CID_PARAMS);
/******************************************************************************
* External variables
******************************************************************************/
/******************************************************************************
* MBIM_CID_DEVICE_CAPS Chapter 10.5.1
******************************************************************************/
#define IMEI_MAX_SIZE (18)
typedef struct _MBIM_DEVICE_CAPS_INFO
{
UINT32 deviceType;
UINT32 cellularClass;
UINT32 voiceClass;
UINT32 simClass;
UINT32 dataClass;
UINT32 smsCaps;
UINT32 controlCaps;
UINT32 maxSessions;
UINT32 CustomDataClassOffset;
UINT32 CustomDataClassSize;
UINT32 deviceIdOffset;
UINT32 deviceIdSize;
UINT32 firmwareInfoOffset;
UINT32 firmwareInfoSize;
UINT32 hardwareInfoOffset;
UINT32 HardwareInfoSize;
char dataBuffer[1]; //Place holder only (Need to allocate enough data for all commands).
}MBIM_DEVICE_CAPS_INFO, *P_MBIM_DEVICE_CAPS_INFO;
typedef struct _MBIM_DEVICE_CAPS_INFO_V2
{
UINT32 deviceType;
UINT32 cellularClass;
UINT32 voiceClass;
UINT32 simClass;
UINT32 dataClass;
UINT32 smsCaps;
UINT32 controlCaps;
UINT32 maxSessions;
UINT32 CustomDataClassOffset;
UINT32 CustomDataClassSize;
UINT32 deviceIdOffset;
UINT32 deviceIdSize;
UINT32 firmwareInfoOffset;
UINT32 firmwareInfoSize;
UINT32 hardwareInfoOffset;
UINT32 HardwareInfoSize;
UINT32 ExecutorIndex;
char dataBuffer[1]; //Place holder only (Need to allocate enough data for all commands).
}MBIM_DEVICE_CAPS_INFO_V2, *P_MBIM_DEVICE_CAPS_INFO_V2;
typedef struct _MBIM_DEVICE_CAPS_INFO_V3
{
UINT32 deviceType;
UINT32 cellularClass;
UINT32 voiceClass;
UINT32 simClass;
UINT32 dataClass;
UINT32 smsCaps;
UINT32 controlCaps;
UINT64 DataSubClass;
UINT32 maxSessions;
UINT32 ExecutorIndex;
UINT32 WcdmaBandClass;
}MBIM_DEVICE_CAPS_INFO_V3, *P_MBIM_DEVICE_CAPS_INFO_V3;
typedef enum _MBIM_DEVICE_TYPE_ENUM
{
MBIMDeviceTypeUnknown = 0,
MBIMDeviceTypeEmbedded,
MBIMDeviceTypeRemovable,
MBIMDeviceTypeRemote
}MBIM_DEVICE_TYPE_ENUM;
typedef enum _MBIM_CELLULAR_CLASS_ENUM
{
MBIMCellularClassGsm = 1,
MBIMCellularClassCdma
}MBIM_CELLULAR_CLASS_ENUM;
typedef enum _MBIM_VOICE_CLASS_ENUM
{
MBIMVoiceClassUnknown = 0,
MBIMVoiceClassNoVoice,
MBIMVoiceClassSeparateVoiceData,
MBIMVoiceClassSimultaneousVoiceData
}MBIM_VOICE_CLASS_ENUM;
typedef enum _MBIM_SIM_CLASS_ENUM
{
MBIMSimClassSimLogical = 1,
MBIMSimClassSimRemovable
}MBIM_SIM_CLASS_ENUM;
//MBIM_DATA_CLASS
#define MBIMDataClassNone (0x0)
#define MBIMDataClassGPRS (0x1)
#define MBIMDataClassEDGE (0x2)
#define MBIMDataClassUMTS (0x4)
#define MBIMDataClassHSDPA (0x8)
#define MBIMDataClassHSUPA (0x10)
#define MBIMDataClassLTE (0x20)
#define MBIMDataClass5G (0x40)
#define MBIMDataClassUnused (0x80)
#define MBIMDataClass1XRTT (0x10000)
#define MBIMDataClass1XEVDO (0x20000)
#define MBIMDataClass1XEVDORevA (0x40000)
#define MBIMDataClass1XEVDV (0x80000)
#define MBIMDataClass3XRTT (0x100000)
#define MBIMDataClass1XEVDORevB (0x200000)
#define MBIMDataClassUMB (0x400000)
#define MBIMDataClassCustom (0x80000000)
//MBIM_DATA_SUBCLASS
#define MBIMDataSubClassNone (0x0)
#define MBIMDataSubClass5GENDC (0x1)
#define MBIMDataSubClass5GNR (0x2)
#define MBIMDataSubClass5GNEDC (0x4)
#define MBIMDataSubClass5GELTE (0x8)
#define MBIMDataSubClass5GNGENDC (0x10)
//MBIM_SMS_CAPS
#define MBIMSmsCapsNone (0x0)
#define MBIMSmsCapsPduReceive (0x1)
#define MBIMSmsCapsPduSend (0x2)
#define MBIMSmsCapsTextReceive (0x4)
#define MBIMSmsCapsTextSend (0x8)
//MBIM_CTRL_CAPS
#define MBIMCtrlCapsNone (0x0)
#define MBIMCtrlCapsRegManual (0x1)
#define MBIMCtrlCapsHwRadioSwitch (0x2)
#define MBIMCtrlCapsCdmaMobileIp (0x4)
#define MBIMCtrlCapsCdmaSimpleIp (0x8)
#define MBIMCtrlCapsMultiCarrier (0x10)
#define MBIMCtrlCapsESIM (0x20)
#define MBIMCtrlCapsUEPolicyRouteSelection (0x40)
#define MBIMCtrlCapsSIMHotSwapCapable (0x80)
/******************************************************************************
* MBIM_CID_SUBSCRIBER_READY_STATUS Chapter 10.5.2
******************************************************************************/
#define NUM_OF_PHONE_NUMBER_SUPPORTED (1)
#define IMSI_MAX_SIZE (15)
typedef struct _MBIM_TELEPHONE_NUMBER
{
char number[22]; //max size is 22
}MBIM_TELEPHONE_NUMBER, *P_MBIM_TELEPHONE_NUMBER;
typedef struct _MBIM_SUBSCRIBER_READY_INFO_V1
{
UINT32 readyState;
UINT32 subscriberIdOffset;
UINT32 subscriberIdSize;
UINT32 simIccIdOffset;
UINT32 simIccIdSize;
UINT32 readyInfo;
UINT32 elementCount;
//Here go OL_PAIR_LIST
//Then data buffer
}MBIM_SUBSCRIBER_READY_INFO_V1, *P_MBIM_SUBSCRIBER_READY_INFO_V1;
typedef struct _MBIM_SUBSCRIBER_READY_INFO_V3
{
UINT32 readyState;
UINT32 flags;
UINT32 subscriberIdOffset;
UINT32 subscriberIdSize;
UINT32 simIccIdOffset;
UINT32 simIccIdSize;
UINT32 readyInfo;
UINT32 elementCount;
//Here go OL_PAIR_LIST
//Then data buffer
}MBIM_SUBSCRIBER_READY_INFO_V3, *P_MBIM_SUBSCRIBER_READY_INFO_V3;
typedef enum _MBIM_SUBSCRIBER_READY_STATE_ENUM
{
MBIMSubscriberReadyStateNotInitialized = 0,
MBIMSubscriberReadyStateInitialized,
MBIMSubscriberReadyStateSimNotInserted,
MBIMSubscriberReadyStateBadSim,
MBIMSubscriberReadyStateFailure,
MBIMSubscriberReadyStateNotActivated,
MBIMSubscriberReadyStateDeviceLocked,
MBIMSubscriberReadyStateNoEsimProfile,
}MBIM_SUBSCRIBER_READY_STATE_ENUM;
typedef enum _MBIM_UNIQUE_ID_FLAGS_ENUM
{
MBIMReadyInfoFlagsNone = 0,
MBIMReadyInfoFlagsProtectUniqueID
}MBIM_UNIQUE_ID_FLAGS_ENUM;
typedef enum _MBIM_SUBSCRIBER_READY_STATUS_FLAGS
{
MBIMSubscriberReadyStatusFlagNone = 0x0,
MBIMSubscriberReadyStatusFlagESim = 0x1,
MBIMSubscriberReadyStatusFlagSIMRemovabilityKnown = 0x2,
MBIMSubscriberReadyStatusFlagSIMRemovable = 0x4
}MBIM_SUBSCRIBER_READY_STATUS_FLAGS;
/******************************************************************************
* MBIM_CID_RADIO_STATE Chapter 10.5.3
******************************************************************************/
typedef struct _MBIM_SET_RADIO_STATE
{
UINT32 RadioState;
}MBIM_SET_RADIO_STATE, *P_MBIM_SET_RADIO_STATE;
typedef struct _MBIM_RADIO_STATE_INFO
{
UINT32 HwRadioState;
UINT32 SwRadioState;
}MBIM_RADIO_STATE_INFO, *P_MBIM_RADIO_STATE_INFO;
typedef enum _MBIM_RADIO_SWITCH_STATE_ENUM
{
MBIMRadioOff = 0,
MBIMRadioOn
}MBIM_RADIO_SWITCH_STATE_ENUM;
/******************************************************************************
* MBIM_CID_PIN Chapter 10.5.4
******************************************************************************/
typedef struct _MBIM_SET_PIN
{
UINT32 pinType;
UINT32 pinOperation;
UINT32 pinOffset;
UINT32 pinSize;
UINT32 newPinOffset;
UINT32 newPinSize;
char *dataBuffer[1];
}MBIM_SET_PIN, *P_MBIM_SET_PIN;
typedef struct _MBIM_PIN_INFO
{
UINT32 pinType;
UINT32 pinState;
UINT32 remainingAttempts;
}MBIM_PIN_INFO, *P_MBIM_PIN_INFO;
typedef enum _MBIM_PIN_TYPE_ENUM
{
MBIMPinTypeNone = 0, // No PIN is pending to be entered.
MBIMPinTypeCustom = 1, // The PIN type is a custom type and is none of the other PIN types listed in this enumeration.
MBIMPinTypePin1 = 2, // The PIN1 key.
MBIMPinTypePin2 = 3, // The PIN2 key.
MBIMPinTypeDeviceSimPin = 4, // The device to SIM key.
MBIMPinTypeDeviceFirstSimPin = 5, // The device to very first SIM key.
MBIMPinTypeNetworkPin = 6, // The network personalization key.
MBIMPinTypeNetworkSubsetPin = 7, // The network subset personalization key.
MBIMPinTypeServiceProviderPin = 8, // The service provider(SP) personalization key.
MBIMPinTypeCorporatePin = 9, // The corporate personalization key.
MBIMPinTypeSubsidyLock = 10, // The subsidy unlock key.
MBIMPinTypePuk1 = 11, // The Personal Identification Number 1 Unlock Key(PUK1).
MBIMPinTypePuk2 = 12, // The Personal Identification Number 2 Unlock Key(PUK2).
MBIMPinTypeDeviceFirstSimPuk = 13, // The device to very first SIM PIN unlock key.
MBIMPinTypeNetworkPuk = 14, // The network personalization unlock key.
MBIMPinTypeNetworkSubsetPuk = 15, // The network subset personalization unlock key.
MBIMPinTypeServiceProviderPuk = 16, // The service provider(SP) personalization unlock key.
MBIMPinTypeCorporatePuk = 17, // The corporate personalization unlock key.
MBIMPinTypeNev = 18, // The NEV key.
MBIMPinTypeAdm = 19, // The administrative key.
}MBIM_PIN_TYPE_ENUM;
typedef enum _MBIM_PIN_STATE
{
MBIMPinStateUnlocked = 0,
MBIMPinStateLocked = 1,
MIBMPinStateNone = 0xFF
}MBIM_PIN_STATE;
typedef enum _MBIM_PIN_OPERATION_ENUM
{
MBIMPinOperationEnter = 0,
MBIMPinOperationEnable,
MBIMPinOperationDisable,
MBIMPinOperationChange
}MBIM_PIN_OPERATION_ENUM;
/******************************************************************************
* MBIM_CID_PIN_LIST Chapter 10.5.5
******************************************************************************/
typedef struct _MBIM_PIN_DESC
{
UINT32 pinMode;
UINT32 pinFormat;
UINT32 pinLengthMin;
UINT32 pinLengthMax;
}MBIM_PIN_DESC, *P_MBIM_PIN_DESC;
typedef struct _MBIM_PIN_LIST_INFO
{
MBIM_PIN_DESC pinDescPin1;
MBIM_PIN_DESC pinDescPin2;
MBIM_PIN_DESC pinDescDeviceSimPin;
MBIM_PIN_DESC PinDescDeviceFirstSimPin;
MBIM_PIN_DESC PinDescNetworkPin;
MBIM_PIN_DESC PinDescNetworkSubsetPin;
MBIM_PIN_DESC PinDescServiceProviderPin;
MBIM_PIN_DESC PinDescCorporatePin;
MBIM_PIN_DESC PinDescSubsidyLock;
MBIM_PIN_DESC PinDescCustom;
}MBIM_PIN_LIST_INFO, *P_MBIM_PIN_LIST_INFO;
typedef enum _MBIM_PIN_MODE_ENUM
{
MBIMPinModeNotSupported = 0,
MBIMPinModeEnabled,
MBIMPinModeDisabled
}MBIM_PIN_MODE_ENUM;
typedef enum _MBIM_PIN_FORMAT_ENUM
{
MBIMPinFormatUnknown = 0,
MBIMPinFormatNumeric,
MBIMPinFormatAlphaNumeric
}MBIM_PIN_FORMAT_ENUM;
#define MBIM_MAX_PIN_PASS_SIZE 8
#define MBIM_MIN_PIN_PASS_SIZE 4
typedef enum _MBIM_PIN_STATUS
{
LOCK_ENABLE_ACTIVATED = 0,
LOCK_ENABLE_DEACTIVATED,
LOCK_DISENABLE,
LOCK_BLOCK,
LOCK_STATE_NOT_READ,
MEP_NOT_SUPPORT
}MBIM_PIN_STATUS;
/******************************************************************************
* MBIM_CID_HOME_PROVIDER Chapter 10.5.6
******************************************************************************/
typedef struct _MBIM_PROVIDER
{
UINT32 providerIdOffset;
UINT32 providerIdSize;
UINT32 providerIdState;
UINT32 providerNameOffset;
UINT32 providerNameSize;
UINT32 cellularClass;
UINT32 rssi;
UINT32 errorRate;
char dataBuffer[0];
} MBIM_PROVIDER, *P_MBIM_PROVIDER;
#define MBIM_PROVIDER_STATE_UNKNOWN (0x0)
#define MBIM_PROVIDER_STATE_HOME (0x1)
#define MBIM_PROVIDER_STATE_FORBIDDEN (0x2)
#define MBIM_PROVIDER_STATE_PREFERRED (0x4)
#define MBIM_PROVIDER_STATE_VISIBLE (0x8)
#define MBIM_PROVIDER_STATE_REGISTERED (0x10)
#define MBIM_PROVIDER_STATE_PREFERRED_MULTICARRIER (0x20)
/******************************************************************************
* MBIM_CID_VISIBLE_PROVIDERS Chapter 10.5.8
******************************************************************************/
typedef struct _MBIM_VISIBLE_PROVIDERS_REQ
{
UINT32 action;
}MBIM_VISIBLE_PROVIDERS_REQ, *P_MBIM_VISIBLE_PROVIDERS_REQ;
typedef struct _MBIM_PROVIDERS
{
UINT32 elementCount;
//OL_PAIR_LIST[elementCount]
//DataBuffer for each element
}MBIM_PROVIDERS, *P_MBIM_PROVIDERS;
typedef enum _MBIM_VISIBLE_PROVIDERS_ACTION_ENUM
{
MBIMVisibleProvidersActionFullScan = 0,
MBIMVisibleProvidersActionRestrictedScan
}MBIM_VISIBLE_PROVIDERS_ACTION_ENUM;
/******************************************************************************
* MBIM_CID_REGISTER_STATE Chapter 10.5.9
******************************************************************************/
#define COPS_OPERATOR_ID_FORMAT 2 //This is for MNC MCC
#define CID_REGISTER_MAX_PROVIDER_NAME_SIZE 20
#define CID_REGISTER_MAX_PROVIDER_ID_SIZE 12
typedef struct _MBIM_SET_REGISTRATION_STATE
{
UINT32 providerIdOffset;
UINT32 providerIdSize;
UINT32 registerAction;
UINT32 dataClass;
char *dataBuffer[1]; //Provider Id
} MBIM_SET_REGISTRATION_STATE, *P_MBIM_SET_REGISTRATION_STATE;
typedef struct _MBIM_REGISTRATION_STATE_INFO_V1
{
UINT32 nwError;
UINT32 registerState;
UINT32 registerMode;
UINT32 availableDataClass;
UINT32 currentCellularClass;
UINT32 providerIdOffset;
UINT32 providerIdSize;
UINT32 providerNameOffset;
UINT32 providerNameSize;
UINT32 roamingTextOffset;
UINT32 roamingTextSize;
UINT32 registrationFlag;
char dataBuffer[0]; //ProviderId, Provider Name, Roamingtext
}MBIM_REGISTRATION_STATE_INFO_V1, *P_MBIM_REGISTRATION_STATE_INFO_V1;
typedef struct _MBIM_REGISTRATION_STATE_INFO
{
UINT32 nwError;
UINT32 registerState;
UINT32 registerMode;
UINT32 availableDataClass;
UINT32 currentCellularClass;
UINT32 providerIdOffset;
UINT32 providerIdSize;
UINT32 providerNameOffset;
UINT32 providerNameSize;
UINT32 roamingTextOffset;
UINT32 roamingTextSize;
UINT32 registrationFlag;
/*
A bitmap of the values in Table: MBIM_DATA_CLASS that represents the enabled data classes in device.
The device can only operate using data classes enabled.
*/
UINT32 preferredDataClasses;
char dataBuffer[0]; //ProviderId, Provider Name, Roamingtext
}MBIM_REGISTRATION_STATE_INFO, *P_MBIM_REGISTRATION_STATE_INFO;
typedef enum _MBIM_REGISTER_ACTION_ENUM
{
MBIMRegisterActionAutomatic = 0,
MBIMRegisterActionManual
}MBIM_REGISTER_ACTION_ENUM;
typedef enum _MBIM_REGISTER_STATE_ENUM
{
MBIMRegisterStateUnknown = 0,
MBIMRegisterStateDeregistered,
MBIMRegisterStateSearching,
MBIMRegisterStateHome,
MBIMRegisterStateRoaming,
MBIMRegisterStatePartner,
MBIMRegisterStateDenied
}MBIM_REGISTER_STATE_ENUM;
typedef enum _MBIM_REGISTER_MODE_ENUM
{
MBIMRegisterModeUnknown = 0,
MBIMRegisterModeAutomatic,
MBIMRegisterModeManual
}MBIM_REGISTER_MODE_ENUM;
typedef enum _MBIM_REGISTRATION_FLAGS_ENUM
{
MBIM_REGISTRATION_NONE = 0,
MBIM_REGISTRATION_MANUAL_SELECTION_NOT_AVAILABLE,
MBIM_REGISTRATION_PACKET_SERVICE_AUTOMATIC_ATTACH
}MBIM_REGISTRATION_FLAGS_ENUM;
/******************************************************************************
* MBIM_CID_HOME_PROVIDER Chapter 10.5.10
******************************************************************************/
typedef struct _MBIM_SET_PACKET_SERVICE
{
UINT32 packetServiceAction;
}MBIM_SET_PACKET_SERVICE, *P_MBIM_SET_PACKET_SERVICE;
typedef enum _MBIM_FREQUENCY_RANGE
{
MBIMFrequencyRangeUnknown = 0, //If system type is not 5G
MBIMFrequencyRange1, //FR1 in 3GPP TS 38.101-1 (Sub-6G)
MBIMFrequencyRange2, //FR2 in 3GPP TS 38.101-2 (mmWave)
MBIMFrequencyRange1AndRange2 //If both FR1 and FR2 carriers are connected
}MBIM_FREQUENCY_RANGE;
typedef struct _MBIM_PACKET_SERVICE_INFO_V1
{
UINT32 nwError;
UINT32 packetServiceState;
UINT32 highestAvailableDataClass;
UINT64 ulinkSpeed;
UINT64 DownlinkSpeed;
}MBIM_PACKET_SERVICE_INFO_V1, *P_MBIM_PACKET_SERVICE_INFO_V1;
typedef struct _MBIM_PACKET_SERVICE_INFO_V2
{
UINT32 nwError;
UINT32 packetServiceState;
UINT32 currentDataClass; //MBIM_DATA_CLASS
UINT64 ulinkSpeed;
UINT64 DownlinkSpeed;
UINT32 FrequencyRange; //MBIM_FREQUENCY_RANGE
}MBIM_PACKET_SERVICE_INFO_V2, *P_MBIM_PACKET_SERVICE_INFO_V2;
/*
Mobile Country Code of 3 decimal digits;
The least significant 12 bits contains BCD-encoded 3 decimal digits sequentially for the MCC, with the last digit of the MCC in the least significant 4 bits.
The unused bits in the UINT16 integer must be zeros.
Mobile Network Code of either 3 or 2 decimal digits;
The most significant bit indicates whether the MNC has 2 decimal digits or 3 decimal digits.
If this bit has 1, the MNC has 2 decimal digits and the least significant 8 bits contains them in BCD-encoded form sequentially, with the last digit of the MNC in the least significant 4 bits.
If the most significant bit has 0, the MNC has 3 decimal digits and the least significant 12 bits contains them in BCD-encoded form sequentially, with the last digit of the MNC in the least significant 4 bits.
The unused bits in the UINT16 integer must be zeros.
*/
typedef struct _MBIM_MS_PLMN
{
UINT16 Mcc;
UINT16 Mnc;
}MBIM_MS_PLMN, *P_MBIM_MS_PLMN;
typedef struct _MBIM_MS_TAI
{
MBIM_MS_PLMN Plmn;
UINT32 Tac;
}MBIM_MS_TAI, *P_MBIM_MS_TAI;
#pragma pack(1)
typedef struct _MBIM_PACKET_SERVICE_INFO_V3
{
UINT32 nwError;
UINT32 packetServiceState;
UINT32 currentDataClass; //MBIM_DATA_CLASS
UINT64 ulinkSpeed;
UINT64 DownlinkSpeed;
UINT32 FrequencyRange; //MBIM_FREQUENCY_RANGE
UINT32 CurrentDataSubClass;
MBIM_MS_TAI TrackingAreaIdentity;
}MBIM_PACKET_SERVICE_INFO_V3, *P_MBIM_PACKET_SERVICE_INFO_V3;
typedef struct _MBIM_PACKET_SERVICE_INFO
{
UINT32 nwError;
UINT32 packetServiceState;
union {
UINT32 highestAvailableDataClass;
UINT32 currentDataClass; //MBIM_DATA_CLASS
};
UINT64 ulinkSpeed;
UINT64 DownlinkSpeed;
UINT32 FrequencyRange; //MBIM_FREQUENCY_RANGE v2
UINT32 CurrentDataSubClass; //v3
MBIM_MS_TAI TrackingAreaIdentity; //v3
}MBIM_PACKET_SERVICE_INFO, *P_MBIM_PACKET_SERVICE_INFO;
#pragma pack()
typedef enum _MBIM_PACKET_SERVICE_ACTION_ENUM
{
MBIMPacketServiceActionAttach = 0,
MBIMPacketServiceActionDetach
}MBIM_PACKET_SERVICE_ACTION_ENUM, *P__MBIM_PACKET_SERVICE_ACTION_ENUM;
typedef enum _MBIM_PACKET_SERVICE_STATE
{
MBIMPacketServiceStateUnknown = 0,
MBIMPacketServiceStateAttaching,
MBIMPacketServiceStateAttached,
MBIMPacketServiceStateDetaching,
MBIMPacketServiceStateDetached
}MBIM_PACKET_SERVICE_STATE, *P_MBIM_PACKET_SERVICE_STATE;
/******************************************************************************
* MBIM_CID_SIGNAL_STRENGTH Chapter 10.5.11
******************************************************************************/
#define CID_SIGNAL_STRENGTH_RSSI_UNKOWN 99
#define CID_SIGNAL_STRENGTH_ERROR_RATE_UNKOWN 99
#define CID_SIGNAL_STRENGTH_ERROR_RATE_THR_DONT_CARE (0xFFFFFFFFL)
typedef struct _MBIM_SET_SIGNAL_STATE
{
UINT32 signalStrengthInterval; //Repoert Interval in seconds
UINT32 rssiThreshold;
UINT32 errorRateThreshold;
}MBIM_SET_SIGNAL_STATE, *P_MBIM_SET_SIGNAL_STATE;
typedef struct _MBIM_SIGNAL_STATE_INFO_V1
{
UINT32 rssi;
UINT32 errorRate;
UINT32 signalStrengthInterval;
UINT32 RssiThreshold;
UINT32 errorRateThreshold;
}MBIM_SIGNAL_STATE_INFO_V1, *P_MBIM_SIGNAL_STATE_INFO_V1;
typedef struct _MBIM_RSRP_SNR_INFO
{
UINT32 RSRP;
UINT32 SNR;
UINT32 RSRPTreshold;
UINT32 SNRThreshold;
UINT32 SystemType; //MBIM_DATA_CLASS
}MBIM_RSRP_SNR_INFO, *P_MBIM_RSRP_SNR_INFO;
typedef struct _MBIM_RSRP_SNR
{
UINT32 ElementCount; //Count of RSRP_SNR entries following this element
char *DataBuffer; //Array of RSRP_SNR records, each specified as MBIM_RSRP_SNR_INFO
}MBIM_RSRP_SNR, *P_MBIM_RSRP_SNR;
typedef struct _MBIM_SIGNAL_STATE_INFO
{
UINT32 rssi;
UINT32 errorRate;
UINT32 signalStrengthInterval;
UINT32 RssiThreshold;
UINT32 errorRateThreshold;
UINT32 RsrpSnrOffset;
UINT32 RsrpSnrSize;
char *DataBuffer[1]; //MBIM_RSRP_SNR
}MBIM_SIGNAL_STATE_INFO, *P_MBIM_SIGNAL_STATE_INFO;
/******************************************************************************
* MBIM_CID_CONNECT Chapter 10.5.12
******************************************************************************/
typedef enum _MBIM_MS_ACCESS_MEDIA_TYPE
{
MBIMAccessMediaTypeNone = 0,
MBIMAccessMediaType3GPP = 1,
MBIMAccessMediaType3GPPPreferred = 2,
}MBIM_MS_ACCESS_MEDIA_TYPE;
typedef struct _MBIM_SET_CONNECT_EX3
{
UINT32 sessionId;
UINT32 activationCommand;
UINT32 Compression;
UINT32 authProtocol;
UINT32 ipType;
MBIM_UUID contextType;
UINT32 MediaPreference;
char *dataBuffer[1];
}MBIM_SET_CONNECT_EX3, *P_MBIM_SET_CONNECT_EX3;
typedef struct _MBIM_CONNECT_QUERY_INFO_EX3
{
UINT32 SessionId;
}MBIM_CONNECT_QUERY_INFO_EX3, *P_MBIM_CONNECT_QUERY_INFO_EX3;
typedef struct _MBIM_SET_CONNECT
{
UINT32 sessionId;
UINT32 activationCommand;
UINT32 accessStringOffset;
UINT32 accessStringSize;
UINT32 userNameOffset;
UINT32 userNameSize;
UINT32 passwordOffset;
UINT32 passwordSize;
UINT32 Compression;
UINT32 authProtocol;
UINT32 ipType;
MBIM_UUID contextType;
char *dataBuffer[1]; //Data container (Access String, UserName, Password)
}MBIM_SET_CONNECT, *P_MBIM_SET_CONNECT;
typedef struct _MBIM_CONNECT_INFO
{
UINT32 sessionId;
UINT32 activationState;
UINT32 voiceCallState;
UINT32 ipType;
MBIM_UUID contextType;
UINT32 nwError;
//v3
UINT32 AccessMedia;
char *dataBuffer[1]; //DNN, unamed IE's
} MBIM_CONNECT_INFO, *P_MBIM_CONNECT_INFO;
typedef struct _MBIM_CONNECT_INFO_V1
{
UINT32 sessionId;
UINT32 activationState;
UINT32 voiceCallState;
UINT32 ipType;
MBIM_UUID contextType;
UINT32 nwError;
} MBIM_CONNECT_INFO_V1, *P_MBIM_CONNECT_INFO_V1;
typedef enum _MBIM_ACTIVATION_COMMAND_ENUM
{
MBIMActivationCommandDeactivate = 0,
MBIMActivationCommandActivate
}MBIM_ACTIVATION_COMMAND_ENUM;
typedef enum _MBIM_COMPRESSION_ENUM
{
MBIMCompressionNone = 0,
MBIMCompressionEnable
}MBIM_COMPRESSION_ENUM;
typedef enum _MBIM_AUTH_PROTOCOL_ENUM
{
MBIMAuthProtocolNone = 0,
MBIMAuthProtocolPap,
MBIMAuthProtocolChap,
MBIMAuthProtocolMsChapV2
}MBIM_AUTH_PROTOCOL_ENUM;
typedef enum _MBIM_CONTEXT_IP_TYPE_ENUM
{
MBIMContextIPTypeDefault = 0,
MBIMContextIPTypeIPv4,
MBIMContextIPTypeIPv6,
MBIMContextIPTypeIPv4v6,
MBIMContextIPTypeIPv4AndIPv6
}MBIM_CONTEXT_IP_TYPE_ENUM;
typedef enum _MBIM_ACTIVATION_STATE_ENUM
{
MBIMActivationStateUnknown = 0,
MBIMActivationStateActivated,
MBIMActivationStateActivating,
MBIMActivationStateDeactivated,
MBIMActivationStateDeactivating
}MBIM_ACTIVATION_STATE_ENUM;
typedef enum _MBIM_VOICE_CALL_STATE_ENUM
{
MBIMVoiceCallStateNone = 0,
MBIMVoiceCallStateInProgress,
MBIMVoiceCallStateHangUp
}MBIM_VOICE_CALL_STATE_ENUM;
#define MBIMContextTypeNone "\xB4\x3F\x75\x8C" "\xA5\x60" "\x4B\x46" "\xB3\x5E" "\xC5\x86\x96\x41\xFB\x54"
#define MBIMContextTypeInternet "\x7E\x5E\x2A\x7E" "\x4E\x6F" "\x72\x72" "\x73\x6B" "\x65\x6E\x7E\x5E\x2A\x7E"
#define MBIMContextTypeVpn "\x9B\x9F\x7B\xBE" "\x89\x52" "\x44\xB7" "\x83\xAC" "\xCA\x41\x31\x8D\xF7\xA0"
#define MBIMContextTypeVoice "\x88\x91\x82\x94" "\x0E\xF4" "\x43\x96" "\x8C\xCA" "\xA8\x58\x8F\xBC\x02\xB2"
#define MBIMContextTypeVideoShare "\x05\xA2\xA7\x16" "\x7C\x34" "\x4B\x4D" "\x9A\x91" "\xC5\xEF\x0C\x7A\xAA\xCC"
#define MBIMContextTypePurchase "\xB3\x27\x24\x96" "\xAC\x6C" "\x42\x2B" "\xA8\xC0" "\xAC\xF6\x87\xA2\x72\x17"
#define MBIMContextTypeIMS "\x21\x61\x0D\x01" "\x30\x74" "\x4B\xCE" "\x94\x25" "\xB5\x3A\x07\xD6\x97\xD6"
#define MBIMContextTypeMMS "\x46\x72\x66\x64" "\x72\x69" "\x6B\xC6" "\x96\x24" "\xD1\xD3\x53\x89\xAC\xA9"
#define MBIMContextTypeLocal "\xA5\x7A\x9A\xFC" "\xB0\x9F" "\x45\xD7" "\xBB\x40" "\x03\x3C\x39\xF6\x0D\xB9"
#define MBIMMsContextTypeAdmin "\x5f\x7e\x4c\x2e" "\xe8\x0b" "\x40\xa9" "\xa2\x39" "\xf0\xab\xcf\xd1\x1f\x4b"
#define MBIMMSContextTypeApp "\x74\xd8\x8a\x3d" "\xdf\xbd" "\x47\x99" "\x9a\x8c" "\x73\x10\xa3\x7b\xb2\xee"
#define MBIMMsContextTypeXcap "\x50\xd3\x78\xa7" "\xba\xa5" "\x4a\x50" "\xb8\x72" "\x3f\xe5\xbb\x46\x34\x11"
#define MBIMMsContextTypeTethering "\x5e\x4e\x06\x01" "\x48\xdc" "\x4e\x2b" "\xac\xb8" "\x08\xb4\x01\x6b\xba\xac"
#define MBIMMsContextTypeEmergencyCalling "\x5f\x41\xad\xb8" "\x20\x4e" "\x4d\x31" "\x9d\xa8" "\xb3\xc9\x70\xe3\x60\xf2"
typedef enum _STATUS_CODES_CID_CONNECT_ENUM
{
CID_CONNECT_MBIM_STATUS_SUCCESS = 0,
CID_CONNECT_MBIM_STATUS_RADIO_POWER_OFF,
CID_CONNECT_MBIM_STATUS_SERVICE_NOT_ACTIVATED,
CID_CONNECT_MBIM_STATUS_PROVIDER_NOT_VISIBLE,
CID_CONNECT_MBIM_STATUS_MAX_ACTIVATED_CONTEXTS,
CID_CONNECT_MBIM_STATUS_INVALID_ACCESS_STRING,
CID_CONNECT_MBIM_STATUS_INVALID_USER_NAME_PWD,
CID_CONNECT_MBIM_STATUS_PACKET_SERVICE_DETACHED,
CID_CONNECT_MBIM_STATUS_NOT_REGISTERED,
CID_CONNECT_MBIM_STATUS_VOICE_CALL_IN_PROGRESS,
CID_CONNECT_MBIM_STATUS_CONTEXT_NOT_ACTIVATED,
CID_CONNECT_MBIM_STATUS_CONTEXT_NOT_SUPPORTED,
CID_CONNECT_MBIM_STATUS_OPERATION_NOT_ALLOWED
}STATUS_CODES_CID_CONNECT_ENUM;
/******************************************************************************
* MBIM_CID_PROVISIONED_CONTEXTS Chapter 10.5.13
******************************************************************************/
typedef struct _MBIM_SET_PROVISIONED_CONTEXT
{
UINT32 contextId;
MBIM_UUID contextType;
UINT32 accessStringOffset;
UINT32 accessStringSize;
UINT32 userNameOffset;
UINT32 userNameSize;
UINT32 passwordOffset;
UINT32 passwordSize;
UINT32 compression;
UINT32 authProtocol;
UINT32 providerIdOffset;
UINT32 providerIdSize;
char dataBuffer[1];
}MBIM_SET_PROVISIONED_CONTEXT, *P_MBIM_SET_PROVISIONED_CONTEXT;
typedef struct _MBIM_PROVISIONED_CONTEXTS_INFO
{
UINT32 elementCount;
// Here goes OL_PAIR_LIST
// Then data buffer
}MBIM_PROVISIONED_CONTEXTS_INFO, *P_MBIM_PROVISIONED_CONTEXTS_INFO;
typedef struct _MBIM_CONTEXT
{
UINT32 ContextId;
MBIM_UUID ContextType;
UINT32 accessStringOffset;
UINT32 accessStringSize;
UINT32 userNameOffset;
UINT32 userNameSize;
UINT32 passwordOffset;
UINT32 passwordSize;
UINT32 compression;
UINT32 authProtocol;
UINT32 dataBuffer[1];
}MBIM_CONTEXT, *P_MBIM_CONTEXT;
/******************************************************************************
* MBIM_CID_IP_CONFIGURATION Chapter 10.5.19
******************************************************************************/
#define IP_CONFIG_IPV4_ADDRESS_BASE 0x5A01A8C0
#define IP_CONFIG_MASK_LEN 24
#define IP_CONFIG_GATEWAY 0x0101A8C0
typedef struct _MBIM_EVENT_ENTRY
{
MBIM_UUID deviceServiceId;
UINT32 cidCount;
UINT32 dataBuffer[1]; //up tp 4*CidCount
}MBIM_EVENT_ENTRY, *P_MBIM_EVENT_ENTRY;
typedef struct _MBIM_DEVICE_SERVICE_SUBSCRIBE_LIST
{
UINT32 elementCount;
UINT32 deviceServiceSubscribeRefList;
char dataBuffer[1]; //Array of MBIM_EVENT_ENTRY structures
} MBIM_DEVICE_SERVICE_SUBSCRIBE_LIST, *P_MBIM_DEVICE_SERVICE_SUBSCRIBE_LIST;
/******************************************************************************
* MBIM_CID_IP_CONFIGURATION Chapter 10.5.20
******************************************************************************/
typedef struct _MBIM_IPV4_ADDRESS
{
UINT8 address[4];
}MBIM_IPV4_ADDRESS, *P_MBIM_IPV4_ADDRESS;
typedef struct _MBIM_IPV4_ELEMENT
{
UINT32 onLinkPrefixLength;
MBIM_IPV4_ADDRESS ipv4Address;
}MBIM_IPV4_ELEMENT, *P_MBIM_IPV4_ELEMENT;
typedef struct _MBIM_IPV6_ADDRESS
{
UINT8 address[16];
}MBIM_IPV6_ADDRESS, *P_MBIM_IPV6_ADDRESS;
typedef struct _MBIM_IPV6_ELEMENT
{
UINT32 onLinkPrefixLength;
MBIM_IPV6_ADDRESS ipv6Address;
}MBIM_IPV6_ELEMENT, *P_MBIM_IPV6_ELEMENT;
typedef union _MbimIpAvailableInfo
{
struct
{
UINT32 AddrAvailable : 1;
UINT32 GwAvailable : 1;
UINT32 DnsAvailable : 1;
UINT32 MtuAvailable : 1;
UINT32 reserved : 28;
};
UINT32 intRepresentation;
}MbimIpAvailableInfo;
typedef struct _MBIM_IP_CONFIGURATION_INFO
{
UINT32 sessionId;
MbimIpAvailableInfo ipPv4ConfigurationAvailable;
MbimIpAvailableInfo ipPv6ConfigurationAvailable;
UINT32 iPv4AddressCount;
UINT32 iPv4AddressOffset;
UINT32 iPv6AddressCount;
UINT32 iPv6AddressOffset;
UINT32 iPv4GatewayOffset;
UINT32 iPv6GatewayOffset;
UINT32 iPv4DnsServerCount;
UINT32 iPv4DnsServerOffset;
UINT32 iPv6DnsServerCount;
UINT32 iPv6DnsServerOffset;
UINT32 iPv4Mtu;
UINT32 iPv6Mtu;
char *dataBuffer[1]; //Actual Address Data
}MBIM_IP_CONFIGURATION_INFO, *P_MBIM_IP_CONFIGURATION_INFO;
/******************************************************************************
* MBIM_CID_DEVICE_SERVICES Chapter 10.5.29
******************************************************************************/
typedef struct _OL_PAIR_LIST
{
UINT32 offset;
UINT32 size;
}OL_PAIR_LIST, *P_OL_PAIR_LIST;
typedef struct _MBIM_DEVICE_SERVICE_ELEMENT
{
MBIM_UUID deviceServiceId;
UINT32 dssPayload;
UINT32 maxDssInstaces;
UINT32 cidCount;
char dataBuffer[1];
}MBIM_DEVICE_SERVICE_ELEMENT, *P_MBIM_DEVICE_SERVICE_ELEMENT;
typedef struct _MBIM_DEVICE_SERVICE_INFO
{
UINT32 deviceServicesCount;
UINT32 maxDssSessions;
//Here go OL_PAIR_LIST
//Then data buffer
}MBIM_DEVICE_SERVICE_INFO, *P_MBIM_DEVICE_SERVICE_INFO;
/******************************************************************************
* MBIM_CID_NETWORK_IDLE_HINT Chapter 10.5.35
******************************************************************************/
typedef struct _MBIM_NETWORK_IDLE_HINT
{
UINT32 networkIdleHintState;
}MBIM_NETWORK_IDLE_HINT, *P_MBIM_NETWORK_IDLE_HINT;
typedef enum _MBIM_NETWORK_IDLE_HINT_STATES_ENUM
{
MBIMNetworkIdleHintDisabled = 0,
MBIMNetworkIdleHintEnabled
}MBIM_NETWORK_IDLE_HINT_STATES_ENUM;
/******************************************************************************
* MBIM_CID_EMERGENCY_MODE Chapter 10.5.36
******************************************************************************/
typedef struct _MBIM_EMERGENCY_MODE_INFO
{
UINT32 EmergencyMode;
}MBIM_EMERGENCY_MODE_INFO, *P_MBIM_EMERGENCY_MODE_INFO;
typedef enum _MBIM_EMERGENCY_MODE_STATES_ENUM
{
MBIMEmergencyModeOff = 0,
MBIMEmergencyModeOn
}MBIM_EMERGENCY_MODE_STATES_ENUM;
/******************************************************************************
* MBIM_CID_IP_PACKET_FILTER Chapter 10.5.37
******************************************************************************/
typedef struct _MBIM_IP_PACKET_FILTER
{
UINT32 sessionId;
UINT32 packetFilterCount;
char dataBuffer[1]; //PacketFilterRefList (8 * packetfilterCount) + MBIM_SINGLE_PACKET_FILTER
}MBIM_IP_PACKET_FILTER, *P_MBIM_IP_PACKET_FILTER;
typedef struct _MBIM_SINGLE_PACKET_FILTER
{
UINT32 filterSize;
UINT32 packetFilterOffset;
UINT32 packetMaskOffset;
char dataBuffer[1];
}MBIM_SINGLE_PACKET_FILTER, *P_MBIM_SINGLE_PACKET_FILTER;
typedef struct _MBIM_SINGLE_PACKET_FILTER_V2
{
UINT32 filterSize;
UINT32 packetFilterOffset;
UINT32 packetMaskOffset;
UINT32 FilterId;
char dataBuffer[1];
}MBIM_SINGLE_PACKET_FILTER_V2, *P_MBIM_SINGLE_PACKET_FILTER_V2;
#endif