int parseMessage(char *buffer){ // read the first byte for type char *type[1]; bcopy(buffer,type,1); // read the 5th-8th bytes of buffer to determine type int *size=malloc(sizeof(int)); bcopy(buffer+4,size,4); // read the 9th-end bytes of buffer to get the message char *message=malloc(size); bcopy(buffer+8,message,size-8); switch(type){ // check the type case 0: // if it is a control message switch(message){ case "QUIT": break; case "LIST": break; default: break; } break; default: break; } }