X-Git-Url: https://git.jankratochvil.net/?p=gnokii.git;a=blobdiff_plain;f=common%2Fnewmodules%2Fsniff%2Fsniff.c;h=7536d61ace26524530a7a7c4fbf4ab2e76b81f6c;hp=cf71682ac9eb4c629174cfbf43fa1c63144ff4b4;hb=bd2325c6e5ee9fad610a886c91994d9a04d1b18a;hpb=a1cd8f8d3a6cbe586ebc3148afa87dd4cb2afb15 diff --git a/common/newmodules/sniff/sniff.c b/common/newmodules/sniff/sniff.c index cf71682..7536d61 100644 --- a/common/newmodules/sniff/sniff.c +++ b/common/newmodules/sniff/sniff.c @@ -1,48 +1,48 @@ -/* - - G N O K I I - - A Linux/Unix toolset and driver for Nokia mobile phones. - - Released under the terms of the GNU GPL, see file COPYING for more details. - - This file provides an API for accessing functions on the sniff and similar - phones. - -*/ - -/* "Turn on" prototypes in n-sniff.h */ - -#define __n_sniff_c - -/* System header files */ -#include -#include -#include - -#ifndef WIN32 - - #include "devices/device.h" - -#endif - -/* Various header file */ -#ifndef VC6 - #include "config.h" -#endif -#include "misc.h" -#include "gsm-api.h" -#include "gsm-common.h" -#include "files/cfgreader.h" -#include "newmodules/sniff/sniff.h" -#include "newmodules/n6110.h" -#include "newmodules/n7110.h" -#include "gsm-networks.h" - -/* Global variables used by code in gsm-api.c to expose the functions - supported by this model of phone. */ - - +/* + + G N O K I I + + A Linux/Unix toolset and driver for Nokia mobile phones. + + Released under the terms of the GNU GPL, see file COPYING for more details. + + This file provides an API for accessing functions on the sniff and similar + phones. + +*/ + +/* "Turn on" prototypes in n-sniff.h */ + +#define __n_sniff_c + +/* System header files */ +#include +#include +#include + +#ifndef WIN32 + + #include "devices/device.h" + +#endif + +/* Various header file */ +#ifndef VC6 + #include "config.h" +#endif +#include "misc.h" +#include "gsm-api.h" +#include "gsm-common.h" +#include "files/cfgreader.h" +#include "newmodules/sniff/sniff.h" +#include "newmodules/n6110.h" +#include "newmodules/n7110.h" +#include "gsm-networks.h" + +/* Global variables used by code in gsm-api.c to expose the functions + supported by this model of phone. */ + + static char *realmodel; /* Model from .gnokiirc file. */ static char *Port; /* Port from .gnokiirc file */ static char *Initlength; /* Init length from .gnokiirc file */ @@ -51,76 +51,76 @@ static char *SynchronizeTime; /* If we set date and time from computer to phone static char *BinDir; /* Binaries directory from .gnokiirc file - not used here yet */ static GSM_ConnectionType connectiontype; - - - - - - -/* Here we initialise model specific functions. */ - -GSM_Functions Nsniff_Functions = { - Nsniff_Initialise, - Nsniff_DispatchMessage, - NULL_Terminate, - NULL_KeepAlive, - NOTSUPPORTED, - NOTSUPPORTED, - NOTSUPPORTED, - NOTSUPPORTED, - NOTSUPPORTED, - NOTSUPPORTED, - NOTSUPPORTED, - NOTSUPPORTED, - NOTSUPPORTED, - NOTSUPPORTED, - NOTSUPPORTED, - NOTSUPPORTED, - NOTSUPPORTED, - NOTSUPPORTED, - NOTSUPPORTED, - NOTSUPPORTED, - NOTSUPPORTED, - NOTSUPPORTED, - NOTSUPPORTED, - NOTSUPPORTED, - NOTSUPPORTED, - NOTSUPPORTED, - NOTSUPPORTED, - NOTSUPPORTED, - NOTSUPPORTED, - NOTSUPPORTED, - NOTSUPPORTED, - NOTSUPPORTED, - NOTSUPPORTED, - NOTSUPPORTED, - NOTSUPPORTED, - NOTSUPPORTED, - NOTSUPPORTED, - NOTSUPPORTED, - NOTSUPPORTED, - NOTSUPPORTED, - NOTSUPPORTED, - NOTSUPPORTED, - NOTSUPPORTED, - NOTSUPPORTED, - NOTSUPPORTED, - NOTSUPPORTED, - NOTSUPPORTED, - NOTSUPPORTED, - NOTSUPPORTED, - NOTSUPPORTED, - NOTSUPPORTED, - NOTSUPPORTED, - NOTSUPPORTED, - NOTSUPPORTED, - NOTSUPPORTED, - NOTSUPPORTED, - NOTSUPPORTED, - NOTSUPPORTED, - NOTSUPPORTED, - NOTSUPPORTED, - NOTSUPPORTED, NOTSUPPORTED, + + + + + + +/* Here we initialise model specific functions. */ + +GSM_Functions Nsniff_Functions = { + Nsniff_Initialise, + Nsniff_DispatchMessage, + NULL_Terminate, + NULL_KeepAlive, + NOTSUPPORTED, + NOTSUPPORTED, + NOTSUPPORTED, + NOTSUPPORTED, + NOTSUPPORTED, + NOTSUPPORTED, + NOTSUPPORTED, + NOTSUPPORTED, + NOTSUPPORTED, + NOTSUPPORTED, + NOTSUPPORTED, + NOTSUPPORTED, + NOTSUPPORTED, + NOTSUPPORTED, + NOTSUPPORTED, + NOTSUPPORTED, + NOTSUPPORTED, + NOTSUPPORTED, + NOTSUPPORTED, + NOTSUPPORTED, + NOTSUPPORTED, + NOTSUPPORTED, + NOTSUPPORTED, + NOTSUPPORTED, + NOTSUPPORTED, + NOTSUPPORTED, + NOTSUPPORTED, + NOTSUPPORTED, + NOTSUPPORTED, + NOTSUPPORTED, + NOTSUPPORTED, + NOTSUPPORTED, + NOTSUPPORTED, + NOTSUPPORTED, + NOTSUPPORTED, + NOTSUPPORTED, + NOTSUPPORTED, + NOTSUPPORTED, + NOTSUPPORTED, + NOTSUPPORTED, + NOTSUPPORTED, + NOTSUPPORTED, + NOTSUPPORTED, + NOTSUPPORTED, + NOTSUPPORTED, + NOTSUPPORTED, + NOTSUPPORTED, + NOTSUPPORTED, + NOTSUPPORTED, + NOTSUPPORTED, + NOTSUPPORTED, + NOTSUPPORTED, + NOTSUPPORTED, + NOTSUPPORTED, + NOTSUPPORTED, + NOTSUPPORTED, + NOTSUPPORTED, NOTSUPPORTED, NOTSUPPORTED, NOTSUPPORTED, NOTSUPPORTED, @@ -130,87 +130,87 @@ GSM_Functions Nsniff_Functions = { NOTSUPPORTED, NOTSUPPORTED, NOTSUPPORTED -}; - - - -/* for all these Phones we support sniff */ - -GSM_Information Nsniff_Information = { - "3210sniff|3310sniff|3330sniff|5110sniff|5130sniff|5190sniff|6110sniff|6130sniff|6150sniff|6190sniff|8210sniff|8850sniff|6210sniff|6250sniff|7110sniff", - /* Supported models in FBUS */ - "3210sniff|3310sniff|3330sniff|5110sniff|5130sniff|5190sniff|6110sniff|6130sniff|6150sniff|6190sniff|8210sniff|8850sniff|6210sniff|6250sniff|7110sniff", - /* Supported models in MBUS */ - "", - /* Supported models in FBUS over infrared */ - "", - /* Supported models in FBUS over DLR3 */ +}; + + + +/* for all these Phones we support sniff */ + +GSM_Information Nsniff_Information = { + "3210sniff|3310sniff|3330sniff|5110sniff|5130sniff|5190sniff|6110sniff|6130sniff|6150sniff|6190sniff|8210sniff|8850sniff|6210sniff|6250sniff|7110sniff", + /* Supported models in FBUS */ + "3210sniff|3310sniff|3330sniff|5110sniff|5130sniff|5190sniff|6110sniff|6130sniff|6150sniff|6190sniff|8210sniff|8850sniff|6210sniff|6250sniff|7110sniff", + /* Supported models in MBUS */ + "", + /* Supported models in FBUS over infrared */ + "", + /* Supported models in FBUS over DLR3 */ "", "6210decode|6250decode|7110decode", /* Supported models in FBUS over Irda sockets */ "", - 4, /* Max RF Level */ - 0, /* Min RF Level */ - GRF_Arbitrary, /* RF level units */ - 4, /* Max Battery Level */ - 0, /* Min Battery Level */ - GBU_Arbitrary, /* Battery level units */ - GDT_None, /* No date/time support */ - GDT_None, /* No alarm support */ - 0 /* Max alarms = 0 */ -}; - -/* Initialise variables and state machine. */ -GSM_Error Nsniff_Initialise(char *port_device, char *initlength, - GSM_ConnectionType connection, - void (*rlp_callback)(RLP_F96Frame *frame)) -{ - - GSM_PhonebookEntry phonebook; - GSM_SpeedDial speed; - GSM_SMSMessage sms; - GSM_MemoryStatus status; - GSM_NetworkInfo netinfo; - GSM_SMSStatus smsstatus; + 4, /* Max RF Level */ + 0, /* Min RF Level */ + GRF_Arbitrary, /* RF level units */ + 4, /* Max Battery Level */ + 0, /* Min Battery Level */ + GBU_Arbitrary, /* Battery level units */ + GDT_None, /* No date/time support */ + GDT_None, /* No alarm support */ + 0 /* Max alarms = 0 */ +}; + +/* Initialise variables and state machine. */ +GSM_Error Nsniff_Initialise(char *port_device, char *initlength, + GSM_ConnectionType connection, + void (*rlp_callback)(RLP_F96Frame *frame)) +{ + + GSM_PhonebookEntry phonebook; + GSM_SpeedDial speed; + GSM_SMSMessage sms; + GSM_MemoryStatus status; + GSM_NetworkInfo netinfo; + GSM_SMSStatus smsstatus; GSM_SMSFolders folders; - GSM_MessageCenter smsc; - int secstatus; - GSM_SecurityCode seccode; - GSM_DateTime date; - GSM_DateTime alarm; - GSM_CalendarNote note; - char netmon; - GSM_Bitmap logo; - GSM_Profile profile; - GSM_CBMessage cb; - GSM_Network netname; + GSM_MessageCenter smsc; + int secstatus; + GSM_SecurityCode seccode; + GSM_DateTime date; + GSM_DateTime alarm; + GSM_CalendarNote note; + char netmon; + GSM_Bitmap logo; + GSM_Profile profile; + GSM_CBMessage cb; + GSM_Network netname; GSM_BinRingtone binring; - GSM_AllSimlocks siml; if (Protocol->Initialise(port_device,initlength,connection,rlp_callback)!=GE_NONE) - { - return GE_NOTSUPPORTED; - } - - CurrentLinkOK = true; - - CurrentPhonebookEntry=&phonebook; - CurrentSpeedDialEntry=&speed; - CurrentSMSMessage=&sms; - CurrentMemoryStatus=&status; - CurrentNetworkInfo=&netinfo; - CurrentSMSStatus=&smsstatus; + GSM_AllSimlocks siml; if (Protocol->Initialise(port_device,initlength,connection,rlp_callback)!=GE_NONE) + { + return GE_NOTSUPPORTED; + } + + CurrentLinkOK = true; + + CurrentPhonebookEntry=&phonebook; + CurrentSpeedDialEntry=&speed; + CurrentSMSMessage=&sms; + CurrentMemoryStatus=&status; + CurrentNetworkInfo=&netinfo; + CurrentSMSStatus=&smsstatus; CurrentSMSFolders=&folders; - CurrentMessageCenter=&smsc; - CurrentSecurityCodeStatus=&secstatus; - CurrentSecurityCode=&seccode; - CurrentDateTime=&date; - CurrentAlarm=&alarm; - CurrentCalendarNote=¬e; - CurrentNetmonitor=&netmon; - CurrentGetBitmap=&logo; - CurrentProfile=&profile; - CurrentCBMessage=&cb; - CurrentGetOperatorNameNetwork=&netname; + CurrentMessageCenter=&smsc; + CurrentSecurityCodeStatus=&secstatus; + CurrentSecurityCode=&seccode; + CurrentDateTime=&date; + CurrentAlarm=&alarm; + CurrentCalendarNote=¬e; + CurrentNetmonitor=&netmon; + CurrentGetBitmap=&logo; + CurrentProfile=&profile; + CurrentCBMessage=&cb; + CurrentGetOperatorNameNetwork=&netname; CurrentGetBinRingtone=&binring; - CurrentSimLock=⪝ + CurrentSimLock=⪝ /* Read config file, once again to get real model */ if (CFG_ReadConfig(&realmodel, &Port, &Initlength, &Connection, &BinDir, &SynchronizeTime,false) < 0) { @@ -218,9 +218,9 @@ GSM_Error Nsniff_Initialise(char *port_device, char *initlength, } connectiontype = GetConnectionTypeFromString(Connection); - return (GE_NONE); -} - + return (GE_NONE); +} + void Nsniff_DispatchMessage(u16 MessageLength, u8 *MessageBuffer, u8 MessageType) {