/[dynamips]/upstream/dynamips-0.2.5/frame_relay.h
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /upstream/dynamips-0.2.5/frame_relay.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1 - (show annotations)
Sat Oct 6 16:01:44 2007 UTC (12 years, 2 months ago) by dpavlin
File MIME type: text/plain
File size: 2207 byte(s)
import 0.2.5 from upstream

1 /*
2 * Cisco 7200 (Predator) simulation platform.
3 * Copyright (c) 2006 Christophe Fillot (cf@utc.fr)
4 *
5 * Frame-Relay definitions.
6 */
7
8 #ifndef __FRAME_RELAY_H__
9 #define __FRAME_RELAY_H__
10
11 #include <pthread.h>
12
13 #include "utils.h"
14 #include "mempool.h"
15 #include "net_io.h"
16
17 /* DLCIs used for LMI */
18 #define FR_DLCI_LMI_ANSI 0 /* ANSI LMI */
19 #define FR_DLCI_LMI_CISCO 1023 /* Cisco LMI */
20
21 #define FR_LMI_ANSI_STATUS_OFFSET 5
22 #define FR_LMI_ANSI_STATUS_ENQUIRY 0x75 /* sent by user */
23 #define FR_LMI_ANSI_STATUS 0x7d /* sent by network */
24
25 /* Maximum packet size */
26 #define FR_MAX_PKT_SIZE 2048
27
28 /* Frame-Relay switch table */
29 typedef struct frsw_conn frsw_conn_t;
30 struct frsw_conn {
31 frsw_conn_t *hash_next,*next,**pprev;
32 netio_desc_t *input,*output;
33 u_int dlci_in,dlci_out;
34 m_uint64_t count;
35 };
36
37 /* Virtual Frame-Relay switch table */
38 #define FRSW_HASH_SIZE 256
39
40 typedef struct frsw_table frsw_table_t;
41 struct frsw_table {
42 char *name;
43 pthread_mutex_t lock;
44 mempool_t mp;
45 m_uint64_t drop;
46 frsw_conn_t *dlci_table[FRSW_HASH_SIZE];
47 };
48
49 #define FRSW_LOCK(t) pthread_mutex_lock(&(t)->lock)
50 #define FRSW_UNLOCK(t) pthread_mutex_unlock(&(t)->lock)
51
52 /* Acquire a reference to a Frame-Relay switch (increment reference count) */
53 frsw_table_t *frsw_acquire(char *name);
54
55 /* Release a Frame-Relay switch (decrement reference count) */
56 int frsw_release(char *name);
57
58 /* Create a virtual switch table */
59 frsw_table_t *frsw_create_table(char *name);
60
61 /* Delete a Frame-Relay switch */
62 int frsw_delete(char *name);
63
64 /* Delete all Frame-Relay switches */
65 int frsw_delete_all(void);
66
67 /* Create a switch connection */
68 int frsw_create_vc(frsw_table_t *t,char *nio_input,u_int dlci_in,
69 char *nio_output,u_int dlci_out);
70
71 /* Remove a switch connection */
72 int frsw_delete_vc(frsw_table_t *t,char *nio_input,u_int dlci_in,
73 char *nio_output,u_int dlci_out);
74
75 /* Save the configuration of a Frame-Relay switch */
76 void frsw_save_config(frsw_table_t *t,FILE *fd);
77
78 /* Save configurations of all Frame-Relay switches */
79 void frsw_save_config_all(FILE *fd);
80
81 /* Start a virtual Frame-Relay switch */
82 int frsw_start(char *filename);
83
84 #endif

  ViewVC Help
Powered by ViewVC 1.1.26