I am trying to send an ethernet packet using RAW socket in C Linux. I have following `struct` definition in my code: 

```
typedef struct vlink_header_s
{
    uint8_t verCmd;     
    uint8_t reverseVerCmd;
}vlink_header_t;

typedef struct vlink_reg_rd_s
{
    vlink_header_t  header;
    uint32_t        address;
    uint16_t        length;
}vlink_reg_rd_t;

```

In `main` i created a struct:

```
vlink_reg_rd_t g_pkt;
g_pkt.header.verCmd = 0x10|VLINK_CMD_REG_RD;
g_pkt.header.reverseVerCmd = ~(g_pkt.header.verCmd);
g_pkt.address = 0x0007 ..... 

```

and message:

```
char sendbuf[1024];
struct ether_header *eh = (struct ether_header *) sendbuf;

```

how do I add all the info from the struct **g\_pkt** to this **sendbuf** after ether\_header so I can send a complete packet using:

```
sendto(sockfd, sendbuf, txLen, 0, (struct sockaddr*)&socket_address, sizeof(struct sockaddr_ll));

```

Everything else in my code is working, I tried other ways by adding info to `sendbuf` one by one and it works fine and my machine receive the packets on the other side too. I just want to make it more versatile because there are a bunch of commands and structs for each commands will work best. Thanks.