Пример #1
0
static int32_t ghttp_send_ecm(struct s_client *client, ECM_REQUEST *er, uchar *UNUSED(buf))
{
	uint32_t hash;
	s_ghttp *context = (s_ghttp *)client->ghttp;

	if(_is_pid_ignored(er))
	{
		cs_debug_mask(D_CLIENT, "%s: ca context found in ignore list, ecm blocked: %x-%x-%x pid %x", client->reader->label, er->onid, er->tsid, er->srvid, er->pid);
		return -1;
	}

	if(!context->host_id) { context->host_id = (uchar *)cs_strdup(client->reader->device); }

	ll_append(context->ecm_q, er);
	if(ll_count(context->ecm_q) > 1)
		{ cs_debug_mask(D_CLIENT, "%s: %d simultaneous ecms...", client->reader->label, ll_count(context->ecm_q)); }

	if(_is_post_context(context->post_contexts, er, false))
	{
		_ghttp_post_ecmdata(client, er);
	}
	else
	{
		hash = javastring_hashcode(er->ecm + 3, er->ecmlen - 3);
		_ghttp_http_get(client, hash, er->ecm[0] == 0x81);
	}

	return 0;
}
Пример #2
0
static int32_t ghttp_send_ecm(struct s_client *client, ECM_REQUEST *er, uchar *UNUSED(buf))
{
  uint32_t hash;
  // int32_t ret;
  s_ghttp* context = (s_ghttp*)client->ghttp;

  context->prev_sid = context->last_ecm.srvid;
  if(context->prev_sid != er->srvid) {
    cs_debug_mask(D_CLIENT, "%s: zap detected? prev %x, current %x", client->reader->label, context->prev_sid, er->srvid);    
    context->do_post_next = 1;
  }

  client->reader->msg_idx = er->idx;
  if(context->do_post_next) {
    _ghttp_post_ecmdata(client, er);
  } else {
    hash = javastring_hashcode(er->ecm + 3, er->ecmlen - 3);
    _ghttp_http_get(client, hash, er->ecm[0] == 0x81);
  }

  context->last_ecm = *er; //struct copy

  return 0;
}