public static RegularMsg getRegularMsg(int messageLength, MessageType messageType,
			int index) {
		byte[] payload = null;
		switch (messageType.ordinal())
		{
		case 0:
		case 1:
		case 2:
		case 3:
			return new RegularMsg(messageLength, messageType, null);

		case 4:
			/*
			 * have: Message has a payload that contains a
			 * 4-byte index of a file piece. It indicates that the sender has
			 * the piece referred to by the index. Payload = filesystem.getIsIndex();
			 */

			return new RegularMsg(messageLength, messageType, payload);

		case 5:
			/*
			 * bitfield: Find all the bits that correspond to the preset
			 * file chunks with current peer. Payload = filesystem.getPiecesInfo(index);
			 */
			return new RegularMsg(messageLength, messageType, payload);
		case 6:
			/*
			 * request: Message has a 4-byte payload, which contains the 
			 * index of the piece being requested. Payload = filesystem.getPiecesInfo(index);
			 */
			return new RegularMsg(messageLength, messageType, payload);
		case 7:
			/*
			 * piece: Message has a payload consisting of a 4-byte 
			 * piece index and the content of the piece. It is used to
			 * send a piece from the sender to a receiving peer.
			 * Payload = filesystem.getData(index);
			 */
			return new RegularMsg(messageLength, messageType, payload);
		default:
			break;
		}
		return null;
	}