Exemplo n.º 1
0
static void alloc_section(class_handle_t handle, dvb_section_t *p_src_sec)
{
  u16 id = 0;
  service_t *p_svc = p_src_sec->p_svc;
  dvb_section_t *p_sec = NULL;
  dvb_svc_data_t *p_svc_data = (dvb_svc_data_t *)p_svc->get_data_buffer(p_svc);
  dvb_priv_t *p_priv = p_svc_data->p_this->p_data;
  alloc_ret_t ret = ALLOC_SUC;
  BOOL ret_boo = FALSE;
  class_handle_t q_handle = p_priv->q_handle;

  MT_ASSERT(p_src_sec != NULL);

  ret_boo = pop_simple_queue(p_priv->q_handle, p_priv->free_queue, &id);

  //fix me
  if(!ret_boo)
  {
    return; //drap it
  }

  if(id >= DVB_MAX_SECTION_NUM)
  {
    return; //drap it
  }
  
  MT_ASSERT(ret_boo == TRUE);
  p_sec = p_priv->p_sec + id;
  //MT_ASSERT(id == p_sec->id);
  if(id != p_sec->id)
  {
    show_sec(p_priv);
    id = p_sec->id;

   // MT_ASSERT(0);
  }

  memcpy(p_sec, p_src_sec, sizeof(dvb_section_t));
  p_sec->pti_handle = NULL;
  p_sec->p_buffer = NULL;
  p_sec->id = id;
  
//    push_simple_queue(p_priv->q_handle, p_svc_data->wait_queue, id);
  
  ret = alloc_filter(p_priv, p_sec);
  if(ALLOC_SUC == ret)
  {
    MT_ASSERT(p_sec->pti_handle != NULL);
    // alloc filter suc, push it to using q
    push_simple_queue(q_handle, p_svc_data->using_queue, id);
  }
  else
  {
    OS_PRINTF("xxx dvb_alloc_section failed continue... \n");
    push_simple_queue(p_priv->q_handle, p_svc_data->wait_queue, id);
  }
  
}
Exemplo n.º 2
0
static void alloc_section(class_handle_t handle, dvb_section_t *p_src_sec)
{
  u16 id = 0;
  service_t *p_svc = p_src_sec->p_svc;
  dvb_section_t *p_sec = NULL;
  dvb_svc_data_t *p_svc_data = (dvb_svc_data_t *)p_svc->get_data_buffer(p_svc);
  dvb_priv_t *p_priv = p_svc_data->p_this->p_data;
  alloc_ret_t ret = ALLOC_SUC;
  BOOL ret_boo = FALSE;
  class_handle_t q_handle = p_priv->q_handle;

  MT_ASSERT(p_src_sec != NULL);

  ret_boo = pop_simple_queue(p_priv->q_handle, p_priv->free_queue, &id);

  //for warriors bug 22712,37060, prj shoudl select soft filter.
  p_src_sec->use_soft_filter = g_use_soft_filter;

  //fix me
  if(!ret_boo)
  {
    return; //drap it
  }

  if(id >= DVB_MAX_SECTION_NUM)
  {
    return; //drap it
  }
  
  MT_ASSERT(ret_boo == TRUE);
  p_sec = p_priv->p_sec + id;
  //MT_ASSERT(id == p_sec->id);
  if(id != p_sec->id)
  {
    OS_PRINTF("DVB WARNING!!!id %d, p_sec->id %d\n", id, p_sec->id);
    show_sec(p_priv);
    id = p_sec->id;

   // MT_ASSERT(0);
  }

  memcpy(p_sec, p_src_sec, sizeof(dvb_section_t));
  p_sec->dmx_handle = 0xffff;
  p_sec->p_buffer = NULL;
  p_sec->id = id;
  p_sec->buf_id = 0xffff;
  p_sec->ts_in = p_priv->current_ts_in;
  
//    push_simple_queue(p_priv->q_handle, p_svc_data->wait_queue, id);
  
  ret = alloc_filter(p_priv, p_sec);
  if(ALLOC_SUC == ret)
  {
    MT_ASSERT(p_sec->dmx_handle != 0xffff);
    // alloc filter suc, push it to using q
    push_simple_queue(q_handle, p_svc_data->using_queue, id);
  }
  else
  {
    OS_PRINTF("xxx dvb_alloc_section failed continue... \n");
    push_simple_queue(p_priv->q_handle, p_svc_data->wait_queue, id);
  }
  
}
Exemplo n.º 3
0
/*
 * Edit one record, return -1 if there are errors, 0 if ok.
 */
int EditMGrpRec(int Area)
{
    FILE	    *fil;
    static char	    mfile[PATH_MAX], temp[13];
    static int	    offset;
    static int	    i, j, tmp;
    unsigned int    crc, crc1;
    int		    oldgrp, newgrp;

    clr_index();
    working(1, 0, 0);
    IsDoing("Edit MessageGroup");

    snprintf(mfile, PATH_MAX, "%s/etc/mgroups.temp", getenv("MBSE_ROOT"));
    if ((fil = fopen(mfile, "r")) == NULL) {
	working(2, 0, 0);
	return -1;
    }

    offset = sizeof(mgrouphdr) + ((Area -1) * sizeof(mgroup));
    if (fseek(fil, offset, 0) != 0) {
	working(2, 0, 0);
	return -1;
    }

    fread(&mgroup, sizeof(mgroup), 1, fil);
    fclose(fil);
    crc = 0xffffffff;
    crc = upd_crc32((char *)&mgroup, crc, sizeof(mgroup));
    MgScreen();
	
    for (;;) {
	set_color(WHITE, BLACK);
	show_str(  7,16,12, mgroup.Name);
	show_str(  8,16,55, mgroup.Comment);
	show_str(  9,16,64, mgroup.BasePath);
	show_sec( 10,16,    mgroup.RDSec);
	show_sec( 11,16,    mgroup.WRSec);
	show_sec( 12,16,    mgroup.SYSec);
	mbse_mvprintw( 13,22,    getflag(mgroup.LinkSec.flags, mgroup.LinkSec.notflags));
	show_int( 14,16,    mgroup.StartArea);
	show_int( 15,16,    mgroup.NetReply);
	show_bool(16,16,    mgroup.UsrDelete);
	show_bool(17,16,    mgroup.Aliases);
	show_bool(18,16,    mgroup.Quotes);
	show_bool(19,16,    mgroup.Active);

	show_bool(14,42,    mgroup.Deleted);
	show_bool(15,42,    mgroup.AutoChange);
	show_bool(16,42,    mgroup.UserChange);
	show_aka( 17,42,    mgroup.UseAka);
	show_aka( 18,42,    mgroup.UpLink);
	show_str( 19,42,12, mgroup.AreaFile);

	show_charset(14,70, mgroup.Charset);
	snprintf(temp, 5, "#%03d", mgroup.GoldEDgroup);
	show_str( 15,70, 5, temp);

	j = select_menu(21);
	switch(j) {
	    case 0: if (!mgroup.StartArea && strlen(mgroup.AreaFile)) {
			errmsg("Areas file defined but no BBS start area");
		        break;
		    }
		    crc1 = 0xffffffff;
		    crc1 = upd_crc32((char *)&mgroup, crc1, sizeof(mgroup));
		    if (crc != crc1) {
			if (yes_no((char *)"Record is changed, save") == 1) {
			    working(1, 0, 0);
			    if ((fil = fopen(mfile, "r+")) == NULL) {
				WriteError("$Can't reopen %s", mfile);
				working(2, 0, 0);
				return -1;
			    }
			    fseek(fil, offset, 0);
			    fwrite(&mgroup, sizeof(mgroup), 1, fil);
			    fclose(fil);
			    MGrpUpdated = 1;
			    working(6, 0, 0);
			}
		    }
		    IsDoing("Browsing Menu");
		    return 0;
	    case 1: if (CheckMgroup())
			break;
		    strcpy(mgroup.Name, edit_str(7,16,12, mgroup.Name, (char *)"The ^name^ for this message group"));
		    if (strlen(mgroup.BasePath) == 0) {
		        memset(&temp, 0, sizeof(temp));
		        strcpy(temp, mgroup.Name);
		        for (i = 0; i < strlen(temp); i++) {
			    if (temp[i] == '.')
				temp[i] = '/';
			    if (isupper(temp[i]))
			        temp[i] = tolower(temp[i]);
			}
		        snprintf(mgroup.BasePath, 65, "%s/var/mail/%s", getenv("MBSE_ROOT"), temp);
		    }
		    break;
	    case 2: E_STR(  8,16,55, mgroup.Comment,    "The ^desription^ for this message group")
	    case 3: E_PTH(  9,16,64, mgroup.BasePath,   "The ^Base path^ where new JAM areas are created", 0770)
	    case 4: E_SEC( 10,16,    mgroup.RDSec,      "9.1.4 MESSAGE GROUP READ SECURITY", MgScreen)
	    case 5: E_SEC( 11,16,    mgroup.WRSec,      "9.1.5 MESSAGE GROUP WRITE SECURITY", MgScreen)
	    case 6: E_SEC( 12,16,    mgroup.SYSec,      "9.1.6 MESSAGE GROUP SYSOP SECURITY", MgScreen)
	    case 7: mgroup.LinkSec = edit_asec(mgroup.LinkSec, (char *)"9.1.7 DEFAULT SECURITY FOR NEW AREAS");
		    MgScreen();
		    break;
	    case 8: E_INT( 14,16,    mgroup.StartArea,  "The ^Start area number^ from where to add areas")
	    case 9: E_INT( 15,16,    mgroup.NetReply,   "The ^Area Number^ for netmail replies")
	    case 10:E_BOOL(16,16,    mgroup.UsrDelete,  "Allow users to ^Delete^ their messages")
	    case 11:E_BOOL(17,16,    mgroup.Aliases,    "Allow ^Aliases^ or real names only")
	    case 12:E_BOOL(18,16,    mgroup.Quotes,     "Allow random ^quotes^ to new messages")
	    case 13:if (mgroup.Active && CheckMgroup())
		        break;
		    E_BOOL(19,16,    mgroup.Active,     "Is this message group ^active^")
	    case 14:if (CheckMgroup())
		        break;
		    E_BOOL(14,42,    mgroup.Deleted,    "Is this group ^Deleted^")
	    case 15:E_BOOL(15,42,    mgroup.AutoChange, "^Auto change^ areas from new areas lists")
	    case 16:tmp = edit_bool(16,42, mgroup.UserChange, (char *)"^Auto add/delete^ areas from downlinks requests");
		    if (tmp && !mgroup.UpLink.zone)
		        errmsg("It looks like you are the toplevel, no Uplink defined");
		    else
		        mgroup.UserChange = tmp;
		    break;
	    case 17:tmp = PickAka((char *)"9.1.17", TRUE);
		    if (tmp != -1)
		    	memcpy(&mgroup.UseAka, &CFG.aka[tmp], sizeof(fidoaddr));
		    MgScreen();
		    break;
	    case 18:mgroup.UpLink = PullUplink((char *)"9.1.18");
		    MgScreen();
		    break;
	    case 19:E_STR( 19,42,12, mgroup.AreaFile,   "The name of the ^Areas File^ from the uplink (case sensitive)")
	    case 20:mgroup.Charset = edit_charset(14, 70, mgroup.Charset);
		    break;
	    case 21:oldgrp = mgroup.GoldEDgroup;
		    newgrp = edit_int(15, 70, oldgrp, (char *)"The new groupnumber for the ^GoldED groups^ (1..999)");
		    if ((newgrp < 1) || (newgrp > 999)) {
			errmsg("Groupnumber must be between 1 and 999");
		    } else if (newgrp && (newgrp != oldgrp)) {
			if (gedgrps[newgrp] == 1) {
			    errmsg("This groupnumber is already in use");
			} else {
			    gedgrps[oldgrp] = 0;
			    gedgrps[newgrp] = 1;
			    mgroup.GoldEDgroup = newgrp;
			}
		    }
		    break;
	}
    }

    return 0;
}