📄 libif.lst
字号:
119 /************************************************************************/
120 int client_action(TSOCK *ts, CONN_STATE conn)
121 {
122 1 /* Uncomment this line to set the Urgent and Push Flag in the TCP/IP packet. */
123 1 /* ts->connflags = ts->connflags|TURGE|TPUSH; */
124 1
125 1 if (ts->upcall)
126 1 return (ts->upcall(ts,conn));
127 1 /*client socket doesn't have upcall function.*/
128 1 return 0;
129 1 }
130 /************************************************************************
131 /* Function Name : get_frame *
132 /* *
133 /* Arguments : *
134 /* GENFRAME xdata *gfp:Point to GENFRAME to return frame. *
135 /* *
136 /* Return : *
137 /* The size in byte receive from network. *
138 /* *
139 /* Comment : *
140 /* This function gets an ethernet frame from the network. *
141 /* Return the frame length excluding the. hardware header. *
142 /* *
143 /************************************************************************/
144 int get_frame (GENFRAME xdata *gfp)
145 {
146 1
147 1 /* check if anything is received on the Ethernet Interface*/
148 1
149 1 if (gfp->g.dtype == DTYPE_ETHER)
150 1 if ((gfp->g.len = Ethernet_Receive (gfp->buff))>0)
151 1 {
152 2 return (gfp->g.len - sizeof (ETHERHDR));
153 2 }
154 1 return (0);
155 1 }
156
157 /************************************************************************
158 /* Function Name : put_frame *
159 /* *
160 /* Arguments : *
161 /* GENFRAME xdata *gfp:Point to GENFRAME to be transmitted. *
162 /* int len : The data length of gfp *
163 /* *
164 /* Return : *
165 /* The size size in byte transmit to network. *
166 /* *
167 /* Comment : *
168 /* This function aend an ethernet frame out onto the network. *
169 /* *
170 /************************************************************************/
171 int put_frame (GENFRAME xdata *gfp, int len)
172 {
173 1 extern xdata unsigned char nic_xmit_buf [];
174 1 int ret=0;
175 1 if (len > 0)
176 1 {
177 2 /* wait until the last transmission is done*/
178 2 while (!Ethernet_Transmit_Ready ());
C51 COMPILER V7.50 LIBIF 10/12/2006 15:31:39 PAGE 4
179 2
180 2 /* copy to a page-aligned buffer*/
181 2 /* Edit by lin_jy 021219
182 2 memcpy (nic_xmit_buf, gfp->buff, (WORD)len);
183 2
184 2 ret = Ethernet_Transmit (nic_xmit_buf, (WORD)len);*/
185 2 ret = Ethernet_Transmit (gfp->buff, (WORD)len);
186 2 if (gfp_buff_flag)
187 2 {
188 3 gfp_buff_flag=0;
189 3 gfp->buff=&nic_xmit_buf[0];
190 3 }
191 2 else
192 2 {
193 3 gfp_buff_flag=1;
194 3 gfp->buff=&nic_xmit_buf[1536];
195 3 }
196 2
197 2 }
198 1
199 1 return(ret);
200 1 }
201 /************************************************************************
202 /* Function Name : udp_receive *
203 /* *
204 /* Arguments : *
205 /* GENFRAME *gfp:Point to GENFRAME that contain UDP packet. *
206 /* int len : UDP data size. *
207 /* *
208 /* Return : *
209 /* None. *
210 /* *
211 /* Comment : *
212 /* This function upcall from TCP stack to client when opening, *
213 /* connecting,receiving data or closing a port. *
214 /* *
215 /************************************************************************/
216 void udp_receive(GENFRAME *gfp, int len)
217 {
218 1 /*Below is a sample code for udp application*/
219 1 /*
220 1 UDPKT *udp;
221 1 NODE loc, rem;
222 1 udp = getframe_datap(gfp);
223 1 getudp_srce(gfp, &rem);
224 1 getudp_locdest(gfp, &loc);
225 1 */
226 1 return ;
227 1 }
*** WARNING C280 IN LINE 216 OF LIBIF.C: 'gfp': unreferenced local variable
*** WARNING C280 IN LINE 216 OF LIBIF.C: 'len': unreferenced local variable
228
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 357 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = 32 19
PDATA SIZE = ---- ----
DATA SIZE = ---- ----
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
C51 COMPILER V7.50 LIBIF 10/12/2006 15:31:39 PAGE 5
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 2 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -