File: command.h

package info (click to toggle)
tcng 10b-4
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 3,644 kB
  • sloc: ansic: 19,040; pascal: 4,640; yacc: 2,619; sh: 1,914; perl: 1,546; lex: 772; makefile: 751
file content (58 lines) | stat: -rw-r--r-- 1,226 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*
 * command.h - Command construction and execution
 *
 * Written 2001,2003 by Werner Almesberger
 * Copyright 2001 EPFL-ICA, Network Robots
 * Copyright 2003 Werner Almesberger
 */


#ifndef COMMAND_H
#define COMMAND_H

#include "jiffies.h"


enum command_type { ct_tc,ct_send,ct_poll,ct_every,ct_echo };

struct command {
    enum command_type type;
    int ref; /* reference count */
    union {
	struct {
	   int argc;
	   char **argv; 
	} tc;
	struct {
	    struct net_device *dev;
	    void *buf;
	    int len;
	    struct attributes attr;
	} send;
	struct {
	    struct jiffval interval;
	    struct jiffval until;
	    struct command *cmd;
	} every;
	struct {
	    struct net_device *dev;
	} poll;
	struct {
	    char *msg;
	} echo;
    } u;
};

struct command *cmd_clone(struct command *cmd);
struct command *cmd_tc(int argc,char **argv);
struct command *cmd_send(struct net_device *dev,void *buf,int len,
  struct attributes attr);
struct command *cmd_poll(struct net_device *dev);
struct command *cmd_every(struct jiffval interval,struct jiffval until,
  struct command *command);
struct command *cmd_echo(char *msg);

void cmd_run(struct command *cmd);
void cmd_free(struct command *cmd);

#endif /* COMMAND_H */