make problem :(
hi.
i receive the following error when i m trying to reate the executable binary,using "make" make gcc -c -ggdb rsa.c gcc -c -ggdb communication.c communication.c: In function ‘btcomm’: communication.c:130: error: called object ‘socket’ is not a function communication.c: In function ‘apDecryptedRecv’: communication.c:270: error: static declaration of ‘authorization’ follows non-static declaration communication.c:42: error: previous declaration of ‘authorization’ was here communication.c:408: error: expected declaration or statement at end of input make: *** [communication.o] Error 1 i m a newbie! tnx |
It appears as if it is failing to load a header file. Did you see anything missing when you ran ./configure?
|
well i tried to run ./configure but ir is giving an error:
bash: ./configure: No such file or directory i read somewhere that it requires a configure file, which is not in that folder[i got this whole software from a friend].the other files included in the folder are a few header files, a few *.c files, a makefile,n a exe file.there is a readme file that says: To create the executable binary, run: make The normal usage is: zoned The usage options is: zoned -d 500 -p 1 (default use) -d directory_size -p procedure_type wat to do:confused: :newbie: |
i would lose the pink writing in your reply's
its really hard to read.I missed it the first time around. Quote:
Anyway,I would download the sources from whoever writes and maintains the software as there seems to be some problems here with this code!? i.e double variable declarations and the calling of functions that have not been defined. |
hey sorry for font colour!!
anyways i m pasting the void function from the communication.c file[which is giving the first error]. tell me wat to do?????:confused: [B]void* btcomm(void *bnode) { struct sockaddr_l2 rem_addr, loc_addr; struct l2cap_options opts; //socket type, asynnous packet is used, alternatively, uses int socktype = SOCK_DGRAM; int socktype = SOCK_SEQPACKET; bdaddr_t bdaddr; //get address HashNode *node = ((HashNode*) bnode); char* ba = node->curr_bdaddr; bdaddr_t *remote_addr = strtoba((char*)ba); //bdadd_t is the type used to store BT address. //default mtu int imtu = 672; int omtu = 0; unsigned short psm; psm = 171; //receive buffer is the highes maximum trasger unit. We are amiming to transfer one MTU //at the maximum to increase performance. unsigned char rbuf[672]; int s, opt,status; int encryptionRand[1]; // define the role of this communication //int master =0 ; //int auth=0; //int encrypt = 0; opt=0; //if (master) // opt |= L2CAP_LM_MASTER; //if (encrypt) // opt |= L2CAP_LM_ENCRYPT; // if (auth) // opt |= L2CAP_LM_AUTH; //prepare socket for communication if( (s = socket(PF_BLUETOOTH, socktype, BTPROTO_L2CAP)) < 0 ) { printf("Error: Can't create socket. %s(%d)\n", strerror(errno), errno); close(s); dec_thread(); changeCommStatus(1, node); return ; } //using memset to allocate memory the size of sockaddr_l2 memset(&loc_addr, 0, sizeof(loc_addr)); loc_addr.l2_family = AF_BLUETOOTH; bacpy(&bdaddr, BDADDR_ANY); printf("The address connect from :\t%s \n", batostr(&loc_addr.l2_bdaddr) ); if( bind(s, (struct sockaddr *) &loc_addr, sizeof(loc_addr)) < 0 ) { printf("Error:Can't bind socket. %s(%d)\n", strerror(errno), errno); dec_thread(); changeCommStatus(1, node); close(s); return ; } // Get default options, and use the struct l2cap_option as output opt = sizeof(opts); if( getsockopt(s, SOL_L2CAP, L2CAP_OPTIONS, &opts, &opt) < 0 ) { //syslog(LOG_ERR, "Can't get default L2CAP options. %s(%d)", strerror(errno), errno); printf("Can't get option. %s(%d)\n", strerror(errno), errno); changeCommStatus(1, node); dec_thread(); close(s); return; } // Set new options, from previous get opt, insert max input, and min output trasfer unit opts.omtu = omtu; opts.imtu = imtu; if( setsockopt(s, SOL_L2CAP, L2CAP_OPTIONS, &opts, opt) < 0 ) { printf("Can't set option. %s(%d)\n", strerror(errno), errno); changeCommStatus(1, node); dec_thread(); close(s); return; } int time=5; setsockopt(s, SOCK_SEQPACKET, SO_RCVTIMEO,&time,sizeof(time) ); memset(&rem_addr, 0, sizeof(rem_addr)); rem_addr.l2_family = AF_BLUETOOTH; //required to swap the address for remote addr baswap(&rem_addr.l2_bdaddr, remote_addr); printf("The address to connect is:\t%s \n", batostr(&rem_addr.l2_bdaddr)); rem_addr.l2_psm = htobs(psm); //handshaking to determine whether we are talking to a zoneIT enabled phone if (handshake(s,rem_addr,node,encryptionRand)>0){ //when error return; } if(authorization(s,rem_addr,node,encryptionRand)>0){ //when error return; } //initiate //when all is successful close(s); dec_thread(); changeCommStatus(0, node); printf("No of threads is %i",threads_running); return ; } //method used to change the state of a bluetooth device inside the directory void changeCommStatus(int stat, HashNode* node){ lock_directory(); node->comm_status=stat; node->last_detected=scan_count; unlock_directory(); return; } //the handshaking procedure. involves the exchange of pre-defined strings. int handshake(int s, struct sockaddr_l2 rem_addr, HashNode* node,int* encryptionRand){ unsigned char AP_INIT[24] = "BTA_INIT_AP_CHALLANGE\0"; unsigned char PHONE_INIT_RESP[25] = "BTA_INIT_PHONE_RESPONSE\0"; unsigned char rbuf[672]; the RED line is giving the error??? |
Quote:
at the top of communication.c put #include sys/socket.h #include sys/types.h |
:cry: same error!!
:confused: |
type
"man socket" on the command line on your system. what header files are related to the function in the synopsis section? should be something like Code:
SYNOPSIS |
ya..it shows...
SYNOPSIS #include <sys/types.h> #include <sys/socket.h> int socket(int domain, int type, int protocol); is there some prob wid the compiler or libraries or ???? well this software is a kind of access point or server for mobiles n using bluetooth[bluez] :confused: :confused: :confused: |
strange...
Do you hve the /usr/include/sys/socket.h file on your system? Without seeing all the code/files it going to be kinda hard to trouble shoot this. well written software should have stuff like double declarations in them. Thats the sort of thing that should be picked up on while developing. Did your friend test this b4 he/she gave it to you? |
ya, the socket.h file is also over there.
well this prog ran on my friends pc.the prob is that he is not available now,otherwise i would not hav troubled u ppl! my friend was using mandrake 9.1 n i m using FC5...does this has something to do with linux distributions??? should i paste the whole code over here or upload it somewhere?? :confused: |
if there's alot of it then it would probably be best if you could upload all of the files somewhere.
The Makefile aswell. I am curious to have a look... |
hey..i hav sent u the link!!
|
hey..
I haven't 4gotten u. This couldn't have compiled for you friends machine in its current state.?!!!:scratch: I got the same errors as you when I compiled this. I have cleaned up a few typo's in the code so that it now compiles albeit with warnings. However upon running the prog it crashes with a segmentation fault !?! I'm going to bed now,so I will take another look at this 2morrow. |
i was thinking if it might be a linker error with some specific libraries... not sure though
|
All times are GMT -5. The time now is 09:38 AM. |