40 #define DEFAULT_UNIT 0
41 #define DEFAULT_VLAN 1
42 #define MAX_DIGITS_IN_CHOICE 5
45 "Syntax: example_packet_transmit \n\r"
47 "Paramaters: None. \n\r"
49 "Example: The following command is used to demonstrate transmit and \n\r"
51 " example_packet_transmit \n\r"
53 "Usage Guidelines: None. \n\r";
109 char data[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x82, 0x2f,
110 0x2e, 0x42, 0x46, 0x74, 0x08, 0x06, 0x00, 0x01,
111 0x08, 0x00, 0x06, 0x04, 0x00, 0x01, 0x82, 0x2f,
112 0x2e, 0x42, 0x46, 0x74, 0x0a, 0x00, 0x00, 0x01,
113 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00,
114 0x00, 0x02, 0x00, 0x00, 0x00, 0x00 };
116 for (i = 0; i < count; i++)
122 printf(
"Error Sending Packet: %d. Error: %s\n", i + 1,
opennsl_errmsg(rv));
126 printf(
"Transmitted Packet %d of size %zu\n", i + 1,
sizeof(data));
139 int main(
int argc,
char *argv[])
148 if(strcmp(argv[0],
"gdb") == 0)
153 if((argc != (index + 1)) || ((argc > (index + 1)) && (strcmp(argv[index + 1],
"--help") == 0))) {
159 printf(
"Initializing the system.\r\n");
163 printf(
"\r\nFailed to initialize the system. Error %s\r\n",
171 printf(
"\r\nFailed to apply default config on ports, rc = %d (%s).\r\n",
176 printf(
"Adding ports to default vlan.\r\n");
179 printf(
"\r\nFailed to add default ports. rv: %s\r\n",
opennsl_errmsg(rv));
184 printf(
"\r\nUser menu: Select one of the following options\r\n");
185 printf(
"1. Transmit a packet\n");
186 printf(
"2. Display OpenNSL version\n");
187 #ifdef INCLUDE_DIAG_SHELL
188 printf(
"9. Launch diagnostic shell\n");
190 printf(
"0. Quit the application\n");
194 printf(
"Invalid option entered. Please re-enter.\n");
201 printf(
"\r\nEnter the port on which packet needs to be transmitted.\r\n");
204 printf(
"Invalid option entered. Please re-enter.\n");
208 printf(
"\r\nEnter number of packets to be sent.\r\n");
211 printf(
"Invalid option entered. Please re-enter.\n");
227 #ifdef INCLUDE_DIAG_SHELL
230 opennsl_driver_shell();
237 printf(
"Exiting the application.\n");