Today I began reading on good old wikipedia about the different compilers I could choose from, I found the following options.
Impressions of Freeswitch
From what I've read about FreeSWITCH is that it's relatively new (as of 2006) and is a softswitch communicator that interfaces with both physical and digital phones. It's built on open source technologies like SQLight and Apache. FreeSWITCH accepts an array of protocols such as VOIP, SIP, Google Talk and many more to interface with and supports a wide array of audio codecs.
Here are some of the more important configuration file fore FreeSWITCH:
On our datacom server, FreeSWITCH is located in '/usr/local/freeswitch' and includes the following directories in its base:
[root@dhcp-171 freeswitch]# ls bin conf db grammar htdocs include lib log mod recordings run scripts sounds storage [root@dhcp-171 freeswitch]#
Bin holds the various executables that are the core of freeswitch, conf holds configuration files that some genius wrote in xml to sort in some ridiculous hierarchical model.
There are other meta items like FreeSWITCH's library and scripts.
This is a sample format for a dated entry. Please substitute the actual date for “Month Day, Year”, and duplicate the level 4 heading to make additional entries.
As an aid, feel free to use the following questions to help you generate content for your entries:
Remember that 4 is just the minimum number of entries. Feel free to have more.
This is a sample format for a dated entry. Please substitute the actual date for “Month Day, Year”, and duplicate the level 4 heading to make additional entries.
As an aid, feel free to use the following questions to help you generate content for your entries:
Remember that 4 is just the minimum number of entries. Feel free to have more.
Identification of chosen keyword.
All programs contain at least a main() function. The main()function typically is executed when the program starts. functions contain parameters or instructions to be used during the programs computation. Here is an example of a function parameter:
long sum( int array[], int number ) // Identifiers { //body of function int i; long result = 0; for( i = 0; i < number; ++i ) result += (long)array[i]; return result; }
Functions can also have declarations before the body where you can call datatypes.
List any sites, books, or sources utilized when researching information on this topic. (Remove any filler text).
Identification of chosen keyword.
Structs, not your mama's sneaker shoes.
#include <stdio.h> #include <stdlib.h> struct mystruct { // int test; // Declaration of initial struct. }; // typedef struct mystruct * newstruct; // newstruct function is a pointer to my struct. newstruct getnewstruct() { newstruct temp = (newstruct)malloc(sizeof(newstruct*)) ; return temp; } int main() { newstruct tester = getnewstruct() ; // tester -> test = 8; // Mathematical manipulation and printing of structure. tester -> test++; // printf ("The value is %i\n",tester -> test) ; // free(tester) ; return 0; }
Demonstration of the indicated keyword.
If you wish to aid your definition with a code sample, you can do so by using a wiki code block, an example follows:
Alternatively (or additionally), if you want to demonstrate something on the command-line, you can do so as follows:
andrew ~ $ gcc malloc.c -o malloc andrew ~ $ ./malloc First value: 10 Pi is: 3.140000
Identification of chosen keyword.
Definition (in your own words) of the chosen keyword.
List any sites, books, or sources utilized when researching information on this topic. (Remove any filler text).
asterisk
A programming language to communicate and execute the basic functions of telephony services.
'extensions.conf' located in '/etc/asterisk/extensions.conf' maintains a bulk of the configurations options for the asterisk service including your dial plan and how inbound/outbound calls are routed. Example of an extension:
exten => 602,1,Dial(SIP/Andrew,20) exten => 602,n,VoiceMail(602@vm,u)
'sip.conf' located in '/etc/asterisk/sip.conf' maintains the users locations and affiliation to the asterisk server. Example of a sip.conf user entry:
[Andrew] type=friend secret=123456 host=dynamic context=users deny=0.0.0.0/0 permit=10.80.2.0/255.255.255.0 mailbox=778@vm
Can you include the main() of a program in a header file?
I suspect that you can include any function within a header file and call it. Including main().
Then call it like so:
main();
I'm going to take the main portion of the encipher program from project two and place it into main.h
int main(int argc, char **argv) { printf("Greetings, Agent Haas.\n"); FILE *in, *out; int cipher; int key; in = fopen("plain.txt", "r"); out = fopen("enciphered.txt", "w"); if(argv[1] == NULL) { printf("\nNo argument provided, execute with key argument.\nexample: ./encipher 1\n"); exit(1); } char *plain; plain = (char*) malloc (sizeof(char) * 127); int count = 0; if(in == NULL) { printf("\nFile empty, enter some text to encipher\n"); fgets(plain, 127, stdin); while(plain[count] != '\0') { count = count+1; } int cipher = atoi(argv[1]); count = 0; while(plain[count] != '\0') { key = 1; if(plain[count] >= 65 && plain[count] <= 90) { key = plain[count] + cipher; while(key > 90) { key = key - 26; } } if(plain[count] >= 97 && plain[count] <= 122) { key = plain[count] + cipher; while(key > 122) { key = key - 26; } } if(key == 1) { key = 32; } fprintf(out, "%c", key); count = count+1; } printf("\nEnciphered text is loated in enciphered.txt\n"); printf ("It took me %d clicks (%f seconds).\n",t,((float)t)/CLOCKS_PER_SEC); } else { fgets(plain, 127, in); printf("\nText before cipherication: "); while(plain[count] != '\0') { printf("%c", plain[count]); count = count+1; } int cipher = atoi(argv[1]); count = 0; printf("\nCiphered text output: "); while(plain[count] != '\0') { key = 1; if(plain[count] >= 65 && plain[count] <= 90) { key = plain[count] + cipher; while(key > 90) { key = key - 26; } } if(plain[count] >= 97 && plain[count] <= 122) { key = plain[count] + cipher; while(key > 122) { key = key - 26; } } if(key == 1) { key = 32; } printf("%c", key); fprintf(out, "%c", key); count = count+1; } fclose(in); fclose(out); return (0); } }
Here's main.h:
#ifndef _MAIN_H #define _MAIN_H int main(int argc, char **argv) { int t; t = clock(); printf("Greetings, Agent Haas.\n"); FILE *in, *out; int cipher; int key; in = fopen("plain.txt", "r"); out = fopen("enciphered.txt", "w"); if(argv[1] == NULL) { printf("\nNo argument provided, execute with key argument.\nexample: ./encipher 1\n"); exit(1); } char *plain; plain = (char*) malloc (sizeof(char) * 127); int count = 0; if(in == NULL) { printf("\nFile empty, enter some text to encipher\n"); fgets(plain, 127, stdin); while(plain[count] != '\0') { count = count+1; } int cipher = atoi(argv[1]); count = 0; while(plain[count] != '\0') { key = 1; if(plain[count] >= 65 && plain[count] <= 90) { key = plain[count] + cipher; while(key > 90) { key = key - 26; } } if(plain[count] >= 97 && plain[count] <= 122) { key = plain[count] + cipher; while(key > 122) { key = key - 26; } } if(key == 1) { key = 32; } fprintf(out, "%c", key); count = count+1; } printf("\nEnciphered text is loated in enciphered.txt\n"); printf ("It took me %d clicks (%f seconds).\n",t,((float)t)/CLOCKS_PER_SEC); } else { fgets(plain, 127, in); printf("\nText before cipherication: "); while(plain[count] != '\0') { printf("%c", plain[count]); count = count+1; } int cipher = atoi(argv[1]); count = 0; printf("\nCiphered text output: "); while(plain[count] != '\0') { key = 1; if(plain[count] >= 65 && plain[count] <= 90) { key = plain[count] + cipher; while(key > 90) { key = key - 26; } } if(plain[count] >= 97 && plain[count] <= 122) { key = plain[count] + cipher; while(key > 122) { key = key - 26; } } if(key == 1) { key = 32; } printf("%c", key); fprintf(out, "%c", key); count = count+1; } printf("\nEnciphered text is located in enciphered.txt\n\n"); printf ("It took me %d clicks (%f seconds).\n",t,((float)t)/CLOCKS_PER_SEC); fclose(in); fclose(out); return (0); } } #endif
Here's the modified program:
#include <stdio.h> #include <math.h> #include <stdlib.h> #include "main.h" main();
And the gcc output:
lab46:~/src/cprog/cipher$ gcc encipher.c -o encipher encipher.c:20: warning: data definition has no type or storage class lab46:~/src/cprog/cipher$
Got a warning, but it worked.
Based on the data collected:
Header files are a brilliant way to break up ANY function in a program to allow more readable code and FAR better organization.