示例#1
0
void list(char *buf){
    uint32_t i = 1;
    char tmp[11] = {0};
    video *cur = vhead;

    while(cur) {
        int2str(tmp,sizeof(tmp),i++);
        SSEND(cgc_strlen(tmp),tmp);
        SSEND(3,".) ")
        SSENDL(cgc_strlen(cur->name),cur->name);
        cur = cur->next;
    }
}
void sendDisconnect(int exitStatus,
		    struct client_config *client_config) {    
    struct disconnect disconnect;
    disconnect.opCode = htons(CMD_DISCONNECT);
    disconnect.reserved = 0;
    SSEND(disconnect);
    if (exitStatus == 0)
	udpc_flprintf("Transfer complete.\007\n");
}
static int sendConnectReq(struct client_config *client_config,
			  struct net_config *net_config,
			  int haveServerAddress) {
    struct connectReq connectReq;

    if(net_config->flags & FLAG_PASSIVE)
	return 0;

    connectReq.opCode = htons(CMD_CONNECT_REQ);
    connectReq.reserved = 0;
    connectReq.capabilities = htonl(RECEIVER_CAPABILITIES);
    connectReq.rcvbuf = htonl(getRcvBuf(client_config->S_UCAST));
    if(haveServerAddress)
      return SSEND(connectReq);
    else
      return BCAST_CONTROL(client_config->S_UCAST, connectReq);
}
int sendGo(struct client_config *client_config) {
    struct go go;
    go.opCode = htons(CMD_GO);
    go.reserved = 0;
    return SSEND(go);
}