Esempio n. 1
0
Param_t * stringbreaker(char*str, Param_t *param)
{
	char *t; //create new temporary character array
	char *stringcount[MAXARGS]; //create array of character pointers
	int i=0;
	t=strtok(str," \n\t"); //tokenize first argument based on where " ", "\t", and "\n" are located
	printf("Temp String: %s\n",t); //print the temporary string

	//tokenize the rest of the string
	while(t != NULL)
	{
		printf("\nThe token is: %s", t);
		stringcount[i] = t; //add temp char to string array
		param->argumentCount++; //increment argc
		t = strtok(NULL," \n\t"); //tokenize
		i++;
	}
	
	
	parseParams(stringcount,param); //
	printParams(param); //print params, returns nothing
	//theshell(param) //fork to new process id, show child process and wait
	param = clearParam(param);
	return param;
}
Esempio n. 2
0
// Put the list of net media in a parameter list
void SDPMedia::putMedia(NamedList& msg, bool putPort)
{
    msg.addParam("media" + suffix(),"yes");
    msg.addParam("formats" + suffix(),formats());
    msg.addParam("transport" + suffix(),transport());
    if (mappings())
	msg.addParam("rtp_mapping" + suffix(),mappings());
    if (isAudio())
	msg.addParam("rtp_rfc2833",rfc2833());
    if (putPort)
	msg.addParam("rtp_port" + suffix(),remotePort());
    if (remoteCrypto())
	msg.addParam("crypto" + suffix(),remoteCrypto());
    // must handle encryption differently
    const char* enc = getValue("encryption");
    if (enc)
	msg.addParam("encryption" + suffix(),enc);
    clearParam("encryption");
    unsigned int n = length();
    for (unsigned int i = 0; i < n; i++) {
	const NamedString* param = getParam(i);
	if (param)
	    msg.addParam("sdp" + suffix() + "_" + param->name(),*param);
    }
}
Esempio n. 3
0
Param_t * createParam()
{
	Param_t * param = (Param_t *)malloc(sizeof(Param_t) +1); //Allocate enough space for new parameter (+1 byte for error reasons?)
	param = clearParam(param); //clear/reset parameter values
	return param; //return new cleared/allocated parameter
}