SASC
DVBSoftCAM

process_req.h File Reference

#include <getopt.h>
#include "list.h"
#include "msg_passing.h"
#include "dvbloopback.h"
#include "debug.h"

Go to the source code of this file.

Classes

struct  poll_ll
struct  common_data
struct  parser_cmds
struct  parser_adpt
struct  cmd_list
struct  plugin_cmd

Defines

#define ATTACH_CALLBACK(_cb, _cmd, _pri)   _attach_callback(_cb, _cmd, _pri, PLUGIN_ID)

Enumerations

enum  cmdret_t {
  CMD_NOCHANGE = 0x00, CMD_STOP = 0x01, CMD_SKIPCALL = 0x02, CMD_SKIPPOST = 0x04,
  CMD_STOPALL = 0x07
}
enum  arg_enum_t { ARG_INIT, ARG_HELP, ARG_PARSE }

Functions

static void _attach_callback (struct list_head *cb, void(*cmd)(struct parser_cmds *, struct poll_ll *, cmdret_t *, int *, unsigned long int, unsigned char *), int priority, int _id)
void launch_processors (struct parser_adpt *pc_all)
void shutdown_parser (struct parser_adpt *pc_all)
void init_parser (struct parser_adpt *pc_all, struct common_data *common)

Variables

struct list_head plugin_cmdlist
pthread_attr_t default_attr

Define Documentation

#define ATTACH_CALLBACK (   _cb,
  _cmd,
  _pri 
)    _attach_callback(_cb, _cmd, _pri, PLUGIN_ID)

Definition at line 93 of file process_req.h.

Referenced by connect_cam(), connect_imsg(), connect_rb(), connect_scan(), and connect_sid().


Enumeration Type Documentation

enum arg_enum_t
Enumerator:
ARG_INIT 
ARG_HELP 
ARG_PARSE 

Definition at line 97 of file process_req.h.

enum cmdret_t
Enumerator:
CMD_NOCHANGE 
CMD_STOP 
CMD_SKIPCALL 
CMD_SKIPPOST 
CMD_STOPALL 

Definition at line 64 of file process_req.h.

             {
  CMD_NOCHANGE = 0x00, //Default state
  CMD_STOP =     0x01, //Don't do any further processing in the current loop
  CMD_SKIPCALL = 0x02, //Don't execute the requested command
  CMD_SKIPPOST = 0x04, //Don't execute the post-call loop
  CMD_STOPALL  = 0x07,
} cmdret_t;

Function Documentation

static void _attach_callback ( struct list_head *  cb,
void(*)(struct parser_cmds *, struct poll_ll *, cmdret_t *, int *, unsigned long int, unsigned char *)  cmd,
int  priority,
int  _id 
) [inline, static]

Definition at line 85 of file process_req.h.

References cmd, cmd_list::cmd, cmd_list::id, cmd_list::list, and list_add_priority().

                               {
  struct cmd_list *reg = (struct cmd_list *)malloc(sizeof(struct cmd_list));
  reg->cmd = cmd;
  reg->id = _id;
  list_add_priority(&reg->list, cb, priority);
}
void init_parser ( struct parser_adpt *  pc_all,
struct common_data *  common 
)

Definition at line 516 of file process_req.c.

References dnames, DVB_DEVICE_DEMUX, DVB_DEVICE_DVR, DVB_DEVICE_FRONTEND, parser_adpt::frontend, i, init_device(), common_data::real_adapt, and common_data::virt_adapt.

Referenced by main().

{
  char realdev[255], virtdev[255];
  struct stat st;

  int types[] = {DVB_DEVICE_FRONTEND, DVB_DEVICE_DEMUX, DVB_DEVICE_DVR, -1};
  struct parser_cmds **ptr;
  int i;
  
  bzero(pc_all, sizeof(struct parser_adpt));
  for (i = 0; types[i] != -1; i++) {
    sprintf(realdev, "/dev/dvb/adapter%d/%s0", common->real_adapt,
                                               dnames[types[i]]);
    sprintf(virtdev, "/dev/dvb/adapter%d/%s0", common->virt_adapt,
                                               dnames[types[i]]);
    if (stat(realdev, &st) != 0 || stat(virtdev, &st) != 0) {
      continue;
    }
    ptr = (&pc_all->frontend) + i;// * sizeof(struct parser_cmds *);
    *ptr = init_device(common, types[i]);
  }
}
void launch_processors ( struct parser_adpt *  pc_all)

Definition at line 467 of file process_req.c.

References parser_adpt::ca, default_attr, parser_adpt::demux, parser_adpt::dvr, forward_data(), parser_adpt::frontend, poll_handler(), and parser_cmds::thread.

Referenced by main().

{
//pthread_attr_t attr;
  signal(SIGPOLL, poll_handler);
//pthread_attr_init(&attr);
//pthread_attr_setscope( &attr, PTHREAD_SCOPE_SYSTEM );
//pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED);
//pthread_attr_setschedpolicy( &attr, SCHED_FIFO );
  if(pc_all->frontend) {
    pthread_create(&pc_all->frontend->thread, &default_attr, forward_data,
                   pc_all->frontend);
  }
  if(pc_all->demux) {
    pthread_create(&pc_all->demux->thread, &default_attr, forward_data,
                   pc_all->demux);
  }
  if(pc_all->dvr) {
    pthread_create(&pc_all->dvr->thread, &default_attr, forward_data,
                   pc_all->dvr);
  }
  if(pc_all->ca) {
    pthread_create(&pc_all->ca->thread, &default_attr, forward_data,
                   pc_all->ca);
  }
}
void shutdown_parser ( struct parser_adpt *  pc_all)

Definition at line 504 of file process_req.c.

References parser_adpt::ca, parser_adpt::demux, parser_adpt::dvr, parser_adpt::frontend, and kill_parser().

Referenced by main().

{
  if(pc_all->ca)
    kill_parser(pc_all->ca);
  if(pc_all->dvr)
    kill_parser(pc_all->dvr);
  if(pc_all->demux)
    kill_parser(pc_all->demux);
  if(pc_all->frontend)
    kill_parser(pc_all->frontend);
}

Variable Documentation

pthread_attr_t default_attr

Definition at line 64 of file forward.c.

Referenced by forward_data(), launch_processors(), launch_scan(), launch_sid(), and main().

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines