亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? mbchecker.c

?? ~{JV;z6LO{O"7~Nq5D7~NqFw:M?M; 6K~}(linux~{#)~}
?? C
?? 第 1 頁 / 共 2 頁
字號:
/*========================================================== * Program : mbchecker.c                   Project : smslink * Author  : Philippe Andersson. * Date    : 25/02/00 * Version : 0.10b * Notice  : (c) Les Ateliers du Heron, 1998 for Scitex Europe, S.A. * Comment : Mailbox checking functions for the smslink server. * * Modification History : * - 0.01a (05/12/98) : Initial release. * - 0.02a (16/05/99) : Added include line for errno.h, to solve *   compilation problem on RedHat platform. * - 0.03a (06/06/99) : Started building the actual mailbox *   check procedure. * - 0.04b (28/06/99) : In mbcheck(), moved the AT+CNMI command *   after the PIN check routine. PIN-Activated SIM is required *   for AT+CNMI. Solved a bug with default SMSC. * - 0.05a (03/07/99) : Added list managment functions. * - 0.06a (11/07/99) : Added dumptofile() function. * ++++ Switch to Beta ++++ * - 0.07b (20/07/99) : Improved mbcheck() to also remove the *   messages from the SIM after having saved them to disk. * - 0.08b (17/08/99) : Included code to create and update the *   checkpoint file after each successfull mailbox check (needed *   for interaction with the SMS to Mail gateway). * - 0.09b (02/12/99) : Improved handling for default SMSC in *   mbcheck(). Now uses the value kept in /etc/gsmdevices. * - 0.10b (25/02/00) : In mbcheck_wrapper(), moved the update *   of the checkpoint file outside of the device-checking loop *   (first because there's no need to update it more than once, *   second because it caused sms2mailgw to fire during the *   device checking loop). *========================================================*/#include <stdio.h>                         /* for fprintf */#include <stdlib.h>                  /* for errno & stuff */#include <ctype.h>                       /* for isdigit() */#include <errno.h>#include <string.h>#include <unistd.h>#include <fcntl.h>#include <syslog.h>#include <signal.h>#include <sys/time.h>           /* for the struct timeval */#include <sys/types.h>#include <sys/ipc.h>#include <sys/sem.h>                        /* semaphores */#include <sys/shm.h>                     /* shared memory */#include <sys/ioctl.h>            /* for the ioctl() call */#include <termios.h>         /* for baudrates definitions */#include <dial/modems.h>           /* requires 'libmodem' */#include "sms_serv.h"/*========================================================*//* For debugging purposes only - comment out for normal compile *//* #define INCL_DEBUG_CODE *//*-------------------------------------External variables *//* program specific *//*---------------------------------------Global variables */int MBC_instance;int MBC_instance_is_set = FALSE;/*========================================================*//**********               FUNCTIONS                ********//*========================================================*/void mbox_list_init (mbox_list *list){  list->head = NULL;  list->tail = NULL;}                                    /* mbox_list_init () *//*========================================================*/int empty_mbox_list (mbox_list list){  return (list.head == NULL);}                                   /* empty_mbox_list () *//*========================================================*/void mbox_list_insert (mbox_list *list, struct mbox_item *element){  /* WARNING : the order of the elements IS relevent - has to   * be chronological => insert at tail. */    /* chain the element in the list */  if (empty_mbox_list (*list)) {    list->head = element;    list->tail = element;    element->next = NULL;    element->prev = NULL;  }  else {    element->next = NULL;    element->prev = list->tail;    list->tail->next = element;    list->tail = element;  }}                                  /* mbox_list_insert () *//*========================================================*/void free_mbox_list (mbox_list *list){  struct mbox_item *cursor;  if (!empty_mbox_list (*list)) {    /* hop to element before last */    cursor = list->tail->prev;    /* now go back and clean behind */    while (cursor != NULL) {      free (cursor->next);      cursor->next = NULL;      list->tail = cursor;      cursor = cursor->prev;    }                           /* while (cursor != NULL) */  }                          /* if (!empty_mbox_list (... */  /* now clean last element and reset header */  free (list->head);  list->head = NULL;  list->tail = NULL;}                                    /* free_mbox_list () *//*========================================================*/void MBC_unlock_gsm (){  extern int shmem_sem;  extern struct gsms_def *gsmdevices;  syslog ((FACILITY | LOG_WARNING), "MBC being hit by SIGTERM.");  /* set the allocated GSM module back to 'free' status */  if (MBC_instance_is_set) {    if (sem_wait (shmem_sem) == -1)      syserr ("sms_serv: failed to wait on shared mem. semaphore");    /* ---- Begin Crit. Sect. #5 ---- */    if (!gsmdevices[MBC_instance].free) {      gsmdevices[MBC_instance].free = TRUE;      gsmdevices[MBC_instance].owner = 0;      syslog ((FACILITY | LOG_WARNING), "GSM instance </dev/%s> has been unlocked.",             gsmdevices[MBC_instance].device);    }    /* leave crit. sect. */    if (sem_signal (shmem_sem) == -1)      syserr ("sms_serv: can't signal shared mem. semaphore");    /* ---- End Crit. Sect. #5 ---- */  }  /* free what's need to be freed and exit */  /*------------------------------------------------------*/  exit (0);}                                    /* MBC_unlock_gsm () *//*========================================================*/int all_done (int *array, int size){  int retval = TRUE;  int i;  for (i = 0; i < size; i++) {    retval = (retval && array[i]);  }  return (retval);}                                          /* all_done () *//*========================================================*/struct mbox_item *mbparse (char *msg_string){  struct mbox_item *msg;  char *s;  char *token;  char date[9];  char time[10];  char brol[5];  int year, month, day;    /*----------------Take a local copy of the input string */  if ((s = (char *) malloc ((strlen (msg_string) + 1) * sizeof (char))) == NULL)    return (NULL);  strcpy (s, msg_string);  /*-----------------------Allocate memory for the struct */  if ((msg = (struct mbox_item *) malloc (sizeof (struct mbox_item))) == NULL)    return (NULL);  /*----------------------------------------Initialize it */  msg->msgid = 0;  msg->fromgsm[0] = '\0';  msg->date[0] = '\0';  msg->time[0] = '\0';  msg->text[0] = '\0';  msg->next = NULL;  msg->prev = NULL;  /*----------------------------Parse message string copy */  /*...........................................Message ID */  if ((token = strtok (s, ",")) != NULL) {    /* Message ID - extract the ID token alone and atoi it */    while (!isdigit (token[0]) && token[0])      token++;    msg->msgid = atoi (token);#ifdef INCL_DEBUG_CODE    fprintf (stderr, "token #1, msg ID = [%d]\n", msg->msgid);#endif  }  else {    /* Internal structure error */    return (NULL);  }  /*.......................................Message Status */  if ((token = strtok (NULL, ",")) != NULL) {    /* Message status - drop it */#ifdef INCL_DEBUG_CODE    fprintf (stderr, "token #2, msg status = [%s] (ignored)\n", token);#endif  }  else {    /* Internal structure error */    return (NULL);  }  /*....................................Sender GSM number */  if ((token = strtok (NULL, ",")) != NULL) {    /* Sender GSM number - dequote it */    dequote (token);    strcpy (msg->fromgsm, token);#ifdef INCL_DEBUG_CODE    fprintf (stderr, "token #3, sender GSM = [%s]\n", msg->fromgsm);#endif  }  else {    /* Internal structure error */    return (NULL);  }  /*........................................Date and Time */  if ((token = strtok (NULL, "\r")) != NULL) {    /* Date and Time - dequote and split */    dequote (token);    strncpy (date, token, 8);    date[8] = '\0';    token += 9;    strncpy (time, token, 9);    time[9] = '\0';    /* Convert date format from DD/MM/YY to YYYYMMDD */    strncpy (brol, date, 2);                       /* day */    day = atoi (brol);    shiftleft (date, 3);    strncpy (brol, date, 2);                     /* month */    month = atoi (brol);    shiftleft (date, 3);    strncpy (brol, date, 2);                      /* year */    year = atoi (brol);    /* take care of the missing century */    if (year < 95)      year += 2000;    else      year += 1900;    sprintf (msg->date, "%d%02d%02d", year, month, day);    /* Copy the time over */    strcpy (msg->time, time);#ifdef INCL_DEBUG_CODE    fprintf (stderr, "token #4, message date = [%s]\n", msg->date);    fprintf (stderr, "token #5, message time = [%s]\n", msg->time);#endif  }  else {    /* Internal structure error */    return (NULL);  }  /*.........................................Message text */  if ((token = strtok (NULL, "\r")) != NULL) {    /* Message text - trim unwanted characters */    trim (token);    strcpy (msg->text, token);#ifdef INCL_DEBUG_CODE    fprintf (stderr, "token #6, message text = [%s]\n", msg->text);#endif  }  else {    /* Internal structure error */    return (NULL);  }  /*-------------------------------------------------Exit */  free (s);  return (msg);}                                           /* mbparse () *//*========================================================*/int dumptofile (mbox_list *list, char *device){  int nline = 0;  FILE *mbox_file;  int lockf_desc;  struct mbox_item *cursor;  int save_errno;  lockf_desc = open (MBOX_LOCKF, (O_RDWR | O_CREAT | O_EXCL), 0444);  if (lockf_desc == -1) {    syslog ((FACILITY | LOG_ERR), "can't lock the inbox file.");    mdmperror ("sms_serv: can't lock the inbox file");  }  else {    /* file is now locked */    if ((mbox_file = fopen (MBOX_FILE, "a")) != NULL) {      cursor = list->head;      while (cursor != NULL) {        fprintf (mbox_file, "/dev/%s,%d,%s,%s,%s,\"%s\"\n",	        device, cursor->msgid, cursor->fromgsm,		cursor->date, cursor->time, cursor->text);	nline++;	cursor = cursor->next;      }                         /* while (cursor != NULL) */      fclose (mbox_file);    }    else {      syslog ((FACILITY | LOG_ERR), "can't open the inbox file.");      mdmperror ("sms_serv: can't open the inbox file");    }    /* Now remove lock file */    close (lockf_desc);    if (unlink (MBOX_LOCKF) == -1) {      syslog ((FACILITY | LOG_ERR), "can't remove the lock file.");      mdmperror ("sms_serv: can't remove the lock file");    }  }                              /* if (lockf_desc == -1) */  return (nline);}                                        /* dumptofile () *//*========================================================*/int mbcheck (struct gsms_def *gsm){  int fd, retval = 0;  int nmsgin = 0;  char *scratch;  char *p1;  char *p2;  char *cmsgid;  int nread;  int newpin;  int retries;  int msgid;  struct mbox_item *message;  mbox_list mailbox;    /*--------------------------------------Initializations */  scratch = (char *) malloc ((BIGBUFF + 1) * sizeof (char));  if (!scratch)    syserr ("sms_serv: can't allocate scratch space");  memset (scratch, 0, (BIGBUFF + 1));  mbox_list_init (&mailbox);    /* open modem line */  fd = blopen_mdm_line (gsm->device, B9600);  if (fd < 0) {    syslog ((FACILITY | LOG_ERR), "call to blopen_mdm_line() failed.");    mdmperror ("sms_serv: blopen_mdm_line() failed");    free (scratch);    return (-1);  }    /*------------set GSM to "verbose" error reporting mode */  sprintf (scratch, "at+cmee=1\r");  tell_gsm (fd, scratch);  memset (scratch, 0, (BIGBUFF + 1));  if (get_gsm_answer (fd, scratch, BIGBUFF, 1)) {#ifdef INCL_DEBUG_CODE    fprintf (stderr, "%s\n", scratch);#endif    /* check for "OK" */    if (strstr (scratch, "OK") == NULL) {      mdm_unlock (mdmopendevice);      hangup (fd);      free (scratch);      syslog ((FACILITY | LOG_ERR), "error after sending AT+CMEE command.");      mdmperror ("sms_serv: error after sending AT+CMEE command");      return (-1);    }  }  else {    mdm_unlock (mdmopendevice);    hangup (fd);    free (scratch);    syslog ((FACILITY | LOG_ERR), "GSM module not responding.");    mdmperror ("sms_serv: GSM not responding");    return (-1);  }    /*---------------------------then, check for SIM status */  sprintf (scratch, "at+cpin?\r");  tell_gsm (fd, scratch);  memset (scratch, 0, (BIGBUFF + 1));  if (get_gsm_answer (fd, scratch, BIGBUFF, 1)) {#ifdef INCL_DEBUG_CODE    fprintf (stderr, "%s\n", scratch);#endif    /* check for "READY" -- if not, make it so */    retries = MAXATTEMPTS;    while ((strstr (scratch, "READY") == NULL) && retries--) {      /* not ready yet -> asking for PIN or PUK ? */      if (strstr (scratch, "SIM PIN")) {        /* send PIN */	sprintf (scratch, "at+cpin=%s\r", gsm->PIN);	tell_gsm (fd, scratch);	memset (scratch, 0, (BIGBUFF + 1));	if (get_gsm_answer (fd, scratch, BIGBUFF, 15)) {#ifdef INCL_DEBUG_CODE          fprintf (stderr, "%s\n", scratch);#endif	  /* check for "OK" */	  if (strstr (scratch, "OK") == NULL) {	    mdm_unlock (mdmopendevice);	    hangup (fd);	    free (scratch);            syslog ((FACILITY | LOG_ERR), "can't send PIN to GSM or wrong PIN.");	    mdmperror ("sms_serv: can't send PIN to GSM or wrong PIN");	    return (-1);	  }	}	else {	  mdm_unlock (mdmopendevice);	  hangup (fd);	  free (scratch);          syslog ((FACILITY | LOG_ERR), "GSM module not responding.");	  mdmperror ("sms_serv: GSM not responding");	  return (-1);	}      }      else if (strstr (scratch, "SIM PUK")) {        /* send PUK - set new random PIN */	srand (getpid ());	newpin = rand ();	syslog ((FACILITY | LOG_WARNING), "I'll try to set new PIN for </dev/%s>.", gsm->device);	sprintf (scratch, "at+cpin=\"%s\",\"%04d\"\r", gsm->PUK, newpin);	tell_gsm (fd, scratch);	memset (scratch, 0, (BIGBUFF + 1));

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲丝袜美腿综合| 亚洲免费电影在线| 精品久久久久久久一区二区蜜臀| 一本色道久久加勒比精品| www.欧美精品一二区| 欧美日韩在线播放| 欧美久久一二区| 欧美国产日韩亚洲一区| 中文在线免费一区三区高中清不卡| 国产女同互慰高潮91漫画| 天天操天天综合网| 色综合久久综合网欧美综合网 | 欧美国产精品一区二区| 亚洲1区2区3区4区| 91啪在线观看| 欧美精品日韩一区| 欧美第一区第二区| 国产精品毛片大码女人| 久久国产人妖系列| 日韩亚洲欧美在线观看| 国产精品久久久久三级| 免费观看成人鲁鲁鲁鲁鲁视频| 91黄色激情网站| 欧美国产一区二区在线观看 | 精品不卡在线视频| 国产欧美日韩久久| 国产成人自拍在线| 久久蜜桃av一区二区天堂| 国产精品久久久久久亚洲毛片| 韩国女主播成人在线| 久久综合网色—综合色88| 激情都市一区二区| 91极品美女在线| 亚洲影院在线观看| 欧美日韩国产成人在线91| 日韩欧美中文字幕一区| 欧美激情综合网| av亚洲产国偷v产偷v自拍| 欧美精品视频www在线观看| 亚洲一二三区在线观看| 91麻豆精品国产| 精品一区二区免费看| 欧美色网站导航| 国产清纯白嫩初高生在线观看91 | 欧美高清一级片在线| 天堂在线亚洲视频| eeuss鲁片一区二区三区 | 国产亚洲一区二区三区在线观看| 亚洲乱码国产乱码精品精98午夜| 免费观看在线综合色| 精品久久国产97色综合| 亚洲一区二区三区四区不卡| 欧美男男青年gay1069videost| 国产精品免费免费| 欧美在线观看一区| 国产精品丝袜一区| 欧美伊人久久久久久久久影院| 无码av免费一区二区三区试看| 欧美成va人片在线观看| 成人免费观看视频| 亚洲一二三区视频在线观看| a在线播放不卡| 久久婷婷色综合| 91视频你懂的| 国产精品欧美一级免费| 91黄色小视频| 国产激情一区二区三区桃花岛亚洲| 91精品一区二区三区久久久久久| 亚洲少妇30p| 99久久精品国产一区| 日韩和欧美一区二区三区| 欧美在线三级电影| 亚洲综合在线第一页| 欧美videossexotv100| 99久久99久久综合| 伦理电影国产精品| 一区二区三区日本| 欧美在线一区二区| 国产精品18久久久久久久网站| 久久综合一区二区| 欧美日本国产视频| aaa欧美日韩| 国产精一品亚洲二区在线视频| 亚洲欧美色图小说| 欧美午夜片在线看| 成人免费视频视频在线观看免费 | 亚洲最大成人综合| 国产欧美日韩不卡免费| www.亚洲在线| 亚洲欧美一区二区三区极速播放 | 五月天激情综合网| 欧美精品三级日韩久久| 色激情天天射综合网| 成人看片黄a免费看在线| 亚洲色图19p| 国产欧美日本一区视频| 在线看一区二区| 国产精品1区2区3区| 亚洲啪啪综合av一区二区三区| 色欧美乱欧美15图片| zzijzzij亚洲日本少妇熟睡| 一个色妞综合视频在线观看| 国产精品麻豆网站| 中文字幕精品—区二区四季| 色激情天天射综合网| 午夜电影网一区| 亚洲宅男天堂在线观看无病毒 | 日韩免费视频线观看| 国产成人亚洲精品狼色在线| 麻豆精品一二三| 久久激五月天综合精品| 另类小说欧美激情| 久久国产三级精品| 一区二区在线观看av| 欧美日韩1区2区| 欧美三级日韩三级| 欧美精品亚洲二区| 成人国产一区二区三区精品| 偷拍一区二区三区| 三级久久三级久久| 日本欧美一区二区在线观看| 中文字幕国产一区二区| 欧美在线视频你懂得| 69久久夜色精品国产69蝌蚪网| 成人综合激情网| 一区二区三区四区亚洲| 亚洲已满18点击进入久久| 一区二区在线观看免费视频播放| 亚洲制服丝袜在线| 精品国产免费人成电影在线观看四季| 欧美精品高清视频| 日韩精品综合一本久道在线视频| 午夜不卡在线视频| 亚洲美女免费在线| 亚洲精品乱码久久久久久 | 午夜不卡av免费| 天堂一区二区在线免费观看| 免费在线看成人av| 国产福利精品一区二区| 97久久精品人人澡人人爽| 91网站最新网址| 欧美肥大bbwbbw高潮| 欧美xxxx在线观看| 国产精品国产自产拍在线| 亚洲一区免费视频| 狠狠色综合日日| 色婷婷综合五月| 欧美va亚洲va国产综合| 国产精品久久久久天堂| 午夜影院久久久| 国产成人丝袜美腿| 欧美系列在线观看| 久久久久久综合| 亚洲va国产天堂va久久en| 精品一区二区三区免费| 一本到高清视频免费精品| 日韩一区和二区| 亚洲精选视频免费看| 免费观看一级特黄欧美大片| 99re免费视频精品全部| 日韩欧美国产一区二区在线播放| 亚洲欧洲成人自拍| 六月丁香婷婷色狠狠久久| 91浏览器入口在线观看| 精品88久久久久88久久久| 亚洲综合精品自拍| 国产白丝精品91爽爽久久| 在线综合亚洲欧美在线视频| 亚洲欧洲av在线| 国产一区二区三区免费在线观看| 在线一区二区观看| 国产精品网曝门| 九九**精品视频免费播放| 欧美日韩国产欧美日美国产精品| 日本一区二区免费在线| 免费成人小视频| 欧美片在线播放| 亚洲国产色一区| 97久久久精品综合88久久| 日本一区二区综合亚洲| 国内精品伊人久久久久av一坑| 在线播放一区二区三区| 一区二区三区欧美视频| 波多野结衣在线aⅴ中文字幕不卡| 精品日韩一区二区| 免费看日韩a级影片| 91精选在线观看| 日韩电影在线一区二区三区| 在线国产亚洲欧美| 亚洲色图欧洲色图| 北条麻妃国产九九精品视频| 日本一区二区三区四区在线视频| 国产一区二区三区久久悠悠色av| 日韩欧美你懂的| 日韩国产精品大片| 欧美一区二区三区不卡| 免费人成在线不卡| 日韩免费视频一区| 激情综合色综合久久| 久久久久久久久99精品|