mdp.c
1.31 KB
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
#include "mdp.h"
#include "/usr/include/sys/msg.h"
#include <sys/types.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
int main(){
int msgid1, msgid2;
key_t KEY2=500;
mdpSendMsg_t sen_msg;
mdpAnswerMsg_t ans_msg;
if((msgid1 = msgget(KEY,IPC_EXCL|0666)) == -1){
perror("msgget1 Failed");
exit(1);
}
if((msgid2 = msgget(KEY2,IPC_CREAT|0666)) == -1){
perror("msgget2 Failed");
exit(1);
}
sen_msg.type=66;
sen_msg.key_ipc_response=KEY2;
strcpy(sen_msg.login, "mbalbast\0");
//strcpy(sen_msg.mdp, "0x62c66a7a5dd7 0c3146618063c344e531e6 d4b59e379808443c e962b3abd63c5a");
//uint8_t mdp={"0x5a","0x3c","0xd6","0xab","0xb3","0x62","0xe9","0x3c","0x44","0x08","0x98","0x37","0x9e","0xb5","0xd4","0xe6","0x31","0xe5","0x44","0xc3","0x63","0x80","0x61","0x46","0x31","0x0c","0xd7","0x5d","0x7a","0x6a","0xc6","0x62"};
uint8_t mdp={"\x5a","\x3c","\xd6","\xab","\xb3","\x62","\xe9","\x3c","\x44","\x08","\x98","\x37","\x9e","\xb5","\xd4","\xe6","\x31","\xe5","\x44","\xc3","\x63","\x80","\x61","\x46","\x31","\x0c","\xd7","\x5d","\x7a","\x6a","\xc6","\x62"};
memcpy(sen_msg.mdp,mdp,32);
msgsnd(msgid1, &sen_msg, MSG_SIZE,0);
msgrcv(msgid2, &ans_msg, ANSWER_SIZE,66,0);
printf("%s", ans_msg.answer);
}