OpenCores
URL https://opencores.org/ocsvn/amber/amber/trunk

Subversion Repositories amber

[/] [amber/] [trunk/] [sw/] [boot-loader-ethmac/] [tcp.h] - Blame information for rev 80

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 61 csantifort
/*----------------------------------------------------------------
2
//                                                              //
3
//  boot-loader.h                                               //
4
//                                                              //
5
//  This file is part of the Amber project                      //
6
//  http://www.opencores.org/project,amber                      //
7
//                                                              //
8
//  Description                                                 //
9
//  Defines for the boot-loader application.                    //
10
//                                                              //
11
//  Author(s):                                                  //
12
//      - Conor Santifort, csantifort.amber@gmail.com           //
13
//                                                              //
14
//////////////////////////////////////////////////////////////////
15
//                                                              //
16
// Copyright (C) 2010 Authors and OPENCORES.ORG                 //
17
//                                                              //
18
// This source file may be used and distributed without         //
19
// restriction provided that this copyright statement is not    //
20
// removed from the file and that any derivative work contains  //
21
// the original copyright notice and the associated disclaimer. //
22
//                                                              //
23
// This source file is free software; you can redistribute it   //
24
// and/or modify it under the terms of the GNU Lesser General   //
25
// Public License as published by the Free Software Foundation; //
26
// either version 2.1 of the License, or (at your option) any   //
27
// later version.                                               //
28
//                                                              //
29
// This source is distributed in the hope that it will be       //
30
// useful, but WITHOUT ANY WARRANTY; without even the implied   //
31
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      //
32
// PURPOSE.  See the GNU Lesser General Public License for more //
33
// details.                                                     //
34
//                                                              //
35
// You should have received a copy of the GNU Lesser General    //
36
// Public License along with this source; if not, download it   //
37
// from http://www.opencores.org/lgpl.shtml                     //
38
//                                                              //
39
----------------------------------------------------------------*/
40
 
41
 
42
enum tcp_state {
43
        TCP_CLOSED    = 0,
44
        TCP_PENDING   = 1,
45
        TCP_OPEN      = 2
46
};
47
 
48
 
49
enum tcp_options {
50
        TCP_NEW         = 0,
51
        TCP_NORMAL      = 1,
52
        TCP_RESET       = 2
53
};
54
 
55
 
56 80 csantifort
typedef struct {
57
 
58
    packet_buffer_t** tcp_buf;
59
    int          tcp_current_buf;
60
 
61
    /* Telnet rx and tx line buffers */
62
    line_buf_t*  telnet_rxbuf;
63
    line_buf_t*  telnet_txbuf;
64
 
65
    int          telnet_sent_opening_message;
66
    int          telnet_echo_mode;
67
    int          telnet_connection_state;
68
    int          telnet_options_sent;
69
 
70
    int          packets_sent;
71
    int          packets_received;
72
    int          packets_resent;
73
 
74
    int          tcp_connection_state;
75
    int          tcp_reset;
76
    int          tcp_disconnect;
77
    int          tcp_seq;            /* should be random initial seq number for tcp */
78
    int          tcp_last_seq;
79
    unsigned int tcp_last_ack;
80
 
81
    int          id;
82
 
83
    packet_t*    rx_packet;  /* Header info from last packet received */
84
 
85
    /* pointers to the next socket in the chain and the first socket in the chain */
86
    void*        next;
87
    void*        first;
88
} socket_t;
89
 
90
 
91
/* Global Variables */
92
extern socket_t*    first_socket_g;
93
extern int          tcp_checksum_errors_g;
94
 
95
 
96
/* Function prototypes */
97
socket_t*       new_socket              (socket_t* prev);
98
 
99 61 csantifort
unsigned short  tcp_checksum            (unsigned char *, packet_t*, unsigned short);
100
unsigned int    tcp_header              (char *, socket_t*, int, int);
101
void            tcp_reply               (socket_t*, char*, int);
102
void            tcp_open                (socket_t*);
103
void            tcp_retransmit          (socket_t*);
104
void            tcp_ack                 (socket_t*);
105
void            tcp_response            (char*, socket_t*);
106
void            tcp_disconnect          (socket_t*);
107
void            tcp_tx                  (socket_t*, char*, int);
108
void            parse_tcp_options       (char*, packet_t*);
109
void            parse_tcp_packet        (char*, packet_t*);
110 80 csantifort
void            process_tcp             (socket_t*);
111 61 csantifort
 
112
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.