コード例 #1
0
ファイル: ipifc.c プロジェクト: alfongj/akaros
/*
 *  non-standard control messages.
 *  called with c locked.
 */
static char *ipifcctl(struct conv *c, char **argv, int argc)
{
	struct Ipifc *ifc;
	int i;

	ifc = (struct Ipifc *)c->ptcl;
	if (strcmp(argv[0], "add") == 0)
		return ipifcadd(ifc, argv, argc, 0, NULL);
	else if (strcmp(argv[0], "bootp") == 0)
		return bootp(ifc);
	else if (strcmp(argv[0], "try") == 0)
		return ipifcadd(ifc, argv, argc, 1, NULL);
	else if (strcmp(argv[0], "remove") == 0)
		return ipifcrem(ifc, argv, argc);
	else if (strcmp(argv[0], "unbind") == 0)
		return ipifcunbind(ifc);
	else if (strcmp(argv[0], "joinmulti") == 0)
		return ipifcjoinmulti(ifc, argv, argc);
	else if (strcmp(argv[0], "leavemulti") == 0)
		return ipifcleavemulti(ifc, argv, argc);
	else if (strcmp(argv[0], "mtu") == 0)
		return ipifcsetmtu(ifc, argv, argc);
	else if (strcmp(argv[0], "reassemble") == 0) {
		ifc->reassemble = 1;
		return NULL;
	} else if (strcmp(argv[0], "iprouting") == 0) {
		i = 1;
		if (argc > 1)
			i = atoi(argv[1]);
		iprouting(c->p->f, i);
		return NULL;
	} else if (strcmp(argv[0], "addpref6") == 0)
		return ipifcaddpref6(ifc, argv, argc);
	else if (strcmp(argv[0], "setpar6") == 0)
		return ipifcsetpar6(ifc, argv, argc);
	else if (strcmp(argv[0], "sendra6") == 0)
		return ipifcsendra6(ifc, argv, argc);
	else if (strcmp(argv[0], "recvra6") == 0)
		return ipifcrecvra6(ifc, argv, argc);
	return "unsupported ctl";
}
コード例 #2
0
ファイル: ipifc.c プロジェクト: qioixiy/harvey
/*
 *  non-standard control messages.
 *  called with c->car locked.
 */
static char*
ipifcctl(Conv* c, char**argv, int argc)
{
	Ipifc *ifc;
	int i;

	ifc = (Ipifc*)c->ptcl;
	if(strcmp(argv[0], "add") == 0)
		return ipifcadd(ifc, argv, argc, 0, nil);
	else if(strcmp(argv[0], "try") == 0)
		return ipifcadd(ifc, argv, argc, 1, nil);
	else if(strcmp(argv[0], "remove") == 0)
		return ipifcrem(ifc, argv, argc);
	else if(strcmp(argv[0], "unbind") == 0)
		return ipifcunbind(ifc);
	else if(strcmp(argv[0], "joinmulti") == 0)
		return ipifcjoinmulti(ifc, argv, argc);
	else if(strcmp(argv[0], "leavemulti") == 0)
		return ipifcleavemulti(ifc, argv, argc);
	else if(strcmp(argv[0], "mtu") == 0)
		return ipifcsetmtu(ifc, argv, argc);
	else if(strcmp(argv[0], "reassemble") == 0){
		ifc->reassemble = 1;
		return nil;
	}
	else if(strcmp(argv[0], "iprouting") == 0){
		i = 1;
		if(argc > 1)
			i = atoi(argv[1]);
		iprouting(c->p->f, i);
		return nil;
	}
	else if(strcmp(argv[0], "add6") == 0)
		return ipifcadd6(ifc, argv, argc);
	else if(strcmp(argv[0], "ra6") == 0)
		return ipifcra6(ifc, argv, argc);
	return "unsupported ctl";
}