switch have error "expected a type specifier" (C)

60 views Asked by At

I trying create C-struct with switch. I have a enum with values of type of messages in TLS Handshake protocol.

  typedef struct ui24 { int uint24[3] } uint24;

  typedef enum HT {
    client_hello = 0x01,
    server_helo = 0x02,
    new_session_ticket = 0x04,
    end_of_early_data = 0x05,
    encrypted_extensions = 0x08,
    setrificate = 0x0B,
    sertificate_request = 0x0D,
    certificate_verify = 0x0F,
    finished = 0x14,
    key_update = 0x18,
    message_hash = 0xFE
  } HandshakeType;

I need compare real message type with each value in my list of message type for understanding, that my message is ClientHello or ServerHello or another. Operator "switch" is underlining and have an error "expected a type specifier".

struct Handshake {
    HandshakeType msg_type;
    uint24 lenght;
    switch (msg_type)
    {
    case client_hello: char* ClientHello
        break;
    case server_hello: char* ServerHello
        break;
    };
};
0

There are 0 answers